|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.iids.aos.systemservices.module.AbstractModule
org.iids.aos.hostmanager.LifeCycleModule
public class LifeCycleModule
Agent lifecycle management module.
All lifecycle related management can be found here, like migrating, suspending and running agents.
NOTE: synchronization to be investigated
| Constructor Summary | |
|---|---|
LifeCycleModule(Communicator _communicator,
AgentScapeConfig _asc,
SystemServiceModule ssm,
RegistrationModule rm,
AgentRegistrationModule arm,
AgentScapeHMNegotiationModule nm,
AgentContainerManager acm,
MessageCenter mc)
|
|
| Method Summary | |
|---|---|
boolean |
containsAgent(AgentID id)
Query to see if this host contains a certain agent. |
void |
createAgent(AgentID agentID,
java.lang.String token)
|
AgentHandle |
createAgentHandle(AgentID id)
Creates a new unique AgentHandle for an existing agent, which can be used to refer to this agent. |
AgentArchive |
exportAgent(AgentID id)
|
int |
getAgentCPUtime(AgentID agentId)
Report CPU time consumed by an agent. |
java.util.List<AgentHandle> |
getAgentHandles(AgentID id)
Obtain a list of agent handles belonging to an agent. |
MigrationEndpoint |
handleMigration(AgentID agentId,
java.lang.String migrationToken,
Address requestingAddress)
Called by local location manager to instruct host manager to prepare for an incoming agent. |
boolean |
isStarted()
|
void |
killAgent(AgentID agentId)
|
void |
migrationRequest(AgentID requestingAgentId,
java.lang.String migrationToken,
AgentScapeID locationId)
Handles migration requests from local agents. |
void |
migrationStatus(MigrationID mid,
boolean success)
Called by remote hostmanager to indicate success or failure of agent migration on the remote side. |
void |
notifyCompletion(ContainerWaitThread cwt)
Used by a ContainerWaitThread to indicate that it completed the transfer, and the agent can be loaded (if successful). |
java.util.List<Envelope> |
removeAgentHandle(AgentID id,
AgentHandle ah,
boolean pickup)
|
void |
start()
|
void |
startAgent(AgentID agentId,
boolean collect,
java.lang.String[] args)
Instruct host/agentserver to start running an agent. |
void |
stop()
|
void |
suspendAgent(AgentID agentId)
Suspend a running agent. |
AgentArchive |
waitForAgent(AgentID id,
boolean pickup)
Collect finished agent container (if it was killed on this host). |
| Methods inherited from class org.iids.aos.systemservices.module.AbstractModule |
|---|
getCommunicator, getModuleName |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public LifeCycleModule(Communicator _communicator,
AgentScapeConfig _asc,
SystemServiceModule ssm,
RegistrationModule rm,
AgentRegistrationModule arm,
AgentScapeHMNegotiationModule nm,
AgentContainerManager acm,
MessageCenter mc)
throws java.lang.NoSuchMethodException,
CommunicatorException
java.lang.NoSuchMethodException
CommunicatorException| Method Detail |
|---|
public void createAgent(AgentID agentID,
java.lang.String token)
throws AgentCreationException
AgentCreationException
public void startAgent(AgentID agentId,
boolean collect,
java.lang.String[] args)
throws AgentIDUnknownException,
AgentStartupException
Implementation of
HostManager.start_agent(org.iids.aos.systemservices.communicator.structs.AgentID, boolean, java.lang.String[]).
AgentIDUnknownException
AgentStartupException
public void suspendAgent(AgentID agentId)
throws AgentIDUnknownException,
AgentSuspendException
Implementation of
HostManager.suspend_agent(org.iids.aos.systemservices.communicator.structs.AgentID).
AgentIDUnknownException
AgentSuspendException
public void killAgent(AgentID agentId)
throws AgentIDUnknownException
AgentIDUnknownException
public int getAgentCPUtime(AgentID agentId)
throws AgentIDUnknownException
agentId - AgentID to get CPU time from.
AgentIDUnknownException
public void migrationRequest(AgentID requestingAgentId,
java.lang.String migrationToken,
AgentScapeID locationId)
throws MigrationFailedException
The remote host manager is contacted, and the AC is sent to the remote host. Once this is done, this function returns. The remote host then tries to start the agent.
Note that if the migration succeeds, but agent startup cannot be completed, the initiating host does not notice this. This is now the responsibility of the host manager that accepted the agent.
requestingAgentId - AgentID of the requesting agent.migrationToken - String token for this agent. This can be either a lease identifier
indicating where the agent will be placed, or a string containing
the language requirement for the agent.locationId - Target location of the agent
MigrationFailedException - If the migration failed for some reason.
public MigrationEndpoint handleMigration(AgentID agentId,
java.lang.String migrationToken,
Address requestingAddress)
throws MigrationFailedException
This creates a migration endpoint to which the initiating host manager can send the Agent Container.
agentId - AgentID of the incoming agent to expect.migrationToken - Token that identifier this migration action. Could be either a
pre-negotiated lease information, or a String containing the
language requirements used to select agent server.requestingAddress - Address of the HostManager that initiated the transfer.
MigrationFailedException - If the migration request could not be fulfilled.
public void migrationStatus(MigrationID mid,
boolean success)
throws MigrationFailedException
If there is a (sending) thread blocked waiting for the AC to arrive (there probably is), then it is unblocked and notified of the migration status.
mid - Migration ID identifying the agent transfer.success - Boolean identifying successful migration (true) or failure (false).
MigrationFailedExceptionpublic boolean containsAgent(AgentID id)
public AgentHandle createAgentHandle(AgentID id)
throws AgentIDUnknownException
Implementation of
HostManager.create_agent_handle(org.iids.aos.systemservices.communicator.structs.AgentID).
AgentIDUnknownException
public java.util.List<Envelope> removeAgentHandle(AgentID id,
AgentHandle ah,
boolean pickup)
throws AgentIDUnknownException
AgentIDUnknownException
public java.util.List<AgentHandle> getAgentHandles(AgentID id)
throws AgentIDUnknownException
Implementation of
HostManager.get_agent_handles(org.iids.aos.systemservices.communicator.structs.AgentID).
AgentIDUnknownExceptionpublic void notifyCompletion(ContainerWaitThread cwt)
If all is well, the remote host (that shipped the AC) is notified that the AC has arrived. After that we try to load the agent implementation from the AC.
The agent is loaded after notifying the sending host because this notification can get lost (i.e. if the connection breaks). In this case this would mean that the agent will not be started here, and the sending host manager can find out itself (e.g. after a timeout) that something went wrong, so it can possibly restart the agent locally. If the notification was to be sent after loading the agent, then we could have two copies of the same agent.
In short, migration is an at-most-once process.
cwt - The ContainerWaitThread that noticed completion of the transferpublic boolean isStarted()
public void start()
public void stop()
public AgentArchive waitForAgent(AgentID id,
boolean pickup)
throws AgentIDUnknownException,
AgentContainerException
Implementation of
HostManager.wait_for_agent(org.iids.aos.systemservices.communicator.structs.AgentID, boolean).
AgentIDUnknownException
AgentContainerException
public AgentArchive exportAgent(AgentID id)
throws AgentIDUnknownException,
AgentContainerException
AgentIDUnknownException
AgentContainerException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||