Package fr.dyade.aaa.agent
Class AgentFactory
- java.lang.Object
-
- fr.dyade.aaa.agent.Agent
-
- fr.dyade.aaa.agent.AgentFactory
-
- All Implemented Interfaces:
AgentMBean,Encodable,Serializable
final class AgentFactory extends Agent
Agentused to allow remote agent creation. Every agent server hosts a factory agent, they all use a predefined stamp identifierAgentId.factoryId. The factory must be able to create all types of objects, actually it is supposed that the corresponding classes can be reached.The agent creation process involves the following steps
- locally creating the
Agentobject in memory ; - serializing the agent state, building an
AgentCreateRequestnotification with the resulting string, sending it to the target Factory agent ; - the factory agent building the object in memory from the serialized image, and saving it into operational storage ;
- the factory agent calling the initialize method.
-
-
Field Summary
Fields Modifier and Type Field Description private static longserialVersionUIDdefine serialVersionUID for interoperability-
Fields inherited from class fr.dyade.aaa.agent.Agent
agentProfiling, commitTime, DEBUG, deployed, emptyString, fixed, id, last, logmon, name, reactNb, reactTime
-
Fields inherited from interface fr.dyade.aaa.common.encoding.Encodable
BOOLEAN_ENCODED_SIZE, BYTE_ENCODED_SIZE, DOUBLE_ENCODED_SIZE, FLOAT_ENCODED_SIZE, INT_ENCODED_SIZE, LONG_ENCODED_SIZE, SHORT_ENCODED_SIZE
-
-
Constructor Summary
Constructors Constructor Description AgentFactory(AgentId factoryId)Allocates a newAgentFactoryagent.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidagentInitialize(boolean firstTime)Gives this agent an opportunity to initialize after having been deployed, and each time it is loaded into memory.protected StringgetLogTopic()Returns log topic for factory agent.voidreact(AgentId from, Notification not)Reacts to notifications ... .-
Methods inherited from class fr.dyade.aaa.agent.Agent
agentFinalize, agentSave, decode, delete, delete, delete, deploy, deploy, doAdminSyncNotification, encode, getAgentId, getCommitTime, getEncodableClassId, getEncodedSize, getId, getName, getReactNb, getReactTime, hasName, incWorkInProgress, isAgentProfiling, isDeployed, isFixed, isUpdated, load, load, needToBeCommited, resetCommitTime, resetReactTime, resetTimer, save, sendTo, sendTo, sendTo, setAgentProfiling, setName, setNoSave, setSave, toString
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
define serialVersionUID for interoperability- See Also:
- Constant Field Values
-
-
Constructor Detail
-
AgentFactory
AgentFactory(AgentId factoryId)
Allocates a newAgentFactoryagent. AnAgentFactoryagent must be created on every agent server the first time it runs.- Parameters:
factoryId- unique identifier for factory agent.
-
-
Method Detail
-
getLogTopic
protected String getLogTopic()
Returns log topic for factory agent.- Overrides:
getLogTopicin classAgent- Returns:
- the default log topic for agents.
-
agentInitialize
protected void agentInitialize(boolean firstTime) throws ExceptionGives this agent an opportunity to initialize after having been deployed, and each time it is loaded into memory. Loads the list of agents with afixedfield set totrue.- Overrides:
agentInitializein classAgent- Parameters:
firstTime- true when first called by the factory- Throws:
Exception- unspecialized exception
-
-