Class NIOHTTPBEDispatcher

    • Constructor Detail

      • NIOHTTPBEDispatcher

        public NIOHTTPBEDispatcher()
    • Method Detail

      • kill

        public void kill()
        Termination self initiated or forced by the MediatorManager we are attached to.
        Specified by:
        kill in interface JICPMediator
      • tick

        public void tick​(long time)
        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
      • 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. In both cases the Front-end is connecting --> Set the front-end status to CONNECTING, but don't use this connection: to allow us sending commands to the front-end an initial dummy response will be received soon.
        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.
      • handleJICPPacket

        public JICPPacket handleJICPPacket​(JICPPacket pkt,
                                           InetAddress addr,
                                           int port)
                                    throws ICPException
        Description copied from interface: JICPMediator
        Passes to this JICPMediator a JICP packet. This is called by the JICPServer this Mediator is attached to when a JICPPacket is received having the recipient-ID field set to the ID of this JICPMediator.
        Specified by:
        handleJICPPacket in interface JICPMediator
        Parameters:
        pkt - the JICPPacket
        addr - the address of the mediated entity
        port - the local port used by the mediated entity
        Throws:
        ICPException
      • handleConnectionError

        public void handleConnectionError​(Connection c,
                                          Exception e)
        Description copied from interface: NIOMediator
        Notify this NIOMediator that an error occurred on one of the Connections it was using. 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:
        handleConnectionError in interface NIOMediator
      • 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()
        Termination initiated by the BackEndContainer (i.e. by the platform). When the BackEndContainer exits
        Specified by:
        shutdown in interface BEConnectionManager
      • 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