You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mina.apache.org by el...@apache.org on 2008/07/17 15:27:08 UTC
svn commit: r677580 - in
/mina/trunk/core/src/main/java/org/apache/mina/core/service:
AbstractIoService.java IoService.java IoServiceIdleState.java
IoServiceStatistics.java
Author: elecharny
Date: Thu Jul 17 06:27:07 2008
New Revision: 677580
URL: http://svn.apache.org/viewvc?rev=677580&view=rev
Log:
Applied patch for DIRMINA-608 provided by Barend
Added:
mina/trunk/core/src/main/java/org/apache/mina/core/service/IoServiceIdleState.java
mina/trunk/core/src/main/java/org/apache/mina/core/service/IoServiceStatistics.java
Modified:
mina/trunk/core/src/main/java/org/apache/mina/core/service/AbstractIoService.java
mina/trunk/core/src/main/java/org/apache/mina/core/service/IoService.java
Modified: mina/trunk/core/src/main/java/org/apache/mina/core/service/AbstractIoService.java
URL: http://svn.apache.org/viewvc/mina/trunk/core/src/main/java/org/apache/mina/core/service/AbstractIoService.java?rev=677580&r1=677579&r2=677580&view=diff
==============================================================================
--- mina/trunk/core/src/main/java/org/apache/mina/core/service/AbstractIoService.java (original)
+++ mina/trunk/core/src/main/java/org/apache/mina/core/service/AbstractIoService.java Thu Jul 17 06:27:07 2008
@@ -61,7 +61,7 @@
* @author The Apache MINA Project (dev@mina.apache.org)
* @version $Rev$, $Date$
*/
-public abstract class AbstractIoService implements IoService {
+public abstract class AbstractIoService implements IoService, IoServiceStatistics, IoServiceIdleState {
/**
* The unique number identifying the Service. It's incremented
* for each new IoService created.
@@ -433,6 +433,20 @@
/**
* {@inheritDoc}
*/
+ public IoServiceIdleState getIdleState() {
+ return this;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public IoServiceStatistics getStatistics() {
+ return this;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
public final long getReadBytes() {
return readBytes.get();
}
Modified: mina/trunk/core/src/main/java/org/apache/mina/core/service/IoService.java
URL: http://svn.apache.org/viewvc/mina/trunk/core/src/main/java/org/apache/mina/core/service/IoService.java?rev=677580&r1=677579&r2=677580&view=diff
==============================================================================
--- mina/trunk/core/src/main/java/org/apache/mina/core/service/IoService.java (original)
+++ mina/trunk/core/src/main/java/org/apache/mina/core/service/IoService.java Thu Jul 17 06:27:07 2008
@@ -28,7 +28,6 @@
import org.apache.mina.core.filterchain.IoFilterChain;
import org.apache.mina.core.filterchain.IoFilterChainBuilder;
import org.apache.mina.core.future.WriteFuture;
-import org.apache.mina.core.session.IdleStatus;
import org.apache.mina.core.session.IoSession;
import org.apache.mina.core.session.IoSessionConfig;
import org.apache.mina.core.session.IoSessionDataStructureFactory;
@@ -104,19 +103,6 @@
int getManagedSessionCount();
/**
- * Returns the maximum number of sessions which were being managed at the
- * same time.
- */
- int getLargestManagedSessionCount();
-
- /**
- * 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'.
- */
- long getCumulativeManagedSessionCount();
-
- /**
* Returns the default configuration of the new {@link IoSession}s
* created by this service.
*/
@@ -169,253 +155,23 @@
long getActivationTime();
/**
- * Returns the time in millis when I/O occurred lastly.
- */
- long getLastIoTime();
-
- /**
- * Returns the time in millis when read operation occurred lastly.
- */
- long getLastReadTime();
-
- /**
- * Returns the time in millis when write operation occurred lastly.
- */
- long getLastWriteTime();
-
- /**
- * Returns <code>true</code> if this service is idle for the specified
- * {@link IdleStatus}.
- */
- boolean isIdle(IdleStatus status);
-
- /**
- * Returns <code>true</code> if this service is {@link IdleStatus#READER_IDLE}.
- * @see #isIdle(IdleStatus)
- */
- boolean isReaderIdle();
-
- /**
- * Returns <code>true</code> if this service is {@link IdleStatus#WRITER_IDLE}.
- * @see #isIdle(IdleStatus)
- */
- boolean isWriterIdle();
-
- /**
- * Returns <code>true</code> if this service is {@link IdleStatus#BOTH_IDLE}.
- * @see #isIdle(IdleStatus)
- */
- boolean isBothIdle();
-
- /**
- * Returns the number of the fired continuous <tt>serviceIdle</tt> events
- * for the specified {@link IdleStatus}.
- * <p/>
- * If <tt>serviceIdle</tt> event is fired first after some time after I/O,
- * <tt>idleCount</tt> becomes <tt>1</tt>. <tt>idleCount</tt> resets to
- * <tt>0</tt> if any I/O occurs again, otherwise it increases to
- * <tt>2</tt> and so on if <tt>serviceIdle</tt> event is fired again without
- * any I/O between two (or more) <tt>serviceIdle</tt> events.
- */
- int getIdleCount(IdleStatus status);
-
- /**
- * Returns the number of the fired continuous <tt>serviceIdle</tt> events
- * for {@link IdleStatus#READER_IDLE}.
- * @see #getIdleCount(IdleStatus)
- */
- int getReaderIdleCount();
-
- /**
- * Returns the number of the fired continuous <tt>serviceIdle</tt> events
- * for {@link IdleStatus#WRITER_IDLE}.
- * @see #getIdleCount(IdleStatus)
- */
- int getWriterIdleCount();
-
- /**
- * Returns the number of the fired continuous <tt>serviceIdle</tt> events
- * for {@link IdleStatus#BOTH_IDLE}.
- * @see #getIdleCount(IdleStatus)
- */
- int getBothIdleCount();
-
- /**
- * Returns the time in milliseconds when the last <tt>serviceIdle</tt> event
- * is fired for the specified {@link IdleStatus}.
- */
- long getLastIdleTime(IdleStatus status);
-
- /**
- * Returns the time in milliseconds when the last <tt>serviceIdle</tt> event
- * is fired for {@link IdleStatus#READER_IDLE}.
- * @see #getLastIdleTime(IdleStatus)
- */
- long getLastReaderIdleTime();
-
- /**
- * Returns the time in milliseconds when the last <tt>serviceIdle</tt> event
- * is fired for {@link IdleStatus#WRITER_IDLE}.
- * @see #getLastIdleTime(IdleStatus)
- */
- long getLastWriterIdleTime();
-
- /**
- * Returns the time in milliseconds when the last <tt>serviceIdle</tt> event
- * is fired for {@link IdleStatus#BOTH_IDLE}.
- * @see #getLastIdleTime(IdleStatus)
- */
- long getLastBothIdleTime();
-
- /**
- * Returns idle time for the specified type of idleness in seconds.
- */
- int getIdleTime(IdleStatus status);
-
- /**
- * Returns idle time for the specified type of idleness in milliseconds.
- */
- long getIdleTimeInMillis(IdleStatus status);
-
- /**
- * Sets idle time for the specified type of idleness in seconds.
- */
- void setIdleTime(IdleStatus status, int idleTime);
-
- /**
- * Returns idle time for {@link IdleStatus#READER_IDLE} in seconds.
- */
- int getReaderIdleTime();
-
- /**
- * Returns idle time for {@link IdleStatus#READER_IDLE} in milliseconds.
- */
- long getReaderIdleTimeInMillis();
-
- /**
- * Sets idle time for {@link IdleStatus#READER_IDLE} in seconds.
- */
- void setReaderIdleTime(int idleTime);
-
- /**
- * Returns idle time for {@link IdleStatus#WRITER_IDLE} in seconds.
- */
- int getWriterIdleTime();
-
- /**
- * Returns idle time for {@link IdleStatus#WRITER_IDLE} in milliseconds.
- */
- long getWriterIdleTimeInMillis();
-
- /**
- * Sets idle time for {@link IdleStatus#WRITER_IDLE} in seconds.
- */
- void setWriterIdleTime(int idleTime);
-
- /**
- * Returns idle time for {@link IdleStatus#BOTH_IDLE} in seconds.
- */
- int getBothIdleTime();
-
- /**
- * Returns idle time for {@link IdleStatus#BOTH_IDLE} in milliseconds.
- */
- long getBothIdleTimeInMillis();
-
- /**
- * Sets idle time for {@link IdleStatus#WRITER_IDLE} in seconds.
- */
- void setBothIdleTime(int idleTime);
-
- /**
- * Returns the number of bytes read by this service
- *
- * @return
- * The number of bytes this service has read
- */
- long getReadBytes();
-
- /**
- * Returns the number of bytes written out by this service
- *
- * @return
- * The number of bytes this service has written
- */
- long getWrittenBytes();
-
- /**
- * Returns the number of messages this services has read
- *
- * @return
- * The number of messages this services has read
- */
- long getReadMessages();
-
- /**
- * Returns the number of messages this service has written
- *
- * @return
- * The number of messages this service has written
- */
- long getWrittenMessages();
-
- /**
- * Returns the number of read bytes per second.
- */
- double getReadBytesThroughput();
-
- /**
- * Returns the number of written bytes per second.
- */
- double getWrittenBytesThroughput();
-
- /**
- * Returns the number of read messages per second.
- */
- double getReadMessagesThroughput();
-
- /**
- * Returns the number of written messages per second.
- */
- double getWrittenMessagesThroughput();
-
- /**
- * Returns the maximum of the {@link #getReadBytesThroughput() readBytesThroughput}.
- */
- double getLargestReadBytesThroughput();
-
- /**
- * Returns the maximum of the {@link #getWrittenBytesThroughput() writtenBytesThroughput}.
- */
- double getLargestWrittenBytesThroughput();
-
- /**
- * Returns the maximum of the {@link #getReadMessagesThroughput() readMessagesThroughput}.
- */
- double getLargestReadMessagesThroughput();
-
- /**
- * Returns the maximum of the {@link #getWrittenMessagesThroughput() writtenMessagesThroughput}.
- */
- double getLargestWrittenMessagesThroughput();
-
- /**
- * Returns the interval (seconds) between each throughput calculation.
- * The default value is <tt>3</tt> seconds.
+ * Writes the specified {@code message} to all the {@link IoSession}s
+ * managed by this service. This method is a convenience shortcut for
+ * {@link IoUtil#broadcast(Object, Collection)}.
*/
- int getThroughputCalculationInterval();
+ Set<WriteFuture> broadcast(Object message);
/**
- * Returns the interval (milliseconds) between each throughput calculation.
- * The default value is <tt>3</tt> seconds.
+ * Returns the {@link IoSessionDataStructureFactory} that provides
+ * related data structures for a new session created by this service.
*/
- long getThroughputCalculationIntervalInMillis();
+ IoSessionDataStructureFactory getSessionDataStructureFactory();
/**
- * Sets the interval (seconds) between each throughput calculation. The
- * default value is <tt>3</tt> seconds.
+ * Sets the {@link IoSessionDataStructureFactory} that provides
+ * related data structures for a new session created by this service.
*/
- void setThroughputCalculationInterval(int throughputCalculationInterval);
+ void setSessionDataStructureFactory(IoSessionDataStructureFactory sessionDataStructureFactory);
/**
* Returns the number of bytes scheduled to be written
@@ -434,21 +190,16 @@
int getScheduledWriteMessages();
/**
- * Writes the specified {@code message} to all the {@link IoSession}s
- * managed by this service. This method is a convenience shortcut for
- * {@link IoUtil#broadcast(Object, Collection)}.
+ * Returns the IoServiceIdleState for this service.
+ *
+ * @return The idle state object for this service.
*/
- Set<WriteFuture> broadcast(Object message);
+ IoServiceIdleState getIdleState();
/**
- * Returns the {@link IoSessionDataStructureFactory} that provides
- * related data structures for a new session created by this service.
+ * Returns the IoServiceStatistics object for this service.
+ *
+ * @return The statistics object for this service.
*/
- IoSessionDataStructureFactory getSessionDataStructureFactory();
-
- /**
- * Sets the {@link IoSessionDataStructureFactory} that provides
- * related data structures for a new session created by this service.
- */
- void setSessionDataStructureFactory(IoSessionDataStructureFactory sessionDataStructureFactory);
+ IoServiceStatistics getStatistics();
}
Added: mina/trunk/core/src/main/java/org/apache/mina/core/service/IoServiceIdleState.java
URL: http://svn.apache.org/viewvc/mina/trunk/core/src/main/java/org/apache/mina/core/service/IoServiceIdleState.java?rev=677580&view=auto
==============================================================================
--- mina/trunk/core/src/main/java/org/apache/mina/core/service/IoServiceIdleState.java (added)
+++ mina/trunk/core/src/main/java/org/apache/mina/core/service/IoServiceIdleState.java Thu Jul 17 06:27:07 2008
@@ -0,0 +1,175 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.mina.core.service;
+
+import org.apache.mina.core.session.IdleStatus;
+
+/**
+ * Gives access to the idle state information for an IoService.
+ *
+ * @author The Apache MINA Project (dev@mina.apache.org)
+ * @since 2.0-M3
+ */
+public interface IoServiceIdleState {
+
+ /**
+ * Returns <code>true</code> if this service is idle for the specified
+ * {@link IdleStatus}.
+ */
+ boolean isIdle(IdleStatus status);
+
+ /**
+ * Returns <code>true</code> if this service is {@link IdleStatus#READER_IDLE}.
+ * @see #isIdle(IdleStatus)
+ */
+ boolean isReaderIdle();
+
+ /**
+ * Returns <code>true</code> if this service is {@link IdleStatus#WRITER_IDLE}.
+ * @see #isIdle(IdleStatus)
+ */
+ boolean isWriterIdle();
+
+ /**
+ * Returns <code>true</code> if this service is {@link IdleStatus#BOTH_IDLE}.
+ * @see #isIdle(IdleStatus)
+ */
+ boolean isBothIdle();
+
+ /**
+ * Returns the number of the fired continuous <tt>serviceIdle</tt> events
+ * for the specified {@link IdleStatus}.
+ * <p/>
+ * If <tt>serviceIdle</tt> event is fired first after some time after I/O,
+ * <tt>idleCount</tt> becomes <tt>1</tt>. <tt>idleCount</tt> resets to
+ * <tt>0</tt> if any I/O occurs again, otherwise it increases to
+ * <tt>2</tt> and so on if <tt>serviceIdle</tt> event is fired again without
+ * any I/O between two (or more) <tt>serviceIdle</tt> events.
+ */
+ int getIdleCount(IdleStatus status);
+
+ /**
+ * Returns the number of the fired continuous <tt>serviceIdle</tt> events
+ * for {@link IdleStatus#READER_IDLE}.
+ * @see #getIdleCount(IdleStatus)
+ */
+ int getReaderIdleCount();
+
+ /**
+ * Returns the number of the fired continuous <tt>serviceIdle</tt> events
+ * for {@link IdleStatus#WRITER_IDLE}.
+ * @see #getIdleCount(IdleStatus)
+ */
+ int getWriterIdleCount();
+
+ /**
+ * Returns the number of the fired continuous <tt>serviceIdle</tt> events
+ * for {@link IdleStatus#BOTH_IDLE}.
+ * @see #getIdleCount(IdleStatus)
+ */
+ int getBothIdleCount();
+
+ /**
+ * Returns the time in milliseconds when the last <tt>serviceIdle</tt> event
+ * is fired for the specified {@link IdleStatus}.
+ */
+ long getLastIdleTime(IdleStatus status);
+
+ /**
+ * Returns the time in milliseconds when the last <tt>serviceIdle</tt> event
+ * is fired for {@link IdleStatus#READER_IDLE}.
+ * @see #getLastIdleTime(IdleStatus)
+ */
+ long getLastReaderIdleTime();
+
+ /**
+ * Returns the time in milliseconds when the last <tt>serviceIdle</tt> event
+ * is fired for {@link IdleStatus#WRITER_IDLE}.
+ * @see #getLastIdleTime(IdleStatus)
+ */
+ long getLastWriterIdleTime();
+
+ /**
+ * Returns the time in milliseconds when the last <tt>serviceIdle</tt> event
+ * is fired for {@link IdleStatus#BOTH_IDLE}.
+ * @see #getLastIdleTime(IdleStatus)
+ */
+ long getLastBothIdleTime();
+
+ /**
+ * Returns idle time for the specified type of idleness in seconds.
+ */
+ int getIdleTime(IdleStatus status);
+
+ /**
+ * Returns idle time for the specified type of idleness in milliseconds.
+ */
+ long getIdleTimeInMillis(IdleStatus status);
+
+ /**
+ * Sets idle time for the specified type of idleness in seconds.
+ */
+ void setIdleTime(IdleStatus status, int idleTime);
+
+ /**
+ * Returns idle time for {@link IdleStatus#READER_IDLE} in seconds.
+ */
+ int getReaderIdleTime();
+
+ /**
+ * Returns idle time for {@link IdleStatus#READER_IDLE} in milliseconds.
+ */
+ long getReaderIdleTimeInMillis();
+
+ /**
+ * Sets idle time for {@link IdleStatus#READER_IDLE} in seconds.
+ */
+ void setReaderIdleTime(int idleTime);
+
+ /**
+ * Returns idle time for {@link IdleStatus#WRITER_IDLE} in seconds.
+ */
+ int getWriterIdleTime();
+
+ /**
+ * Returns idle time for {@link IdleStatus#WRITER_IDLE} in milliseconds.
+ */
+ long getWriterIdleTimeInMillis();
+
+ /**
+ * Sets idle time for {@link IdleStatus#WRITER_IDLE} in seconds.
+ */
+ void setWriterIdleTime(int idleTime);
+
+ /**
+ * Returns idle time for {@link IdleStatus#BOTH_IDLE} in seconds.
+ */
+ int getBothIdleTime();
+
+ /**
+ * Returns idle time for {@link IdleStatus#BOTH_IDLE} in milliseconds.
+ */
+ long getBothIdleTimeInMillis();
+
+ /**
+ * Sets idle time for {@link IdleStatus#WRITER_IDLE} in seconds.
+ */
+ void setBothIdleTime(int idleTime);
+}
\ No newline at end of file
Added: mina/trunk/core/src/main/java/org/apache/mina/core/service/IoServiceStatistics.java
URL: http://svn.apache.org/viewvc/mina/trunk/core/src/main/java/org/apache/mina/core/service/IoServiceStatistics.java?rev=677580&view=auto
==============================================================================
--- mina/trunk/core/src/main/java/org/apache/mina/core/service/IoServiceStatistics.java (added)
+++ mina/trunk/core/src/main/java/org/apache/mina/core/service/IoServiceStatistics.java Thu Jul 17 06:27:07 2008
@@ -0,0 +1,145 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+package org.apache.mina.core.service;
+
+/**
+ * Provides usage statistics for an IoService.
+ *
+ * @author The Apache MINA Project (dev@mina.apache.org)
+ */
+public interface IoServiceStatistics {
+ /**
+ * Returns the maximum number of sessions which were being managed at the
+ * same time.
+ */
+ int getLargestManagedSessionCount();
+
+ /**
+ * 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'.
+ */
+ long getCumulativeManagedSessionCount();
+
+ /**
+ * Returns the time in millis when I/O occurred lastly.
+ */
+ long getLastIoTime();
+
+ /**
+ * Returns the time in millis when read operation occurred lastly.
+ */
+ long getLastReadTime();
+
+ /**
+ * Returns the time in millis when write operation occurred lastly.
+ */
+ long getLastWriteTime();
+
+ /**
+ * Returns the number of bytes read by this service
+ *
+ * @return
+ * The number of bytes this service has read
+ */
+ long getReadBytes();
+
+ /**
+ * Returns the number of bytes written out by this service
+ *
+ * @return
+ * The number of bytes this service has written
+ */
+ long getWrittenBytes();
+
+ /**
+ * Returns the number of messages this services has read
+ *
+ * @return
+ * The number of messages this services has read
+ */
+ long getReadMessages();
+
+ /**
+ * Returns the number of messages this service has written
+ *
+ * @return
+ * The number of messages this service has written
+ */
+ long getWrittenMessages();
+
+ /**
+ * Returns the number of read bytes per second.
+ */
+ double getReadBytesThroughput();
+
+ /**
+ * Returns the number of written bytes per second.
+ */
+ double getWrittenBytesThroughput();
+
+ /**
+ * Returns the number of read messages per second.
+ */
+ double getReadMessagesThroughput();
+
+ /**
+ * Returns the number of written messages per second.
+ */
+ double getWrittenMessagesThroughput();
+
+ /**
+ * Returns the maximum of the {@link #getReadBytesThroughput() readBytesThroughput}.
+ */
+ double getLargestReadBytesThroughput();
+
+ /**
+ * Returns the maximum of the {@link #getWrittenBytesThroughput() writtenBytesThroughput}.
+ */
+ double getLargestWrittenBytesThroughput();
+
+ /**
+ * Returns the maximum of the {@link #getReadMessagesThroughput() readMessagesThroughput}.
+ */
+ double getLargestReadMessagesThroughput();
+
+ /**
+ * Returns the maximum of the {@link #getWrittenMessagesThroughput() writtenMessagesThroughput}.
+ */
+ double getLargestWrittenMessagesThroughput();
+
+ /**
+ * Returns the interval (seconds) between each throughput calculation.
+ * The default value is <tt>3</tt> seconds.
+ */
+ int getThroughputCalculationInterval();
+
+ /**
+ * Returns the interval (milliseconds) between each throughput calculation.
+ * The default value is <tt>3</tt> seconds.
+ */
+ long getThroughputCalculationIntervalInMillis();
+
+ /**
+ * Sets the interval (seconds) between each throughput calculation. The
+ * default value is <tt>3</tt> seconds.
+ */
+ void setThroughputCalculationInterval(int throughputCalculationInterval);
+}
Re: svn commit: r677580 - in /mina/trunk/core/src/main/java/org/apache/mina/core/service: AbstractIoService.java IoService.java IoServiceIdleState.java IoServiceStatistics.java
Posted by Niklas Gustavsson <ni...@protocol7.com>.
´On Fri, Jul 18, 2008 at 7:03 PM, Julien Vermillard
<jv...@archean.fr> wrote:
> On Fri, 18 Jul 2008 19:01:32 +0200
> "Niklas Gustavsson" <ni...@protocol7.com> wrote:
>
>> On Fri, Jul 18, 2008 at 9:22 AM, Julien Vermillard
>> <jv...@archean.fr> wrote:
>> > Is it possible to build serial transport too ?
>> > You need to add -Dwith-LGPL-dependencies to the mvn command line.
Turned out it doesn't currently work, bug was already reported here:
https://hudson.dev.java.net/issues/show_bug.cgi?id=2040
I'll track the bug and fix the build as a new Hudson version is released.
/niklas
Re: svn commit: r677580 - in
/mina/trunk/core/src/main/java/org/apache/mina/core/service:
AbstractIoService.java IoService.java IoServiceIdleState.java
IoServiceStatistics.java
Posted by Julien Vermillard <jv...@archean.fr>.
On Fri, 18 Jul 2008 19:01:32 +0200
"Niklas Gustavsson" <ni...@protocol7.com> wrote:
> On Fri, Jul 18, 2008 at 9:22 AM, Julien Vermillard
> <jv...@archean.fr> wrote:
> > Is it possible to build serial transport too ?
> > You need to add -Dwith-LGPL-dependencies to the mvn command line.
>
> Yeah sure, what branches is it available in?
>
> /niklas
only in trunk,
thanks !
Julien
Re: svn commit: r677580 - in /mina/trunk/core/src/main/java/org/apache/mina/core/service: AbstractIoService.java IoService.java IoServiceIdleState.java IoServiceStatistics.java
Posted by Niklas Gustavsson <ni...@protocol7.com>.
On Fri, Jul 18, 2008 at 9:22 AM, Julien Vermillard
<jv...@archean.fr> wrote:
> Is it possible to build serial transport too ?
> You need to add -Dwith-LGPL-dependencies to the mvn command line.
Yeah sure, what branches is it available in?
/niklas
Re: svn commit: r677580 - in
/mina/trunk/core/src/main/java/org/apache/mina/core/service:
AbstractIoService.java IoService.java IoServiceIdleState.java
IoServiceStatistics.java
Posted by Julien Vermillard <jv...@archean.fr>.
Is it possible to build serial transport too ?
You need to add -Dwith-LGPL-dependencies to the mvn command line.
Julien
On Thu, 17 Jul 2008 22:47:25 +0200
"Niklas Gustavsson" <ni...@protocol7.com> wrote:
> Since I haven't set up the email notifications yet, I'll have to do it
> by hand :-)
>
> This patch broke the build:
> http://hudson.zones.apache.org/hudson/view/MINA/job/MINA-trunk/8/org.apache.mina$mina-example/console
>
> I don't have the time to fix it right now but will do it tomorrow if
> not someone else beats me to it.
>
> /niklas
>
> On Thu, Jul 17, 2008 at 3:27 PM, <el...@apache.org> wrote:
> > Author: elecharny
> > Date: Thu Jul 17 06:27:07 2008
> > New Revision: 677580
> >
> > URL: http://svn.apache.org/viewvc?rev=677580&view=rev
> > Log:
> > Applied patch for DIRMINA-608 provided by Barend
> >
> > Added:
> > mina/trunk/core/src/main/java/org/apache/mina/core/service/IoServiceIdleState.java
> > mina/trunk/core/src/main/java/org/apache/mina/core/service/IoServiceStatistics.java
> > Modified:
> > mina/trunk/core/src/main/java/org/apache/mina/core/service/AbstractIoService.java
> > mina/trunk/core/src/main/java/org/apache/mina/core/service/IoService.java
> >
> > Modified:
> > mina/trunk/core/src/main/java/org/apache/mina/core/service/AbstractIoService.java
> > URL:
> > http://svn.apache.org/viewvc/mina/trunk/core/src/main/java/org/apache/mina/core/service/AbstractIoService.java?rev=677580&r1=677579&r2=677580&view=diff
> > ==============================================================================
> > ---
> > mina/trunk/core/src/main/java/org/apache/mina/core/service/AbstractIoService.java
> > (original) +++
> > mina/trunk/core/src/main/java/org/apache/mina/core/service/AbstractIoService.java
> > Thu Jul 17 06:27:07 2008 @@ -61,7 +61,7 @@
> > * @author The Apache MINA Project (dev@mina.apache.org)
> > * @version $Rev$, $Date$
> > */
> > -public abstract class AbstractIoService implements IoService {
> > +public abstract class AbstractIoService implements IoService,
> > IoServiceStatistics, IoServiceIdleState { /**
> > * The unique number identifying the Service. It's incremented
> > * for each new IoService created.
> > @@ -433,6 +433,20 @@
> > /**
> > * {@inheritDoc}
> > */
> > + public IoServiceIdleState getIdleState() {
> > + return this;
> > + }
> > +
> > + /**
> > + * {@inheritDoc}
> > + */
> > + public IoServiceStatistics getStatistics() {
> > + return this;
> > + }
> > +
> > + /**
> > + * {@inheritDoc}
> > + */
> > public final long getReadBytes() {
> > return readBytes.get();
> > }
> >
> > Modified:
> > mina/trunk/core/src/main/java/org/apache/mina/core/service/IoService.java
> > URL:
> > http://svn.apache.org/viewvc/mina/trunk/core/src/main/java/org/apache/mina/core/service/IoService.java?rev=677580&r1=677579&r2=677580&view=diff
> > ==============================================================================
> > ---
> > mina/trunk/core/src/main/java/org/apache/mina/core/service/IoService.java
> > (original) +++
> > mina/trunk/core/src/main/java/org/apache/mina/core/service/IoService.java
> > Thu Jul 17 06:27:07 2008 @@ -28,7 +28,6 @@ import
> > org.apache.mina.core.filterchain.IoFilterChain; import
> > org.apache.mina.core.filterchain.IoFilterChainBuilder; import
> > org.apache.mina.core.future.WriteFuture; -import
> > org.apache.mina.core.session.IdleStatus; import
> > org.apache.mina.core.session.IoSession; import
> > org.apache.mina.core.session.IoSessionConfig; import
> > org.apache.mina.core.session.IoSessionDataStructureFactory; @@
> > -104,19 +103,6 @@ int getManagedSessionCount();
> >
> > /**
> > - * Returns the maximum number of sessions which were being
> > managed at the
> > - * same time.
> > - */
> > - int getLargestManagedSessionCount();
> > -
> > - /**
> > - * 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'.
> > - */
> > - long getCumulativeManagedSessionCount();
> > -
> > - /**
> > * Returns the default configuration of the new {@link
> > IoSession}s
> > * created by this service.
> > */
> > @@ -169,253 +155,23 @@
> > long getActivationTime();
> >
> > /**
> > - * Returns the time in millis when I/O occurred lastly.
> > - */
> > - long getLastIoTime();
> > -
> > - /**
> > - * Returns the time in millis when read operation occurred
> > lastly.
> > - */
> > - long getLastReadTime();
> > -
> > - /**
> > - * Returns the time in millis when write operation occurred
> > lastly.
> > - */
> > - long getLastWriteTime();
> > -
> > - /**
> > - * Returns <code>true</code> if this service is idle for the
> > specified
> > - * {@link IdleStatus}.
> > - */
> > - boolean isIdle(IdleStatus status);
> > -
> > - /**
> > - * Returns <code>true</code> if this service is {@link
> > IdleStatus#READER_IDLE}.
> > - * @see #isIdle(IdleStatus)
> > - */
> > - boolean isReaderIdle();
> > -
> > - /**
> > - * Returns <code>true</code> if this service is {@link
> > IdleStatus#WRITER_IDLE}.
> > - * @see #isIdle(IdleStatus)
> > - */
> > - boolean isWriterIdle();
> > -
> > - /**
> > - * Returns <code>true</code> if this service is {@link
> > IdleStatus#BOTH_IDLE}.
> > - * @see #isIdle(IdleStatus)
> > - */
> > - boolean isBothIdle();
> > -
> > - /**
> > - * Returns the number of the fired continuous
> > <tt>serviceIdle</tt> events
> > - * for the specified {@link IdleStatus}.
> > - * <p/>
> > - * If <tt>serviceIdle</tt> event is fired first after some
> > time after I/O,
> > - * <tt>idleCount</tt> becomes <tt>1</tt>. <tt>idleCount</tt>
> > resets to
> > - * <tt>0</tt> if any I/O occurs again, otherwise it increases
> > to
> > - * <tt>2</tt> and so on if <tt>serviceIdle</tt> event is fired
> > again without
> > - * any I/O between two (or more) <tt>serviceIdle</tt> events.
> > - */
> > - int getIdleCount(IdleStatus status);
> > -
> > - /**
> > - * Returns the number of the fired continuous
> > <tt>serviceIdle</tt> events
> > - * for {@link IdleStatus#READER_IDLE}.
> > - * @see #getIdleCount(IdleStatus)
> > - */
> > - int getReaderIdleCount();
> > -
> > - /**
> > - * Returns the number of the fired continuous
> > <tt>serviceIdle</tt> events
> > - * for {@link IdleStatus#WRITER_IDLE}.
> > - * @see #getIdleCount(IdleStatus)
> > - */
> > - int getWriterIdleCount();
> > -
> > - /**
> > - * Returns the number of the fired continuous
> > <tt>serviceIdle</tt> events
> > - * for {@link IdleStatus#BOTH_IDLE}.
> > - * @see #getIdleCount(IdleStatus)
> > - */
> > - int getBothIdleCount();
> > -
> > - /**
> > - * Returns the time in milliseconds when the last
> > <tt>serviceIdle</tt> event
> > - * is fired for the specified {@link IdleStatus}.
> > - */
> > - long getLastIdleTime(IdleStatus status);
> > -
> > - /**
> > - * Returns the time in milliseconds when the last
> > <tt>serviceIdle</tt> event
> > - * is fired for {@link IdleStatus#READER_IDLE}.
> > - * @see #getLastIdleTime(IdleStatus)
> > - */
> > - long getLastReaderIdleTime();
> > -
> > - /**
> > - * Returns the time in milliseconds when the last
> > <tt>serviceIdle</tt> event
> > - * is fired for {@link IdleStatus#WRITER_IDLE}.
> > - * @see #getLastIdleTime(IdleStatus)
> > - */
> > - long getLastWriterIdleTime();
> > -
> > - /**
> > - * Returns the time in milliseconds when the last
> > <tt>serviceIdle</tt> event
> > - * is fired for {@link IdleStatus#BOTH_IDLE}.
> > - * @see #getLastIdleTime(IdleStatus)
> > - */
> > - long getLastBothIdleTime();
> > -
> > - /**
> > - * Returns idle time for the specified type of idleness in
> > seconds.
> > - */
> > - int getIdleTime(IdleStatus status);
> > -
> > - /**
> > - * Returns idle time for the specified type of idleness in
> > milliseconds.
> > - */
> > - long getIdleTimeInMillis(IdleStatus status);
> > -
> > - /**
> > - * Sets idle time for the specified type of idleness in
> > seconds.
> > - */
> > - void setIdleTime(IdleStatus status, int idleTime);
> > -
> > - /**
> > - * Returns idle time for {@link IdleStatus#READER_IDLE} in
> > seconds.
> > - */
> > - int getReaderIdleTime();
> > -
> > - /**
> > - * Returns idle time for {@link IdleStatus#READER_IDLE} in
> > milliseconds.
> > - */
> > - long getReaderIdleTimeInMillis();
> > -
> > - /**
> > - * Sets idle time for {@link IdleStatus#READER_IDLE} in
> > seconds.
> > - */
> > - void setReaderIdleTime(int idleTime);
> > -
> > - /**
> > - * Returns idle time for {@link IdleStatus#WRITER_IDLE} in
> > seconds.
> > - */
> > - int getWriterIdleTime();
> > -
> > - /**
> > - * Returns idle time for {@link IdleStatus#WRITER_IDLE} in
> > milliseconds.
> > - */
> > - long getWriterIdleTimeInMillis();
> > -
> > - /**
> > - * Sets idle time for {@link IdleStatus#WRITER_IDLE} in
> > seconds.
> > - */
> > - void setWriterIdleTime(int idleTime);
> > -
> > - /**
> > - * Returns idle time for {@link IdleStatus#BOTH_IDLE} in
> > seconds.
> > - */
> > - int getBothIdleTime();
> > -
> > - /**
> > - * Returns idle time for {@link IdleStatus#BOTH_IDLE} in
> > milliseconds.
> > - */
> > - long getBothIdleTimeInMillis();
> > -
> > - /**
> > - * Sets idle time for {@link IdleStatus#WRITER_IDLE} in
> > seconds.
> > - */
> > - void setBothIdleTime(int idleTime);
> > -
> > - /**
> > - * Returns the number of bytes read by this service
> > - *
> > - * @return
> > - * The number of bytes this service has read
> > - */
> > - long getReadBytes();
> > -
> > - /**
> > - * Returns the number of bytes written out by this service
> > - *
> > - * @return
> > - * The number of bytes this service has written
> > - */
> > - long getWrittenBytes();
> > -
> > - /**
> > - * Returns the number of messages this services has read
> > - *
> > - * @return
> > - * The number of messages this services has read
> > - */
> > - long getReadMessages();
> > -
> > - /**
> > - * Returns the number of messages this service has written
> > - *
> > - * @return
> > - * The number of messages this service has written
> > - */
> > - long getWrittenMessages();
> > -
> > - /**
> > - * Returns the number of read bytes per second.
> > - */
> > - double getReadBytesThroughput();
> > -
> > - /**
> > - * Returns the number of written bytes per second.
> > - */
> > - double getWrittenBytesThroughput();
> > -
> > - /**
> > - * Returns the number of read messages per second.
> > - */
> > - double getReadMessagesThroughput();
> > -
> > - /**
> > - * Returns the number of written messages per second.
> > - */
> > - double getWrittenMessagesThroughput();
> > -
> > - /**
> > - * Returns the maximum of the {@link #getReadBytesThroughput()
> > readBytesThroughput}.
> > - */
> > - double getLargestReadBytesThroughput();
> > -
> > - /**
> > - * Returns the maximum of the {@link
> > #getWrittenBytesThroughput() writtenBytesThroughput}.
> > - */
> > - double getLargestWrittenBytesThroughput();
> > -
> > - /**
> > - * Returns the maximum of the {@link
> > #getReadMessagesThroughput() readMessagesThroughput}.
> > - */
> > - double getLargestReadMessagesThroughput();
> > -
> > - /**
> > - * Returns the maximum of the {@link
> > #getWrittenMessagesThroughput() writtenMessagesThroughput}.
> > - */
> > - double getLargestWrittenMessagesThroughput();
> > -
> > - /**
> > - * Returns the interval (seconds) between each throughput
> > calculation.
> > - * The default value is <tt>3</tt> seconds.
> > + * Writes the specified {@code message} to all the {@link
> > IoSession}s
> > + * managed by this service. This method is a convenience
> > shortcut for
> > + * {@link IoUtil#broadcast(Object, Collection)}.
> > */
> > - int getThroughputCalculationInterval();
> > + Set<WriteFuture> broadcast(Object message);
> >
> > /**
> > - * Returns the interval (milliseconds) between each throughput
> > calculation.
> > - * The default value is <tt>3</tt> seconds.
> > + * Returns the {@link IoSessionDataStructureFactory} that
> > provides
> > + * related data structures for a new session created by this
> > service. */
> > - long getThroughputCalculationIntervalInMillis();
> > + IoSessionDataStructureFactory getSessionDataStructureFactory();
> >
> > /**
> > - * Sets the interval (seconds) between each throughput
> > calculation. The
> > - * default value is <tt>3</tt> seconds.
> > + * Sets the {@link IoSessionDataStructureFactory} that provides
> > + * related data structures for a new session created by this
> > service. */
> > - void setThroughputCalculationInterval(int
> > throughputCalculationInterval);
> > + void
> > setSessionDataStructureFactory(IoSessionDataStructureFactory
> > sessionDataStructureFactory);
> >
> > /**
> > * Returns the number of bytes scheduled to be written
> > @@ -434,21 +190,16 @@
> > int getScheduledWriteMessages();
> >
> > /**
> > - * Writes the specified {@code message} to all the {@link
> > IoSession}s
> > - * managed by this service. This method is a convenience
> > shortcut for
> > - * {@link IoUtil#broadcast(Object, Collection)}.
> > + * Returns the IoServiceIdleState for this service.
> > + *
> > + * @return The idle state object for this service.
> > */
> > - Set<WriteFuture> broadcast(Object message);
> > + IoServiceIdleState getIdleState();
> >
> > /**
> > - * Returns the {@link IoSessionDataStructureFactory} that
> > provides
> > - * related data structures for a new session created by this
> > service.
> > + * Returns the IoServiceStatistics object for this service.
> > + *
> > + * @return The statistics object for this service.
> > */
> > - IoSessionDataStructureFactory getSessionDataStructureFactory();
> > -
> > - /**
> > - * Sets the {@link IoSessionDataStructureFactory} that provides
> > - * related data structures for a new session created by this
> > service.
> > - */
> > - void
> > setSessionDataStructureFactory(IoSessionDataStructureFactory
> > sessionDataStructureFactory);
> > + IoServiceStatistics getStatistics();
> > }
> >
> > Added:
> > mina/trunk/core/src/main/java/org/apache/mina/core/service/IoServiceIdleState.java
> > URL:
> > http://svn.apache.org/viewvc/mina/trunk/core/src/main/java/org/apache/mina/core/service/IoServiceIdleState.java?rev=677580&view=auto
> > ==============================================================================
> > ---
> > mina/trunk/core/src/main/java/org/apache/mina/core/service/IoServiceIdleState.java
> > (added) +++
> > mina/trunk/core/src/main/java/org/apache/mina/core/service/IoServiceIdleState.java
> > Thu Jul 17 06:27:07 2008 @@ -0,0 +1,175 @@ +/*
> > + * Licensed to the Apache Software Foundation (ASF) under one
> > + * or more contributor license agreements. See the NOTICE file
> > + * distributed with this work for additional information
> > + * regarding copyright ownership. The ASF licenses this file
> > + * to you under the Apache License, Version 2.0 (the
> > + * "License"); you may not use this file except in compliance
> > + * with the License. You may obtain a copy of the License at
> > + *
> > + * http://www.apache.org/licenses/LICENSE-2.0
> > + *
> > + * Unless required by applicable law or agreed to in writing,
> > + * software distributed under the License is distributed on an
> > + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
> > + * KIND, either express or implied. See the License for the
> > + * specific language governing permissions and limitations
> > + * under the License.
> > + *
> > + */
> > +package org.apache.mina.core.service;
> > +
> > +import org.apache.mina.core.session.IdleStatus;
> > +
> > +/**
> > + * Gives access to the idle state information for an IoService.
> > + *
> > + * @author The Apache MINA Project (dev@mina.apache.org)
> > + * @since 2.0-M3
> > + */
> > +public interface IoServiceIdleState {
> > +
> > + /**
> > + * Returns <code>true</code> if this service is idle for the
> > specified
> > + * {@link IdleStatus}.
> > + */
> > + boolean isIdle(IdleStatus status);
> > +
> > + /**
> > + * Returns <code>true</code> if this service is {@link
> > IdleStatus#READER_IDLE}.
> > + * @see #isIdle(IdleStatus)
> > + */
> > + boolean isReaderIdle();
> > +
> > + /**
> > + * Returns <code>true</code> if this service is {@link
> > IdleStatus#WRITER_IDLE}.
> > + * @see #isIdle(IdleStatus)
> > + */
> > + boolean isWriterIdle();
> > +
> > + /**
> > + * Returns <code>true</code> if this service is {@link
> > IdleStatus#BOTH_IDLE}.
> > + * @see #isIdle(IdleStatus)
> > + */
> > + boolean isBothIdle();
> > +
> > + /**
> > + * Returns the number of the fired continuous
> > <tt>serviceIdle</tt> events
> > + * for the specified {@link IdleStatus}.
> > + * <p/>
> > + * If <tt>serviceIdle</tt> event is fired first after some
> > time after I/O,
> > + * <tt>idleCount</tt> becomes <tt>1</tt>. <tt>idleCount</tt>
> > resets to
> > + * <tt>0</tt> if any I/O occurs again, otherwise it increases
> > to
> > + * <tt>2</tt> and so on if <tt>serviceIdle</tt> event is fired
> > again without
> > + * any I/O between two (or more) <tt>serviceIdle</tt> events.
> > + */
> > + int getIdleCount(IdleStatus status);
> > +
> > + /**
> > + * Returns the number of the fired continuous
> > <tt>serviceIdle</tt> events
> > + * for {@link IdleStatus#READER_IDLE}.
> > + * @see #getIdleCount(IdleStatus)
> > + */
> > + int getReaderIdleCount();
> > +
> > + /**
> > + * Returns the number of the fired continuous
> > <tt>serviceIdle</tt> events
> > + * for {@link IdleStatus#WRITER_IDLE}.
> > + * @see #getIdleCount(IdleStatus)
> > + */
> > + int getWriterIdleCount();
> > +
> > + /**
> > + * Returns the number of the fired continuous
> > <tt>serviceIdle</tt> events
> > + * for {@link IdleStatus#BOTH_IDLE}.
> > + * @see #getIdleCount(IdleStatus)
> > + */
> > + int getBothIdleCount();
> > +
> > + /**
> > + * Returns the time in milliseconds when the last
> > <tt>serviceIdle</tt> event
> > + * is fired for the specified {@link IdleStatus}.
> > + */
> > + long getLastIdleTime(IdleStatus status);
> > +
> > + /**
> > + * Returns the time in milliseconds when the last
> > <tt>serviceIdle</tt> event
> > + * is fired for {@link IdleStatus#READER_IDLE}.
> > + * @see #getLastIdleTime(IdleStatus)
> > + */
> > + long getLastReaderIdleTime();
> > +
> > + /**
> > + * Returns the time in milliseconds when the last
> > <tt>serviceIdle</tt> event
> > + * is fired for {@link IdleStatus#WRITER_IDLE}.
> > + * @see #getLastIdleTime(IdleStatus)
> > + */
> > + long getLastWriterIdleTime();
> > +
> > + /**
> > + * Returns the time in milliseconds when the last
> > <tt>serviceIdle</tt> event
> > + * is fired for {@link IdleStatus#BOTH_IDLE}.
> > + * @see #getLastIdleTime(IdleStatus)
> > + */
> > + long getLastBothIdleTime();
> > +
> > + /**
> > + * Returns idle time for the specified type of idleness in
> > seconds.
> > + */
> > + int getIdleTime(IdleStatus status);
> > +
> > + /**
> > + * Returns idle time for the specified type of idleness in
> > milliseconds.
> > + */
> > + long getIdleTimeInMillis(IdleStatus status);
> > +
> > + /**
> > + * Sets idle time for the specified type of idleness in
> > seconds.
> > + */
> > + void setIdleTime(IdleStatus status, int idleTime);
> > +
> > + /**
> > + * Returns idle time for {@link IdleStatus#READER_IDLE} in
> > seconds.
> > + */
> > + int getReaderIdleTime();
> > +
> > + /**
> > + * Returns idle time for {@link IdleStatus#READER_IDLE} in
> > milliseconds.
> > + */
> > + long getReaderIdleTimeInMillis();
> > +
> > + /**
> > + * Sets idle time for {@link IdleStatus#READER_IDLE} in
> > seconds.
> > + */
> > + void setReaderIdleTime(int idleTime);
> > +
> > + /**
> > + * Returns idle time for {@link IdleStatus#WRITER_IDLE} in
> > seconds.
> > + */
> > + int getWriterIdleTime();
> > +
> > + /**
> > + * Returns idle time for {@link IdleStatus#WRITER_IDLE} in
> > milliseconds.
> > + */
> > + long getWriterIdleTimeInMillis();
> > +
> > + /**
> > + * Sets idle time for {@link IdleStatus#WRITER_IDLE} in
> > seconds.
> > + */
> > + void setWriterIdleTime(int idleTime);
> > +
> > + /**
> > + * Returns idle time for {@link IdleStatus#BOTH_IDLE} in
> > seconds.
> > + */
> > + int getBothIdleTime();
> > +
> > + /**
> > + * Returns idle time for {@link IdleStatus#BOTH_IDLE} in
> > milliseconds.
> > + */
> > + long getBothIdleTimeInMillis();
> > +
> > + /**
> > + * Sets idle time for {@link IdleStatus#WRITER_IDLE} in
> > seconds.
> > + */
> > + void setBothIdleTime(int idleTime);
> > +}
> > \ No newline at end of file
> >
> > Added:
> > mina/trunk/core/src/main/java/org/apache/mina/core/service/IoServiceStatistics.java
> > URL:
> > http://svn.apache.org/viewvc/mina/trunk/core/src/main/java/org/apache/mina/core/service/IoServiceStatistics.java?rev=677580&view=auto
> > ==============================================================================
> > ---
> > mina/trunk/core/src/main/java/org/apache/mina/core/service/IoServiceStatistics.java
> > (added) +++
> > mina/trunk/core/src/main/java/org/apache/mina/core/service/IoServiceStatistics.java
> > Thu Jul 17 06:27:07 2008 @@ -0,0 +1,145 @@ +/*
> > + * Licensed to the Apache Software Foundation (ASF) under one
> > + * or more contributor license agreements. See the NOTICE file
> > + * distributed with this work for additional information
> > + * regarding copyright ownership. The ASF licenses this file
> > + * to you under the Apache License, Version 2.0 (the
> > + * "License"); you may not use this file except in compliance
> > + * with the License. You may obtain a copy of the License at
> > + *
> > + * http://www.apache.org/licenses/LICENSE-2.0
> > + *
> > + * Unless required by applicable law or agreed to in writing,
> > + * software distributed under the License is distributed on an
> > + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
> > + * KIND, either express or implied. See the License for the
> > + * specific language governing permissions and limitations
> > + * under the License.
> > + *
> > + */
> > +package org.apache.mina.core.service;
> > +
> > +/**
> > + * Provides usage statistics for an IoService.
> > + *
> > + * @author The Apache MINA Project (dev@mina.apache.org)
> > + */
> > +public interface IoServiceStatistics {
> > + /**
> > + * Returns the maximum number of sessions which were being
> > managed at the
> > + * same time.
> > + */
> > + int getLargestManagedSessionCount();
> > +
> > + /**
> > + * 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'.
> > + */
> > + long getCumulativeManagedSessionCount();
> > +
> > + /**
> > + * Returns the time in millis when I/O occurred lastly.
> > + */
> > + long getLastIoTime();
> > +
> > + /**
> > + * Returns the time in millis when read operation occurred
> > lastly.
> > + */
> > + long getLastReadTime();
> > +
> > + /**
> > + * Returns the time in millis when write operation occurred
> > lastly.
> > + */
> > + long getLastWriteTime();
> > +
> > + /**
> > + * Returns the number of bytes read by this service
> > + *
> > + * @return
> > + * The number of bytes this service has read
> > + */
> > + long getReadBytes();
> > +
> > + /**
> > + * Returns the number of bytes written out by this service
> > + *
> > + * @return
> > + * The number of bytes this service has written
> > + */
> > + long getWrittenBytes();
> > +
> > + /**
> > + * Returns the number of messages this services has read
> > + *
> > + * @return
> > + * The number of messages this services has read
> > + */
> > + long getReadMessages();
> > +
> > + /**
> > + * Returns the number of messages this service has written
> > + *
> > + * @return
> > + * The number of messages this service has written
> > + */
> > + long getWrittenMessages();
> > +
> > + /**
> > + * Returns the number of read bytes per second.
> > + */
> > + double getReadBytesThroughput();
> > +
> > + /**
> > + * Returns the number of written bytes per second.
> > + */
> > + double getWrittenBytesThroughput();
> > +
> > + /**
> > + * Returns the number of read messages per second.
> > + */
> > + double getReadMessagesThroughput();
> > +
> > + /**
> > + * Returns the number of written messages per second.
> > + */
> > + double getWrittenMessagesThroughput();
> > +
> > + /**
> > + * Returns the maximum of the {@link #getReadBytesThroughput()
> > readBytesThroughput}.
> > + */
> > + double getLargestReadBytesThroughput();
> > +
> > + /**
> > + * Returns the maximum of the {@link
> > #getWrittenBytesThroughput() writtenBytesThroughput}.
> > + */
> > + double getLargestWrittenBytesThroughput();
> > +
> > + /**
> > + * Returns the maximum of the {@link
> > #getReadMessagesThroughput() readMessagesThroughput}.
> > + */
> > + double getLargestReadMessagesThroughput();
> > +
> > + /**
> > + * Returns the maximum of the {@link
> > #getWrittenMessagesThroughput() writtenMessagesThroughput}.
> > + */
> > + double getLargestWrittenMessagesThroughput();
> > +
> > + /**
> > + * Returns the interval (seconds) between each throughput
> > calculation.
> > + * The default value is <tt>3</tt> seconds.
> > + */
> > + int getThroughputCalculationInterval();
> > +
> > + /**
> > + * Returns the interval (milliseconds) between each throughput
> > calculation.
> > + * The default value is <tt>3</tt> seconds.
> > + */
> > + long getThroughputCalculationIntervalInMillis();
> > +
> > + /**
> > + * Sets the interval (seconds) between each throughput
> > calculation. The
> > + * default value is <tt>3</tt> seconds.
> > + */
> > + void setThroughputCalculationInterval(int
> > throughputCalculationInterval); +}
> >
> >
> >
Re: svn commit: r677580 - in /mina/trunk/core/src/main/java/org/apache/mina/core/service: AbstractIoService.java IoService.java IoServiceIdleState.java IoServiceStatistics.java
Posted by Niklas Gustavsson <ni...@protocol7.com>.
Since I haven't set up the email notifications yet, I'll have to do it
by hand :-)
This patch broke the build:
http://hudson.zones.apache.org/hudson/view/MINA/job/MINA-trunk/8/org.apache.mina$mina-example/console
I don't have the time to fix it right now but will do it tomorrow if
not someone else beats me to it.
/niklas
On Thu, Jul 17, 2008 at 3:27 PM, <el...@apache.org> wrote:
> Author: elecharny
> Date: Thu Jul 17 06:27:07 2008
> New Revision: 677580
>
> URL: http://svn.apache.org/viewvc?rev=677580&view=rev
> Log:
> Applied patch for DIRMINA-608 provided by Barend
>
> Added:
> mina/trunk/core/src/main/java/org/apache/mina/core/service/IoServiceIdleState.java
> mina/trunk/core/src/main/java/org/apache/mina/core/service/IoServiceStatistics.java
> Modified:
> mina/trunk/core/src/main/java/org/apache/mina/core/service/AbstractIoService.java
> mina/trunk/core/src/main/java/org/apache/mina/core/service/IoService.java
>
> Modified: mina/trunk/core/src/main/java/org/apache/mina/core/service/AbstractIoService.java
> URL: http://svn.apache.org/viewvc/mina/trunk/core/src/main/java/org/apache/mina/core/service/AbstractIoService.java?rev=677580&r1=677579&r2=677580&view=diff
> ==============================================================================
> --- mina/trunk/core/src/main/java/org/apache/mina/core/service/AbstractIoService.java (original)
> +++ mina/trunk/core/src/main/java/org/apache/mina/core/service/AbstractIoService.java Thu Jul 17 06:27:07 2008
> @@ -61,7 +61,7 @@
> * @author The Apache MINA Project (dev@mina.apache.org)
> * @version $Rev$, $Date$
> */
> -public abstract class AbstractIoService implements IoService {
> +public abstract class AbstractIoService implements IoService, IoServiceStatistics, IoServiceIdleState {
> /**
> * The unique number identifying the Service. It's incremented
> * for each new IoService created.
> @@ -433,6 +433,20 @@
> /**
> * {@inheritDoc}
> */
> + public IoServiceIdleState getIdleState() {
> + return this;
> + }
> +
> + /**
> + * {@inheritDoc}
> + */
> + public IoServiceStatistics getStatistics() {
> + return this;
> + }
> +
> + /**
> + * {@inheritDoc}
> + */
> public final long getReadBytes() {
> return readBytes.get();
> }
>
> Modified: mina/trunk/core/src/main/java/org/apache/mina/core/service/IoService.java
> URL: http://svn.apache.org/viewvc/mina/trunk/core/src/main/java/org/apache/mina/core/service/IoService.java?rev=677580&r1=677579&r2=677580&view=diff
> ==============================================================================
> --- mina/trunk/core/src/main/java/org/apache/mina/core/service/IoService.java (original)
> +++ mina/trunk/core/src/main/java/org/apache/mina/core/service/IoService.java Thu Jul 17 06:27:07 2008
> @@ -28,7 +28,6 @@
> import org.apache.mina.core.filterchain.IoFilterChain;
> import org.apache.mina.core.filterchain.IoFilterChainBuilder;
> import org.apache.mina.core.future.WriteFuture;
> -import org.apache.mina.core.session.IdleStatus;
> import org.apache.mina.core.session.IoSession;
> import org.apache.mina.core.session.IoSessionConfig;
> import org.apache.mina.core.session.IoSessionDataStructureFactory;
> @@ -104,19 +103,6 @@
> int getManagedSessionCount();
>
> /**
> - * Returns the maximum number of sessions which were being managed at the
> - * same time.
> - */
> - int getLargestManagedSessionCount();
> -
> - /**
> - * 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'.
> - */
> - long getCumulativeManagedSessionCount();
> -
> - /**
> * Returns the default configuration of the new {@link IoSession}s
> * created by this service.
> */
> @@ -169,253 +155,23 @@
> long getActivationTime();
>
> /**
> - * Returns the time in millis when I/O occurred lastly.
> - */
> - long getLastIoTime();
> -
> - /**
> - * Returns the time in millis when read operation occurred lastly.
> - */
> - long getLastReadTime();
> -
> - /**
> - * Returns the time in millis when write operation occurred lastly.
> - */
> - long getLastWriteTime();
> -
> - /**
> - * Returns <code>true</code> if this service is idle for the specified
> - * {@link IdleStatus}.
> - */
> - boolean isIdle(IdleStatus status);
> -
> - /**
> - * Returns <code>true</code> if this service is {@link IdleStatus#READER_IDLE}.
> - * @see #isIdle(IdleStatus)
> - */
> - boolean isReaderIdle();
> -
> - /**
> - * Returns <code>true</code> if this service is {@link IdleStatus#WRITER_IDLE}.
> - * @see #isIdle(IdleStatus)
> - */
> - boolean isWriterIdle();
> -
> - /**
> - * Returns <code>true</code> if this service is {@link IdleStatus#BOTH_IDLE}.
> - * @see #isIdle(IdleStatus)
> - */
> - boolean isBothIdle();
> -
> - /**
> - * Returns the number of the fired continuous <tt>serviceIdle</tt> events
> - * for the specified {@link IdleStatus}.
> - * <p/>
> - * If <tt>serviceIdle</tt> event is fired first after some time after I/O,
> - * <tt>idleCount</tt> becomes <tt>1</tt>. <tt>idleCount</tt> resets to
> - * <tt>0</tt> if any I/O occurs again, otherwise it increases to
> - * <tt>2</tt> and so on if <tt>serviceIdle</tt> event is fired again without
> - * any I/O between two (or more) <tt>serviceIdle</tt> events.
> - */
> - int getIdleCount(IdleStatus status);
> -
> - /**
> - * Returns the number of the fired continuous <tt>serviceIdle</tt> events
> - * for {@link IdleStatus#READER_IDLE}.
> - * @see #getIdleCount(IdleStatus)
> - */
> - int getReaderIdleCount();
> -
> - /**
> - * Returns the number of the fired continuous <tt>serviceIdle</tt> events
> - * for {@link IdleStatus#WRITER_IDLE}.
> - * @see #getIdleCount(IdleStatus)
> - */
> - int getWriterIdleCount();
> -
> - /**
> - * Returns the number of the fired continuous <tt>serviceIdle</tt> events
> - * for {@link IdleStatus#BOTH_IDLE}.
> - * @see #getIdleCount(IdleStatus)
> - */
> - int getBothIdleCount();
> -
> - /**
> - * Returns the time in milliseconds when the last <tt>serviceIdle</tt> event
> - * is fired for the specified {@link IdleStatus}.
> - */
> - long getLastIdleTime(IdleStatus status);
> -
> - /**
> - * Returns the time in milliseconds when the last <tt>serviceIdle</tt> event
> - * is fired for {@link IdleStatus#READER_IDLE}.
> - * @see #getLastIdleTime(IdleStatus)
> - */
> - long getLastReaderIdleTime();
> -
> - /**
> - * Returns the time in milliseconds when the last <tt>serviceIdle</tt> event
> - * is fired for {@link IdleStatus#WRITER_IDLE}.
> - * @see #getLastIdleTime(IdleStatus)
> - */
> - long getLastWriterIdleTime();
> -
> - /**
> - * Returns the time in milliseconds when the last <tt>serviceIdle</tt> event
> - * is fired for {@link IdleStatus#BOTH_IDLE}.
> - * @see #getLastIdleTime(IdleStatus)
> - */
> - long getLastBothIdleTime();
> -
> - /**
> - * Returns idle time for the specified type of idleness in seconds.
> - */
> - int getIdleTime(IdleStatus status);
> -
> - /**
> - * Returns idle time for the specified type of idleness in milliseconds.
> - */
> - long getIdleTimeInMillis(IdleStatus status);
> -
> - /**
> - * Sets idle time for the specified type of idleness in seconds.
> - */
> - void setIdleTime(IdleStatus status, int idleTime);
> -
> - /**
> - * Returns idle time for {@link IdleStatus#READER_IDLE} in seconds.
> - */
> - int getReaderIdleTime();
> -
> - /**
> - * Returns idle time for {@link IdleStatus#READER_IDLE} in milliseconds.
> - */
> - long getReaderIdleTimeInMillis();
> -
> - /**
> - * Sets idle time for {@link IdleStatus#READER_IDLE} in seconds.
> - */
> - void setReaderIdleTime(int idleTime);
> -
> - /**
> - * Returns idle time for {@link IdleStatus#WRITER_IDLE} in seconds.
> - */
> - int getWriterIdleTime();
> -
> - /**
> - * Returns idle time for {@link IdleStatus#WRITER_IDLE} in milliseconds.
> - */
> - long getWriterIdleTimeInMillis();
> -
> - /**
> - * Sets idle time for {@link IdleStatus#WRITER_IDLE} in seconds.
> - */
> - void setWriterIdleTime(int idleTime);
> -
> - /**
> - * Returns idle time for {@link IdleStatus#BOTH_IDLE} in seconds.
> - */
> - int getBothIdleTime();
> -
> - /**
> - * Returns idle time for {@link IdleStatus#BOTH_IDLE} in milliseconds.
> - */
> - long getBothIdleTimeInMillis();
> -
> - /**
> - * Sets idle time for {@link IdleStatus#WRITER_IDLE} in seconds.
> - */
> - void setBothIdleTime(int idleTime);
> -
> - /**
> - * Returns the number of bytes read by this service
> - *
> - * @return
> - * The number of bytes this service has read
> - */
> - long getReadBytes();
> -
> - /**
> - * Returns the number of bytes written out by this service
> - *
> - * @return
> - * The number of bytes this service has written
> - */
> - long getWrittenBytes();
> -
> - /**
> - * Returns the number of messages this services has read
> - *
> - * @return
> - * The number of messages this services has read
> - */
> - long getReadMessages();
> -
> - /**
> - * Returns the number of messages this service has written
> - *
> - * @return
> - * The number of messages this service has written
> - */
> - long getWrittenMessages();
> -
> - /**
> - * Returns the number of read bytes per second.
> - */
> - double getReadBytesThroughput();
> -
> - /**
> - * Returns the number of written bytes per second.
> - */
> - double getWrittenBytesThroughput();
> -
> - /**
> - * Returns the number of read messages per second.
> - */
> - double getReadMessagesThroughput();
> -
> - /**
> - * Returns the number of written messages per second.
> - */
> - double getWrittenMessagesThroughput();
> -
> - /**
> - * Returns the maximum of the {@link #getReadBytesThroughput() readBytesThroughput}.
> - */
> - double getLargestReadBytesThroughput();
> -
> - /**
> - * Returns the maximum of the {@link #getWrittenBytesThroughput() writtenBytesThroughput}.
> - */
> - double getLargestWrittenBytesThroughput();
> -
> - /**
> - * Returns the maximum of the {@link #getReadMessagesThroughput() readMessagesThroughput}.
> - */
> - double getLargestReadMessagesThroughput();
> -
> - /**
> - * Returns the maximum of the {@link #getWrittenMessagesThroughput() writtenMessagesThroughput}.
> - */
> - double getLargestWrittenMessagesThroughput();
> -
> - /**
> - * Returns the interval (seconds) between each throughput calculation.
> - * The default value is <tt>3</tt> seconds.
> + * Writes the specified {@code message} to all the {@link IoSession}s
> + * managed by this service. This method is a convenience shortcut for
> + * {@link IoUtil#broadcast(Object, Collection)}.
> */
> - int getThroughputCalculationInterval();
> + Set<WriteFuture> broadcast(Object message);
>
> /**
> - * Returns the interval (milliseconds) between each throughput calculation.
> - * The default value is <tt>3</tt> seconds.
> + * Returns the {@link IoSessionDataStructureFactory} that provides
> + * related data structures for a new session created by this service.
> */
> - long getThroughputCalculationIntervalInMillis();
> + IoSessionDataStructureFactory getSessionDataStructureFactory();
>
> /**
> - * Sets the interval (seconds) between each throughput calculation. The
> - * default value is <tt>3</tt> seconds.
> + * Sets the {@link IoSessionDataStructureFactory} that provides
> + * related data structures for a new session created by this service.
> */
> - void setThroughputCalculationInterval(int throughputCalculationInterval);
> + void setSessionDataStructureFactory(IoSessionDataStructureFactory sessionDataStructureFactory);
>
> /**
> * Returns the number of bytes scheduled to be written
> @@ -434,21 +190,16 @@
> int getScheduledWriteMessages();
>
> /**
> - * Writes the specified {@code message} to all the {@link IoSession}s
> - * managed by this service. This method is a convenience shortcut for
> - * {@link IoUtil#broadcast(Object, Collection)}.
> + * Returns the IoServiceIdleState for this service.
> + *
> + * @return The idle state object for this service.
> */
> - Set<WriteFuture> broadcast(Object message);
> + IoServiceIdleState getIdleState();
>
> /**
> - * Returns the {@link IoSessionDataStructureFactory} that provides
> - * related data structures for a new session created by this service.
> + * Returns the IoServiceStatistics object for this service.
> + *
> + * @return The statistics object for this service.
> */
> - IoSessionDataStructureFactory getSessionDataStructureFactory();
> -
> - /**
> - * Sets the {@link IoSessionDataStructureFactory} that provides
> - * related data structures for a new session created by this service.
> - */
> - void setSessionDataStructureFactory(IoSessionDataStructureFactory sessionDataStructureFactory);
> + IoServiceStatistics getStatistics();
> }
>
> Added: mina/trunk/core/src/main/java/org/apache/mina/core/service/IoServiceIdleState.java
> URL: http://svn.apache.org/viewvc/mina/trunk/core/src/main/java/org/apache/mina/core/service/IoServiceIdleState.java?rev=677580&view=auto
> ==============================================================================
> --- mina/trunk/core/src/main/java/org/apache/mina/core/service/IoServiceIdleState.java (added)
> +++ mina/trunk/core/src/main/java/org/apache/mina/core/service/IoServiceIdleState.java Thu Jul 17 06:27:07 2008
> @@ -0,0 +1,175 @@
> +/*
> + * Licensed to the Apache Software Foundation (ASF) under one
> + * or more contributor license agreements. See the NOTICE file
> + * distributed with this work for additional information
> + * regarding copyright ownership. The ASF licenses this file
> + * to you under the Apache License, Version 2.0 (the
> + * "License"); you may not use this file except in compliance
> + * with the License. You may obtain a copy of the License at
> + *
> + * http://www.apache.org/licenses/LICENSE-2.0
> + *
> + * Unless required by applicable law or agreed to in writing,
> + * software distributed under the License is distributed on an
> + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
> + * KIND, either express or implied. See the License for the
> + * specific language governing permissions and limitations
> + * under the License.
> + *
> + */
> +package org.apache.mina.core.service;
> +
> +import org.apache.mina.core.session.IdleStatus;
> +
> +/**
> + * Gives access to the idle state information for an IoService.
> + *
> + * @author The Apache MINA Project (dev@mina.apache.org)
> + * @since 2.0-M3
> + */
> +public interface IoServiceIdleState {
> +
> + /**
> + * Returns <code>true</code> if this service is idle for the specified
> + * {@link IdleStatus}.
> + */
> + boolean isIdle(IdleStatus status);
> +
> + /**
> + * Returns <code>true</code> if this service is {@link IdleStatus#READER_IDLE}.
> + * @see #isIdle(IdleStatus)
> + */
> + boolean isReaderIdle();
> +
> + /**
> + * Returns <code>true</code> if this service is {@link IdleStatus#WRITER_IDLE}.
> + * @see #isIdle(IdleStatus)
> + */
> + boolean isWriterIdle();
> +
> + /**
> + * Returns <code>true</code> if this service is {@link IdleStatus#BOTH_IDLE}.
> + * @see #isIdle(IdleStatus)
> + */
> + boolean isBothIdle();
> +
> + /**
> + * Returns the number of the fired continuous <tt>serviceIdle</tt> events
> + * for the specified {@link IdleStatus}.
> + * <p/>
> + * If <tt>serviceIdle</tt> event is fired first after some time after I/O,
> + * <tt>idleCount</tt> becomes <tt>1</tt>. <tt>idleCount</tt> resets to
> + * <tt>0</tt> if any I/O occurs again, otherwise it increases to
> + * <tt>2</tt> and so on if <tt>serviceIdle</tt> event is fired again without
> + * any I/O between two (or more) <tt>serviceIdle</tt> events.
> + */
> + int getIdleCount(IdleStatus status);
> +
> + /**
> + * Returns the number of the fired continuous <tt>serviceIdle</tt> events
> + * for {@link IdleStatus#READER_IDLE}.
> + * @see #getIdleCount(IdleStatus)
> + */
> + int getReaderIdleCount();
> +
> + /**
> + * Returns the number of the fired continuous <tt>serviceIdle</tt> events
> + * for {@link IdleStatus#WRITER_IDLE}.
> + * @see #getIdleCount(IdleStatus)
> + */
> + int getWriterIdleCount();
> +
> + /**
> + * Returns the number of the fired continuous <tt>serviceIdle</tt> events
> + * for {@link IdleStatus#BOTH_IDLE}.
> + * @see #getIdleCount(IdleStatus)
> + */
> + int getBothIdleCount();
> +
> + /**
> + * Returns the time in milliseconds when the last <tt>serviceIdle</tt> event
> + * is fired for the specified {@link IdleStatus}.
> + */
> + long getLastIdleTime(IdleStatus status);
> +
> + /**
> + * Returns the time in milliseconds when the last <tt>serviceIdle</tt> event
> + * is fired for {@link IdleStatus#READER_IDLE}.
> + * @see #getLastIdleTime(IdleStatus)
> + */
> + long getLastReaderIdleTime();
> +
> + /**
> + * Returns the time in milliseconds when the last <tt>serviceIdle</tt> event
> + * is fired for {@link IdleStatus#WRITER_IDLE}.
> + * @see #getLastIdleTime(IdleStatus)
> + */
> + long getLastWriterIdleTime();
> +
> + /**
> + * Returns the time in milliseconds when the last <tt>serviceIdle</tt> event
> + * is fired for {@link IdleStatus#BOTH_IDLE}.
> + * @see #getLastIdleTime(IdleStatus)
> + */
> + long getLastBothIdleTime();
> +
> + /**
> + * Returns idle time for the specified type of idleness in seconds.
> + */
> + int getIdleTime(IdleStatus status);
> +
> + /**
> + * Returns idle time for the specified type of idleness in milliseconds.
> + */
> + long getIdleTimeInMillis(IdleStatus status);
> +
> + /**
> + * Sets idle time for the specified type of idleness in seconds.
> + */
> + void setIdleTime(IdleStatus status, int idleTime);
> +
> + /**
> + * Returns idle time for {@link IdleStatus#READER_IDLE} in seconds.
> + */
> + int getReaderIdleTime();
> +
> + /**
> + * Returns idle time for {@link IdleStatus#READER_IDLE} in milliseconds.
> + */
> + long getReaderIdleTimeInMillis();
> +
> + /**
> + * Sets idle time for {@link IdleStatus#READER_IDLE} in seconds.
> + */
> + void setReaderIdleTime(int idleTime);
> +
> + /**
> + * Returns idle time for {@link IdleStatus#WRITER_IDLE} in seconds.
> + */
> + int getWriterIdleTime();
> +
> + /**
> + * Returns idle time for {@link IdleStatus#WRITER_IDLE} in milliseconds.
> + */
> + long getWriterIdleTimeInMillis();
> +
> + /**
> + * Sets idle time for {@link IdleStatus#WRITER_IDLE} in seconds.
> + */
> + void setWriterIdleTime(int idleTime);
> +
> + /**
> + * Returns idle time for {@link IdleStatus#BOTH_IDLE} in seconds.
> + */
> + int getBothIdleTime();
> +
> + /**
> + * Returns idle time for {@link IdleStatus#BOTH_IDLE} in milliseconds.
> + */
> + long getBothIdleTimeInMillis();
> +
> + /**
> + * Sets idle time for {@link IdleStatus#WRITER_IDLE} in seconds.
> + */
> + void setBothIdleTime(int idleTime);
> +}
> \ No newline at end of file
>
> Added: mina/trunk/core/src/main/java/org/apache/mina/core/service/IoServiceStatistics.java
> URL: http://svn.apache.org/viewvc/mina/trunk/core/src/main/java/org/apache/mina/core/service/IoServiceStatistics.java?rev=677580&view=auto
> ==============================================================================
> --- mina/trunk/core/src/main/java/org/apache/mina/core/service/IoServiceStatistics.java (added)
> +++ mina/trunk/core/src/main/java/org/apache/mina/core/service/IoServiceStatistics.java Thu Jul 17 06:27:07 2008
> @@ -0,0 +1,145 @@
> +/*
> + * Licensed to the Apache Software Foundation (ASF) under one
> + * or more contributor license agreements. See the NOTICE file
> + * distributed with this work for additional information
> + * regarding copyright ownership. The ASF licenses this file
> + * to you under the Apache License, Version 2.0 (the
> + * "License"); you may not use this file except in compliance
> + * with the License. You may obtain a copy of the License at
> + *
> + * http://www.apache.org/licenses/LICENSE-2.0
> + *
> + * Unless required by applicable law or agreed to in writing,
> + * software distributed under the License is distributed on an
> + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
> + * KIND, either express or implied. See the License for the
> + * specific language governing permissions and limitations
> + * under the License.
> + *
> + */
> +package org.apache.mina.core.service;
> +
> +/**
> + * Provides usage statistics for an IoService.
> + *
> + * @author The Apache MINA Project (dev@mina.apache.org)
> + */
> +public interface IoServiceStatistics {
> + /**
> + * Returns the maximum number of sessions which were being managed at the
> + * same time.
> + */
> + int getLargestManagedSessionCount();
> +
> + /**
> + * 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'.
> + */
> + long getCumulativeManagedSessionCount();
> +
> + /**
> + * Returns the time in millis when I/O occurred lastly.
> + */
> + long getLastIoTime();
> +
> + /**
> + * Returns the time in millis when read operation occurred lastly.
> + */
> + long getLastReadTime();
> +
> + /**
> + * Returns the time in millis when write operation occurred lastly.
> + */
> + long getLastWriteTime();
> +
> + /**
> + * Returns the number of bytes read by this service
> + *
> + * @return
> + * The number of bytes this service has read
> + */
> + long getReadBytes();
> +
> + /**
> + * Returns the number of bytes written out by this service
> + *
> + * @return
> + * The number of bytes this service has written
> + */
> + long getWrittenBytes();
> +
> + /**
> + * Returns the number of messages this services has read
> + *
> + * @return
> + * The number of messages this services has read
> + */
> + long getReadMessages();
> +
> + /**
> + * Returns the number of messages this service has written
> + *
> + * @return
> + * The number of messages this service has written
> + */
> + long getWrittenMessages();
> +
> + /**
> + * Returns the number of read bytes per second.
> + */
> + double getReadBytesThroughput();
> +
> + /**
> + * Returns the number of written bytes per second.
> + */
> + double getWrittenBytesThroughput();
> +
> + /**
> + * Returns the number of read messages per second.
> + */
> + double getReadMessagesThroughput();
> +
> + /**
> + * Returns the number of written messages per second.
> + */
> + double getWrittenMessagesThroughput();
> +
> + /**
> + * Returns the maximum of the {@link #getReadBytesThroughput() readBytesThroughput}.
> + */
> + double getLargestReadBytesThroughput();
> +
> + /**
> + * Returns the maximum of the {@link #getWrittenBytesThroughput() writtenBytesThroughput}.
> + */
> + double getLargestWrittenBytesThroughput();
> +
> + /**
> + * Returns the maximum of the {@link #getReadMessagesThroughput() readMessagesThroughput}.
> + */
> + double getLargestReadMessagesThroughput();
> +
> + /**
> + * Returns the maximum of the {@link #getWrittenMessagesThroughput() writtenMessagesThroughput}.
> + */
> + double getLargestWrittenMessagesThroughput();
> +
> + /**
> + * Returns the interval (seconds) between each throughput calculation.
> + * The default value is <tt>3</tt> seconds.
> + */
> + int getThroughputCalculationInterval();
> +
> + /**
> + * Returns the interval (milliseconds) between each throughput calculation.
> + * The default value is <tt>3</tt> seconds.
> + */
> + long getThroughputCalculationIntervalInMillis();
> +
> + /**
> + * Sets the interval (seconds) between each throughput calculation. The
> + * default value is <tt>3</tt> seconds.
> + */
> + void setThroughputCalculationInterval(int throughputCalculationInterval);
> +}
>
>
>