fr.dyade.aaa.agent
Class ProxyAgent
- AgentMBean, Serializable
public abstract class ProxyAgent
void | agentFinalize(boolean lastime) - Finalizes this proxy agent execution.
|
protected void | agentInitialize(boolean firstTime) - Initializes the transient members of this agent.
|
void | cleanDriverOut() - Method cleaning DriverOut.
|
void | cleanDriverOut(int drvKey) - Method cleaning the
DriverOut specified
by the key parameter (multi-connections mode).
|
protected void | closeAllConnections() - Closes all the connections.
|
void | connect() - Initializes the connection with the outside, up to creating
the input and output streams
ois and oos .
|
void | disconnect() - Closes the connection with the outside.
|
protected void | driverDone(DriverDone not) - Reacts to end of driver execution.
|
protected void | driverReact(int key, Notification not) - Method called by the ProxyAgent
DriverIn instances to
forward the notifications they got from their input streams.
|
protected String | getLogTopic() - Returns default log topic for proxies.
|
void | react(AgentId from, Notification not) - Method implementing the
ProxyAgent reactions to
notifications.
|
protected void | reinitialize() - Reinitializes the agent, that is reconnects its input and output.
|
protected void | sendOut(int key, Notification not) - Method called by subclasses to directly send their notifications
to the right
DriverOut .
|
void | setMultiConn() - Method setting the
ProxyAgent in multiConn mode.
|
protected void | stop() - Stops all drivers (non multiConn mode).
|
protected void | stop(int drvKey) - Method stopping the specified connection set (multi-connections mode).
|
String | toString() - Provides a string image for this object.
|
agentFinalize , agentInitialize , delete , delete , deploy , deploy , getId , getLogTopic , getName , isDeployed , isFixed , needToBeCommited , react , save , sendTo , sendTo , sendTo , setNoSave , toString |
DRIVER_IN
public static final int DRIVER_IN
- 1
DRIVER_OUT
public static final int DRIVER_OUT
- 2
blockingCnx
protected boolean blockingCnx
true if connect may block
driversTable
protected Hashtable driversTable
Table holding the DriverMonitor
objects, each one holding a
connection set (a pair of drivers, a qout, ois, oos, ...).
For multi-connections management.
DriverMonitor
inFlowControl
protected int inFlowControl
flow control in driver in
multiConn
protected boolean multiConn
true
if the proxy manages multiple connections.
multipleCnx
protected boolean multipleCnx
true if proxy may handle multiple connection
qout
protected Queue qout
communication with drvOut
ProxyAgent
public ProxyAgent()
Allocates a new Agent object. The resulting object is not an agent;
before it can react to a notification you must deploy it. This constructor
has the same effect as
Agent(AgentServer.getServerId(), null, false)
.
Agent.Agent(short, java.lang.String, boolean)
, Agent.deploy()
ProxyAgent
public ProxyAgent(String n)
Allocates a new Agent object. This constructor has the same effect
as Agent(AgentServer.getServerId(), name, false)
.
Agent.Agent(short, java.lang.String, boolean)
ProxyAgent
public ProxyAgent(String name,
int stamp)
ProxyAgent
public ProxyAgent(short to,
String n)
Allocates a new Agent object. This constructor has the same effect
as Agent(to, name, false)
.
to
- Identication of target agent server
Agent.Agent(short, java.lang.String, boolean)
agentFinalize
public void agentFinalize(boolean lastime)
Finalizes this proxy agent execution. Calls disconnect
to
close the open streams, and stop
to stop the drivers.
- agentFinalize in interface Agent
agentInitialize
protected void agentInitialize(boolean firstTime)
throws Exception
Initializes the transient members of this agent.
This function is first called by the factory agent, then by the system
each time the agent server is restarted.
This function is not declared final so that derived classes
may change their reload policy.
- agentInitialize in interface Agent
firstTime
- true when first called by the factory
cleanDriverOut
public void cleanDriverOut()
Method cleaning DriverOut. Single connection mode only.
cleanDriverOut
public void cleanDriverOut(int drvKey)
Method cleaning the DriverOut
specified
by the key parameter (multi-connections mode).
drvKey
- key identifying the connection set.
closeAllConnections
protected void closeAllConnections()
Closes all the connections.
connect
public void connect()
throws Exception
Initializes the connection with the outside, up to creating
the input and output streams ois
and oos
.
disconnect
public void disconnect()
throws Exception
Closes the connection with the outside.
driverDone
protected void driverDone(DriverDone not)
throws IOException
Reacts to end of driver execution.
This is the end of the driver thread, however the thread resources
may not have been released. This is why
close
is called
on the notification streams, which requires from the stream classes
to cope with a call to
close
when some resources may have
been released.
driverReact
protected void driverReact(int key,
Notification not)
Method called by the ProxyAgent
DriverIn
instances to
forward the notifications they got from their input streams.
May be overridden for specific behaviour as long as the proxy state
is not modified by the method, because it does not occur within a
transaction.
key
- Driver identifier.not
- Notification to forward.
getLogTopic
protected String getLogTopic()
Returns default log topic for proxies. Its method overriddes
the default one in Agent, the resulting logging topic is
Debug.A3Proxy
dot the real classname.
- getLogTopic in interface Agent
react
public void react(AgentId from,
Notification not)
throws Exception
Method implementing the ProxyAgent
reactions to
notifications.
Forwards notifications coming from an identified agent onto the outgoing
connection.
- react in interface Agent
from
- agent sending notificationnot
- notification to react to
reinitialize
protected void reinitialize()
throws IOException
Reinitializes the agent, that is reconnects its input and output.
This function may be called only when all drivers are null
if the ProxyAgent
manages only one connection at a time.
Otherwise, a multiConn ProxyAgent
will reinitialize
even if the current drivers are not null.
sendOut
protected void sendOut(int key,
Notification not)
throws Exception
Method called by subclasses to directly send their notifications
to the right DriverOut
.
key
- Driver identifier.not
- Notification to send out.
setMultiConn
public void setMultiConn()
Method setting the ProxyAgent
in multiConn mode.
To be called immediately after the ProxyAgent
instanciation.
stop
protected void stop()
Stops all drivers (non multiConn mode).
May be multiply called.
stop
protected void stop(int drvKey)
Method stopping the specified connection set (multi-connections mode).
drvKey
- key identifying the connection set to stop.
toString
public String toString()
Provides a string image for this object.
- toString in interface AgentMBean
- toString in interface Agent
- printable image of this object
Copyright B) 2004 Scalagent - All rights reserved