|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.mina.core.polling.AbstractPollingIoProcessor<AprSession>
org.apache.mina.transport.socket.apr.AprIoProcessor
public final class AprIoProcessor
The class in charge of processing socket level IO events for the AprSocketConnector
Constructor Summary | |
---|---|
AprIoProcessor(java.util.concurrent.Executor executor)
Create a new instance of AprIoProcessor with a given Exector for
handling I/Os events. |
Method Summary | |
---|---|
protected java.util.Iterator<AprSession> |
allSessions()
Get an Iterator for the list of IoSession polled by this
IoProcessor |
protected void |
destroy(AprSession session)
Destroy the underlying client socket handle |
protected void |
dispose0()
Dispose the resources used by this IoProcessor for polling
the client connections |
protected SessionState |
getState(AprSession session)
Get the state of a session (preparing, open, closed) |
protected void |
init(AprSession session)
Initialize the polling of a session. |
protected boolean |
isInterestedInRead(AprSession session)
is this session registered for reading |
protected boolean |
isInterestedInWrite(AprSession session)
is this session registered for writing |
protected boolean |
isReadable(AprSession session)
Is the session ready for reading |
protected boolean |
isSelectorEmpty()
Say if the list of IoSession polled by this IoProcessor
is empty |
protected boolean |
isWritable(AprSession session)
Is the session ready for writing |
protected int |
read(AprSession session,
IoBuffer buffer)
Reads a sequence of bytes from a IoSession into the given IoBuffer . |
protected int |
select()
poll those sessions forever |
protected int |
select(long timeout)
poll those sessions for the given timeout |
protected java.util.Iterator<AprSession> |
selectedSessions()
Get an Iterator for the list of IoSession found selected
by the last call of {@link AbstractPollingIoProcessor#select(int) |
protected void |
setInterestedInRead(AprSession session,
boolean isInterested)
register a session for reading |
protected void |
setInterestedInWrite(AprSession session,
boolean isInterested)
register a session for writing |
protected int |
transferFile(AprSession session,
FileRegion region,
int length)
Write a part of a file to a IoSession , if the underlying API isn't supporting
system calls like sendfile(), you can throw a UnsupportedOperationException so
the file will be send using usual AbstractPollingIoProcessor.write(AbstractIoSession, IoBuffer, int) call. |
protected void |
wakeup()
Interrupt the {@link AbstractPollingIoProcessor#select(int) call. |
protected int |
write(AprSession session,
IoBuffer buf,
int length)
Write a sequence of bytes to a IoSession , means to be called when a session
was found ready for writing. |
Methods inherited from class org.apache.mina.core.polling.AbstractPollingIoProcessor |
---|
add, dispose, flush, isDisposed, isDisposing, remove, updateTrafficControl, updateTrafficMask |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AprIoProcessor(java.util.concurrent.Executor executor)
AprIoProcessor
with a given Exector for
handling I/Os events.
executor
- the Executor
for handling I/O eventsMethod Detail |
---|
protected void dispose0()
IoProcessor
for polling
the client connections
dispose0
in class AbstractPollingIoProcessor<AprSession>
protected int select() throws java.lang.Exception
select
in class AbstractPollingIoProcessor<AprSession>
java.lang.Exception
- if some low level IO error occursprotected int select(long timeout) throws java.lang.Exception
select
in class AbstractPollingIoProcessor<AprSession>
timeout
- milliseconds before the call timeout if no event appear
java.lang.Exception
- if some low level IO error occursprotected boolean isSelectorEmpty()
IoSession
polled by this IoProcessor
is empty
isSelectorEmpty
in class AbstractPollingIoProcessor<AprSession>
IoProcessor
protected void wakeup()
wakeup
in class AbstractPollingIoProcessor<AprSession>
protected java.util.Iterator<AprSession> allSessions()
Iterator
for the list of IoSession
polled by this
IoProcessor
allSessions
in class AbstractPollingIoProcessor<AprSession>
Iterator
of IoSession
protected java.util.Iterator<AprSession> selectedSessions()
Iterator
for the list of IoSession
found selected
by the last call of {@link AbstractPollingIoProcessor#select(int)
selectedSessions
in class AbstractPollingIoProcessor<AprSession>
Iterator
of IoSession
read for I/Os operationprotected void init(AprSession session) throws java.lang.Exception
AbstractPollingIoProcessor
init
in class AbstractPollingIoProcessor<AprSession>
session
- the IoSession
to add to the polling
java.lang.Exception
- any exception thrown by the underlying system callsprotected void destroy(AprSession session) throws java.lang.Exception
destroy
in class AbstractPollingIoProcessor<AprSession>
session
- the IoSession
java.lang.Exception
- any exception thrown by the underlying system callsprotected SessionState getState(AprSession session)
getState
in class AbstractPollingIoProcessor<AprSession>
session
- the IoSession
to inspect
protected boolean isReadable(AprSession session)
isReadable
in class AbstractPollingIoProcessor<AprSession>
session
- the session queried
protected boolean isWritable(AprSession session)
isWritable
in class AbstractPollingIoProcessor<AprSession>
session
- the session queried
protected boolean isInterestedInRead(AprSession session)
isInterestedInRead
in class AbstractPollingIoProcessor<AprSession>
session
- the session queried
protected boolean isInterestedInWrite(AprSession session)
isInterestedInWrite
in class AbstractPollingIoProcessor<AprSession>
session
- the session queried
protected void setInterestedInRead(AprSession session, boolean isInterested) throws java.lang.Exception
setInterestedInRead
in class AbstractPollingIoProcessor<AprSession>
session
- the session registeredisInterested
- true for registering, false for removing
java.lang.Exception
protected void setInterestedInWrite(AprSession session, boolean isInterested) throws java.lang.Exception
setInterestedInWrite
in class AbstractPollingIoProcessor<AprSession>
session
- the session registeredisInterested
- true for registering, false for removing
java.lang.Exception
protected int read(AprSession session, IoBuffer buffer) throws java.lang.Exception
IoSession
into the given IoBuffer
.
Is called when the session was found ready for reading.
read
in class AbstractPollingIoProcessor<AprSession>
session
- the session to readbuffer
- the buffer to fill
java.lang.Exception
- any exception thrown by the underlying system callsprotected int write(AprSession session, IoBuffer buf, int length) throws java.lang.Exception
IoSession
, means to be called when a session
was found ready for writing.
write
in class AbstractPollingIoProcessor<AprSession>
session
- the session to writebuf
- the buffer to writelength
- the number of bytes to write can be superior to the number of bytes remaining
in the buffer
java.lang.Exception
- any exception thrown by the underlying system callsprotected int transferFile(AprSession session, FileRegion region, int length) throws java.lang.Exception
IoSession
, if the underlying API isn't supporting
system calls like sendfile(), you can throw a UnsupportedOperationException
so
the file will be send using usual AbstractPollingIoProcessor.write(AbstractIoSession, IoBuffer, int)
call.
transferFile
in class AbstractPollingIoProcessor<AprSession>
session
- the session to writeregion
- the file region to writelength
- the length of the portion to send
java.lang.Exception
- any exception thrown by the underlying system calls
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |