org.apache.mina.common
Class AbstractPollingIoAcceptor<T extends AbstractIoSession,H>

java.lang.Object
  extended by org.apache.mina.common.AbstractIoService
      extended by org.apache.mina.common.AbstractIoAcceptor
          extended by org.apache.mina.common.AbstractPollingIoAcceptor<T,H>
All Implemented Interfaces:
IoAcceptor, IoService
Direct Known Subclasses:
AprSocketAcceptor, NioSocketAcceptor

public abstract class AbstractPollingIoAcceptor<T extends AbstractIoSession,H>
extends AbstractIoAcceptor

Version:
$Rev: 605069 $, $Date: 2007-12-18 03:47:03 +0100 (Tue, 18 Dec 2007) $
Author:
The Apache MINA Project (dev@mina.apache.org)

Nested Class Summary
 
Nested classes/interfaces inherited from class org.apache.mina.common.AbstractIoAcceptor
AbstractIoAcceptor.AcceptorOperationFuture
 
Nested classes/interfaces inherited from class org.apache.mina.common.AbstractIoService
AbstractIoService.ServiceOperationFuture
 
Field Summary
 
Fields inherited from class org.apache.mina.common.AbstractIoAcceptor
bindLock
 
Constructor Summary
protected AbstractPollingIoAcceptor(IoSessionConfig sessionConfig, Class<? extends IoProcessor<T>> processorClass)
          Create an acceptor with a single processing thread using a NewThreadExecutor
protected AbstractPollingIoAcceptor(IoSessionConfig sessionConfig, Class<? extends IoProcessor<T>> processorClass, int processorCount)
           
protected AbstractPollingIoAcceptor(IoSessionConfig sessionConfig, Executor executor, IoProcessor<T> processor)
           
protected AbstractPollingIoAcceptor(IoSessionConfig sessionConfig, IoProcessor<T> processor)
           
 
Method Summary
protected abstract  T accept(IoProcessor<T> processor, H handle)
           
protected  Set<SocketAddress> bind0(List<? extends SocketAddress> localAddresses)
          Implement this method to perform the actual bind operation.
protected abstract  void close(H handle)
           
protected abstract  void destroy()
           
protected  IoFuture dispose0()
          Implement this method to release any acquired resources.
protected abstract  void init()
           
protected abstract  SocketAddress localAddress(H handle)
           
 IoSession newSession(SocketAddress remoteAddress, SocketAddress localAddress)
          (Optional) Returns an IoSession that is bound to the specified localAddress and the specified remoteAddress which reuses the local address that is already bound by this service.
protected abstract  H open(SocketAddress localAddress)
           
protected abstract  boolean select()
           
protected abstract  Iterator<H> selectedHandles()
           
protected  void unbind0(List<? extends SocketAddress> localAddresses)
          Implement this method to perform the actual unbind operation.
protected abstract  void wakeup()
           
 
Methods inherited from class org.apache.mina.common.AbstractIoAcceptor
bind, bind, bind, bind, getDefaultLocalAddress, getDefaultLocalAddresses, getLocalAddress, getLocalAddresses, isCloseOnDeactivation, setCloseOnDeactivation, setDefaultLocalAddress, setDefaultLocalAddresses, setDefaultLocalAddresses, setDefaultLocalAddresses, toString, unbind, unbind, unbind, unbind
 
Methods inherited from class org.apache.mina.common.AbstractIoService
addListener, broadcast, decreaseScheduledWriteMessages, dispose, finishSessionInitialization, finishSessionInitialization0, 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, getSessionConfig, 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, getSessionConfig, getSessionDataStructureFactory, getThroughputCalculationInterval, getThroughputCalculationIntervalInMillis, getTransportMetadata, 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

AbstractPollingIoAcceptor

protected AbstractPollingIoAcceptor(IoSessionConfig sessionConfig,
                                    Class<? extends IoProcessor<T>> processorClass)
Create an acceptor with a single processing thread using a NewThreadExecutor


AbstractPollingIoAcceptor

protected AbstractPollingIoAcceptor(IoSessionConfig sessionConfig,
                                    Class<? extends IoProcessor<T>> processorClass,
                                    int processorCount)

AbstractPollingIoAcceptor

protected AbstractPollingIoAcceptor(IoSessionConfig sessionConfig,
                                    IoProcessor<T> processor)

AbstractPollingIoAcceptor

protected AbstractPollingIoAcceptor(IoSessionConfig sessionConfig,
                                    Executor executor,
                                    IoProcessor<T> processor)
Method Detail

init

protected abstract void init()
                      throws Exception
Throws:
Exception

destroy

protected abstract void destroy()
                         throws Exception
Throws:
Exception

select

protected abstract boolean select()
                           throws Exception
Throws:
Exception

wakeup

protected abstract void wakeup()

selectedHandles

protected abstract Iterator<H> selectedHandles()

open

protected abstract H open(SocketAddress localAddress)
                   throws Exception
Throws:
Exception

localAddress

protected abstract SocketAddress localAddress(H handle)
                                       throws Exception
Throws:
Exception

accept

protected abstract T accept(IoProcessor<T> processor,
                            H handle)
                                               throws Exception
Throws:
Exception

close

protected abstract void close(H handle)
                       throws Exception
Throws:
Exception

dispose0

protected IoFuture dispose0()
                     throws Exception
Description copied from class: AbstractIoService
Implement this method to release any acquired resources. This method is invoked only once by AbstractIoService.dispose().

Specified by:
dispose0 in class AbstractIoService
Throws:
Exception

bind0

protected final Set<SocketAddress> bind0(List<? extends SocketAddress> localAddresses)
                                  throws Exception
Description copied from class: AbstractIoAcceptor
Implement this method to perform the actual bind operation.

Specified by:
bind0 in class AbstractIoAcceptor
Returns:
the Set of the local addresses which is bound actually
Throws:
Exception

unbind0

protected final void unbind0(List<? extends SocketAddress> localAddresses)
                      throws Exception
Description copied from class: AbstractIoAcceptor
Implement this method to perform the actual unbind operation.

Specified by:
unbind0 in class AbstractIoAcceptor
Throws:
Exception

newSession

public final IoSession newSession(SocketAddress remoteAddress,
                                  SocketAddress localAddress)
Description copied from interface: IoAcceptor
(Optional) Returns an IoSession that is bound to the specified localAddress and the specified remoteAddress which reuses the local address that is already bound by this service.

This operation is optional. Please throw UnsupportedOperationException if the transport type doesn't support this operation. This operation is usually implemented for connectionless transport types.



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