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

java.lang.Object
  extended by org.apache.mina.common.AbstractIoService
      extended by org.apache.mina.common.AbstractIoConnector
          extended by org.apache.mina.common.AbstractPollingIoConnector<org.apache.mina.transport.socket.nio.NioSession,SocketChannel>
              extended by org.apache.mina.transport.socket.nio.NioSocketConnector
All Implemented Interfaces:
IoConnector, IoService, SocketConnector, SocketService

public final class NioSocketConnector
extends AbstractPollingIoConnector<org.apache.mina.transport.socket.nio.NioSession,SocketChannel>
implements SocketConnector

IoConnector for socket transport (TCP/IP).

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

Nested Class Summary
 
Nested classes/interfaces inherited from class org.apache.mina.common.AbstractPollingIoConnector
AbstractPollingIoConnector.ConnectionRequest
 
Nested classes/interfaces inherited from class org.apache.mina.common.AbstractIoService
AbstractIoService.ServiceOperationFuture
 
Constructor Summary
NioSocketConnector()
           
NioSocketConnector(Executor executor, IoProcessor<org.apache.mina.transport.socket.nio.NioSession> processor)
           
NioSocketConnector(int processorCount)
           
NioSocketConnector(IoProcessor<org.apache.mina.transport.socket.nio.NioSession> processor)
           
 
Method Summary
protected  Iterator<SocketChannel> allHandles()
           
protected  void close(SocketChannel handle)
           
protected  boolean connect(SocketChannel handle, SocketAddress remoteAddress)
           
protected  AbstractPollingIoConnector.ConnectionRequest connectionRequest(SocketChannel handle)
           
protected  void destroy()
           
protected  boolean finishConnect(SocketChannel handle)
           
 InetSocketAddress getDefaultRemoteAddress()
          Returns the default remote address to connect to when no argument is specified in IoConnector.connect() method.
 SocketSessionConfig getSessionConfig()
          Returns the default configuration of the new IoSessions created by this service.
 TransportMetadata getTransportMetadata()
          Returns the TransportMetadata that this service runs on.
protected  void init()
           
protected  SocketChannel newHandle(SocketAddress localAddress)
           
protected  org.apache.mina.transport.socket.nio.NioSession newSession(IoProcessor<org.apache.mina.transport.socket.nio.NioSession> processor, SocketChannel handle)
           
protected  void register(SocketChannel handle, AbstractPollingIoConnector.ConnectionRequest request)
           
protected  boolean select(int timeout)
           
protected  Iterator<SocketChannel> selectedHandles()
           
 void setDefaultRemoteAddress(InetSocketAddress defaultRemoteAddress)
           
protected  void wakeup()
           
 
Methods inherited from class org.apache.mina.common.AbstractPollingIoConnector
connect0, dispose0
 
Methods inherited from class org.apache.mina.common.AbstractIoConnector
connect, connect, connect, connect, connect, connect, finishSessionInitialization0, getConnectTimeout, getConnectTimeoutMillis, setConnectTimeout, setDefaultRemoteAddress, toString
 
Methods inherited from class org.apache.mina.common.AbstractIoService
addListener, broadcast, decreaseScheduledWriteMessages, dispose, finishSessionInitialization, getActivationTime, getBothIdleCount, getBothIdleTime, getBothIdleTimeInMillis, getCumulativeManagedSessionCount, getFilterChain, getFilterChainBuilder, getHandler, getIdleCount, getIdleTime, getIdleTimeInMillis, getLargestManagedSessionCount, getLargestReadBytesThroughput, getLargestReadMessagesThroughput, getLargestWrittenBytesThroughput, getLargestWrittenMessagesThroughput, getLastBothIdleTime, getLastIdleTime, getLastIoTime, getLastReaderIdleTime, getLastReadTime, getLastWriterIdleTime, getLastWriteTime, getListeners, getManagedSessionCount, getManagedSessions, getReadBytes, getReadBytesThroughput, getReaderIdleCount, getReaderIdleTime, getReaderIdleTimeInMillis, getReadMessages, getReadMessagesThroughput, getScheduledWriteBytes, getScheduledWriteMessages, getSessionDataStructureFactory, getThroughputCalculationInterval, getThroughputCalculationIntervalInMillis, getWriterIdleCount, getWriterIdleTime, getWriterIdleTimeInMillis, getWrittenBytes, getWrittenBytesThroughput, getWrittenMessages, getWrittenMessagesThroughput, increaseReadBytes, increaseReadMessages, increaseScheduledWriteBytes, increaseScheduledWriteMessages, increaseWrittenBytes, increaseWrittenMessages, isActive, isBothIdle, isDisposed, isDisposing, isIdle, isReaderIdle, isWriterIdle, notifyIdleness, removeListener, setBothIdleTime, setFilterChainBuilder, setHandler, setIdleTime, setLastReadTime, setLastWriteTime, setReaderIdleTime, setSessionDataStructureFactory, setThroughputCalculationInterval, setWriterIdleTime
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.apache.mina.common.IoService
addListener, broadcast, dispose, getActivationTime, getBothIdleCount, getBothIdleTime, getBothIdleTimeInMillis, getCumulativeManagedSessionCount, getFilterChain, getFilterChainBuilder, getHandler, getIdleCount, getIdleTime, getIdleTimeInMillis, getLargestManagedSessionCount, getLargestReadBytesThroughput, getLargestReadMessagesThroughput, getLargestWrittenBytesThroughput, getLargestWrittenMessagesThroughput, getLastBothIdleTime, getLastIdleTime, getLastIoTime, getLastReaderIdleTime, getLastReadTime, getLastWriterIdleTime, getLastWriteTime, getManagedSessionCount, getManagedSessions, getReadBytes, getReadBytesThroughput, getReaderIdleCount, getReaderIdleTime, getReaderIdleTimeInMillis, getReadMessages, getReadMessagesThroughput, getScheduledWriteBytes, getScheduledWriteMessages, getSessionDataStructureFactory, getThroughputCalculationInterval, getThroughputCalculationIntervalInMillis, getWriterIdleCount, getWriterIdleTime, getWriterIdleTimeInMillis, getWrittenBytes, getWrittenBytesThroughput, getWrittenMessages, getWrittenMessagesThroughput, isActive, isBothIdle, isDisposed, isDisposing, isIdle, isReaderIdle, isWriterIdle, removeListener, setBothIdleTime, setFilterChainBuilder, setHandler, setIdleTime, setReaderIdleTime, setSessionDataStructureFactory, setThroughputCalculationInterval, setWriterIdleTime
 
Methods inherited from interface org.apache.mina.common.IoConnector
connect, connect, connect, connect, connect, connect, getConnectTimeout, getConnectTimeoutMillis, setConnectTimeout, setDefaultRemoteAddress
 
Methods inherited from interface org.apache.mina.common.IoService
addListener, broadcast, dispose, getActivationTime, getBothIdleCount, getBothIdleTime, getBothIdleTimeInMillis, getCumulativeManagedSessionCount, getFilterChain, getFilterChainBuilder, getHandler, getIdleCount, getIdleTime, getIdleTimeInMillis, getLargestManagedSessionCount, getLargestReadBytesThroughput, getLargestReadMessagesThroughput, getLargestWrittenBytesThroughput, getLargestWrittenMessagesThroughput, getLastBothIdleTime, getLastIdleTime, getLastIoTime, getLastReaderIdleTime, getLastReadTime, getLastWriterIdleTime, getLastWriteTime, getManagedSessionCount, getManagedSessions, getReadBytes, getReadBytesThroughput, getReaderIdleCount, getReaderIdleTime, getReaderIdleTimeInMillis, getReadMessages, getReadMessagesThroughput, getScheduledWriteBytes, getScheduledWriteMessages, getSessionDataStructureFactory, getThroughputCalculationInterval, getThroughputCalculationIntervalInMillis, getWriterIdleCount, getWriterIdleTime, getWriterIdleTimeInMillis, getWrittenBytes, getWrittenBytesThroughput, getWrittenMessages, getWrittenMessagesThroughput, isActive, isBothIdle, isDisposed, isDisposing, isIdle, isReaderIdle, isWriterIdle, removeListener, setBothIdleTime, setFilterChainBuilder, setHandler, setIdleTime, setReaderIdleTime, setSessionDataStructureFactory, setThroughputCalculationInterval, setWriterIdleTime
 

Constructor Detail

NioSocketConnector

public NioSocketConnector()

NioSocketConnector

public NioSocketConnector(int processorCount)

NioSocketConnector

public NioSocketConnector(IoProcessor<org.apache.mina.transport.socket.nio.NioSession> processor)

NioSocketConnector

