Fixing a visibility problem with Scheduler thread id

This commit is contained in:
Viktor Klang 2011-07-09 19:17:49 +02:00
parent 5df3fbf9d5
commit ac311a32c2

View file

@ -21,6 +21,7 @@ import java.util.concurrent._
import akka.event.EventHandler
import akka.AkkaException
import atomic.AtomicLong
object Scheduler {
import Actor._
@ -133,12 +134,12 @@ object Scheduler {
}
private object SchedulerThreadFactory extends ThreadFactory {
private var count = 0
private val count = new AtomicLong(0)
val threadFactory = Executors.defaultThreadFactory()
def newThread(r: Runnable): Thread = {
val thread = threadFactory.newThread(r)
thread.setName("akka:scheduler-" + count)
thread.setName("akka:scheduler-" + count.incrementAndGet())
thread.setDaemon(true)
thread
}