Package org.glassfish.grizzly
Class AbstractBindingHandler
- java.lang.Object
-
- org.glassfish.grizzly.AbstractBindingHandler
-
- All Implemented Interfaces:
SocketBinder
- Direct Known Subclasses:
TCPNIOBindingHandler,UDPNIOBindingHandler
public abstract class AbstractBindingHandler extends Object implements SocketBinder
- Since:
- 2.2.19
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classAbstractBindingHandler.Builder<E extends AbstractBindingHandler.Builder>Builder
-
Field Summary
Fields Modifier and Type Field Description protected Processorprocessorprotected ProcessorSelectorprocessorSelectorprotected static RandomRANDOMprotected NIOTransporttransport
-
Constructor Summary
Constructors Constructor Description AbstractBindingHandler(NIOTransport transport)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Connection<?>bind(int port)Binds Transport to the specific port on localhost.Connection<?>bind(String host, int port)Binds Transport to the specific host and port.Connection<?>bind(String host, int port, int backlog)Binds Transport to the specific host and port.Connection<?>bind(String host, PortRange portRange, boolean randomStartPort, int backlog)Binds Transport to the specific host, and port within aPortRange.Connection<?>bind(String host, PortRange portRange, int backlog)Binds Transport to the specific host, and port within aPortRange.ProcessorgetProcessor()ProcessorSelectorgetProcessorSelector()Gets the defaultProcessorSelector, which will be used to getProcessorto process I/O events, occurring on connection phase.protected <T> TgetSystemInheritedChannel(Class<?> channelType)voidsetProcessor(Processor processor)voidsetProcessorSelector(ProcessorSelector processorSelector)Sets the defaultProcessorSelector, which will be used to getProcessorto process I/O events, occurring on connection phase.voidunbindAll()This operation is not supported by implementations ofAbstractBindingHandler.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.glassfish.grizzly.SocketBinder
bind, bind, bindToInherited, unbind
-
-
-
-
Field Detail
-
RANDOM
protected static final Random RANDOM
-
transport
protected final NIOTransport transport
-
processor
protected Processor processor
-
processorSelector
protected ProcessorSelector processorSelector
-
-
Constructor Detail
-
AbstractBindingHandler
public AbstractBindingHandler(NIOTransport transport)
-
-
Method Detail
-
getProcessor
public Processor getProcessor()
-
setProcessor
public void setProcessor(Processor processor)
-
getProcessorSelector
public ProcessorSelector getProcessorSelector()
Gets the defaultProcessorSelector, which will be used to getProcessorto process I/O events, occurring on connection phase.- Returns:
- the default
ProcessorSelector, which will be used to getProcessorto process I/O events, occurring on connection phase.
-
setProcessorSelector
public void setProcessorSelector(ProcessorSelector processorSelector)
Sets the defaultProcessorSelector, which will be used to getProcessorto process I/O events, occurring on connection phase.- Parameters:
processorSelector- the defaultProcessorSelector, which will be used to getProcessorto process I/O events, occurring on connection phase.
-
bind
public Connection<?> bind(int port) throws IOException
Binds Transport to the specific port on localhost.- Specified by:
bindin interfaceSocketBinder- Parameters:
port- the port to bind to- Returns:
- bound
Connection - Throws:
IOException- if unable to bind i.e. if port already bound
-
bind
public Connection<?> bind(String host, int port) throws IOException
Binds Transport to the specific host and port.- Specified by:
bindin interfaceSocketBinder- Parameters:
host- the local host the server will bind toport- specific port to bind to- Returns:
- bound
Connection - Throws:
IOException- if unable to bind i.e. if port already bound
-
bind
public Connection<?> bind(String host, int port, int backlog) throws IOException
Binds Transport to the specific host and port.- Specified by:
bindin interfaceSocketBinder- Parameters:
host- the local host the server will bind toport- the port to bind tobacklog- the maximum length of the queue- Returns:
- bound
Connection - Throws:
IOException- if unable to bind i.e. if port already bound
-
bind
public Connection<?> bind(String host, PortRange portRange, int backlog) throws IOException
Binds Transport to the specific host, and port within aPortRange.- Specified by:
bindin interfaceSocketBinder- Parameters:
host- the local host the server will bind toportRange-PortRange.backlog- the maximum length of the queue- Returns:
- bound
Connection - Throws:
IOException- if unable to bind i.e. if port already bound
-
bind
public Connection<?> bind(String host, PortRange portRange, boolean randomStartPort, int backlog) throws IOException
Description copied from interface:SocketBinderBinds Transport to the specific host, and port within aPortRange.- Specified by:
bindin interfaceSocketBinder- Parameters:
host- the local host the server will bind toportRange-PortRange.randomStartPort- if true, a random port in the range will be used as the initial port.backlog- the maximum length of the queue- Returns:
- bound
Connection - Throws:
IOException- if unable to bind i.e. if port already bound
-
unbindAll
public final void unbindAll()
This operation is not supported by implementations ofAbstractBindingHandler.- Specified by:
unbindAllin interfaceSocketBinder- Throws:
UnsupportedOperationException- by default
-
getSystemInheritedChannel
protected <T> T getSystemInheritedChannel(Class<?> channelType) throws IOException
- Throws:
IOException
-
-