public NioSocketConnector(Executor executor,
                          IoProcessor<org.apache.mina.transport.socket.nio.NioSession> processor)
Method Detail

init

protected void init()
             throws Exception
Specified by:
init in class AbstractPollingIoConnector<org.apache.mina.transport.socket.nio.NioSession,SocketChannel>
Throws:
Exception

destroy

protected void destroy()
                throws Exception
Specified by:
destroy in class AbstractPollingIoConnector<org.apache.mina.transport.socket.nio.NioSession,SocketChannel>
Throws:
Exception

getTransportMetadata

public TransportMetadata getTransportMetadata()
Description copied from interface: IoService
Returns the TransportMetadata that this service runs on.

Specified by:
getTransportMetadata in interface IoService

getSessionConfig

public SocketSessionConfig getSessionConfig()
Description copied from interface: IoService
Returns the default configuration of the new IoSessions created by this service.

Specified by:
getSessionConfig in interface IoService
Specified by:
getSessionConfig in interface SocketService
Overrides:
getSessionConfig in class AbstractIoService

getDefaultRemoteAddress

public InetSocketAddress getDefaultRemoteAddress()
Description copied from interface: IoConnector
Returns the default remote address to connect to when no argument is specified in IoConnector.connect() method.

Specified by:
getDefaultRemoteAddress in interface IoConnector
Specified by:
getDefaultRemoteAddress in interface SocketConnector
Overrides:
getDefaultRemoteAddress in class AbstractIoConnector

setDefaultRemoteAddress

public void setDefaultRemoteAddress(InetSocketAddress defaultRemoteAddress)
Specified by:
setDefaultRemoteAddress in interface SocketConnector

allHandles

protected Iterator<SocketChannel> allHandles()
Specified by:
allHandles in class AbstractPollingIoConnector<org.apache.mina.transport.socket.nio.NioSession,SocketChannel>

connect

protected boolean connect(SocketChannel handle,
                          SocketAddress remoteAddress)
                   throws Exception
Specified by:
connect in class AbstractPollingIoConnector<org.apache.mina.transport.socket.nio.NioSession,SocketChannel>
Throws:
Exception

connectionRequest

protected AbstractPollingIoConnector.ConnectionRequest connectionRequest(SocketChannel handle)
Specified by:
connectionRequest in class AbstractPollingIoConnector<org.apache.mina.transport.socket.nio.NioSession,SocketChannel>

close

protected void close(SocketChannel handle)
              throws Exception
Specified by:
close in class AbstractPollingIoConnector<org.apache.mina.transport.socket.nio.NioSession,SocketChannel>
Throws:
Exception

finishConnect

protected boolean finishConnect(SocketChannel handle)
                         throws Exception
Specified by:
finishConnect in class AbstractPollingIoConnector<org.apache.mina.transport.socket.nio.NioSession,SocketChannel>
Throws:
Exception

newHandle

protected SocketChannel newHandle(SocketAddress localAddress)
                           throws Exception
Specified by:
newHandle in class AbstractPollingIoConnector<org.apache.mina.transport.socket.nio.NioSession,SocketChannel>
Throws:
Exception

newSession

protected org.apache.mina.transport.socket.nio.NioSession newSession(IoProcessor<org.apache.mina.transport.socket.nio.NioSession> processor,
                                                                     SocketChannel handle)
Specified by:
newSession in class AbstractPollingIoConnector<org.apache.mina.transport.socket.nio.NioSession,SocketChannel>

register

protected void register(SocketChannel handle,
                        AbstractPollingIoConnector.ConnectionRequest request)
                 throws Exception
Specified by:
register in class AbstractPollingIoConnector<org.apache.mina.transport.socket.nio.NioSession,SocketChannel>
Throws:
Exception

select

protected boolean select(int timeout)
                  throws Exception
Specified by:
select in class AbstractPollingIoConnector<org.apache.mina.transport.socket.nio.NioSession,SocketChannel>
Throws:
Exception

selectedHandles

protected Iterator<SocketChannel> selectedHandles()
Specified by:
selectedHandles in class AbstractPollingIoConnector<org.apache.mina.transport.socket.nio.NioSession,SocketChannel>

wakeup

protected void wakeup()
Specified by:
wakeup in class AbstractPollingIoConnector<org.apache.mina.transport.socket.nio.NioSession,SocketChannel>


Copyright © 2004-2009 Apache MINA Project. All Rights Reserved.