public abstract class AbstractSocketConnectorHandler extends Object implements SocketConnectorHandler
SocketConnectorHandler
interface by pre-implementing some of its methods.Modifier and Type | Class and Description |
---|---|
static class |
AbstractSocketConnectorHandler.Builder<E extends AbstractSocketConnectorHandler.Builder>
Builder
|
Modifier and Type | Field and Description |
---|---|
protected List<ConnectionProbe> |
probes |
protected Transport |
transport |
DEFAULT_CONNECTION_TIMEOUT
Constructor and Description |
---|
AbstractSocketConnectorHandler(Transport transport) |
Modifier and Type | Method and Description |
---|---|
void |
addMonitoringProbe(ConnectionProbe probe)
Add the
ConnectionProbe , which will be notified about
Connection life-cycle events. |
GrizzlyFuture<Connection> |
connect(SocketAddress remoteAddress)
Creates, initializes and establishes
Connection to the specific
remoteAddress . |
void |
connect(SocketAddress remoteAddress,
CompletionHandler<Connection> completionHandler)
Creates, initializes and establishes
Connection to the specific
remoteAddress . |
GrizzlyFuture<Connection> |
connect(SocketAddress remoteAddress,
SocketAddress localAddress)
Creates, initializes
Connection , binds it to the specific local
and remote remoteAddress . |
void |
connect(SocketAddress remoteAddress,
SocketAddress localAddress,
CompletionHandler<Connection> completionHandler)
Creates, initializes
Connection , binds it to the specific local
and remote remoteAddress . |
GrizzlyFuture<Connection> |
connect(String host,
int port)
Creates, initializes and connects socket to the specific remote host
and port and returns
Connection , representing socket. |
protected abstract FutureImpl<Connection> |
connectAsync(SocketAddress remoteAddress,
SocketAddress localAddress,
CompletionHandler<Connection> completionHandler,
boolean needFuture) |
ConnectionProbe[] |
getMonitoringProbes()
Get the
ConnectionProbe , which are registered on the Connection. |
Processor |
getProcessor()
|
ProcessorSelector |
getProcessorSelector()
Gets the default
ProcessorSelector , which will be used to get
Processor to process I/O events, occurring on connection phase. |
protected FutureImpl<Connection> |
makeCancellableFuture(Connection connection) |
protected void |
preConfigure(Connection connection)
Pre-configures
Connection object before actual connecting phase
will be started. |
boolean |
removeMonitoringProbe(ConnectionProbe probe)
Remove the
ConnectionProbe . |
void |
setProcessor(Processor processor)
|
void |
setProcessorSelector(ProcessorSelector processorSelector)
Sets the default
ProcessorSelector , which will be used to get
Processor to process I/O events, occurring on connection phase. |
protected final Transport transport
protected final List<ConnectionProbe> probes
public AbstractSocketConnectorHandler(Transport transport)
public GrizzlyFuture<Connection> connect(String host, int port)
SocketConnectorHandler
Connection
, representing socket.connect
in interface SocketConnectorHandler
host
- remote host to connect to.port
- remote port to connect to.Future
of connect operation, which could be used to get
resulting Connection
.public GrizzlyFuture<Connection> connect(SocketAddress remoteAddress)
ConnectorHandler
Connection
to the specific
remoteAddress
.connect
in interface ConnectorHandler<SocketAddress>
remoteAddress
- remote address to connect toFuture
of connect operation, which could be used to get
resulting Connection
public void connect(SocketAddress remoteAddress, CompletionHandler<Connection> completionHandler)
ConnectorHandler
Connection
to the specific
remoteAddress
.connect
in interface ConnectorHandler<SocketAddress>
remoteAddress
- remote address to connect tocompletionHandler
- CompletionHandler
public GrizzlyFuture<Connection> connect(SocketAddress remoteAddress, SocketAddress localAddress)
ConnectorHandler
Connection
, binds it to the specific local
and remote remoteAddress
.connect
in interface ConnectorHandler<SocketAddress>
remoteAddress
- remote address to connect tolocalAddress
- local address to bind a Connection
toFuture
of connect operation, which could be used to get
resulting Connection
public void connect(SocketAddress remoteAddress, SocketAddress localAddress, CompletionHandler<Connection> completionHandler)
ConnectorHandler
Connection
, binds it to the specific local
and remote remoteAddress
.connect
in interface ConnectorHandler<SocketAddress>
remoteAddress
- remote address to connect tolocalAddress
- local address to bind a Connection
tocompletionHandler
- CompletionHandler
protected abstract FutureImpl<Connection> connectAsync(SocketAddress remoteAddress, SocketAddress localAddress, CompletionHandler<Connection> completionHandler, boolean needFuture)
public Processor getProcessor()
public void setProcessor(Processor processor)
public ProcessorSelector getProcessorSelector()
ProcessorSelector
, which will be used to get
Processor
to process I/O events, occurring on connection phase.ProcessorSelector
, which will be used to get
Processor
to process I/O events, occurring on connection phase.public void setProcessorSelector(ProcessorSelector processorSelector)
ProcessorSelector
, which will be used to get
Processor
to process I/O events, occurring on connection phase.processorSelector
- the default ProcessorSelector
,
which will be used to get Processor
to process I/O events,
occurring on connection phase.public void addMonitoringProbe(ConnectionProbe probe)
ConnectionProbe
, which will be notified about
Connection life-cycle events.probe
- the ConnectionProbe
.public boolean removeMonitoringProbe(ConnectionProbe probe)
ConnectionProbe
.probe
- the ConnectionProbe
.public ConnectionProbe[] getMonitoringProbes()
ConnectionProbe
, which are registered on the Connection.
Please note, it's not appropriate to modify the returned array's content.
Please use addMonitoringProbe(org.glassfish.grizzly.ConnectionProbe)
and
removeMonitoringProbe(org.glassfish.grizzly.ConnectionProbe)
instead.ConnectionProbe
, which are registered on the Connection.protected void preConfigure(Connection connection)
Connection
object before actual connecting phase
will be started.connection
- Connection
to pre-configure.protected FutureImpl<Connection> makeCancellableFuture(Connection connection)
Copyright © 2014 Oracle Corporation. All rights reserved.