public abstract class Behavior extends java.lang.Object implements MessageCallback, MessageDispatch, java.io.Serializable
Modifier and Type | Class and Description |
---|---|
static class |
Behavior.CommandMessage |
static class |
Behavior.EventMessage |
Modifier and Type | Field and Description |
---|---|
protected java.util.concurrent.locks.Lock |
lock |
static MessageType |
MSG_TYPE_COMMAND |
static MessageType |
MSG_TYPE_EVENT |
protected ObjectStub |
obj |
NO_FLAGS, RESPONSE_EXPECTED
Modifier and Type | Method and Description |
---|---|
abstract void |
activate() |
abstract void |
deactivate() |
void |
dispatchMessage(Message message,
int flags,
MessageCallback callback)
Dispatch message to queue or thread pool.
|
ObjectStub |
getObjectStub() |
abstract void |
handleMessage(Message msg,
int flags)
Handle message.
|
void |
initialize() |
void |
setObjectStub(ObjectStub obj) |
protected ObjectStub obj
protected transient java.util.concurrent.locks.Lock lock
public static MessageType MSG_TYPE_COMMAND
public static MessageType MSG_TYPE_EVENT
public Behavior()
public Behavior(SpawnData data)
public ObjectStub getObjectStub()
public void setObjectStub(ObjectStub obj)
public void initialize()
public abstract void activate()
public abstract void deactivate()
public abstract void handleMessage(Message msg, int flags)
MessageCallback
handleMessage
in interface MessageCallback
msg
- Message sent from other agent.flags
- Bitwise OR of MessageCallback.NO_FLAGS
, MessageCallback.RESPONSE_EXPECTED
.public void dispatchMessage(Message message, int flags, MessageCallback callback)
MessageDispatch
flags
through unaltered.dispatchMessage
in interface MessageDispatch
message
- Message sent from other agent.flags
- Bitwise OR of MessageCallback.NO_FLAGS
,
MessageCallback.RESPONSE_EXPECTED
callback
- Callback to handle the message (currently,
always the same as 'this').