|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.mina.common.AbstractIoService
public abstract class AbstractIoService
Base implementation of IoServices.
| Nested Class Summary | |
|---|---|
protected static class |
AbstractIoService.ServiceOperationFuture
|
| Constructor Summary | |
|---|---|
protected |
AbstractIoService(IoSessionConfig sessionConfig)
|
| Method Summary | |
|---|---|
void |
addListener(IoServiceListener listener)
Adds an IoServiceListener that listens any events related with
this service. |
Set<WriteFuture> |
broadcast(Object message)
Writes the specified message to all the IoSessions
managed by this service. |
protected void |
decreaseScheduledWriteMessages()
|
void |
dispose()
Releases any resources allocated by this service. |
protected abstract IoFuture |
dispose0()
Implement this method to release any acquired resources. |
protected void |
finishSessionInitialization(IoSession session,
IoFuture future,
IoSessionInitializer sessionInitializer)
|
protected void |
finishSessionInitialization0(IoSession session,
IoFuture future)
Implement this method to perform additional tasks required for session initialization. |
long |
getActivationTime()
Returns the time when this service was activated. |
int |
getBothIdleCount()
Returns the number of the fired continuous serviceIdle events for IdleStatus.BOTH_IDLE. |
int |
getBothIdleTime()
Returns idle time for IdleStatus.BOTH_IDLE in seconds. |
long |
getBothIdleTimeInMillis()
Returns idle time for IdleStatus.BOTH_IDLE in milliseconds. |
long |
getCumulativeManagedSessionCount()
Returns the cumulative number of sessions which were managed (or are being managed) by this service, which means 'currently managed session count + closed session count'. |
DefaultIoFilterChainBuilder |
getFilterChain()
A shortcut for ( ( DefaultIoFilterChainBuilder ) IoService.getFilterChainBuilder() ). |
IoFilterChainBuilder |
getFilterChainBuilder()
Returns the IoFilterChainBuilder which will build the
IoFilterChain of all IoSessions which is created
by this service. |
IoHandler |
getHandler()
Returns the handler which will handle all connections managed by this service. |
int |
getIdleCount(IdleStatus status)
Returns the number of the fired continuous serviceIdle events for the specified IdleStatus. |
int |
getIdleTime(IdleStatus status)
Returns idle time for the specified type of idleness in seconds. |
long |
getIdleTimeInMillis(IdleStatus status)
Returns idle time for the specified type of idleness in milliseconds. |
int |
getLargestManagedSessionCount()
Returns the maximum number of sessions which were being managed at the same time. |
double |
getLargestReadBytesThroughput()
Returns the maximum of the readBytesThroughput. |
double |
getLargestReadMessagesThroughput()
Returns the maximum of the readMessagesThroughput. |
double |
getLargestWrittenBytesThroughput()
Returns the maximum of the writtenBytesThroughput. |
double |
getLargestWrittenMessagesThroughput()
Returns the maximum of the writtenMessagesThroughput. |
long |
getLastBothIdleTime()
Returns the time in milliseconds when the last serviceIdle event is fired for IdleStatus.BOTH_IDLE. |
long |
getLastIdleTime(IdleStatus status)
Returns the time in milliseconds when the last serviceIdle event is fired for the specified IdleStatus. |
long |
getLastIoTime()
Returns the time in millis when I/O occurred lastly. |
long |
getLastReaderIdleTime()
Returns the time in milliseconds when the last serviceIdle event is fired for IdleStatus.READER_IDLE. |
long |
getLastReadTime()
Returns the time in millis when read operation occurred lastly. |
long |
getLastWriterIdleTime()
Returns the time in milliseconds when the last serviceIdle event is fired for IdleStatus.WRITER_IDLE. |
long |
getLastWriteTime()
Returns the time in millis when write operation occurred lastly. |
protected IoServiceListenerSupport |
getListeners()
|
int |
getManagedSessionCount()
Returns the number of all sessions which are currently managed by this service. |
Set<IoSession> |
getManagedSessions()
Returns all sessions which are currently managed by this service. |
long |
getReadBytes()
Returns the number of bytes read by this service |
double |
getReadBytesThroughput()
Returns the number of read bytes per second. |
int |
getReaderIdleCount()
Returns the number of the fired continuous serviceIdle events for IdleStatus.READER_IDLE. |
int |
getReaderIdleTime()
Returns idle time for IdleStatus.READER_IDLE in seconds. |
long |
getReaderIdleTimeInMillis()
Returns idle time for IdleStatus.READER_IDLE in milliseconds. |
long |
getReadMessages()
Returns the number of messages this services has read |
double |
getReadMessagesThroughput()
Returns the number of read messages per second. |
long |
getScheduledWriteBytes()
Returns the number of bytes scheduled to be written |
long |
getScheduledWriteMessages()
Returns the number of messages scheduled to be written |
IoSessionConfig |
getSessionConfig()
Returns the default configuration of the new IoSessions
created by this service. |
IoSessionDataStructureFactory |
getSessionDataStructureFactory()
Returns the IoSessionDataStructureFactory that provides
related data structures for a new session created by this service. |
int |
getThroughputCalculationInterval()
Returns the interval (seconds) between each throughput calculation. |
long |
getThroughputCalculationIntervalInMillis()
Returns the interval (milliseconds) between each throughput calculation. |
int |
getWriterIdleCount()
Returns the number of the fired continuous serviceIdle events for IdleStatus.WRITER_IDLE. |
int |
getWriterIdleTime()
Returns idle time for IdleStatus.WRITER_IDLE in seconds. |
long |
getWriterIdleTimeInMillis()
Returns idle time for IdleStatus.WRITER_IDLE in milliseconds. |
long |
getWrittenBytes()
Returns the number of bytes written out by this service |
double |
getWrittenBytesThroughput()
Returns the number of written bytes per second. |
long |
getWrittenMessages()
Returns the number of messages this service has written |
double |
getWrittenMessagesThroughput()
Returns the number of written messages per second. |
protected void |
increaseReadBytes(long increment,
long currentTime)
|
protected void |
increaseReadMessages(long currentTime)
|
protected void |
increaseScheduledWriteBytes(long increment)
|
protected void |
increaseScheduledWriteMessages()
|
protected void |
increaseWrittenBytes(long increment,
long currentTime)
|
protected void |
increaseWrittenMessages(long currentTime)
|
boolean |
isActive()
Returns a value of whether or not this service is active |
boolean |
isBothIdle()
Returns true if this service is IdleStatus.BOTH_IDLE. |
boolean |
isDisposed()
Returns true if and if only all resources of this processor have been disposed. |
boolean |
isDisposing()
Returns true if and if only IoService.dispose() method has
been called. |
boolean |
isIdle(IdleStatus status)
Returns true if this service is idle for the specified
IdleStatus. |
boolean |
isReaderIdle()
Returns true if this service is IdleStatus.READER_IDLE. |
boolean |
isWriterIdle()
Returns true if this service is IdleStatus.WRITER_IDLE. |
protected void |
notifyIdleness(long currentTime)
|
void |
removeListener(IoServiceListener listener)
Removed an existing IoServiceListener that listens any events
related with this service. |
void |
setBothIdleTime(int idleTime)
Sets idle time for IdleStatus.WRITER_IDLE in seconds. |
void |
setFilterChainBuilder(IoFilterChainBuilder builder)
Sets the IoFilterChainBuilder which will build the
IoFilterChain of all IoSessions which is created
by this service. |
void |
setHandler(IoHandler handler)
Sets the handler which will handle all connections managed by this service. |
void |
setIdleTime(IdleStatus status,
int idleTime)
Sets idle time for the specified type of idleness in seconds. |
protected void |
setLastReadTime(long lastReadTime)
|
protected void |
setLastWriteTime(long lastWriteTime)
|
void |
setReaderIdleTime(int idleTime)
Sets idle time for IdleStatus.READER_IDLE in seconds. |
void |
setSessionDataStructureFactory(IoSessionDataStructureFactory sessionDataStructureFactory)
Sets the IoSessionDataStructureFactory that provides
related data structures for a new session created by this service. |
void |
setThroughputCalculationInterval(int throughputCalculationInterval)
Sets the interval (seconds) between each throughput calculation. |
void |
setWriterIdleTime(int idleTime)
Sets idle time for IdleStatus.WRITER_IDLE in seconds. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.apache.mina.common.IoService |
|---|
getTransportMetadata |
| Constructor Detail |
|---|
protected AbstractIoService(IoSessionConfig sessionConfig)
| Method Detail |
|---|
public final IoFilterChainBuilder getFilterChainBuilder()
IoServiceIoFilterChainBuilder which will build the
IoFilterChain of all IoSessions which is created
by this service.
The default value is an empty DefaultIoFilterChainBuilder.
getFilterChainBuilder in interface IoServicepublic final void setFilterChainBuilder(IoFilterChainBuilder builder)
IoServiceIoFilterChainBuilder which will build the
IoFilterChain of all IoSessions which is created
by this service.
If you specify null this property will be set to
an empty DefaultIoFilterChainBuilder.
setFilterChainBuilder in interface IoServicepublic final DefaultIoFilterChainBuilder getFilterChain()
IoServiceIoService.getFilterChainBuilder() ).
Please note that the returned object is not a real IoFilterChain
but a DefaultIoFilterChainBuilder. Modifying the returned builder
won't affect the existing IoSessions at all, because
IoFilterChainBuilders affect only newly created IoSessions.
getFilterChain in interface IoServicepublic final void addListener(IoServiceListener listener)
IoServiceIoServiceListener that listens any events related with
this service.
addListener in interface IoServicepublic final void removeListener(IoServiceListener listener)
IoServiceIoServiceListener that listens any events
related with this service.
removeListener in interface IoServicepublic final boolean isActive()
IoService
isActive in interface IoServicepublic final boolean isDisposing()
IoServiceIoService.dispose() method has
been called. Please note that this method will return true
even after all the related resources are released.
isDisposing in interface IoServicepublic final boolean isDisposed()
IoService
isDisposed in interface IoServicepublic final void dispose()
IoService
dispose in interface IoService
protected abstract IoFuture dispose0()
throws Exception
dispose().
Exceptionpublic final Set<IoSession> getManagedSessions()
IoService
getManagedSessions in interface IoServicepublic final long getCumulativeManagedSessionCount()
IoService
getCumulativeManagedSessionCount in interface IoServicepublic final int getLargestManagedSessionCount()
IoService
getLargestManagedSessionCount in interface IoServicepublic final int getManagedSessionCount()
IoService
getManagedSessionCount in interface IoServicepublic final IoHandler getHandler()
IoService
getHandler in interface IoServicepublic final void setHandler(IoHandler handler)
IoService
setHandler in interface IoServicepublic IoSessionConfig getSessionConfig()
IoServiceIoSessions
created by this service.
getSessionConfig in interface IoServicepublic final IoSessionDataStructureFactory getSessionDataStructureFactory()
IoServiceIoSessionDataStructureFactory that provides
related data structures for a new session created by this service.
getSessionDataStructureFactory in interface IoServicepublic final void setSessionDataStructureFactory(IoSessionDataStructureFactory sessionDataStructureFactory)
IoServiceIoSessionDataStructureFactory that provides
related data structures for a new session created by this service.
setSessionDataStructureFactory in interface IoServicepublic final long getReadBytes()
IoService
getReadBytes in interface IoService
protected final void increaseReadBytes(long increment,
long currentTime)
public final long getReadMessages()
IoService
getReadMessages in interface IoServiceprotected final void increaseReadMessages(long currentTime)
public final int getThroughputCalculationInterval()
IoService
getThroughputCalculationInterval in interface IoServicepublic final void setThroughputCalculationInterval(int throughputCalculationInterval)
IoService
setThroughputCalculationInterval in interface IoServicepublic final long getThroughputCalculationIntervalInMillis()
IoService
getThroughputCalculationIntervalInMillis in interface IoServicepublic final double getReadBytesThroughput()
IoService
getReadBytesThroughput in interface IoServicepublic final double getWrittenBytesThroughput()
IoService
getWrittenBytesThroughput in interface IoServicepublic final double getReadMessagesThroughput()
IoService
getReadMessagesThroughput in interface IoServicepublic final double getWrittenMessagesThroughput()
IoService
getWrittenMessagesThroughput in interface IoServicepublic final double getLargestReadBytesThroughput()
IoServicereadBytesThroughput.
getLargestReadBytesThroughput in interface IoServicepublic final double getLargestWrittenBytesThroughput()
IoServicewrittenBytesThroughput.
getLargestWrittenBytesThroughput in interface IoServicepublic final double getLargestReadMessagesThroughput()
IoServicereadMessagesThroughput.
getLargestReadMessagesThroughput in interface IoServicepublic final double getLargestWrittenMessagesThroughput()
IoServicewrittenMessagesThroughput.
getLargestWrittenMessagesThroughput in interface IoServicepublic final long getScheduledWriteBytes()
IoService
getScheduledWriteBytes in interface IoServiceprotected final void increaseScheduledWriteBytes(long increment)
public final long getScheduledWriteMessages()
IoService
getScheduledWriteMessages in interface IoServiceprotected final void increaseScheduledWriteMessages()
protected final void decreaseScheduledWriteMessages()
public final long getActivationTime()
IoService
getActivationTime in interface IoServiceSystem.currentTimeMillis()public final long getLastIoTime()
IoService
getLastIoTime in interface IoServicepublic final long getLastReadTime()
IoService
getLastReadTime in interface IoServiceprotected final void setLastReadTime(long lastReadTime)
public final long getLastWriteTime()
IoService
getLastWriteTime in interface IoServiceprotected final void setLastWriteTime(long lastWriteTime)
public final long getWrittenBytes()
IoService
getWrittenBytes in interface IoService
protected final void increaseWrittenBytes(long increment,
long currentTime)
public final long getWrittenMessages()
IoService
getWrittenMessages in interface IoServiceprotected final void increaseWrittenMessages(long currentTime)
public final int getIdleTime(IdleStatus status)
IoService
getIdleTime in interface IoServicepublic final long getIdleTimeInMillis(IdleStatus status)
IoService
getIdleTimeInMillis in interface IoService
public final void setIdleTime(IdleStatus status,
int idleTime)
IoService
setIdleTime in interface IoServicepublic final boolean isIdle(IdleStatus status)
IoServicetrue if this service is idle for the specified
IdleStatus.
isIdle in interface IoServicepublic final int getIdleCount(IdleStatus status)
IoServiceIdleStatus.
If serviceIdle event is fired first after some time after I/O,
idleCount becomes 1. idleCount resets to
0 if any I/O occurs again, otherwise it increases to
2 and so on if serviceIdle event is fired again without
any I/O between two (or more) serviceIdle events.
getIdleCount in interface IoServicepublic final long getLastIdleTime(IdleStatus status)
IoServiceIdleStatus.
getLastIdleTime in interface IoServiceprotected final void notifyIdleness(long currentTime)
public final int getBothIdleCount()
IoServiceIdleStatus.BOTH_IDLE.
getBothIdleCount in interface IoServiceIoService.getIdleCount(IdleStatus)public final long getLastBothIdleTime()
IoServiceIdleStatus.BOTH_IDLE.
getLastBothIdleTime in interface IoServiceIoService.getLastIdleTime(IdleStatus)public final long getLastReaderIdleTime()
IoServiceIdleStatus.READER_IDLE.
getLastReaderIdleTime in interface IoServiceIoService.getLastIdleTime(IdleStatus)public final long getLastWriterIdleTime()
IoServiceIdleStatus.WRITER_IDLE.
getLastWriterIdleTime in interface IoServiceIoService.getLastIdleTime(IdleStatus)public final int getReaderIdleCount()
IoServiceIdleStatus.READER_IDLE.
getReaderIdleCount in interface IoServiceIoService.getIdleCount(IdleStatus)public final int getWriterIdleCount()
IoServiceIdleStatus.WRITER_IDLE.
getWriterIdleCount in interface IoServiceIoService.getIdleCount(IdleStatus)public final int getBothIdleTime()
IoServiceIdleStatus.BOTH_IDLE in seconds.
getBothIdleTime in interface IoServicepublic final long getBothIdleTimeInMillis()
IoServiceIdleStatus.BOTH_IDLE in milliseconds.
getBothIdleTimeInMillis in interface IoServicepublic final int getReaderIdleTime()
IoServiceIdleStatus.READER_IDLE in seconds.
getReaderIdleTime in interface IoServicepublic final long getReaderIdleTimeInMillis()
IoServiceIdleStatus.READER_IDLE in milliseconds.
getReaderIdleTimeInMillis in interface IoServicepublic final int getWriterIdleTime()
IoServiceIdleStatus.WRITER_IDLE in seconds.
getWriterIdleTime in interface IoServicepublic final long getWriterIdleTimeInMillis()
IoServiceIdleStatus.WRITER_IDLE in milliseconds.
getWriterIdleTimeInMillis in interface IoServicepublic final boolean isBothIdle()
IoServicetrue if this service is IdleStatus.BOTH_IDLE.
isBothIdle in interface IoServiceIoService.isIdle(IdleStatus)public final boolean isReaderIdle()
IoServicetrue if this service is IdleStatus.READER_IDLE.
isReaderIdle in interface IoServiceIoService.isIdle(IdleStatus)public final boolean isWriterIdle()
IoServicetrue if this service is IdleStatus.WRITER_IDLE.
isWriterIdle in interface IoServiceIoService.isIdle(IdleStatus)public final void setBothIdleTime(int idleTime)
IoServiceIdleStatus.WRITER_IDLE in seconds.
setBothIdleTime in interface IoServicepublic final void setReaderIdleTime(int idleTime)
IoServiceIdleStatus.READER_IDLE in seconds.
setReaderIdleTime in interface IoServicepublic final void setWriterIdleTime(int idleTime)
IoServiceIdleStatus.WRITER_IDLE in seconds.
setWriterIdleTime in interface IoServicepublic final Set<WriteFuture> broadcast(Object message)
IoServicemessage to all the IoSessions
managed by this service. This method is a convenience shortcut for
IoUtil.broadcast(Object, Collection).
broadcast in interface IoServiceprotected final IoServiceListenerSupport getListeners()
protected final void finishSessionInitialization(IoSession session,
IoFuture future,
IoSessionInitializer sessionInitializer)
protected void finishSessionInitialization0(IoSession session,
IoFuture future)
finishSessionInitialization(IoSession, IoFuture, IoSessionInitializer) will call
this method instead.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||