public class SynchronousAgent extends Agent
Modifier and Type | Field and Description |
---|---|
private static SynchronousAgent |
INSTANCE |
static org.objectweb.util.monolog.api.Logger |
logger |
private int |
nextReqMsgId |
private Map<String,Message> |
requests |
private static long |
serialVersionUID |
agentProfiling, emptyString, fixed, logmon
BOOLEAN_ENCODED_SIZE, BYTE_ENCODED_SIZE, DOUBLE_ENCODED_SIZE, FLOAT_ENCODED_SIZE, INT_ENCODED_SIZE, LONG_ENCODED_SIZE, SHORT_ENCODED_SIZE
Constructor and Description |
---|
SynchronousAgent() |
Modifier and Type | Method and Description |
---|---|
void |
agentFinalize(boolean lastTime)
Called to inform this agent that it is garbaged and that it should free
any active resources that it has allocated.
|
protected void |
agentInitialize(boolean firstTime)
Gives this agent an opportunity to initialize after having been deployed,
and each time it is loaded into memory.
|
boolean |
clearQueue(String queueName)
Clears all pending message of a queue
|
boolean |
clearSubscription(String userName,
String subName)
Clears all pending message of a subscription
|
boolean |
createDestination(short serverId,
String name,
String className,
Properties props,
byte expectedType) |
boolean |
createUser(short serverId,
String userName,
String password,
String identityClass,
Properties props) |
boolean |
deleteDest(String agentId) |
boolean |
deleteQueueMessage(String queueName,
String msgId)
Delete a message in a queue
|
boolean |
deleteSubMessage(String userName,
String subName,
String msgId)
Deletes a message in a subscription
|
boolean |
deleteUser(String userName,
String agentId) |
static SynchronousAgent |
getSynchronousAgent() |
private String |
nextReqMsgId() |
void |
react(AgentId from,
Notification not)
Defines the reaction of the agent when receiving a notification.
|
boolean |
setFreeReading(boolean freeReading,
String destId) |
boolean |
setFreeWriting(boolean freeWriting,
String destId) |
agentSave, decode, delete, delete, delete, deploy, deploy, encode, getAgentId, getCommitTime, getEncodableClassId, getEncodedSize, getId, getLogTopic, getName, getReactNb, getReactTime, hasName, isAgentProfiling, isDeployed, isFixed, isUpdated, needToBeCommited, resetCommitTime, resetReactTime, resetTimer, save, sendTo, sendTo, sendTo, setAgentProfiling, setName, setNoSave, setSave, toString
public static org.objectweb.util.monolog.api.Logger logger
private static SynchronousAgent INSTANCE
private static final long serialVersionUID
private int nextReqMsgId
public static SynchronousAgent getSynchronousAgent() throws IOException, InterruptedException
IOException
InterruptedException
protected void agentInitialize(boolean firstTime) throws Exception
Agent
This function is first called by the factory agent, just after it deploys the agent.
This function is used by agents with a fixed
field set to
true
to initialize their transient variables, as it is called
each time the agent server is restarted.
This function is not declared final
so that derived classes
may change their reload policy. The implementation of this method provided
by the Agent
class just registers the JMS MBean.
agentInitialize
in class Agent
firstTime
- true when first called by the factoryException
- unspecialized exceptionpublic void agentFinalize(boolean lastTime)
Agent
Agent
should override this method if it has
any operation that it wants to perform before it is garbaged. For example,
an agent with threads (a ProxyAgent for example) would use the initialize
method to create the threads and the agentFinalize
method to
stop them.
Be careful, the notification sending is not allowed in this method.
The implementation of this method provided by the Agent
class
just unregister the JMX MBean if needed.
agentFinalize
in class Agent
lastTime
- true when last called by the factory on agent deletion.public boolean createDestination(short serverId, String name, String className, Properties props, byte expectedType) throws InterruptedException
InterruptedException
public boolean createUser(short serverId, String userName, String password, String identityClass, Properties props) throws Exception
serverId
- userName
- password
- identityClass
- props
- Exception
ClassNotFoundException
InterruptedException
public boolean deleteUser(String userName, String agentId) throws Exception
Exception
public boolean deleteQueueMessage(String queueName, String msgId) throws InterruptedException
queueName
- Name of the queuemsgId
- ID of the message to be deletedInterruptedException
public boolean deleteSubMessage(String userName, String subName, String msgId) throws InterruptedException
userName
- Subscriber's namesubName
- Subscription namemsgId
- ID of the message to be deletedInterruptedException
public boolean clearQueue(String queueName) throws InterruptedException
queueName
- Name of the queueInterruptedException
public boolean clearSubscription(String userName, String subName) throws InterruptedException
userName
- Subscriber's namesubName
- Subscription nameInterruptedException
public boolean setFreeWriting(boolean freeWriting, String destId) throws InterruptedException
InterruptedException
public boolean setFreeReading(boolean freeReading, String destId) throws InterruptedException
InterruptedException
private String nextReqMsgId()
public void react(AgentId from, Notification not) throws Exception
Agent
If there is no corresponding reaction, the agent send an
UnknownNotification
notification to the sender.
Copyright © 2016 ScalAgent D.T.. All Rights Reserved.