org.apache.mina.transport.socket.nio
Class SocketConnector

java.lang.Object
  extended by org.apache.mina.common.support.BaseIoService
      extended by org.apache.mina.common.support.BaseIoConnector
          extended by org.apache.mina.transport.socket.nio.SocketConnector
All Implemented Interfaces:
IoConnector, IoService

public class SocketConnector
extends org.apache.mina.common.support.BaseIoConnector

IoConnector for socket transport (TCP/IP).

Version:
$Rev: 389042 $, $Date: 2006-03-27 07:49:41Z $
Author:
The Apache Directory Project (mina-dev@directory.apache.org)

Constructor Summary
SocketConnector()
          Create a connector with a single processing thread
SocketConnector(int processorCount)
          Create a connector with the desired number of processing threads
 
Method Summary
 ConnectFuture connect(SocketAddress address, IoHandler handler, IoServiceConfig config)
          Connects to the specified address.
 ConnectFuture connect(SocketAddress address, SocketAddress localAddress, IoHandler handler, IoServiceConfig config)
          Connects to the specified address.
 IoServiceConfig getDefaultConfig()
          Returns the default configuration which is used when you didn't specify any configuration.
 long getWorkerTimeout()
          How many milliseconds to keep the connection thread alive between connection requests
 void setWorkerTimeout(long workerTimeout)
          Set how many milliseconds the connection worker thread should remain alive once idle before terminating itself.
 
Methods inherited from class org.apache.mina.common.support.BaseIoConnector
connect, connect
 
Methods inherited from class org.apache.mina.common.support.BaseIoService
getFilterChain, getFilterChainBuilder, getManagedSessions, setFilterChainBuilder
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.mina.common.IoService
getFilterChain, getFilterChainBuilder, getManagedSessions, setFilterChainBuilder
 

Constructor Detail

SocketConnector

public SocketConnector()
Create a connector with a single processing thread


SocketConnector

public SocketConnector(int processorCount)
Create a connector with the desired number of processing threads

Parameters:
processorCount - Number of processing threads
Method Detail

getWorkerTimeout

public long getWorkerTimeout()
How many milliseconds to keep the connection thread alive between connection requests

Returns:
Number of milliseconds to keep connection thread alive

setWorkerTimeout

public void setWorkerTimeout(long workerTimeout)
Set how many milliseconds the connection worker thread should remain alive once idle before terminating itself.

Parameters:
workerTimeout - Number of milliseconds to keep thread alive. Must be >=0

connect

public ConnectFuture connect(SocketAddress address,
                             IoHandler handler,
                             IoServiceConfig config)
Description copied from interface: IoConnector
Connects to the specified address. If communication starts successfully, events are fired to the specified handler.

config - the configuration
Returns:
ConnectFuture that will tell the result of the connection attempt

connect

public ConnectFuture connect(SocketAddress address,
                             SocketAddress localAddress,
                             IoHandler handler,
                             IoServiceConfig config)
Description copied from interface: IoConnector
Connects to the specified address. If communication starts successfully, events are fired to the specified handler.

config - the configuration
Returns:
ConnectFuture that will tell the result of the connection attempt

getDefaultConfig

public IoServiceConfig getDefaultConfig()
Description copied from interface: IoService
Returns the default configuration which is used when you didn't specify any configuration.