|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--springs.access.AgentReference
A reference to an agent.
Field Summary | |
private java.lang.Object |
_agent
An RMI interface to the remote object. |
private boolean |
_agentIsMoving
A boolean indicating whether the agent is moving (in this case, the reference should not be used until updated). |
private java.lang.String |
_agentName
The name of the agent. |
private springs.context.ContextAddress |
_contextAddress
The address of the agent context. |
private boolean |
_isLocationServer
A boolean indicating whether the reference can be removed from the local references to agents. |
private long |
_millisMustBeRemoved
|
private long |
_millisWhenCreated
|
private boolean |
_mustBeRemoved
A boolean indicating whether the reference should be removed. |
private int |
_seqNum
A number to identify the sequence number for the current address of the agent. |
Constructor Summary | |
AgentReference(springs.context.ContextAddress contextAddress,
java.lang.String agentName,
int seqNum,
boolean isLocationServer,
boolean mustBeRemoved,
long millisWhenCreated)
Constructor. |
Method Summary | |
static java.lang.Object |
callAgentMethod(java.lang.String agentName,
java.lang.String methodName,
java.lang.Object[] args,
boolean cacheRef,
java.lang.String caller)
This method invokes a method of the agent. |
static springs.communication.FutureResult |
callAgentMethodAsynchronously(java.lang.String agentName,
java.lang.String methodName,
java.lang.Object[] args,
boolean cacheRef,
java.lang.String caller)
This method invokes a method of the agent. |
java.lang.Object |
callOnReference(java.lang.String methodName,
java.lang.Object[] args,
java.lang.String caller)
This method invokes a method of the agent. |
java.lang.Object |
clone()
|
boolean |
getAgentIsMoving()
Checks whether the agent is moving. |
java.lang.String |
getAgentName()
Obtains the name of the agent pointed to by this reference. |
java.lang.Object |
getAgentObject()
Obtains the object that refers to the agent. |
springs.context.ContextAddress |
getContextAddress()
Gets the address of the context pointed to by the reference. |
boolean |
getIsLocationServer()
Obtains whether the reference can be removed from the local references to agents. |
long |
getMillisWhenCreated()
Gets the milliseconds when the agent this reference points to was created. |
private static java.lang.Object |
getResultOfRetryingAgentInvoking(springs.access.RetryingAgentInvoking retrying)
Obtains the result of the retrying task. |
int |
getSeqNum()
Gets the sequence number. |
boolean |
mustBeRemoved()
Checks whether the reference must be removed. |
void |
nullifyAgentObject()
Nullifies the agent object. |
static java.lang.Object |
sendMessage(java.lang.String agentName,
springs.communication.Message message,
boolean asynchronous,
boolean cacheRef,
java.lang.String caller)
This method sends a message to the agent. |
void |
setAgentIsMoving(boolean moving)
Sets whether the agent is moving. |
private void |
setAgentObject()
Sets the object that refers to the agent. |
void |
setIsLocationServer(boolean isLocationServer)
Sets whether the reference can be removed from the local references to agents. |
void |
setMustBeRemoved(boolean must)
Marks the reference as a reference that should be removed. |
void |
update(int seqNum,
springs.context.ContextAddress ca,
long millisWhenCreated)
Updates the reference with the given data. |
void |
waitUntilUpdated(int seqNum,
long timeout)
Blocks until the reference is updated. |
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private springs.context.ContextAddress _contextAddress
ContextAddress
private java.lang.String _agentName
String
private long _millisWhenCreated
private java.lang.Object _agent
Object
private int _seqNum
private boolean _isLocationServer
private boolean _mustBeRemoved
private long _millisMustBeRemoved
private boolean _agentIsMoving
Constructor Detail |
public AgentReference(springs.context.ContextAddress contextAddress, java.lang.String agentName, int seqNum, boolean isLocationServer, boolean mustBeRemoved, long millisWhenCreated)
contextAddress
- the context address.agentName
- the agent's name.seqNum
- a number to identify the sequence number for the current address of the agent.isLocationServer
- a boolean indicating whether the reference can be removed from the local
references to agents.mustBeRemoved
- a boolean indicating whether the reference must be removed.millisWhenCreated
- the time instant (in millis) when the agent was created.ContextAddress
,
String
Method Detail |
public long getMillisWhenCreated()
public void setMustBeRemoved(boolean must)
public boolean mustBeRemoved()
public boolean getIsLocationServer()
public void setIsLocationServer(boolean isLocationServer)
isLocationServer
- a boolean indicating that.public java.lang.String getAgentName()
String
public springs.context.ContextAddress getContextAddress()
ContextAddress
public java.lang.Object callOnReference(java.lang.String methodName, java.lang.Object[] args, java.lang.String caller) throws CommunicationException
methodName
- the name of the method.args
- the arguments to the method.caller
- the name of the caller agent.
CommunicationException
- if the invocation fails.String
,
Object
,
CommunicationException
public static java.lang.Object callAgentMethod(java.lang.String agentName, java.lang.String methodName, java.lang.Object[] args, boolean cacheRef, java.lang.String caller) throws CommunicationException
agentName
- the name of the agent.methodName
- the name of the method.args
- the arguments to the method.cacheRef
- a boolean indicating whether the reference to the agent should be cached.caller
- the name of the caller agent.
CommunicationException
- if the invocation fails.String
,
Object
,
CommunicationException
public static springs.communication.FutureResult callAgentMethodAsynchronously(java.lang.String agentName, java.lang.String methodName, java.lang.Object[] args, boolean cacheRef, java.lang.String caller) throws AgentReferenceException
agentName
- the name of the agent.methodName
- the name of the method.args
- the arguments to the method.cacheRef
- a boolean indicating whether the reference to the agent should be cached.caller
- the name of the caller agent.
AgentReferenceException
- if error.FutureResult
,
String
,
Object
,
AgentReferenceException
public static java.lang.Object sendMessage(java.lang.String agentName, springs.communication.Message message, boolean asynchronous, boolean cacheRef, java.lang.String caller) throws CommunicationException
agentName
- the agent's name.message
- the message.asynchronous
- a boolean indicating whether the message should be sent asynchronously
or not.cacheRef
- a boolean indicating whether the reference to the agent should be cached.caller
- the name of the caller agent.
CommunicationException
- if the message cannot be sent.Object
,
Message
,
CommunicationException
public void update(int seqNum, springs.context.ContextAddress ca, long millisWhenCreated)
seqNum
- the new sequence number.ca
- the new context address.millisWhenCreated
- the time instant (in millis) when the agent was created.ContextAddress
public void waitUntilUpdated(int seqNum, long timeout)
seqNum
- the initial sequence number.timeout
- the maximum number of milliseconds to wait.public void setAgentIsMoving(boolean moving)
moving
- a boolean indicating that.public boolean getAgentIsMoving()
public java.lang.Object getAgentObject() throws AgentReferenceException
AgentReferenceException
- if error.Object
,
AgentReferenceException
public void nullifyAgentObject()
public int getSeqNum()
private static java.lang.Object getResultOfRetryingAgentInvoking(springs.access.RetryingAgentInvoking retrying) throws CommunicationException
retrying
- the retrying task.
CommunicationException
- if error.Object
,
CommunicationException
private void setAgentObject() throws AgentReferenceException
AgentReferenceException
- if error.AgentReferenceException
public java.lang.Object clone() throws java.lang.CloneNotSupportedException
clone
in class java.lang.Object
java.lang.CloneNotSupportedException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |