public interface Mailbox extends Runnable
| Modifier and Type | Field and Description |
|---|---|
static String |
Exceptional |
static String |
Paused |
static String |
Stopping |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Close me.
|
int |
concurrencyCapacity()
Answer the total capacity for concurrent operations.
|
boolean |
isClosed()
Answer whether or not I am closed.
|
boolean |
isDelivering()
Answer whether or not I am currently delivering a message.
|
default boolean |
isPreallocated()
Answer whether or not I am a
Mailbox with pre-allocated and reusable Message elements. |
boolean |
isSuspended()
Answer whether or not I am currently suspended.
|
default boolean |
isSuspendedFor(String name) |
int |
pendingMessages()
Answer the count of messages that have not yet been delivered.
|
Message |
receive()
Answer the next
Message that can be received. |
void |
resume(String name)
Recovers the previous operational mode, either active or suspended,
and if active resumes delivery.
|
default void |
send(Actor actor,
Class<?> protocol,
io.vlingo.xoom.common.SerializableConsumer<?> consumer,
Returns<?> returns,
String representation)
Arrange for
Message to be sent by setting the pre-allocated
and reusable element with the parameters. |
void |
send(Message message)
Arrange for
Message to be sent, which will generally
be delivered by another thread. |
void |
suspendExceptFor(String name,
Class<?>... overrides)
Suspend message deliver but allow any of the given
overrides
to pass through, essentially giving these priority. |
static final String Exceptional
static final String Paused
static final String Stopping
void close()
boolean isClosed()
boolean isDelivering()
int concurrencyCapacity()
void resume(String name)
resume() is required.
If the name is not the current suspended mode, its corresponding
overrides may be marked for removal after any later overrides are removed.name - the String name of the overrides for which to resumevoid send(Message message)
Message to be sent, which will generally
be delivered by another thread. Exceptions to this rule are
for possible, such as for TestMailbox.message - the Message to sendvoid suspendExceptFor(String name, Class<?>... overrides)
overrides
to pass through, essentially giving these priority. Note that the
receiving Actor must use resume() to cause normally delivery
when it is ready.
NOTE: If suspendExceptFor(overrides) is used multiple times before
the implementing Mailbox is resumed, the outcome is implementation
dependent. The implementor may accumulate or replace its internal
overrides with the overrides parameter. The name may be helpful
in maintaining accumulated overrides.
name - String the name of the specific overrideoverrides - the varargs Class<?> that are allowed to be delivered although others are suspendedboolean isSuspended()
default boolean isSuspendedFor(String name)
Message receive()
Message that can be received.int pendingMessages()
default boolean isPreallocated()
Mailbox with pre-allocated and reusable Message elements.default void send(Actor actor, Class<?> protocol, io.vlingo.xoom.common.SerializableConsumer<?> consumer, Returns<?> returns, String representation)
Message to be sent by setting the pre-allocated
and reusable element with the parameters. This manner of sending
is meant to be used only when isPreallocated() answers true.actor - the Actor being sent the messageprotocol - the Class<?> type of Actor protocolconsumer - the Consumer<?> to carry out the actionreturns - the Returns<?> through which return values are communicated; null if void returnrepresentation - the String representation of this message invocationCopyright © 2021. All rights reserved.