Class HTTPBEDispatcher

    • Constructor Detail

      • HTTPBEDispatcher

        public HTTPBEDispatcher()
    • Method Detail

      • kill

        public void kill()
        Shutdown self initiated or forced by the MediatorManager this BackEndContainer is attached to.
        Specified by:
        kill in interface JICPMediator
      • handleIncomingConnection

        public boolean handleIncomingConnection​(Connection c,
                                                JICPPacket pkt,
                                                InetAddress addr,
                                                int port)
        Handle an incoming connection. This is called by the MediatorManager when a CREATE or CONNECT_MEDIATOR request is received. The HTTPBEDispatcher reacts to this call by resetting the current situation
        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.
      • tick

        public void tick​(long currentTime)
        Description copied from interface: JICPMediator
        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.
        Specified by:
        tick in interface JICPMediator
      • dispatch

        public byte[] dispatch​(byte[] payload,
                               boolean flush,
                               int oldSessionId)
                        throws ICPException
        This is called by the Stub using this Dispatcher to dispatch a serialized command to the FrontEnd. Mutual exclusion with itself to ensure one command at a time is dispatched.
        Specified by:
        dispatch in interface Dispatcher
        Throws:
        ICPException
      • 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
      • shutdown

        public void shutdown()
        Clean up this HTTPBEDispatcher. The shutdown process can be activated in the following cases: 1) The local container is requested to exit --> The exit commad is forwarded to the FrontEnd 1.a) Forwarding OK. The FrontEnd sends back a response with the TERMINATED_INFO set. When this response is received the shutdown() method is called (see handleJICPPacket()). 1.b) Forwarding failed. The BackEndContainer ignores the exception and directly calls the shutdown() method. Note that in the case the FrontEnd spontaneously exits and in the case the max disconnection time expires the kill() method is called --> see case 1.
        Specified by:
        shutdown in interface BEConnectionManager
      • handlePeerExited

        protected void handlePeerExited()
      • handleConnectionError

        protected void handleConnectionError()