Switching ThreadBasedDispatcher to use SynchronousQueue since only one actor should be in it

This commit is contained in:
Viktor Klang 2011-03-11 23:13:31 +01:00
parent 5ba947cfd6
commit 36a612eea5

View file

@ -9,7 +9,7 @@ import akka.config.Config.config
import akka.util.Duration
import java.util.Queue
import java.util.concurrent.{ConcurrentLinkedQueue, BlockingQueue, TimeUnit, LinkedBlockingQueue}
import java.util.concurrent.{TimeUnit, SynchronousQueue}
import akka.actor
import java.util.concurrent.atomic.AtomicReference
@ -47,6 +47,11 @@ class ThreadBasedDispatcher(_actor: ActorRef, _mailboxType: MailboxType)
}
object ThreadBasedDispatcher {
val oneThread: ThreadPoolConfig = ThreadPoolConfig(allowCorePoolTimeout = true, corePoolSize = 1, maxPoolSize = 1)
val oneThread: ThreadPoolConfig =
ThreadPoolConfig(
allowCorePoolTimeout = true,
corePoolSize = 1,
maxPoolSize = 1,
queueFactory = () => new SynchronousQueue[Runnable])
}