Skip to content

Commit

Permalink
Trying to avoid lock contention.
Browse files Browse the repository at this point in the history
  • Loading branch information
gbasler committed Sep 15, 2012
1 parent 79d6b37 commit 12d3d68
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions src/main/scala/reaktor/scct/Coverage.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,21 @@ package reaktor.scct
import report._

object Coverage {
@uncovered var state = State.New
@uncovered var env: Env = _
@uncovered var data: Map[String, CoveredBlock] = Map[String, CoveredBlock]()

@uncovered def init() {
@uncovered private var state = State.New
@uncovered private var env: Env = _
@uncovered private lazy val data: Map[String, CoveredBlock] = {
state = State.Starting
env = new Env
data = readMetadata
val metaData = readMetadata
env.reportHook match {
case "system.property" => setupSystemPropertyHook
case _ => setupShutdownHook
case _ => setupShutdownHook
}
state = State.Active
metaData
}

@uncovered def invoked(id: String) {
synchronized {
if (state == State.New) {
init()
}
}
data.get(id).foreach { _.increment }
}

Expand Down

0 comments on commit 12d3d68

Please sign in to comment.