|
|||||||||
| 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.agentserver.AgentRunner
public abstract class AgentRunner
Abstract AgentRunner superclass. An agent runner takes care of loading the agent code from the agent container, agent startup and termination. For each language that is to be supported for agents, one needs to implement the abstract functions present in this class, as well as the necessary agent wrappers for that specific language.
JavaAgentRunner,
BinaryAgentRunner| Field Summary | |
|---|---|
protected java.util.Hashtable<AgentID,AgentWrapper> |
agents
|
protected AsCommunicator |
communicator
|
protected AgentScapeConfig |
config
|
protected java.util.Hashtable<AgentHandle,AgentID> |
handles
|
protected HostManagerWrapper |
hostManagerWrapper
|
protected AsLookupService |
lookupService
|
protected AgentNegotiationLib |
neglib
|
protected boolean |
running
|
protected AgentRunnerServletModule |
servletModule
|
protected AgentServer2WSGatewayModule |
wsGatewayModule
|
| Constructor Summary | |
|---|---|
AgentRunner(java.lang.String modulename,
AsCommunicator communicator,
AgentScapeConfig config,
AsLookupService lookupService,
AgentServer2WSGatewayModule wsGatewayModule,
AgentRunnerServletModule servletModule)
Superclass of all agent runners. |
|
| Method Summary | |
|---|---|
java.lang.String |
createDefaultAgentLease(AgentScapeID locationId,
AgentHandle ah)
|
java.lang.String |
createDefaultAgentLease(AgentScapeID locationId,
AgentID aid)
Create a default lease for an agent wanting to start/migrate. |
java.lang.String |
doHttpRequest(java.lang.String request)
|
protected void |
finalize()
|
int |
getAgentCPUtime(AgentHandle agentHandle)
|
int |
getAgentCPUtime(AgentID agentID)
Unimplemented, overload at will. |
AgentID |
getAgentId(AgentHandle agentHandle)
|
java.util.Vector<AgentID> |
getAgents()
|
Address |
getAgentServerAddress()
|
AgentScapeID |
getAgentServerId()
|
AsCommunicator |
getCommunicator()
|
AgentWrapper |
getEntry(AgentID id)
Obtain agent wrapper for a given agent. |
abstract java.lang.String |
getLanguage()
Return a string with the language type of agents that can be run by this agent server. |
AgentNegotiationLib |
getNegotiationLib()
|
boolean |
isStarted()
|
void |
killAgent(AgentHandle agentHandle)
|
void |
killAgent(AgentID agentID)
Completely remove agent from the AgentScape host/location. |
void |
removeAgent(AgentHandle agentHandle)
|
abstract void |
removeAgent(AgentID agentId)
Remove agent from the agent runner. |
void |
setHostManagerWrapper(HostManagerWrapper hmw)
|
abstract void |
shutdown()
|
void |
start()
Start the agent server. |
abstract void |
startAgent(AgentID agentId,
java.lang.String[] args)
Start agent from agent container. |
void |
stop()
Stop the agent server, including all of the agents it has running. |
abstract void |
suspendAgent(AgentID agentId)
Suspend and, if supported, serialize state of a running agent. |
| Methods inherited from class org.iids.aos.systemservices.module.AbstractModule |
|---|
getModuleName |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected HostManagerWrapper hostManagerWrapper
protected AgentScapeConfig config
protected AsCommunicator communicator
protected AsLookupService lookupService
protected AgentServer2WSGatewayModule wsGatewayModule
protected AgentNegotiationLib neglib
protected AgentRunnerServletModule servletModule
protected java.util.Hashtable<AgentID,AgentWrapper> agents
protected java.util.Hashtable<AgentHandle,AgentID> handles
protected boolean running
| Constructor Detail |
|---|
public AgentRunner(java.lang.String modulename,
AsCommunicator communicator,
AgentScapeConfig config,
AsLookupService lookupService,
AgentServer2WSGatewayModule wsGatewayModule,
AgentRunnerServletModule servletModule)
| Method Detail |
|---|
public AgentWrapper getEntry(AgentID id)
throws AgentIDUnknownException
AgentIDUnknownExceptionpublic void start()
public void stop()
public boolean isStarted()
public AgentNegotiationLib getNegotiationLib()
public void setHostManagerWrapper(HostManagerWrapper hmw)
protected void finalize()
throws java.lang.Throwable
finalize in class java.lang.Objectjava.lang.Throwablepublic final java.util.Vector<AgentID> getAgents()
public int getAgentCPUtime(AgentID agentID)
throws AgentIDUnknownException
AgentIDUnknownException
public int getAgentCPUtime(AgentHandle agentHandle)
throws AgentUnknownException
AgentUnknownException
public abstract void startAgent(AgentID agentId,
java.lang.String[] args)
throws AgentIDUnknownException,
AgentStartupException
The agent is supposed to be already registered with the registration service. The runner takes care of reading the code segment(s) from the container and doing agent startup.
agentId - ID of the agent the will be associated with the running agent.args - Optional (may be null or empty) initialization arguments for the agent.
AgentIDUnknownException
AgentStartupException
public abstract void suspendAgent(AgentID agentId)
throws AgentIDUnknownException,
AgentSuspendException
After an agent is suspended, it can be (re) moved. The most recent state of the agent is now supposed to be stored in the agent container, so the agent can be safely migrated.
AgentIDUnknownException
AgentSuspendException
public abstract void removeAgent(AgentID agentId)
throws AgentIDUnknownException
If the agent (process) is still running, it is to be terminated, if this is supported by the language.
Note that this function does not (need to) remove the agent from
the location (deregistration), which is done via the host manager.
When you want to completely remove an agent, you can use the
killAgent(org.iids.aos.systemservices.communicator.structs.AgentID) function, which implicitly calls
this removeAgent function.
TODO: think about exceptions.
agentId - ID of the agent to be removed.
AgentIDUnknownException
public void removeAgent(AgentHandle agentHandle)
throws AgentUnknownException
AgentUnknownExceptionpublic abstract java.lang.String getLanguage()
public java.lang.String createDefaultAgentLease(AgentScapeID locationId,
AgentID aid)
throws NegotiationLibException
In this sense it is quite similar to the createEmptyLeaseRequest function, with the only exception being that the 'language' field of environment resource is specified. The language is the same as the language supported by this agent runner.
The lease is sent to the target location,
locationId - The target location for the lease.aid - The AgentID of the agent that initiated the lease creation
NegotiationLibException - If the lease could not be created.
public java.lang.String createDefaultAgentLease(AgentScapeID locationId,
AgentHandle ah)
throws NegotiationLibException,
AgentUnknownException
NegotiationLibException
AgentUnknownException
public final void killAgent(AgentID agentID)
throws AgentIDUnknownException
removeAgent(org.iids.aos.systemservices.communicator.structs.AgentID) function, because the host manager
also takes care of deregistration of the agent.
SomeException - When agentID is not known by this instance
of the agent runner.
AgentIDUnknownException
public void killAgent(AgentHandle agentHandle)
throws AgentUnknownException
AgentUnknownException
public AgentID getAgentId(AgentHandle agentHandle)
throws AgentUnknownException
AgentUnknownExceptionpublic AgentScapeID getAgentServerId()
public Address getAgentServerAddress()
public abstract void shutdown()
public AsCommunicator getCommunicator()
getCommunicator in interface ModulegetCommunicator in class AbstractModulepublic java.lang.String doHttpRequest(java.lang.String request)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||