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

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
              extended by org.apache.mina.transport.socket.nio.MultiThreadSocketConnector
All Implemented Interfaces:
org.apache.mina.common.IoConnector, org.apache.mina.common.IoService

public class MultiThreadSocketConnector
extends org.apache.mina.transport.socket.nio.SocketConnector

IoConnector for socket transport (TCP/IP).

Version:
$Rev: 619823 $, $Date: 2008-02-08 10:09:37 +0000 (Fri, 08 Feb 2008) $

Constructor Summary
MultiThreadSocketConnector()
          Create a connector with a single processing thread using a NewThreadExecutor
MultiThreadSocketConnector(int processorCount, edu.emory.mathcs.backport.java.util.concurrent.Executor executor)
          Create a connector with the desired number of processing threads
 
Method Summary
 org.apache.mina.common.ConnectFuture connect(SocketAddress address, org.apache.mina.common.IoHandler handler, org.apache.mina.common.IoServiceConfig config)
           
 org.apache.mina.common.ConnectFuture connect(SocketAddress address, SocketAddress localAddress, org.apache.mina.common.IoHandler handler, org.apache.mina.common.IoServiceConfig config)
           
 int getWorkerTimeout()
          How many seconds to keep the connection thread alive between connection requests
 void setWorkerTimeout(int workerTimeout)
          Set how many seconds the connection worker thread should remain alive once idle before terminating itself.
 
Methods inherited from class org.apache.mina.transport.socket.nio.SocketConnector
, getDefaultConfig, setDefaultConfig
 
Methods inherited from class org.apache.mina.common.support.BaseIoConnector
connect, connect
 
Methods inherited from class org.apache.mina.common.support.BaseIoService
addListener, getFilterChain, getFilterChainBuilder, getListeners, getManagedServiceAddresses, getManagedSessions, isManaged, removeListener, 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
addListener, getFilterChain, getFilterChainBuilder, getManagedServiceAddresses, getManagedSessions, isManaged, removeListener, setFilterChainBuilder
 

Constructor Detail

MultiThreadSocketConnector

public MultiThreadSocketConnector()
Create a connector with a single processing thread using a NewThreadExecutor


MultiThreadSocketConnector

public MultiThreadSocketConnector(int processorCount,
                                  edu.emory.mathcs.backport.java.util.concurrent.Executor executor)
Create a connector with the desired number of processing threads

Parameters:
processorCount - Number of processing threads
executor - Executor to use for launching threads
Method Detail

getWorkerTimeout

public int getWorkerTimeout()
How many seconds to keep the connection thread alive between connection requests

Overrides:
getWorkerTimeout in class org.apache.mina.transport.socket.nio.SocketConnector
Returns:
Number of seconds to keep connection thread alive

setWorkerTimeout

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

Overrides:
setWorkerTimeout in class org.apache.mina.transport.socket.nio.SocketConnector
Parameters:
workerTimeout - Number of seconds to keep thread alive. Must be >=0

connect

public org.apache.mina.common.ConnectFuture connect(SocketAddress address,
                                                    org.apache.mina.common.IoHandler handler,
                                                    org.apache.mina.common.IoServiceConfig config)
Specified by:
connect in interface org.apache.mina.common.IoConnector
Overrides:
connect in class org.apache.mina.transport.socket.nio.SocketConnector

connect

public org.apache.mina.common.ConnectFuture connect(SocketAddress address,
                                                    SocketAddress localAddress,
                                                    org.apache.mina.common.IoHandler handler,
                                                    org.apache.mina.common.IoServiceConfig config)
Specified by:
connect in interface org.apache.mina.common.IoConnector
Overrides:
connect in class org.apache.mina.transport.socket.nio.SocketConnector


Licensed to the Apache Software Foundation