From 36a612eea5773d7e3be8371e1a1d5f1c51971d7c Mon Sep 17 00:00:00 2001 From: Viktor Klang Date: Fri, 11 Mar 2011 23:13:31 +0100 Subject: [PATCH] Switching ThreadBasedDispatcher to use SynchronousQueue since only one actor should be in it --- .../main/scala/akka/dispatch/ThreadBasedDispatcher.scala | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/akka-actor/src/main/scala/akka/dispatch/ThreadBasedDispatcher.scala b/akka-actor/src/main/scala/akka/dispatch/ThreadBasedDispatcher.scala index a8dfcf5860..1435884aee 100644 --- a/akka-actor/src/main/scala/akka/dispatch/ThreadBasedDispatcher.scala +++ b/akka-actor/src/main/scala/akka/dispatch/ThreadBasedDispatcher.scala @@ -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]) }