public abstract class AbstractIoConnector extends AbstractIoService implements IoConnector
IoConnector
.AbstractIoService.ServiceOperationFuture
disposalLock
Modifier | Constructor and Description |
---|---|
protected |
AbstractIoConnector(IoSessionConfig sessionConfig,
java.util.concurrent.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(java.net.SocketAddress remoteAddress)
Connects to the specified remote address.
|
ConnectFuture |
connect(java.net.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(java.net.SocketAddress remoteAddress,
java.net.SocketAddress localAddress)
Connects to the specified remote address binding to the specified local address.
|
ConnectFuture |
connect(java.net.SocketAddress remoteAddress,
java.net.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(java.net.SocketAddress remoteAddress,
java.net.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()
Returns the minimum connection timeout value for this connector
|
long |
getConnectTimeoutMillis()
Returns the connect timeout in milliseconds.
|
java.net.SocketAddress |
getDefaultRemoteAddress()
Returns the default remote address to connect to when no argument
is specified in
IoConnector.connect() method. |
void |
setConnectTimeout(int connectTimeout)
Deprecated.
Take a look at setConnectTimeoutMillis(long)
|
void |
setConnectTimeoutCheckInterval(long minimumConnectTimeout) |
void |
setConnectTimeoutMillis(long connectTimeoutInMillis)
Sets the connect timeout value in milliseconds.
|
void |
setDefaultRemoteAddress(java.net.SocketAddress defaultRemoteAddress)
Sets the default remote address to connect to when no argument is
specified in
IoConnector.connect() method. |
java.lang.String |
toString() |
addListener, broadcast, dispose, dispose, dispose0, executeWorker, executeWorker, getActivationTime, getFilterChain, getFilterChainBuilder, getHandler, getListeners, getManagedSessionCount, getManagedSessions, getScheduledWriteBytes, getScheduledWriteMessages, getSessionConfig, 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, java.util.concurrent.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()
.
AbstractIoService.AbstractIoService(IoSessionConfig, Executor)
sessionConfig
- the default configuration for the managed IoSession
executor
- the Executor
used for handling execution of I/O
events. Can be null
.public long getConnectTimeoutCheckInterval()
public void setConnectTimeoutCheckInterval(long minimumConnectTimeout)
public final int getConnectTimeout()
IoConnector
getConnectTimeout
in interface IoConnector
IoConnector.getConnectTimeoutMillis()
public final long getConnectTimeoutMillis()
getConnectTimeoutMillis
in interface IoConnector
public final void setConnectTimeout(int connectTimeout)
IoConnector
setConnectTimeout
in interface IoConnector
setConnectTimeoutMillis()
public final void setConnectTimeoutMillis(long connectTimeoutInMillis)
setConnectTimeoutMillis
in interface IoConnector
public java.net.SocketAddress getDefaultRemoteAddress()
IoConnector.connect()
method.getDefaultRemoteAddress
in interface IoConnector
public final void setDefaultRemoteAddress(java.net.SocketAddress defaultRemoteAddress)
IoConnector.connect()
method.setDefaultRemoteAddress
in interface IoConnector
public final ConnectFuture connect()
default remote address
.connect
in interface IoConnector
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 createdpublic final ConnectFuture connect(java.net.SocketAddress remoteAddress)
connect
in interface IoConnector
ConnectFuture
instance which is completed when the
connection attempt initiated by this call succeeds or fails.public ConnectFuture connect(java.net.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(java.net.SocketAddress remoteAddress, java.net.SocketAddress localAddress)
connect
in interface IoConnector
ConnectFuture
instance which is completed when the
connection attempt initiated by this call succeeds or fails.public final ConnectFuture connect(java.net.SocketAddress remoteAddress, java.net.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(java.net.SocketAddress remoteAddress, java.net.SocketAddress localAddress, IoSessionInitializer<? extends ConnectFuture> sessionInitializer)
localAddress
- null if no local address is specifiedprotected 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;
#finishSessionInitialization(IoSession, IoFuture, IoSessionInitializer)
will call this method instead.finishSessionInitialization0
in class AbstractIoService
public java.lang.String toString()
toString
in class java.lang.Object
Copyright © 2004-2019 Apache MINA Project. All Rights Reserved.