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 customProcessorand/orProcessorSelectoratomically within a bind operation - not something that can normally be done using theTCPNIOTransportalone. 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 classTCPNIOBindingHandler.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 TCPNIOServerConnectionbind(SocketAddress socketAddress)Binds Transport to the specific SocketAddress.TCPNIOServerConnectionbind(SocketAddress socketAddress, int backlog)Binds Transport to the specific SocketAddress.TCPNIOServerConnectionbindToInherited()Binds the Transport to the channel inherited from the entity that created this Java virtual machine.static TCPNIOBindingHandler.Builderbuilder(TCPNIOTransport transport)voidunbind(Connection connection)Unbinds boundTransportconnection.-
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:SocketBinderBinds 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:SocketBinderBinds 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:SocketBinderBinds 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:SocketBinderUnbinds boundTransportconnection.- Parameters:
connection-Connection
-
builder
public static TCPNIOBindingHandler.Builder builder(TCPNIOTransport transport)
-
-