public abstract class AgentCore
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private AsyncMessagingCore |
core |
protected java.lang.Thread |
currentThread |
private java.util.List<java.lang.Throwable> |
errors
Holds agent errors
|
Modifier | Constructor and Description |
---|---|
protected |
AgentCore() |
Modifier and Type | Method and Description |
---|---|
void |
attachToThreadPool(Pool threadPool)
Sets a new thread pool to be used by the agent
|
void |
call(java.lang.Object message)
Adds the message to the agent\s message queue
|
java.util.List<java.lang.Throwable> |
getErrors()
Retrieves a list of exception thrown within the agent's body.
|
(package private) abstract void |
handleMessage(java.lang.Object message)
Dynamically dispatches the method call
|
boolean |
hasErrors()
Indicates whether there have been exception thrown within the agent's body.
|
boolean |
isFair()
Retrieves the agent's fairness flag
Fair agents give up the thread after processing each message, non-fair agents keep a thread until their message queue is empty.
|
void |
leftShift(java.lang.Object message)
Adds the message to the agent\s message queue
|
void |
makeFair()
Makes the agent fair.
|
(package private) void |
registerError(java.lang.Throwable e)
Adds the exception to the list of thrown exceptions
|
void |
send(java.lang.Object message)
Adds the message to the agent\s message queue
|
void |
setPGroup(PGroup pGroup)
Sets an actor group to use for task scheduling
|
private final AsyncMessagingCore core
protected volatile java.lang.Thread currentThread
private java.util.List<java.lang.Throwable> errors
public final void attachToThreadPool(Pool threadPool)
threadPool
- The thread pool to usepublic void setPGroup(PGroup pGroup)
pGroup
- The pGroup to usepublic boolean isFair()
public void makeFair()
public final void send(java.lang.Object message)
message
- A value or a closurepublic final void leftShift(java.lang.Object message)
message
- A value or a closurepublic final void call(java.lang.Object message)
message
- A value or a closureabstract void handleMessage(java.lang.Object message)
message
- A value or a closurevoid registerError(java.lang.Throwable e)
e
- The exception to storepublic java.util.List<java.lang.Throwable> getErrors()
public boolean hasErrors()