public abstract class AbstractIoConnector extends AbstractIoService implements IoConnector
IoConnector
.AbstractIoService.ServiceOperationFuture
disposalLock, LOGGER, sessionConfig
Modifier | Constructor and Description |
---|---|
protected |
AbstractIoConnector(IoSessionConfig sessionConfig,
Executor executor)
Constructor for
AbstractIoConnector . |
Modifier and Type | Method and Description |
---|---|
ConnectFuture |
connect()
Connects to the
default
remote address . |
ConnectFuture |
connect(IoSessionInitializer<? extends ConnectFuture> sessionInitializer)
Connects to the
default
remote address and invokes the ioSessionInitializer when
the IoSession is created but before IoHandler.sessionCreated(IoSession)
is invoked. |
ConnectFuture |
connect(SocketAddress remoteAddress)
Connects to the specified remote address.
|
ConnectFuture |
connect(SocketAddress remoteAddress,
IoSessionInitializer<? extends ConnectFuture> sessionInitializer)
Connects to the specified remote address and invokes
the
ioSessionInitializer when the IoSession is created but before
IoHandler.sessionCreated(IoSession) is invoked. |
ConnectFuture |
connect(SocketAddress remoteAddress,
SocketAddress localAddress)
Connects to the specified remote address binding to the specified local address.
|
ConnectFuture |
connect(SocketAddress remoteAddress,
SocketAddress localAddress,
IoSessionInitializer<? extends ConnectFuture> sessionInitializer)
Connects to the specified remote address binding to the specified local
address and and invokes the
ioSessionInitializer when the
IoSession is created but before IoHandler.sessionCreated(IoSession)
is invoked. |
protected abstract ConnectFuture |
connect0(SocketAddress remoteAddress,
SocketAddress localAddress,
IoSessionInitializer<? extends ConnectFuture> sessionInitializer)
Implement this method to perform the actual connect operation.
|
protected void |
finishSessionInitialization0(IoSession session,
IoFuture future)
Adds required internal attributes and
IoFutureListener s
related with event notifications to the specified session
and future . |
int |
getConnectTimeout()
Deprecated.
Take a look at getConnectTimeoutMillis()
|
long |
getConnectTimeoutCheckInterval() |
long |
getConnectTimeoutMillis() |
SocketAddress |
getDefaultLocalAddress() |
SocketAddress |
getDefaultRemoteAddress() |
void |
setConnectTimeout(int connectTimeout)
Deprecated.
Take a look at setConnectTimeoutMillis(long)
|
void |
setConnectTimeoutCheckInterval(long minimumConnectTimeout)
Sets the timeout for the connection check
|
void |
setConnectTimeoutMillis(long connectTimeoutInMillis)
Sets the connect timeout value in milliseconds.
|
void |
setDefaultLocalAddress(SocketAddress localAddress)
Sets the default local address
|
void |
setDefaultRemoteAddress(SocketAddress defaultRemoteAddress)
Sets the default remote address to connect to when no argument is
specified in
IoConnector.connect() method. |
String |
toString() |
addListener, broadcast, dispose, dispose, dispose0, executeWorker, executeWorker, getActivationTime, getFilterChain, getFilterChainBuilder, getHandler, getListeners, getManagedSessionCount, getManagedSessions, getScheduledWriteBytes, getScheduledWriteMessages, getSessionDataStructureFactory, getStatistics, initSession, isActive, isDisposed, isDisposing, removeListener, setFilterChainBuilder, setHandler, setSessionDataStructureFactory
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
addListener, broadcast, dispose, dispose, getActivationTime, getFilterChain, getFilterChainBuilder, getHandler, getManagedSessionCount, getManagedSessions, getScheduledWriteBytes, getScheduledWriteMessages, getSessionConfig, getSessionDataStructureFactory, getStatistics, getTransportMetadata, isActive, isDisposed, isDisposing, removeListener, setFilterChainBuilder, setHandler, setSessionDataStructureFactory
protected AbstractIoConnector(IoSessionConfig sessionConfig, Executor executor)
AbstractIoConnector
. You need to provide a
default session configuration and an Executor
for handling I/O
events. If null Executor
is provided, a default one will be
created using Executors.newCachedThreadPool()
.sessionConfig
- the default configuration for the managed IoSession
executor
- the Executor
used for handling execution of I/O
events. Can be null
.AbstractIoService.AbstractIoService(IoSessionConfig, Executor)
public long getConnectTimeoutCheckInterval()
public void setConnectTimeoutCheckInterval(long minimumConnectTimeout)
minimumConnectTimeout
- The delay we wait before checking the connection@Deprecated public final int getConnectTimeout()
getConnectTimeout
in interface IoConnector
public final long getConnectTimeoutMillis()
getConnectTimeoutMillis
in interface IoConnector
@Deprecated public final void setConnectTimeout(int connectTimeout)
IoConnector
setConnectTimeout
in interface IoConnector
connectTimeout
- The time out for the connectionpublic final void setConnectTimeoutMillis(long connectTimeoutInMillis)
setConnectTimeoutMillis
in interface IoConnector
connectTimeoutInMillis
- The time out for the connectionpublic SocketAddress getDefaultRemoteAddress()
getDefaultRemoteAddress
in interface IoConnector
IoConnector.connect()
method.public final void setDefaultLocalAddress(SocketAddress localAddress)
setDefaultLocalAddress
in interface IoConnector
localAddress
- The default local addresspublic final SocketAddress getDefaultLocalAddress()
getDefaultLocalAddress
in interface IoConnector
public final void setDefaultRemoteAddress(SocketAddress defaultRemoteAddress)
IoConnector.connect()
method.setDefaultRemoteAddress
in interface IoConnector
defaultRemoteAddress
- The default remote addresspublic final ConnectFuture connect()
default
remote address
.connect
in interface IoConnector
ConnectFuture
instance which is completed when the
connection attempt initiated by this call succeeds or fails.public ConnectFuture connect(IoSessionInitializer<? extends ConnectFuture> sessionInitializer)
default
remote address
and invokes the ioSessionInitializer
when
the IoSession is created but before IoHandler.sessionCreated(IoSession)
is invoked. There is no guarantee that the ioSessionInitializer
will be invoked before this method returns.connect
in interface IoConnector
sessionInitializer
- the callback to invoke when the IoSession
object is createdConnectFuture
instance which is completed when the
connection attempt initiated by this call succeeds or fails.public final ConnectFuture connect(SocketAddress remoteAddress)
connect
in interface IoConnector
remoteAddress
- The remote address to connect toConnectFuture
instance which is completed when the
connection attempt initiated by this call succeeds or fails.public ConnectFuture connect(SocketAddress remoteAddress, IoSessionInitializer<? extends ConnectFuture> sessionInitializer)
ioSessionInitializer
when the IoSession is created but before
IoHandler.sessionCreated(IoSession)
is invoked. There is no
guarantee that the ioSessionInitializer
will be invoked before
this method returns.connect
in interface IoConnector
remoteAddress
- the remote address to connect tosessionInitializer
- the callback to invoke when the IoSession
object is createdConnectFuture
instance which is completed when the
connection attempt initiated by this call succeeds or fails.public ConnectFuture connect(SocketAddress remoteAddress, SocketAddress localAddress)
connect
in interface IoConnector
remoteAddress
- The remote address to connectlocalAddress
- The local address to bindConnectFuture
instance which is completed when the
connection attempt initiated by this call succeeds or fails.public final ConnectFuture connect(SocketAddress remoteAddress, SocketAddress localAddress, IoSessionInitializer<? extends ConnectFuture> sessionInitializer)
ioSessionInitializer
when the
IoSession is created but before IoHandler.sessionCreated(IoSession)
is invoked. There is no guarantee that the ioSessionInitializer
will be invoked before this method returns.connect
in interface IoConnector
remoteAddress
- the remote address to connect tolocalAddress
- the local interface to bind tosessionInitializer
- the callback to invoke when the IoSession
object is createdConnectFuture
instance which is completed when the
connection attempt initiated by this call succeeds or fails.protected abstract ConnectFuture connect0(SocketAddress remoteAddress, SocketAddress localAddress, IoSessionInitializer<? extends ConnectFuture> sessionInitializer)
remoteAddress
- The remote address to connect fromlocalAddress
- null if no local address is specifiedsessionInitializer
- The IoSessionInitializer to use when the connection s successfulprotected final void finishSessionInitialization0(IoSession session, IoFuture future)
IoFutureListener
s
related with event notifications to the specified session
and future
. Do not call this method directly;finishSessionInitialization0
in class AbstractIoService
session
- The session to initializefuture
- The Future to useCopyright © 2004–2021 Apache MINA Project. All rights reserved.