directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jvermill...@apache.org
Subject svn commit: r441462 - in /directory/trunks/mina/core/src/main/java/org/apache/mina/management: IoSessionStat.java StatCollector.java
Date Fri, 08 Sep 2006 10:11:02 GMT
Author: jvermillard
Date: Fri Sep  8 03:11:01 2006
New Revision: 441462

URL: http://svn.apache.org/viewvc?view=rev&rev=441462
Log:
 * more javadoc
 * remove all the IoSessionStat from the sessions when the collector is shutdowned

Modified:
    directory/trunks/mina/core/src/main/java/org/apache/mina/management/IoSessionStat.java
    directory/trunks/mina/core/src/main/java/org/apache/mina/management/StatCollector.java

Modified: directory/trunks/mina/core/src/main/java/org/apache/mina/management/IoSessionStat.java
URL: http://svn.apache.org/viewvc/directory/trunks/mina/core/src/main/java/org/apache/mina/management/IoSessionStat.java?view=diff&rev=441462&r1=441461&r2=441462
==============================================================================
--- directory/trunks/mina/core/src/main/java/org/apache/mina/management/IoSessionStat.java
(original)
+++ directory/trunks/mina/core/src/main/java/org/apache/mina/management/IoSessionStat.java
Fri Sep  8 03:11:01 2006
@@ -21,7 +21,12 @@
 
 /**
  * The collected stats for a session. It's used by {@link StatCollector} to attach
- * throughput stats to an {@link IoSession}.
+ * throughput stats to an {@link IoSession}. You can accces a session stat using 
+ * {@link IoSession} getAttribute method :
+ * <pre>
+ * IoSession session = ...
+ * IoSessionStat stat = session.getAttribute( StatCollector.KEY );
+ * </pre>
  * 
  * @author The Apache Directory Project (mina-dev@directory.apache.org)
  * @version $Rev$, $Date$

Modified: directory/trunks/mina/core/src/main/java/org/apache/mina/management/StatCollector.java
URL: http://svn.apache.org/viewvc/directory/trunks/mina/core/src/main/java/org/apache/mina/management/StatCollector.java?view=diff&rev=441462&r1=441461&r2=441462
==============================================================================
--- directory/trunks/mina/core/src/main/java/org/apache/mina/management/StatCollector.java
(original)
+++ directory/trunks/mina/core/src/main/java/org/apache/mina/management/StatCollector.java
Fri Sep  8 03:11:01 2006
@@ -37,6 +37,16 @@
  * IoService. It's attaching a {@link IoSessionStat} object to all the sessions polled
  * and filling the throughput values.
  * 
+ * Usage :
+ * <pre>
+ * IoService service = ...
+ * StatCollector collector = new StatCollector( service );
+ * collector.start();
+ * </pre>
+ * 
+ * By default the {@link Statcollector} is polling the sessions every 5 seconds. You can

+ * give a different polling time using a second constructor.
+ * 
  * @author The Apache Directory Project (mina-dev@directory.apache.org)
  * @version $Rev$, $Date$
  */
@@ -83,7 +93,7 @@
     };
 
     /**
-     * create a stat collector for the given given service with the default polling time

+     * Create a stat collector for the given service with a default polling time of 5 seconds.

      * @param service the IoService to inspect
      */
     public StatCollector( IoService service )
@@ -104,7 +114,8 @@
     }
 
     /**
-     * start collecting stats
+     * Start collecting stats for the {@link IoSession} of the service.
+     * New sessions or destroyed will be automaticly added or removed.
      */
     public void start()
     {
@@ -140,7 +151,8 @@
     }
 
     /**
-     * stop collecting stats
+     * Stop collecting stats. all the {@link IoSessionStat} object will be removed of the
+     * polled session attachements. 
      */
     public void stop()
     {
@@ -163,12 +175,16 @@
                 }
             }
 
+            for (Iterator iter = polledSessions.iterator(); iter.hasNext();) {
+                IoSession session = (IoSession) iter.next();
+                session.removeAttribute(KEY);
+            }
             polledSessions.clear();
         }
     }
 
     /**
-     * is the stat collector collecting
+     * is the stat collector started and polling the {@link IoSession} of the {@link IoService}
      * @return true if started
      */
     public boolean isRunning()



Mime
View raw message