Class TCPNIOBindingHandler
- java.lang.Object
-
- org.glassfish.grizzly.AbstractBindingHandler
-
- org.glassfish.grizzly.nio.transport.TCPNIOBindingHandler
-
- All Implemented Interfaces:
SocketBinder
public class TCPNIOBindingHandler extends AbstractBindingHandler
This class may be used to apply a customProcessor
and/orProcessorSelector
atomically within a bind operation - not something that can normally be done using theTCPNIOTransport
alone. Example usage:TCPNIOBindingHandler handler = TCPNIOBindingHandler.builder(transport).setProcessor(custom).build(); handler.bind(socketAddress);
- Since:
- 2.2.19
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
TCPNIOBindingHandler.Builder
-
Field Summary
-
Fields inherited from class org.glassfish.grizzly.AbstractBindingHandler
processor, processorSelector, RANDOM, transport
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description TCPNIOServerConnection
bind(SocketAddress socketAddress)
Binds Transport to the specific SocketAddress.TCPNIOServerConnection
bind(SocketAddress socketAddress, int backlog)
Binds Transport to the specific SocketAddress.TCPNIOServerConnection
bindToInherited()
Binds the Transport to the channel inherited from the entity that created this Java virtual machine.static TCPNIOBindingHandler.Builder
builder(TCPNIOTransport transport)
void
unbind(Connection connection)
Unbinds boundTransport
connection.-
Methods inherited from class org.glassfish.grizzly.AbstractBindingHandler
bind, bind, bind, bind, bind, getProcessor, getProcessorSelector, getSystemInheritedChannel, setProcessor, setProcessorSelector, unbindAll
-
-
-
-
Method Detail
-
bind
public TCPNIOServerConnection bind(SocketAddress socketAddress) throws IOException
Description copied from interface:SocketBinder
Binds Transport to the specific SocketAddress.- Parameters:
socketAddress
- the local address the server will bind to- Returns:
- bound
Connection
- Throws:
IOException
- if unable to bind i.e. if port already bound
-
bind
public TCPNIOServerConnection bind(SocketAddress socketAddress, int backlog) throws IOException
Description copied from interface:SocketBinder
Binds Transport to the specific SocketAddress.- Parameters:
socketAddress
- the local address the server will bind tobacklog
- the maximum length of the queue- Returns:
- bound
Connection
- Throws:
IOException
- if unable to bind i.e. if port already bound
-
bindToInherited
public TCPNIOServerConnection bindToInherited() throws IOException
Description copied from interface:SocketBinder
Binds the Transport to the channel inherited from the entity that created this Java virtual machine.- Returns:
- bound
Connection
- Throws:
IOException
- if unable to bind i.e. if port already bound
-
unbind
public void unbind(Connection connection)
Description copied from interface:SocketBinder
Unbinds boundTransport
connection.- Parameters:
connection
-Connection
-
builder
public static TCPNIOBindingHandler.Builder builder(TCPNIOTransport transport)
-
-