From 19f2e7f798f4bc584238f153ee26d9b08eae95e2 Mon Sep 17 00:00:00 2001 From: Viktor Klang Date: Tue, 5 Apr 2011 17:37:30 +0200 Subject: [PATCH] Removing a compilation warning by restructuring the code --- .../ExecutorBasedEventDrivenDispatcher.scala | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/akka-actor/src/main/scala/akka/dispatch/ExecutorBasedEventDrivenDispatcher.scala b/akka-actor/src/main/scala/akka/dispatch/ExecutorBasedEventDrivenDispatcher.scala index 28c07c6af6..4fec527642 100644 --- a/akka-actor/src/main/scala/akka/dispatch/ExecutorBasedEventDrivenDispatcher.scala +++ b/akka-actor/src/main/scala/akka/dispatch/ExecutorBasedEventDrivenDispatcher.scala @@ -116,18 +116,18 @@ class ExecutorBasedEventDrivenDispatcher( override def mailboxSize(actorRef: ActorRef) = getMailbox(actorRef).size def createMailbox(actorRef: ActorRef): AnyRef = mailboxType match { - case b: UnboundedMailbox if b.blocking => - new DefaultUnboundedMessageQueue(true) with ExecutableMailbox { - final def dispatcher = ExecutorBasedEventDrivenDispatcher.this + case b: UnboundedMailbox => + if (b.blocking) { + new DefaultUnboundedMessageQueue(true) with ExecutableMailbox { + final def dispatcher = ExecutorBasedEventDrivenDispatcher.this + } + } else { //If we have an unbounded, non-blocking mailbox, we can go lockless + new ConcurrentLinkedQueue[MessageInvocation] with MessageQueue with ExecutableMailbox { + final def dispatcher = ExecutorBasedEventDrivenDispatcher.this + final def enqueue(m: MessageInvocation) = this.add(m) + final def dequeue(): MessageInvocation = this.poll() + } } - - case b: UnboundedMailbox if !b.blocking => //If we have an unbounded, non-blocking mailbox, we can go lockless - new ConcurrentLinkedQueue[MessageInvocation] with MessageQueue with ExecutableMailbox { - final def dispatcher = ExecutorBasedEventDrivenDispatcher.this - final def enqueue(m: MessageInvocation) = this.add(m) - final def dequeue(): MessageInvocation = this.poll() - } - case b: BoundedMailbox => new DefaultBoundedMessageQueue(b.capacity, b.pushTimeOut, b.blocking) with ExecutableMailbox { final def dispatcher = ExecutorBasedEventDrivenDispatcher.this