|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.mina.common.AbstractPollingIoProcessor<T>
public abstract class AbstractPollingIoProcessor<T extends AbstractIoSession>
An abstract implementation of IoProcessor
which helps
transport developers to write an IoProcessor
easily.
Nested Class Summary | |
---|---|
protected static class |
AbstractPollingIoProcessor.SessionState
|
Constructor Summary | |
---|---|
protected |
AbstractPollingIoProcessor(Executor executor)
|
Method Summary | |
---|---|
void |
add(T session)
Adds the specified session to the I/O processor so that
the I/O processor starts to perform any I/O operations related
with the session . |
protected abstract Iterator<T> |
allSessions()
|
protected abstract void |
destroy(T session)
|
void |
dispose()
Releases any resources allocated by this processor. |
protected abstract void |
dispose0()
|
void |
flush(T session)
Flushes the internal write request queue of the specified session . |
protected abstract void |
init(T session)
|
boolean |
isDisposed()
Returns true if and if only all resources of this processor have been disposed. |
boolean |
isDisposing()
Returns true if and if only IoProcessor.dispose() method has
been called. |
protected abstract boolean |
isInterestedInRead(T session)
is this session registered for reading |
protected abstract boolean |
isInterestedInWrite(T session)
is this session registered for writing |
protected abstract boolean |
isReadable(T session)
Is the session ready for reading |
protected abstract boolean |
isWritable(T session)
Is the session ready for writing |
protected abstract int |
read(T session,
IoBuffer buf)
|
void |
remove(T session)
Removes and closes the specified session from the I/O
processor so that the I/O processor closes the connection
associated with the session and releases any other related
resources. |
protected abstract boolean |
select(int timeout)
poll those sessions for the given timeout |
protected abstract Iterator<T> |
selectedSessions()
|
protected abstract void |
setInterestedInRead(T session,
boolean interested)
register a session for reading |
protected abstract void |
setInterestedInWrite(T session,
boolean interested)
register a session for writing |
protected abstract AbstractPollingIoProcessor.SessionState |
state(T session)
|
protected abstract int |
transferFile(T session,
FileRegion region,
int length)
|
void |
updateTrafficMask(T session)
Controls the traffic of the specified session as specified
in IoSession.getTrafficMask() . |
protected abstract void |
wakeup()
|
protected abstract int |
write(T session,
IoBuffer buf,
int length)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected AbstractPollingIoProcessor(Executor executor)
Method Detail |
---|
public final boolean isDisposing()
IoProcessor
IoProcessor.dispose()
method has
been called. Please note that this method will return true
even after all the related resources are released.
isDisposing
in interface IoProcessor<T extends AbstractIoSession>
public final boolean isDisposed()
IoProcessor
isDisposed
in interface IoProcessor<T extends AbstractIoSession>
public final void dispose()
IoProcessor
dispose
in interface IoProcessor<T extends AbstractIoSession>
protected abstract void dispose0() throws Exception
Exception
protected abstract boolean select(int timeout) throws Exception
timeout
- milliseconds before the call timeout if no event appear
Exception
- if some low level IO error occursprotected abstract void wakeup()
protected abstract Iterator<T> allSessions()
protected abstract Iterator<T> selectedSessions()
protected abstract AbstractPollingIoProcessor.SessionState state(T session)
protected abstract boolean isWritable(T session)
session
- the session queried
protected abstract boolean isReadable(T session)
session
- the session queried
protected abstract void setInterestedInWrite(T session, boolean interested) throws Exception
session
- the session registeredinterested
- true for registering, false for removing
Exception
protected abstract void setInterestedInRead(T session, boolean interested) throws Exception
session
- the session registeredinterested
- true for registering, false for removing
Exception
protected abstract boolean isInterestedInRead(T session)
session
- the session queried
protected abstract boolean isInterestedInWrite(T session)
session
- the session queried
protected abstract void init(T session) throws Exception
Exception
protected abstract void destroy(T session) throws Exception
Exception
protected abstract int read(T session, IoBuffer buf) throws Exception
Exception
protected abstract int write(T session, IoBuffer buf, int length) throws Exception
Exception
protected abstract int transferFile(T session, FileRegion region, int length) throws Exception
Exception
public final void add(T session)
IoProcessor
session
to the I/O processor so that
the I/O processor starts to perform any I/O operations related
with the session
.
add
in interface IoProcessor<T extends AbstractIoSession>
public final void remove(T session)
IoProcessor
session
from the I/O
processor so that the I/O processor closes the connection
associated with the session
and releases any other related
resources.
remove
in interface IoProcessor<T extends AbstractIoSession>
public final void flush(T session)
IoProcessor
session
.
flush
in interface IoProcessor<T extends AbstractIoSession>
public final void updateTrafficMask(T session)
IoProcessor
session
as specified
in IoSession.getTrafficMask()
.
updateTrafficMask
in interface IoProcessor<T extends AbstractIoSession>
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |