Class ServerListener


  • public abstract class ServerListener
    extends java.lang.Object
    This class contains all functions which, if registered at the server object, will be called when certain events are happening.
    See Also:
    Server
    • Constructor Summary

      Constructors 
      Constructor Description
      ServerListener()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void onAccept​(CommunicationHandler ch)
      Will be called once a client has been accepted by the server
      void onAcceptEnd()
      Will be called once the server stops to accept clients
      void onAcceptFailed​(java.lang.Exception e)
      Will be called if an error occures while trying to accept a client
      void onAcceptStart()
      Will be called before the server starts to accept clients
      void onClose()
      Will be called before the closing process of the server is beeing initiated
      void onCloseEnd()
      Will be called once the server has been closed successfully
      void onCloseFailed​(java.lang.Exception e)
      Will be called if an error occures while trying to close the server
      void onCommunicationHandlerClose​(CommunicationHandler ch)
      Will be called before a CommunicationHandler is tried to be closed
      void onCommunicationHandlerCloseEnd​(CommunicationHandler ch)
      Will be called once a CommunicationHandler is closed
      void onCommunicationHandlerCloseFailed​(CommunicationHandler ch, java.lang.Exception exception)
      Will be called if the closing process fails
      void onCommunicationHandlerInitFailed​(java.lang.Exception exception)
      Will be called if an error occures while trying to init the IOHandler inside the CommunicationHandler
      void onSocketClosed​(java.lang.Exception exception)
      Will be fired if the ServerSocket is closed while Client tried to connect.
      void onSocketClosed​(java.lang.Exception exception, java.lang.String clientAddress)
      Will be fired if the ServerSocket is closed while Client tried to connect.
      void onStart()
      Will be called before server startup
      void onStartFailed​(java.lang.Exception e)
      Will be called if server start failed
      void onStartSuccess()
      Will be called after successful server start
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ServerListener

        public ServerListener()
    • Method Detail

      • onStart

        public void onStart()
        Will be called before server startup
      • onStartFailed

        public void onStartFailed​(java.lang.Exception e)
        Will be called if server start failed
        Parameters:
        e - the exception thrown while trying to start the server
      • onStartSuccess

        public void onStartSuccess()
        Will be called after successful server start
      • onAccept

        public void onAccept​(CommunicationHandler ch)
        Will be called once a client has been accepted by the server
        Parameters:
        ch - the CommunicationHandler associated with the client that just connected
      • onAcceptStart

        public void onAcceptStart()
        Will be called before the server starts to accept clients
      • onAcceptEnd

        public void onAcceptEnd()
        Will be called once the server stops to accept clients
      • onAcceptFailed

        public void onAcceptFailed​(java.lang.Exception e)
        Will be called if an error occures while trying to accept a client
        Parameters:
        e - the exception which was thrown
      • onClose

        public void onClose()
        Will be called before the closing process of the server is beeing initiated
      • onCloseEnd

        public void onCloseEnd()
        Will be called once the server has been closed successfully
      • onCloseFailed

        public void onCloseFailed​(java.lang.Exception e)
        Will be called if an error occures while trying to close the server
        Parameters:
        e - the exception which was thrown
      • onCommunicationHandlerInitFailed

        public void onCommunicationHandlerInitFailed​(java.lang.Exception exception)
        Will be called if an error occures while trying to init the IOHandler inside the CommunicationHandler
        Parameters:
        exception - which was thrown
      • onCommunicationHandlerClose

        public void onCommunicationHandlerClose​(CommunicationHandler ch)
        Will be called before a CommunicationHandler is tried to be closed
        Parameters:
        ch - CommunicationHandler that is going to be closed
      • onCommunicationHandlerCloseEnd

        public void onCommunicationHandlerCloseEnd​(CommunicationHandler ch)
        Will be called once a CommunicationHandler is closed
        Parameters:
        ch - CommunicationHandler that has been closed
      • onCommunicationHandlerCloseFailed

        public void onCommunicationHandlerCloseFailed​(CommunicationHandler ch,
                                                      java.lang.Exception exception)
        Will be called if the closing process fails
        Parameters:
        ch - CommunicationHandler which closing process failed
        exception - which was thrown during the process of closing the CommunicationHandler
      • onSocketClosed

        public void onSocketClosed​(java.lang.Exception exception)
        Will be fired if the ServerSocket is closed while Client tried to connect.
        Parameters:
        exception - which is thrown during the process of client acceptance.
      • onSocketClosed

        public void onSocketClosed​(java.lang.Exception exception,
                                   java.lang.String clientAddress)
        Will be fired if the ServerSocket is closed while Client tried to connect.
        Parameters:
        exception - which is thrown during the process of client acceptance.
        clientAddress - of the closed Socket