Class SelectorManager

All Implemented Interfaces:
Container, Destroyable, Dumpable, Dumpable.DumpableContainer, LifeCycle

@ManagedObject("Manager of the NIO Selectors") @Deprecated(since="2021-05-27") public abstract class SelectorManager extends ContainerLifeCycle implements Dumpable
Deprecated.

SelectorManager manages a number of ManagedSelectors that simplify the non-blocking primitives provided by the JVM via the java.nio package.

SelectorManager subclasses implement methods to return protocol-specific EndPoints and Connections.

  • Field Details

    • DEFAULT_CONNECT_TIMEOUT

      public static final int DEFAULT_CONNECT_TIMEOUT
      Deprecated.
      See Also:
  • Method Details

    • getExecutor

      @ManagedAttribute("The Executor") public Executor getExecutor()
      Deprecated.
    • getScheduler

      @ManagedAttribute("The Scheduler") public Scheduler getScheduler()
      Deprecated.
    • getConnectTimeout

      @ManagedAttribute("The Connection timeout (ms)") public long getConnectTimeout()
      Deprecated.
      Get the connect timeout
      Returns:
      the connect timeout (in milliseconds)
    • setConnectTimeout

      public void setConnectTimeout(long milliseconds)
      Deprecated.
      Set the connect timeout (in milliseconds)
      Parameters:
      milliseconds - the number of milliseconds for the timeout
    • getReservedThreads

      @Deprecated public int getReservedThreads()
      Deprecated.
      Returns:
      -1
    • setReservedThreads

      @Deprecated public void setReservedThreads(int threads)
      Deprecated.
      Parameters:
      threads - ignored
    • getSelectorCount

      @ManagedAttribute("The number of NIO Selectors") public int getSelectorCount()
      Deprecated.
      Returns:
      the number of selectors in use
    • connect

      public void connect(SelectableChannel channel, Object attachment)
      Deprecated.

      Registers a channel to perform a non-blocking connect.

      The channel must be set in non-blocking mode, SocketChannel.connect(SocketAddress) must be called prior to calling this method, and the connect operation must not be completed (the return value of SocketChannel.connect(SocketAddress) must be false).

      Parameters:
      channel - the channel to register
      attachment - the attachment object
      See Also:
    • accept

      public void accept(SelectableChannel channel)
      Deprecated.
      Parameters:
      channel - the channel to accept
      See Also:
    • accept

      public void accept(SelectableChannel channel, Object attachment)
      Deprecated.

      Registers a channel to perform non-blocking read/write operations.

      This method is called just after a channel has been accepted by ServerSocketChannel.accept(), or just after having performed a blocking connect via Socket.connect(SocketAddress, int), or just after a non-blocking connect via SocketChannel.connect(SocketAddress) that completed successfully.

      Parameters:
      channel - the channel to register
      attachment - the attachment object
    • acceptor

      public Closeable acceptor(SelectableChannel server)
      Deprecated.

      Registers a server channel for accept operations. When a SocketChannel is accepted from the given ServerSocketChannel then the accepted(SelectableChannel) method is called, which must be overridden by a derivation of this class to handle the accepted channel

      Parameters:
      server - the server channel to register
      Returns:
      A Closable that allows the acceptor to be cancelled
    • connectionOpened

      public void connectionOpened(Connection connection)
      Deprecated.

      Callback method invoked when a connection is opened.

      Parameters:
      connection - the connection just opened
    • connectionClosed

      public void connectionClosed(Connection connection)
      Deprecated.

      Callback method invoked when a connection is closed.

      Parameters:
      connection - the connection just closed
    • newConnection

      public abstract Connection newConnection(SelectableChannel channel, EndPoint endpoint, Object attachment) throws IOException
      Deprecated.

      Factory method to create Connection.

      Parameters:
      channel - the channel associated to the connection
      endpoint - the endpoint
      attachment - the attachment
      Returns:
      a new connection
      Throws:
      IOException - if unable to create new connection
    • addEventListener

      public void addEventListener(EventListener listener)
      Deprecated.
    • removeEventListener

      public void removeEventListener(EventListener listener)
      Deprecated.
    • addAcceptListener

      public void addAcceptListener(SelectorManager.AcceptListener listener)
      Deprecated.
    • removeAcceptListener

      public void removeAcceptListener(SelectorManager.AcceptListener listener)
      Deprecated.