Fixing a visibility problem with Scheduler thread id
This commit is contained in:
parent
5df3fbf9d5
commit
ac311a32c2
1 changed files with 3 additions and 2 deletions
|
|
@ -21,6 +21,7 @@ import java.util.concurrent._
|
||||||
|
|
||||||
import akka.event.EventHandler
|
import akka.event.EventHandler
|
||||||
import akka.AkkaException
|
import akka.AkkaException
|
||||||
|
import atomic.AtomicLong
|
||||||
|
|
||||||
object Scheduler {
|
object Scheduler {
|
||||||
import Actor._
|
import Actor._
|
||||||
|
|
@ -133,12 +134,12 @@ object Scheduler {
|
||||||
}
|
}
|
||||||
|
|
||||||
private object SchedulerThreadFactory extends ThreadFactory {
|
private object SchedulerThreadFactory extends ThreadFactory {
|
||||||
private var count = 0
|
private val count = new AtomicLong(0)
|
||||||
val threadFactory = Executors.defaultThreadFactory()
|
val threadFactory = Executors.defaultThreadFactory()
|
||||||
|
|
||||||
def newThread(r: Runnable): Thread = {
|
def newThread(r: Runnable): Thread = {
|
||||||
val thread = threadFactory.newThread(r)
|
val thread = threadFactory.newThread(r)
|
||||||
thread.setName("akka:scheduler-" + count)
|
thread.setName("akka:scheduler-" + count.incrementAndGet())
|
||||||
thread.setDaemon(true)
|
thread.setDaemon(true)
|
||||||
thread
|
thread
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue