Class BackEndDispatcher

    • Constructor Detail

      • BackEndDispatcher

        public BackEndDispatcher()
    • Method Detail

      • getID

        public String getID()
        Retrieve the ID of this mediator. Returns null if this mediator is not active
        Specified by:
        getID in interface JICPMediator
      • kill

        public void kill()
        Kill the above container. This may be called by the JICPMediatorManager or when a peer termination notification is received.
        Specified by:
        kill in interface JICPMediator
      • handleIncomingConnection

        public boolean handleIncomingConnection​(Connection c,
                                                JICPPacket pkt,
                                                InetAddress addr,
                                                int port)
        Passes to this JICPMediator the connection opened by the mediated entity. This is called by the JICPMediatorManager this Mediator is attached to as soon as the mediated entity (re)connects.
        Specified by:
        handleIncomingConnection in interface JICPMediator
        Parameters:
        c - the connection to the mediated entity
        pkt - the packet that was sent by the mediated entity when opening this connection
        addr - the address of the mediated entity
        port - the local port used by the mediated entity
        Returns:
        an indication to the JICPMediatorManager to keep the connection open.
      • handleConnectionError

        public void handleConnectionError​(Connection c,
                                          Exception e)
        Notify this NIOMediator that an error occurred on one of the Connections it is using. This information is important since, unlike normal mediators, a NIOMediator typically does not read packets from connections on its own (the JICPMediatorManager does that in general).
        Specified by:
        handleConnectionError in interface NIOMediator
      • handleJICPPacket

        public JICPPacket handleJICPPacket​(JICPPacket p,
                                           InetAddress addr,
                                           int port)
                                    throws ICPException
        Passes to this mediator a JICPPacket received by the JICPMediatorManager this mediator is attached to. In a NIOMediator this should never be called.
        Specified by:
        handleJICPPacket in interface JICPMediator
        Parameters:
        p - the JICPPacket
        addr - the address of the mediated entity
        port - the local port used by the mediated entity
        Throws:
        ICPException
      • handleJICPPacket

        public JICPPacket handleJICPPacket​(Connection c,
                                           JICPPacket pkt,
                                           InetAddress addr,
                                           int port)
                                    throws ICPException
        Overloaded version of the handleJICPPacket() method including the Connection the incoming JICPPacket was received from. This information is important since, unlike normal mediators, a NIOMediator may not read packets from connections on its own (the JICPMediatorManager does that in general).
        Specified by:
        handleJICPPacket in interface NIOMediator
        Throws:
        ICPException
      • tick

        public final void tick​(long currentTime)
        This is periodically called by the JICPMediatorManager and is used by this NIOMediator to evaluate the elapsed time without the need of a dedicated thread or timer.
        Specified by:
        tick in interface JICPMediator
      • 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:
        getFrontEnd in interface BEConnectionManager
        Parameters:
        be - The local BackEnd
        props - Additional (implementation dependent) connection configuration properties.
        Returns:
        A stub of the remote FrontEnd.
        Throws:
        IMTPException
      • handleDropDown

        protected void handleDropDown​(Connection c,
                                      JICPPacket pkt,
                                      InetAddress addr,
                                      int port)
        Handle a connection DROP_DOWN request from the FE.
      • requestRefresh

        protected void requestRefresh()
        Request the FE to refresh the connection. This default implementation does nothing. Subclasses may redefine this method to exploit some application specific out-of-band channel
      • isConnected

        public boolean isConnected()