java.lang.Object
org.glassfish.grizzly.AbstractSocketConnectorHandler
- All Implemented Interfaces:
ConnectorHandler<SocketAddress>,SocketConnectorHandler
- Direct Known Subclasses:
TCPNIOConnectorHandler,UDPNIOConnectorHandler
public abstract class AbstractSocketConnectorHandler
extends Object
implements SocketConnectorHandler
Abstract class simplifies the implementation of
SocketConnectorHandler interface by pre-implementing some of
its methods.- Author:
- Alexey Stashok
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classBuilder -
Field Summary
FieldsFields inherited from interface org.glassfish.grizzly.SocketConnectorHandler
DEFAULT_CONNECTION_TIMEOUT -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd theConnectionProbe, which will be notified about Connection life-cycle events.Creates, initializes and connects socket to the specific remote host and port and returnsConnection, representing socket.connect(SocketAddress remoteAddress) Creates, initializes and establishesConnectionto the specificremoteAddress.connect(SocketAddress remoteAddress, SocketAddress localAddress) Creates, initializesConnection, binds it to the specific local and remoteremoteAddress.voidconnect(SocketAddress remoteAddress, SocketAddress localAddress, CompletionHandler<Connection> completionHandler) Creates, initializesConnection, binds it to the specific local and remoteremoteAddress.voidconnect(SocketAddress remoteAddress, CompletionHandler<Connection> completionHandler) Creates, initializes and establishesConnectionto the specificremoteAddress.protected abstract FutureImpl<Connection>connectAsync(SocketAddress remoteAddress, SocketAddress localAddress, CompletionHandler<Connection> completionHandler, boolean needFuture) Get theConnectionProbe, which are registered on the Connection.Gets the defaultProcessorSelector, which will be used to getProcessorto process I/O events, occurring on connection phase.protected FutureImpl<Connection>makeCancellableFuture(Connection connection) protected voidpreConfigure(Connection connection) Pre-configuresConnectionobject before actual connecting phase will be started.booleanRemove theConnectionProbe.voidsetProcessor(Processor processor) voidsetProcessorSelector(ProcessorSelector processorSelector) Sets the defaultProcessorSelector, which will be used to getProcessorto process I/O events, occurring on connection phase.
-
Field Details
-
transport
-
probes
-
-
Constructor Details
-
AbstractSocketConnectorHandler
-
-
Method Details
-
connect
Description copied from interface:SocketConnectorHandlerCreates, initializes and connects socket to the specific remote host and port and returnsConnection, representing socket.- Specified by:
connectin interfaceSocketConnectorHandler- Parameters:
host- remote host to connect to.port- remote port to connect to.- Returns:
Futureof connect operation, which could be used to get resultingConnection.
-
connect
Description copied from interface:ConnectorHandlerCreates, initializes and establishesConnectionto the specificremoteAddress.- Specified by:
connectin interfaceConnectorHandler<SocketAddress>- Parameters:
remoteAddress- remote address to connect to- Returns:
Futureof connect operation, which could be used to get resultingConnection
-
connect
Description copied from interface:ConnectorHandlerCreates, initializes and establishesConnectionto the specificremoteAddress.- Specified by:
connectin interfaceConnectorHandler<SocketAddress>- Parameters:
remoteAddress- remote address to connect tocompletionHandler-CompletionHandler
-
connect
Description copied from interface:ConnectorHandlerCreates, initializesConnection, binds it to the specific local and remoteremoteAddress.- Specified by:
connectin interfaceConnectorHandler<SocketAddress>- Parameters:
remoteAddress- remote address to connect tolocalAddress- local address to bind aConnectionto- Returns:
Futureof connect operation, which could be used to get resultingConnection
-
connect
public void connect(SocketAddress remoteAddress, SocketAddress localAddress, CompletionHandler<Connection> completionHandler) Description copied from interface:ConnectorHandlerCreates, initializesConnection, binds it to the specific local and remoteremoteAddress.- Specified by:
connectin interfaceConnectorHandler<SocketAddress>- Parameters:
remoteAddress- remote address to connect tolocalAddress- local address to bind aConnectiontocompletionHandler-CompletionHandler
-
connectAsync
protected abstract FutureImpl<Connection> connectAsync(SocketAddress remoteAddress, SocketAddress localAddress, CompletionHandler<Connection> completionHandler, boolean needFuture) -
getProcessor
-
setProcessor
-
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
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.
-
addMonitoringProbe
Add theConnectionProbe, which will be notified about Connection life-cycle events.- Parameters:
probe- theConnectionProbe.
-
removeMonitoringProbe
Remove theConnectionProbe.- Parameters:
probe- theConnectionProbe.- Returns:
- true if probe was in the list and is now removed
-
getMonitoringProbes
Get theConnectionProbe, which are registered on the Connection. Please note, it's not appropriate to modify the returned array's content. Please useaddMonitoringProbe(org.glassfish.grizzly.ConnectionProbe)andremoveMonitoringProbe(org.glassfish.grizzly.ConnectionProbe)instead.- Returns:
- the
ConnectionProbe, which are registered on the Connection.
-
preConfigure
Pre-configuresConnectionobject before actual connecting phase will be started.- Parameters:
connection-Connectionto pre-configure.
-
makeCancellableFuture
-