Package akka.dispatch

Class Mailbox

  • All Implemented Interfaces:
    SystemMessageQueue,, java.lang.Runnable, java.util.concurrent.Future<scala.runtime.BoxedUnit>
    Direct Known Subclasses:

    public abstract class Mailbox
    extends ForkJoinTask<scala.runtime.BoxedUnit>
    implements SystemMessageQueue, java.lang.Runnable
    Mailbox and InternalMailbox is separated in two classes because ActorCell is needed for implementation, but can't be exposed to user defined mailbox subclasses.


    See Also:
    Serialized Form
    • Constructor Detail

    • Method Detail

      • Open

        public static final int Open()
      • Closed

        public static final int Closed()
      • Scheduled

        public static final int Scheduled()
      • shouldScheduleMask

        public static final int shouldScheduleMask()
      • shouldNotProcessMask

        public static final int shouldNotProcessMask()
      • suspendMask

        public static final int suspendMask()
      • suspendUnit

        public static final int suspendUnit()
      • debug

        public static final boolean debug()
      • doExec

        public static final int doExec()
      • trySetSignal

        public static final boolean trySetSignal()
      • recordExceptionalCompletion

        public static final int recordExceptionalCompletion​(java.lang.Throwable ex)
      • internalPropagateException

        public static void internalPropagateException​(java.lang.Throwable ex)
      • join

        public static final V join()
      • invoke

        public static final V invoke()
      • cancel

        public static boolean cancel​(boolean mayInterruptIfRunning)
      • isDone

        public static final boolean isDone()
      • isCancelled

        public static final boolean isCancelled()
      • isCompletedAbnormally

        public static final boolean isCompletedAbnormally()
      • isCompletedNormally

        public static final boolean isCompletedNormally()
      • getException

        public static final java.lang.Throwable getException()
      • completeExceptionally

        public static void completeExceptionally​(java.lang.Throwable ex)
      • complete

        public static void complete​(V value)
      • quietlyComplete

        public static final void quietlyComplete()
      • get

        public static final V get()
      • get

        public static final V get​(long timeout,
                                  java.util.concurrent.TimeUnit unit)
      • quietlyJoin

        public static final void quietlyJoin()
      • quietlyInvoke

        public static final void quietlyInvoke()
      • reinitialize

        public static void reinitialize()
      • tryUnfork

        public static boolean tryUnfork()
      • getForkJoinTaskTag

        public static final short getForkJoinTaskTag()
      • setForkJoinTaskTag

        public static final short setForkJoinTaskTag​(short tag)
      • compareAndSetForkJoinTaskTag

        public static final boolean compareAndSetForkJoinTaskTag​(short e,
                                                                 short tag)
      • systemEnqueue

        public abstract static void systemEnqueue​(ActorRef receiver,
                                                  SystemMessage message)
      • hasSystemMessages

        public abstract static boolean hasSystemMessages()
      • actor_$eq

        public void actor_$eq​(ActorCell x$1)
      • setActor

        public void setActor​(ActorCell cell)
      • enqueue

        public void enqueue​(ActorRef receiver,
                            Envelope msg)
        Try to enqueue the message to this queue, or throw an exception.
        receiver - (undocumented)
        msg - (undocumented)
      • dequeue

        public Envelope dequeue()
        Try to dequeue the next message from this queue, return null failing that.
      • hasMessages

        public boolean hasMessages()
        Indicates whether this queue is non-empty.
      • numberOfMessages

        public int numberOfMessages()
        Should return the current number of messages held in this queue; may always return 0 if no other value is available efficiently. Do not use this for testing for presence of messages, use hasMessages instead.
      • _statusDoNotCallMeDirectly

        protected int _statusDoNotCallMeDirectly()
      • _statusDoNotCallMeDirectly_$eq

        protected void _statusDoNotCallMeDirectly_$eq​(int x$1)
      • _systemQueueDoNotCallMeDirectly

        protected SystemMessage _systemQueueDoNotCallMeDirectly()
      • _systemQueueDoNotCallMeDirectly_$eq

        protected void _systemQueueDoNotCallMeDirectly_$eq​(SystemMessage x$1)
      • currentStatus

        public final int currentStatus()
      • shouldProcessMessage

        public final boolean shouldProcessMessage()
      • suspendCount

        public final int suspendCount()
      • isSuspended

        public final boolean isSuspended()
      • isClosed

        public final boolean isClosed()
      • isScheduled

        public final boolean isScheduled()
      • updateStatus

        protected final boolean updateStatus​(int oldStatus,
                                             int newStatus)
      • setStatus

        protected final void setStatus​(int newStatus)
      • resume

        public final boolean resume()
        Reduce the suspend count by one. Caller does not need to worry about whether status was Scheduled or not.

        true if the suspend count reached zero
      • suspend

        public final boolean suspend()
        Increment the suspend count by one. Caller does not need to worry about whether status was Scheduled or not.

        true if the previous suspend count was zero
      • becomeClosed

        public final boolean becomeClosed()
        set new primary status Closed. Caller does not need to worry about whether status was Scheduled or not.
      • setAsScheduled

        public final boolean setAsScheduled()
        Set Scheduled status, keeping primary status as is.
      • setAsIdle

        public final boolean setAsIdle()
        Reset Scheduled status, keeping primary status as is.
      • canBeScheduledForExecution

        public final boolean canBeScheduledForExecution​(boolean hasMessageHint,
                                                        boolean hasSystemMessageHint)
      • run

        public final void run()
        Specified by:
        run in interface java.lang.Runnable
      • getRawResult

        public final void getRawResult()
      • setRawResult

        public final void setRawResult​(scala.runtime.BoxedUnit unit)
        Description copied from class: ForkJoinTask
        Forces the given value to be returned as a result. This method is designed to support extensions, and should not in general be called otherwise.
        Specified by:
        setRawResult in class ForkJoinTask<scala.runtime.BoxedUnit>
        unit - the value
      • exec

        public final boolean exec()
        Description copied from class: ForkJoinTask
        Immediately performs the base action of this task and returns true if, upon return from this method, this task is guaranteed to have completed normally. This method may return false otherwise, to indicate that this task is not necessarily complete (or is not known to be complete), for example in asynchronous actions that require explicit invocations of completion methods. This method may also throw an (unchecked) exception to indicate abnormal exit. This method is designed to support extensions, and should not in general be called otherwise.
        Specified by:
        exec in class ForkJoinTask<scala.runtime.BoxedUnit>
        true if this task is known to have completed normally
      • processAllSystemMessages

        public final void processAllSystemMessages()
        Will at least try to process all queued system messages: in case of failure simply drop and go on to the next, because there is nothing to restart here (failure is in ActorCell somewhere …). In case the mailbox becomes closed (because of processing a Terminate message), dump all already dequeued message to deadLetters.
      • cleanUp

        protected void cleanUp()
        Overridable callback to clean up the mailbox, called when an actor is unregistered. By default it dequeues all system messages + messages and ships them to the owning actors' systems' DeadLetterMailbox