public abstract class Selector<MessageType> extends Object
Details: Selectors: Actors with Multiple Guarded Mailboxes. Shams Imam, Vivek Sarkar. 4th International Workshop on Programming based on Actors, Agents, and Decentralized Control (AGERE! 2014), October 2014.
Modifier and Type | Field and Description |
---|---|
protected int |
numClassifiers |
Modifier | Constructor and Description |
---|---|
protected |
Selector(Class<? extends Enum<?>> enumClass) |
protected |
Selector(Class<? extends Enum<?>> enumClass,
boolean pAlwaysSequentialBody) |
protected |
Selector(int numMailboxes) |
protected |
Selector(int numMailboxes,
boolean pAlwaysSequentialBody) |
protected |
Selector(int numMailboxes,
boolean pAlwaysSequentialBody,
boolean pPriorityPolicy) |
Modifier and Type | Method and Description |
---|---|
protected void |
disable(Enum<?> enumType)
Disable the channel for enumType.
|
protected void |
disable(int mailboxId)
Disable the channel for enumType.
|
protected void |
disableAllExcept(Enum<?> enumType)
Disables all the channels except the one for enumType.
|
protected void |
disableAllExcept(int mailboxId)
Disables all the channels except the one at mailboxId.
|
protected void |
enable(Enum<?> enumType)
Enable the channel for enumType.
|
protected void |
enable(int mailboxId)
Enable the channel for enumType.
|
protected void |
enableAll()
Enables all the channels.
|
protected void |
exit()
Call this to signal intention for the selector to terminate
|
protected void |
handleThrowable(Throwable th)
handleThrowable.
|
boolean |
hasStarted() |
protected boolean |
isEnabled(Enum<?> enumType)
Returns whether the specified mailbox is currently enabled
|
protected boolean |
isEnabled(int mailboxId)
Returns whether the specified mailbox is currently enabled
|
protected void |
onPostExit()
Convenience: specify code to be executed after selector is terminated
|
protected void |
onPostStart()
Convenience: specify code to be executed after selector is started
|
protected void |
onPreExit()
Convenience: specify code to be executed before selector is terminated
|
protected void |
onPreStart()
Convenience: specify code to be executed before selector is started
|
protected abstract void |
process(MessageType theMsg)
Callback allowing user to have custom behavior while processing messages.
|
void |
send(Enum<?> enumType,
MessageType message) |
void |
send(int classifierId,
MessageType message) |
void |
start()
Causes the selector to start processing messages that have been sent to it. pause() messages before the selector
was started are ignored.
|
void |
start(HjPlace hjPlace)
Causes the selector to start processing messages that have been sent to it. pause() messages before the selector
was started are ignored.
|
protected void |
tryProcessMessage(int localSearchStartIndex)
Try and process message from an active mailbox.
|
protected Selector(Class<? extends Enum<?>> enumClass)
enumClass
- The enum used to classify the different messages sent to this ActorNullPointerException
- if enumClass is nullIllegalArgumentException
- if enumClass does not represent an enumprotected Selector(int numMailboxes)
numMailboxes
- The number of mailboxes to useprotected Selector(int numMailboxes, boolean pAlwaysSequentialBody)
numMailboxes
- The number of mailboxes to usepAlwaysSequentialBody
- (Optimization flag) Explicit notification from user for sequential message
processing bodyprotected Selector(int numMailboxes, boolean pAlwaysSequentialBody, boolean pPriorityPolicy)
protected Selector(Class<? extends Enum<?>> enumClass, boolean pAlwaysSequentialBody)
enumClass
- The enum used to classify the different messages sent to this ActorpAlwaysSequentialBody
- (Optimization flag) Explicit notification from user for sequential message
processing bodyNullPointerException
- if enumClass is nullIllegalArgumentException
- if enumClass does not represent an enumpublic final boolean hasStarted()
public final void start()
public final void start(HjPlace hjPlace)
protected void onPreStart()
protected void onPostStart()
protected final void exit()
protected void onPreExit()
protected void onPostExit()
protected abstract void process(MessageType theMsg)
theMsg
- message to processpublic final void send(Enum<?> enumType, MessageType message)
enumType
- The classifier for the mailbox this message goes intomessage
- The message to send to this selectorNullPointerException
- if enumType is nullpublic final void send(int classifierId, MessageType message)
classifierId
- message
- protected final void enableAll()
protected final void disableAllExcept(Enum<?> enumType)
protected final void disableAllExcept(int mailboxId)
protected final void enable(int mailboxId)
protected final void enable(Enum<?> enumType)
protected final void disable(Enum<?> enumType)
protected final void disable(int mailboxId)
protected final boolean isEnabled(Enum<?> enumType)
enumType
- The mailbox to checkprotected final boolean isEnabled(int mailboxId)
mailboxId
- The mailbox to checkprotected void tryProcessMessage(int localSearchStartIndex)
localSearchStartIndex
- The index from which to start searching the mailboxesprotected void handleThrowable(Throwable th)
handleThrowable.
th
- The exception that occurred while processing a message.Copyright © 2015 Rice University - Department of Computer Science. All rights reserved.