Package com.yahoo.jrt

Class Acceptor


  • public class Acceptor
    extends java.lang.Object
    A class used to listen on a network socket. A separate thread is used to accept connections and register them with the underlying transport thread. To create an acceptor you need to invoke the listen method in the Supervisor class.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void join()
      Wait for the acceptor thread to finish
      int port()
      Obtain the local port number this Acceptor is listening to.
      Acceptor shutdown()
      Initiate controlled shutdown of the acceptor thread
      Spec spec()
      Obtain the Spec for the local port and host interface this Acceptor is listening to.
      • Methods inherited from class java.lang.Object

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

      • port

        public int port()
        Obtain the local port number this Acceptor is listening to. If this Acceptor is no longer listening (it has been shut down), -1 will be returned.
        Returns:
        listening port, or -1 if not listening
      • spec

        public Spec spec()
        Obtain the Spec for the local port and host interface this Acceptor is listening to. If this Acceptor is no longer listening (it has been shut down), null will be returned.
        Returns:
        listening spec, or null if not listening.
      • shutdown

        public Acceptor shutdown()
        Initiate controlled shutdown of the acceptor thread
        Returns:
        this object, to enable chaining with join
      • join

        public void join()
        Wait for the acceptor thread to finish