|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.mina.core.service.AbstractIoService
org.apache.mina.core.service.AbstractIoConnector
org.apache.mina.core.polling.AbstractPollingIoConnector<AprSession,Long>
org.apache.mina.transport.socket.apr.AprSocketConnector
public final class AprSocketConnector
IoConnector
for ABR based socket transport (TCP/IP).
Nested Class Summary |
---|
Nested classes/interfaces inherited from class org.apache.mina.core.polling.AbstractPollingIoConnector |
---|
AbstractPollingIoConnector.ConnectionRequest |
Nested classes/interfaces inherited from class org.apache.mina.core.service.AbstractIoService |
---|
AbstractIoService.ServiceOperationFuture |
Field Summary |
---|
Fields inherited from class org.apache.mina.core.service.AbstractIoService |
---|
disposalLock |
Constructor Summary | |
---|---|
AprSocketConnector()
TODO : document superclass |
|
AprSocketConnector(Executor executor,
IoProcessor<AprSession> processor)
TODO : document superclass |
|
AprSocketConnector(int processorCount)
TODO : document superclass |
|
AprSocketConnector(IoProcessor<AprSession> processor)
TODO : document superclass |
Method Summary | |
---|---|
protected Iterator<Long> |
allHandles()
Iterator for all the client sockets polled for connection. |
protected void |
close(Long handle)
Close a client socket. |
protected boolean |
connect(Long handle,
SocketAddress remoteAddress)
Connect a newly created client socket handle to a remote SocketAddress . |
protected AbstractPollingIoConnector.ConnectionRequest |
connectionRequest(Long handle)
get the AbstractPollingIoConnector.ConnectionRequest for a given client socket handle |
protected void |
destroy()
Destroy the polling system, will be called when this IoConnector
implementation will be disposed. |
protected boolean |
finishConnect(Long handle)
Finish the connection process of a client socket after it was marked as ready to process by the AbstractPollingIoConnector.select(int) call. |
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 IoSession s
created by this service. |
TransportMetadata |
getTransportMetadata()
Returns the TransportMetadata that this service runs on. |
protected void |
init()
Initialize the polling system, will be called at construction time. |
protected Long |
newHandle(SocketAddress localAddress)
Create a new client socket handle from a local SocketAddress |
protected AprSession |
newSession(IoProcessor<AprSession> processor,
Long handle)
Create a new IoSession from a connected socket client handle. |
protected void |
register(Long handle,
AbstractPollingIoConnector.ConnectionRequest request)
Register a new client socket for connection, add it to connection polling |
protected boolean |
select(int timeout)
Check for connected sockets, interrupt when at least a connection is processed (connected or failed to connect). |
protected Iterator<Long> |
selectedHandles()
Iterator for the set of client sockets found connected or
failed to connect during the last #select() call. |
void |
setDefaultRemoteAddress(InetSocketAddress defaultRemoteAddress)
TODO : add documentation |
protected void |
wakeup()
Interrupt the #select() method. |
Methods inherited from class org.apache.mina.core.polling.AbstractPollingIoConnector |
---|
connect0, dispose0 |
Methods inherited from class org.apache.mina.core.service.AbstractIoConnector |
---|
connect, connect, connect, connect, connect, connect, finishSessionInitialization0, getConnectTimeout, getConnectTimeoutCheckInterval, getConnectTimeoutMillis, setConnectTimeout, setConnectTimeoutCheckInterval, setConnectTimeoutMillis, setDefaultRemoteAddress, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.apache.mina.core.service.IoConnector |
---|
connect, connect, connect, connect, connect, connect, getConnectTimeout, getConnectTimeoutMillis, setConnectTimeout, setConnectTimeoutMillis, setDefaultRemoteAddress |
Methods inherited from interface org.apache.mina.core.service.IoService |
---|
addListener, broadcast, dispose, getActivationTime, getFilterChain, getFilterChainBuilder, getHandler, getIdleState, getManagedSessionCount, getManagedSessions, getScheduledWriteBytes, getScheduledWriteMessages, getSessionDataStructureFactory, getStatistics, isActive, isDisposed, isDisposing, removeListener, setFilterChainBuilder, setHandler, setSessionDataStructureFactory |
Constructor Detail |
---|
public AprSocketConnector()
public AprSocketConnector(int processorCount)
public AprSocketConnector(IoProcessor<AprSession> processor)
public AprSocketConnector(Executor executor, IoProcessor<AprSession> processor)
Method Detail |
---|
protected void init() throws Exception
init
in class AbstractPollingIoConnector<AprSession,Long>
Exception
- any exception thrown by the underlying system callsprotected void destroy() throws Exception
IoConnector
implementation will be disposed.
destroy
in class AbstractPollingIoConnector<AprSession,Long>
Exception
- any exception thrown by the underlying systems callsprotected Iterator<Long> allHandles()
Iterator
for all the client sockets polled for connection.
allHandles
in class AbstractPollingIoConnector<AprSession,Long>
protected boolean connect(Long handle, SocketAddress remoteAddress) throws Exception
SocketAddress
.
This operation is non-blocking, so at end of the call the socket can be still in connection
process.
connect
in class AbstractPollingIoConnector<AprSession,Long>
handle
- the client socket handleremoteAddress
- the remote address where to connect
Exception
protected AbstractPollingIoConnector.ConnectionRequest connectionRequest(Long handle)
AbstractPollingIoConnector.ConnectionRequest
for a given client socket handle
connectionRequest
in class AbstractPollingIoConnector<AprSession,Long>
handle
- the socket client handle
null
protected void close(Long handle) throws Exception
close
in class AbstractPollingIoConnector<AprSession,Long>
handle
- the client socket
Exception
- any exception thrown by the underlying systems callsprotected boolean finishConnect(Long handle) throws Exception
AbstractPollingIoConnector.select(int)
call. The socket will be connected or reported as connection
failed.
finishConnect
in class AbstractPollingIoConnector<AprSession,Long>
handle
- the client socket handle to finsh to connect
Exception
- any exception thrown by the underlying systems callsprotected Long newHandle(SocketAddress localAddress) throws Exception
SocketAddress
newHandle
in class AbstractPollingIoConnector<AprSession,Long>
localAddress
- the socket address for binding the new client socket
Exception
- any exception thrown by the underlying systems callsprotected AprSession newSession(IoProcessor<AprSession> processor, Long handle) throws Exception
IoSession
from a connected socket client handle.
Will assign the created IoSession
to the given IoProcessor
for
managing future I/O events.
newSession
in class AbstractPollingIoConnector<AprSession,Long>
processor
- the processor in charge of this sessionhandle
- the newly connected client socket handle
IoSession
Exception
- any exception thrown by the underlying systems callsprotected void register(Long handle, AbstractPollingIoConnector.ConnectionRequest request) throws Exception
register
in class AbstractPollingIoConnector<AprSession,Long>
handle
- client socket handlerequest
- the associated AbstractPollingIoConnector.ConnectionRequest
Exception
- any exception thrown by the underlying systems callsprotected boolean select(int timeout) throws Exception
AbstractPollingIoConnector.selectedHandles()
select
in class AbstractPollingIoConnector<AprSession,Long>
Exception
- any exception thrown by the underlying systems callsprotected Iterator<Long> selectedHandles()
Iterator
for the set of client sockets found connected or
failed to connect during the last #select()
call.
selectedHandles
in class AbstractPollingIoConnector<AprSession,Long>
protected void wakeup()
#select()
method. Used when the poll set need to be modified.
wakeup
in class AbstractPollingIoConnector<AprSession,Long>
public TransportMetadata getTransportMetadata()
TransportMetadata
that this service runs on.
getTransportMetadata
in interface IoService
public SocketSessionConfig getSessionConfig()
IoSession
s
created by this service.
getSessionConfig
in interface IoService
getSessionConfig
in interface SocketConnector
getSessionConfig
in class AbstractIoService
public InetSocketAddress getDefaultRemoteAddress()
IoConnector.connect()
method.
getDefaultRemoteAddress
in interface IoConnector
getDefaultRemoteAddress
in interface SocketConnector
getDefaultRemoteAddress
in class AbstractIoConnector
public void setDefaultRemoteAddress(InetSocketAddress defaultRemoteAddress)
setDefaultRemoteAddress
in interface SocketConnector
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |