Package naga

Class ServerSocketObserverAdapter

java.lang.Object
naga.ServerSocketObserverAdapter
All Implemented Interfaces:
ServerSocketObserver

public class ServerSocketObserverAdapter extends Object implements ServerSocketObserver
Class with null-implementations for all callbacks.
Author:
Christoffer Lerno
  • Constructor Details

    • ServerSocketObserverAdapter

      public ServerSocketObserverAdapter()
  • Method Details

    • acceptFailed

      public void acceptFailed(IOException exception)
      Description copied from interface: ServerSocketObserver
      Called by the NIOService on the NIO thread when an accept fails on the socket.

      Note: Since this is a direct callback on the NIO thread, this method will suspend IO on all other connections until the method returns. It is therefore strongly recommended that the implementation of this method returns as quickly as possible to avoid blocking IO.

      Specified by:
      acceptFailed in interface ServerSocketObserver
      Parameters:
      exception - the reason for the failure, never null.
    • serverSocketDied

      public void serverSocketDied(Exception e)
      Description copied from interface: ServerSocketObserver
      Called by the NIOService on the NIO thread when the server socket is closed.

      Note: Since this is a direct callback on the NIO thread, this method will suspend IO on all other connections until the method returns. It is therefore strongly recommended that the implementation of this method returns as quickly as possible to avoid blocking IO.

      Specified by:
      serverSocketDied in interface ServerSocketObserver
      Parameters:
      e - the exception that caused the close, or null if this was caused by an explicit close() on the NIOServerSocket.
    • newConnection

      public void newConnection(NIOSocket nioSocket)
      Description copied from interface: ServerSocketObserver
      Called by the NIOService on the NIO thread when a new connection has been accepted by the socket.

      The normal behaviour would be for the observer to assign a reader and a writer to the socket, and then finally invoke NIOSocket#listen(SocketObserver) on the socket.

      Note: Since this is a direct callback on the NIO thread, this method will suspend IO on all other connections until the method returns. It is therefore strongly recommended that the implementation of this method returns as quickly as possible to avoid blocking IO.

      Specified by:
      newConnection in interface ServerSocketObserver
      Parameters:
      nioSocket - the socket that was accepted.