Package jade.imtp.leap.JICP
Class BIBEDispatcher
- java.lang.Object
-
- java.lang.Thread
-
- jade.imtp.leap.JICP.BIBEDispatcher
-
- All Implemented Interfaces:
BEConnectionManager,Dispatcher,JICPMediator,Runnable
public class BIBEDispatcher extends Thread implements BEConnectionManager, Dispatcher, JICPMediator
Class declaration- Author:
- Giovanni Caire - TILAB
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected classBIBEDispatcher.InpConnectionHolderInner class InpConnectionHolder.protected classBIBEDispatcher.OutConnectionHolderInner class OutConnectionHolder Wrapper for the connection used to receive commands from the FrontEnd-
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler
-
-
Field Summary
Fields Modifier and Type Field Description protected BIBEDispatcher.InpConnectionHolderinpHolderprotected BIBEDispatcher.OutConnectionHolderoutHolder-
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
-
-
Constructor Summary
Constructors Constructor Description BIBEDispatcher()Constructor declaration
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]dispatch(byte[] payload, boolean flush, int oldSessionId)FrontEndgetFrontEnd(BackEnd be, Properties props)Return a stub of the remote FrontEnd that is connected to the local BackEnd.StringgetID()Retrieve the ID of this mediatorbooleanhandleIncomingConnection(Connection c, JICPPacket pkt, InetAddress addr, int port)This is called by the JICPServer when a JICP CREATE_MEDIATOR or CONNECT_MEDIATOR is received.JICPPackethandleJICPPacket(JICPPacket p, InetAddress addr, int port)This is called by the JICPServer when a JICP packet addressing this mediator as recipient-ID is received.protected JICPPackethandlePacket(JICPPacket pkt)voidinit(JICPMediatorManager mgr, String id, Properties props)Initialize parameters and start the embedded threadvoidkill()Shutdown self initiated or forced by the JICPServer this BackEndContainer is attached to.voidrun()voidshutdown()Make this BackEndDispatcher terminate.protected BackEndSkelstartBackEndContainer(Properties props)voidtick(long currentTime)This is periodically called by the JICPMediatorManager and should be used by a JICPMediator to evaluate the elapsed time without the need of a dedicated thread or timer.-
Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, suspend, toString, yield
-
-
-
-
Field Detail
-
inpHolder
protected BIBEDispatcher.InpConnectionHolder inpHolder
-
outHolder
protected BIBEDispatcher.OutConnectionHolder outHolder
-
-
Method Detail
-
getID
public String getID()
Description copied from interface:JICPMediatorRetrieve the ID of this mediator- Specified by:
getIDin interfaceJICPMediator
-
init
public void init(JICPMediatorManager mgr, String id, Properties props) throws ICPException
Initialize parameters and start the embedded thread- Specified by:
initin interfaceJICPMediator- Throws:
ICPException
-
startBackEndContainer
protected final BackEndSkel startBackEndContainer(Properties props) throws ICPException
- Throws:
ICPException
-
kill
public void kill()
Shutdown self initiated or forced by the JICPServer this BackEndContainer is attached to.- Specified by:
killin interfaceJICPMediator
-
handleJICPPacket
public JICPPacket handleJICPPacket(JICPPacket p, InetAddress addr, int port) throws ICPException
This is called by the JICPServer when a JICP packet addressing this mediator as recipient-ID is received. In the case of the BIBEDispatcher this should never happen.- Specified by:
handleJICPPacketin interfaceJICPMediator- Parameters:
p- the JICPPacketaddr- the address of the mediated entityport- the local port used by the mediated entity- Throws:
ICPException
-
handleIncomingConnection
public boolean handleIncomingConnection(Connection c, JICPPacket pkt, InetAddress addr, int port)
This is called by the JICPServer when a JICP CREATE_MEDIATOR or CONNECT_MEDIATOR is received.- Specified by:
handleIncomingConnectionin interfaceJICPMediator- Parameters:
c- the connection to the mediated entitypkt- the packet that was sent by the mediated entity when opening this connectionaddr- the address of the mediated entityport- the local port used by the mediated entity- Returns:
- an indication to the JICPMediatorManager to keep the connection open.
-
tick
public void tick(long currentTime)
Description copied from interface:JICPMediatorThis is periodically called by the JICPMediatorManager and should be used by a JICPMediator to evaluate the elapsed time without the need of a dedicated thread or timer.- Specified by:
tickin interfaceJICPMediator
-
getFrontEnd
public FrontEnd getFrontEnd(BackEnd be, Properties props) throws IMTPException
Return a stub of the remote FrontEnd that is connected to the local BackEnd.- Specified by:
getFrontEndin interfaceBEConnectionManager- Parameters:
be- The local BackEndprops- Additional (implementation dependent) connection configuration properties.- Returns:
- A stub of the remote FrontEnd.
- Throws:
IMTPException
-
shutdown
public void shutdown()
Make this BackEndDispatcher terminate.- Specified by:
shutdownin interfaceBEConnectionManager
-
dispatch
public byte[] dispatch(byte[] payload, boolean flush, int oldSessionId) throws ICPException- Specified by:
dispatchin interfaceDispatcher- Throws:
ICPException
-
handlePacket
protected JICPPacket handlePacket(JICPPacket pkt)
-
-