Package jade.imtp.leap.JICP
Class BIFEDispatcher
- java.lang.Object
-
- jade.imtp.leap.JICP.BIFEDispatcher
-
- All Implemented Interfaces:
FEConnectionManager,TimerListener,Dispatcher,Runnable
- Direct Known Subclasses:
BIFESDispatcher
public class BIFEDispatcher extends Object implements FEConnectionManager, Dispatcher, TimerListener, Runnable
Class declaration- Author:
- Giovanni Caire - TILAB
-
-
Field Summary
Fields Modifier and Type Field Description protected static byteINPprotected TransportAddressmediatorTAprotected jade.imtp.leap.JICP.BIFEDispatcher.InputManagermyInputManagerprotected StringmyMediatorClassprotected static byteOUTprotected ConnectionoutConnectionprotected booleanrefreshingInputprotected booleanrefreshingOutput
-
Constructor Summary
Constructors Constructor Description BIFEDispatcher()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]dispatch(byte[] payload, boolean flush, int oldSessionId)Deliver a serialized command to the BackEnd.protected voiddispatchWhileDropped()voiddoTimeOut(Timer t)BackEndgetBackEnd(FrontEnd fe, Properties props)Connect to a remote BackEnd and return a stub to communicate with itprotected JICPConnectiongetConnection(TransportAddress ta)subclasses may overwrite this to provide their version of a JICPConnectionprotected voidhandleInpReconnection(Connection c)protected voidhandleOutReconnection(Connection c)protected JICPPacketprepareDropDownRequest()protected voidrefreshInp()Close the current InputManager (if any) and start a new oneprotected voidrefreshOut()Close the current outConnection (if any) and starts a new thread that asynchronously tries to restore it.voidrun()Asynchronously restore the OUT connectionprotected voidsendKeepAlive()Send a KEEP_ALIVE packet to the BE.voidshutdown()Make this BIFEDispatcher terminate.protected voidwritePacket(JICPPacket pkt, Connection c)
-
-
-
Field Detail
-
INP
protected static final byte INP
- See Also:
- Constant Field Values
-
OUT
protected static final byte OUT
- See Also:
- Constant Field Values
-
myMediatorClass
protected String myMediatorClass
-
mediatorTA
protected TransportAddress mediatorTA
-
outConnection
protected Connection outConnection
-
myInputManager
protected jade.imtp.leap.JICP.BIFEDispatcher.InputManager myInputManager
-
refreshingInput
protected boolean refreshingInput
-
refreshingOutput
protected boolean refreshingOutput
-
-
Method Detail
-
getBackEnd
public BackEnd getBackEnd(FrontEnd fe, Properties props) throws IMTPException
Connect to a remote BackEnd and return a stub to communicate with it- Specified by:
getBackEndin interfaceFEConnectionManager- Parameters:
fe- The FrontEnd container that is requesting the connection setup.props- Additional (implementation dependent) connection configuration properties.- Returns:
- A stub of the remote BackEnd.
- Throws:
IMTPException
-
shutdown
public void shutdown()
Make this BIFEDispatcher terminate.- Specified by:
shutdownin interfaceFEConnectionManager
-
dispatch
public byte[] dispatch(byte[] payload, boolean flush, int oldSessionId) throws ICPExceptionDeliver a serialized command to the BackEnd.- Specified by:
dispatchin interfaceDispatcher- Returns:
- The serialized response
- Throws:
ICPException
-
refreshInp
protected void refreshInp()
Close the current InputManager (if any) and start a new one
-
refreshOut
protected void refreshOut()
Close the current outConnection (if any) and starts a new thread that asynchronously tries to restore it.
-
run
public void run()
Asynchronously restore the OUT connection
-
handleInpReconnection
protected void handleInpReconnection(Connection c)
-
handleOutReconnection
protected void handleOutReconnection(Connection c)
-
writePacket
protected void writePacket(JICPPacket pkt, Connection c) throws IOException
- Throws:
IOException
-
doTimeOut
public void doTimeOut(Timer t)
- Specified by:
doTimeOutin interfaceTimerListener
-
sendKeepAlive
protected void sendKeepAlive()
Send a KEEP_ALIVE packet to the BE. This is executed within a synchronized block --> Mutual exclusion with dispatch() is guaranteed.
-
prepareDropDownRequest
protected JICPPacket prepareDropDownRequest()
-
dispatchWhileDropped
protected void dispatchWhileDropped()
-
getConnection
protected JICPConnection getConnection(TransportAddress ta) throws IOException
subclasses may overwrite this to provide their version of a JICPConnection- Parameters:
ta-- Returns:
- Throws:
IOException
-
-