#1860 - Making all default messagequeues be the implementation, and therefor avoiding one level of indirection.

This commit is contained in:
Viktor Klang 2012-02-24 13:13:55 +01:00
parent d987ad2228
commit 2c5f65b0b2

View file

@ -360,8 +360,8 @@ case class UnboundedMailbox() extends MailboxType {
def this(config: Config) = this() def this(config: Config) = this()
final override def create(owner: Option[ActorContext]): MessageQueue = final override def create(owner: Option[ActorContext]): MessageQueue =
new QueueBasedMessageQueue with UnboundedMessageQueueSemantics { new ConcurrentLinkedQueue[Envelope]() with QueueBasedMessageQueue with UnboundedMessageQueueSemantics {
final val queue = new ConcurrentLinkedQueue[Envelope]() final def queue: Queue[Envelope] = this
} }
} }
@ -374,8 +374,8 @@ case class BoundedMailbox( final val capacity: Int, final val pushTimeOut: Durat
if (pushTimeOut eq null) throw new IllegalArgumentException("The push time-out for BoundedMailbox can not be null") if (pushTimeOut eq null) throw new IllegalArgumentException("The push time-out for BoundedMailbox can not be null")
final override def create(owner: Option[ActorContext]): MessageQueue = final override def create(owner: Option[ActorContext]): MessageQueue =
new QueueBasedMessageQueue with BoundedMessageQueueSemantics { new LinkedBlockingQueue[Envelope](capacity) with QueueBasedMessageQueue with BoundedMessageQueueSemantics {
final val queue = new LinkedBlockingQueue[Envelope](capacity) final def queue: BlockingQueue[Envelope] = this
final val pushTimeOut = BoundedMailbox.this.pushTimeOut final val pushTimeOut = BoundedMailbox.this.pushTimeOut
} }
} }
@ -385,8 +385,8 @@ case class BoundedMailbox( final val capacity: Int, final val pushTimeOut: Durat
*/ */
class UnboundedPriorityMailbox( final val cmp: Comparator[Envelope]) extends MailboxType { class UnboundedPriorityMailbox( final val cmp: Comparator[Envelope]) extends MailboxType {
final override def create(owner: Option[ActorContext]): MessageQueue = final override def create(owner: Option[ActorContext]): MessageQueue =
new QueueBasedMessageQueue with UnboundedMessageQueueSemantics { new PriorityBlockingQueue[Envelope](11, cmp) with QueueBasedMessageQueue with UnboundedMessageQueueSemantics {
final val queue = new PriorityBlockingQueue[Envelope](11, cmp) final def queue: Queue[Envelope] = this
} }
} }
@ -399,8 +399,8 @@ class BoundedPriorityMailbox( final val cmp: Comparator[Envelope], final val cap
if (pushTimeOut eq null) throw new IllegalArgumentException("The push time-out for BoundedMailbox can not be null") if (pushTimeOut eq null) throw new IllegalArgumentException("The push time-out for BoundedMailbox can not be null")
final override def create(owner: Option[ActorContext]): MessageQueue = final override def create(owner: Option[ActorContext]): MessageQueue =
new QueueBasedMessageQueue with BoundedMessageQueueSemantics { new BoundedBlockingQueue[Envelope](capacity, new PriorityQueue[Envelope](11, cmp)) with QueueBasedMessageQueue with BoundedMessageQueueSemantics {
final val queue = new BoundedBlockingQueue[Envelope](capacity, new PriorityQueue[Envelope](11, cmp)) final def queue: BlockingQueue[Envelope] = this
final val pushTimeOut = BoundedPriorityMailbox.this.pushTimeOut final val pushTimeOut = BoundedPriorityMailbox.this.pushTimeOut
} }
} }