Package com.yahoo.jrt
Class Acceptor
- java.lang.Object
-
- com.yahoo.jrt.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 thelisten
method in theSupervisor
class.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
join()
Wait for the acceptor thread to finishint
port()
Obtain the local port number this Acceptor is listening to.Acceptor
shutdown()
Initiate controlled shutdown of the acceptor threadSpec
spec()
Obtain the Spec for the local port and host interface this Acceptor is listening to.
-
-
-
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
-
-