Package com.yahoo.jrt
Class Acceptor
java.lang.Object
com.yahoo.jrt.Acceptor
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
Modifier and TypeMethodDescriptionvoid
join()
Wait for the acceptor thread to finishint
port()
Obtain the local port number this Acceptor is listening to.shutdown()
Initiate controlled shutdown of the acceptor threadspec()
Obtain the Spec for the local port and host interface this Acceptor is listening to.
-
Method Details
-
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
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
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
-