You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mina.apache.org by tr...@apache.org on 2007/11/14 07:45:50 UTC

svn commit: r594785 - in /mina/trunk: core/src/main/java/org/apache/mina/management/ integration-jmx/src/main/java/org/apache/mina/integration/jmx/

Author: trustin
Date: Tue Nov 13 22:45:49 2007
New Revision: 594785

URL: http://svn.apache.org/viewvc?rev=594785&view=rev
Log:
Resolved issue: DIRMINA-449 (Improve current JMX integration code using new statistical properties.)
* Renamed IoSessionStat to IoStatistics because it can be used for IoService too.
* Renamed StatCollector to IoStatisticsCollector
* Renamed many methods for consistent naming aligned with IoSession and IoService
* Changed IoStatisticsCollector to use the performance counters that a service provides to calculate per-service throughput



Added:
    mina/trunk/core/src/main/java/org/apache/mina/management/IoStatistics.java   (with props)
    mina/trunk/core/src/main/java/org/apache/mina/management/IoStatisticsCollector.java
      - copied, changed from r594734, mina/trunk/core/src/main/java/org/apache/mina/management/StatCollector.java
Removed:
    mina/trunk/core/src/main/java/org/apache/mina/management/IoSessionStat.java
    mina/trunk/core/src/main/java/org/apache/mina/management/StatCollector.java
Modified:
    mina/trunk/integration-jmx/src/main/java/org/apache/mina/integration/jmx/IoServiceManager.java
    mina/trunk/integration-jmx/src/main/java/org/apache/mina/integration/jmx/IoServiceManagerMBean.java
    mina/trunk/integration-jmx/src/main/java/org/apache/mina/integration/jmx/IoSessionManager.java
    mina/trunk/integration-jmx/src/main/java/org/apache/mina/integration/jmx/IoSessionManagerMBean.java

Added: mina/trunk/core/src/main/java/org/apache/mina/management/IoStatistics.java
URL: http://svn.apache.org/viewvc/mina/trunk/core/src/main/java/org/apache/mina/management/IoStatistics.java?rev=594785&view=auto
==============================================================================
--- mina/trunk/core/src/main/java/org/apache/mina/management/IoStatistics.java (added)
+++ mina/trunk/core/src/main/java/org/apache/mina/management/IoStatistics.java Tue Nov 13 22:45:49 2007
@@ -0,0 +1,148 @@
+/*
+ *  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.management;
+
+import org.apache.mina.common.IoSession;
+
+/**
+ * The collected stats for a session. It's used by {@link IoStatisticsCollector}
+ * to attach throughput stats to an {@link IoSession}. You can access a session 
+ * stat using {@link IoSession#getAttribute(Object)} method:
+ * <pre>
+ * IoSession session = ...
+ * IoStatistics stat = session.getAttribute( IoStatisticsCollector.STATICTICS );
+ * </pre>
+ *
+ * @author The Apache MINA Project (dev@mina.apache.org)
+ * @version $Rev$, $Date$
+ */
+public class IoStatistics {
+    
+    private long lastReadBytes = 0;
+    private long lastWrittenBytes = 0;
+    private long lastReadMessages = 0;
+    private long lastWrittenMessages = 0;
+    private float byteWriteThroughput = 0;
+    private float byteReadThroughput = 0;
+    private float messageWriteThroughput = 0;
+    private float messageReadThroughput = 0;
+    // last time the session was polled
+    private long lastPollingTime = System.currentTimeMillis();
+
+    /**
+     * Bytes read per second
+     * @return bytes per second
+     */
+    public float getByteReadThroughput() {
+        return byteReadThroughput;
+    }
+
+    /**
+     * Bytes written per second
+     * @return bytes per second
+     */
+    public float getByteWriteThroughput() {
+        return byteWriteThroughput;
+    }
+
+    /**
+     * Messages read per second
+     * @return messages per second
+     */
+    public float getMessageReadThroughput() {
+        return messageReadThroughput;
+    }
+
+    /**
+     * Messages written per second
+     * @return messages per second
+     */
+    public float getMessageWriteThroughput() {
+        return messageWriteThroughput;
+    }
+
+    void setLastReadBytes(long lastReadBytes) {
+        this.lastReadBytes = lastReadBytes;
+    }
+
+    void setLastWrittenBytes(long lastWrittenBytes) {
+        this.lastWrittenBytes = lastWrittenBytes;
+    }
+
+    void setLastReadMessages(long lastReadMessages) {
+        this.lastReadMessages = lastReadMessages;
+    }
+
+    void setLastWrittenMessages(long lastWrittenMessages) {
+        this.lastWrittenMessages = lastWrittenMessages;
+    }
+
+    void setByteWriteThroughput(float byteWriteThroughput) {
+        this.byteWriteThroughput = byteWriteThroughput;
+    }
+
+    void setByteReadThroughput(float byteReadThroughput) {
+        this.byteReadThroughput = byteReadThroughput;
+    }
+
+    void setMessageWriteThroughput(float messageWriteThroughput) {
+        this.messageWriteThroughput = messageWriteThroughput;
+    }
+
+    void setMessageReadThroughput(float messageReadThroughput) {
+        this.messageReadThroughput = messageReadThroughput;
+    }
+
+    /**
+     * used for the StatCollector, last polling value
+     */
+    long getLastReadBytes() {
+        return lastReadBytes;
+    }
+
+    /**
+     * used for the StatCollector, last polling value
+     */
+    long getLastWrittenBytes() {
+        return lastWrittenBytes;
+    }
+
+    /**
+     * used for the StatCollector, last polling value
+     */
+    long getLastReadMessages() {
+        return lastReadMessages;
+    }
+
+    /**
+     * used for the StatCollector, last polling value
+     */
+    long getLastWrittenMessages() {
+        return lastWrittenMessages;
+    }
+
+    long getLastPollingTime() {
+        return lastPollingTime;
+    }
+
+    void setLastPollingTime(long lastPollingTime) {
+        this.lastPollingTime = lastPollingTime;
+    }
+}
\ No newline at end of file

Propchange: mina/trunk/core/src/main/java/org/apache/mina/management/IoStatistics.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: mina/trunk/core/src/main/java/org/apache/mina/management/IoStatistics.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Copied: mina/trunk/core/src/main/java/org/apache/mina/management/IoStatisticsCollector.java (from r594734, mina/trunk/core/src/main/java/org/apache/mina/management/StatCollector.java)
URL: http://svn.apache.org/viewvc/mina/trunk/core/src/main/java/org/apache/mina/management/IoStatisticsCollector.java?p2=mina/trunk/core/src/main/java/org/apache/mina/management/IoStatisticsCollector.java&p1=mina/trunk/core/src/main/java/org/apache/mina/management/StatCollector.java&r1=594734&r2=594785&rev=594785&view=diff
==============================================================================
--- mina/trunk/core/src/main/java/org/apache/mina/management/StatCollector.java (original)
+++ mina/trunk/core/src/main/java/org/apache/mina/management/IoStatisticsCollector.java Tue Nov 13 22:45:49 2007
@@ -19,8 +19,6 @@
  */
 package org.apache.mina.management;
 
-import java.util.Queue;
-import java.util.concurrent.ConcurrentLinkedQueue;
 import java.util.concurrent.atomic.AtomicLong;
 
 import org.apache.mina.common.AttributeKey;
@@ -29,56 +27,37 @@
 import org.apache.mina.common.IoSession;
 
 /**
- * Collects statistics of an {@link IoService}. It's polling all the sessions of a given
- * IoService. It's attaching a {@link IoSessionStat} object to all the sessions polled
- * and filling the throughput values.
+ * Collects statistics of an {@link IoService}. It's polling all the sessions
+ * of a given IoService. It's attaching a {@link IoStatistics} object to all
+ * the sessions polled and filling the throughput values.
  *
  * Usage :
  * <pre>
  * IoService service = ...
- * StatCollector collector = new StatCollector( service );
+ * IoStatisticsCollector collector = new IoStatisticsCollector( 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.
+ * By default the {@link IoStatisticsCollector} is polling the sessions every 5
+ * seconds. You can give a different polling time using a second constructor.
  *
  * @author The Apache MINA Project (dev@mina.apache.org)
  * @version $Rev$, $Date$
  */
-public class StatCollector {
-    /**
-     * The session attribute key for {@link IoSessionStat}.
-     */
-    public static final AttributeKey KEY = new AttributeKey(StatCollector.class, "stat");
+public class IoStatisticsCollector {
+    public static final AttributeKey STATISTICS = 
+        new AttributeKey(IoStatisticsCollector.class, "statistics");
 
-    /**
-     * @noinspection StaticNonFinalField
-     */
     private static volatile int nextId = 0;
 
     private final int id = nextId++;
-
-    private final Object calcLock = new Object();
-
     private final IoService service;
-
-    private Worker worker;
-
     private int pollingInterval = 5000;
+    private Worker worker;
 
-    private Queue<IoSession> polledSessions;
-
-    // resume of session stats, for simplifying acces to the statistics
+    // resume of session stats, for simplifying access to the statistics
     private final AtomicLong totalProcessedSessions = new AtomicLong();
-
-    private float msgWrittenThroughput = 0f;
-
-    private float msgReadThroughput = 0f;
-
-    private float bytesWrittenThroughput = 0f;
-
-    private float bytesReadThroughput = 0f;
+    private final IoStatistics serviceStatistics = new IoStatistics();
 
     private final IoServiceListener serviceListener = new IoServiceListener() {
         public void serviceActivated(IoService service) {
@@ -100,7 +79,7 @@
      * 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) {
+    public IoStatisticsCollector(IoService service) {
         this(service, 5000);
     }
 
@@ -109,7 +88,7 @@
      * @param service the IoService to inspect
      * @param pollingInterval milliseconds
      */
-    public StatCollector(IoService service, int pollingInterval) {
+    public IoStatisticsCollector(IoService service, int pollingInterval) {
         this.service = service;
         this.pollingInterval = pollingInterval;
     }
@@ -124,10 +103,6 @@
                 throw new RuntimeException("Stat collecting already started");
             }
 
-            // add all current sessions
-
-            polledSessions = new ConcurrentLinkedQueue<IoSession>();
-
             for (IoSession ioSession : service.getManagedSessions()) {
                 addSession(ioSession);
             }
@@ -144,7 +119,7 @@
     }
 
     /**
-     * Stop collecting stats. all the {@link IoSessionStat} object will be removed of the
+     * Stop collecting stats. all the {@link IoStatistics} object will be removed of the
      * polled session attachements.
      */
     public void stop() {
@@ -166,10 +141,9 @@
                 }
             }
 
-            for (IoSession session : polledSessions) {
-                session.removeAttribute(KEY);
+            for (IoSession session: service.getManagedSessions()) {
+                session.removeAttribute(STATISTICS);
             }
-            polledSessions.clear();
 
             worker = null;
         }
@@ -186,34 +160,12 @@
     }
 
     private void addSession(IoSession session) {
-        IoSessionStat sessionStats = new IoSessionStat();
-        session.setAttribute(KEY, sessionStats);
+        session.setAttribute(STATISTICS, new IoStatistics());
         totalProcessedSessions.incrementAndGet();
-        polledSessions.add(session);
     }
 
     private void removeSession(IoSession session) {
-        // remove the session from the list of polled sessions
-        polledSessions.remove(session);
-
-        // add the bytes processed between last polling and session closing
-        // prevent non seen byte with non-connected protocols like HTTP and datagrams
-        IoSessionStat sessStat = (IoSessionStat) session.getAttribute(KEY);
-
-        // computing with time between polling and closing
-        long currentTime = System.currentTimeMillis();
-        synchronized (calcLock) {
-            bytesReadThroughput += (session.getReadBytes() - sessStat.lastByteRead)
-                    / ((currentTime - sessStat.lastPollingTime) / 1000f);
-            bytesWrittenThroughput += (session.getWrittenBytes() - sessStat.lastByteWrite)
-                    / ((currentTime - sessStat.lastPollingTime) / 1000f);
-            msgReadThroughput += (session.getReadMessages() - sessStat.lastMessageRead)
-                    / ((currentTime - sessStat.lastPollingTime) / 1000f);
-            msgWrittenThroughput += (session.getWrittenMessages() - sessStat.lastMessageWrite)
-                    / ((currentTime - sessStat.lastPollingTime) / 1000f);
-        }
-
-        session.removeAttribute(KEY);
+        session.removeAttribute(STATISTICS);
     }
 
     /**
@@ -224,24 +176,24 @@
         return totalProcessedSessions.get();
     }
 
-    public float getBytesReadThroughput() {
-        return bytesReadThroughput;
+    public float getByteReadThroughput() {
+        return serviceStatistics.getByteReadThroughput();
     }
 
-    public float getBytesWrittenThroughput() {
-        return bytesWrittenThroughput;
+    public float getByteWriteThroughput() {
+        return serviceStatistics.getByteWriteThroughput();
     }
 
-    public float getMsgReadThroughput() {
-        return msgReadThroughput;
+    public float getMessageReadThroughput() {
+        return serviceStatistics.getMessageReadThroughput();
     }
 
-    public float getMsgWrittenThroughput() {
-        return msgWrittenThroughput;
+    public float getMessageWriteThroughput() {
+        return serviceStatistics.getMessageWriteThroughput();
     }
 
     public long getSessionCount() {
-        return polledSessions.size();
+        return service.getManagedSessions().size();
     }
 
     private class Worker extends Thread {
@@ -254,58 +206,81 @@
 
         @Override
         public void run() {
-            while (!stop) {
-                for (IoSession session : polledSessions) {
-                    IoSessionStat sessStat = (IoSessionStat) session
-                            .getAttribute(KEY);
-
-                    sessStat.lastByteRead = session.getReadBytes();
-                    sessStat.lastByteWrite = session.getWrittenBytes();
-                    sessStat.lastMessageRead = session.getReadMessages();
-                    sessStat.lastMessageWrite = session.getWrittenMessages();
-                }
+            // Initialize...
+            serviceStatistics.setLastReadBytes(service.getReadBytes());
+            serviceStatistics.setLastWrittenBytes(service.getWrittenBytes());
+            serviceStatistics.setLastReadMessages(service.getReadMessages());
+            serviceStatistics.setLastWrittenMessages(service.getWrittenMessages());
+            serviceStatistics.setLastPollingTime(System.currentTimeMillis());
+            
+            for (IoSession session: service.getManagedSessions()) {
+                IoStatistics statistics =
+                    (IoStatistics) session.getAttribute(STATISTICS);
+
+                statistics.setLastReadBytes(session.getReadBytes());
+                statistics.setLastWrittenBytes(session.getWrittenBytes());
+                statistics.setLastReadMessages(session.getReadMessages());
+                statistics.setLastWrittenMessages(session.getWrittenMessages());
+            }
 
+            while (!stop) {
                 // wait polling time
                 try {
                     Thread.sleep(pollingInterval);
                 } catch (InterruptedException e) {
                 }
-
-                float tmpMsgWrittenThroughput = 0f;
-                float tmpMsgReadThroughput = 0f;
-                float tmpBytesWrittenThroughput = 0f;
-                float tmpBytesReadThroughput = 0f;
-
-                for (IoSession session : polledSessions) {
-
-                    // upadating individual session statistics
-                    IoSessionStat sessStat = (IoSessionStat) session
-                            .getAttribute(KEY);
-
-                    sessStat.byteReadThroughput = (session.getReadBytes() - sessStat.lastByteRead)
-                            / (pollingInterval / 1000f);
-                    tmpBytesReadThroughput += sessStat.byteReadThroughput;
-
-                    sessStat.byteWrittenThroughput = (session.getWrittenBytes() - sessStat.lastByteWrite)
-                            / (pollingInterval / 1000f);
-                    tmpBytesWrittenThroughput += sessStat.byteWrittenThroughput;
-
-                    sessStat.messageReadThroughput = (session.getReadMessages() - sessStat.lastMessageRead)
-                            / (pollingInterval / 1000f);
-                    tmpMsgReadThroughput += sessStat.messageReadThroughput;
-
-                    sessStat.messageWrittenThroughput = (session
-                            .getWrittenMessages() - sessStat.lastMessageWrite)
-                            / (pollingInterval / 1000f);
-                    tmpMsgWrittenThroughput += sessStat.messageWrittenThroughput;
-
-                    synchronized (calcLock) {
-                        msgWrittenThroughput = tmpMsgWrittenThroughput;
-                        msgReadThroughput = tmpMsgReadThroughput;
-                        bytesWrittenThroughput = tmpBytesWrittenThroughput;
-                        bytesReadThroughput = tmpBytesReadThroughput;
-                        sessStat.lastPollingTime = System.currentTimeMillis();
+                
+                long readBytes, writtenBytes, readMessages, writtenMessages;
+                
+                // Calculate service throughput.
+                readBytes = service.getReadBytes();
+                writtenBytes = service.getWrittenBytes();
+                readMessages = service.getReadMessages();
+                writtenMessages = service.getWrittenMessages();
+                
+                serviceStatistics.setLastPollingTime(System.currentTimeMillis());
+                serviceStatistics.setByteReadThroughput(
+                        (readBytes - serviceStatistics.getLastReadBytes()) /
+                        (pollingInterval / 1000f));
+                serviceStatistics.setByteWriteThroughput(
+                        (writtenBytes - serviceStatistics.getLastWrittenBytes()) /
+                        (pollingInterval / 1000f));
+                serviceStatistics.setMessageReadThroughput(
+                        (readMessages - serviceStatistics.getLastReadMessages()) /
+                        (pollingInterval / 1000f));
+                serviceStatistics.setMessageWriteThroughput(
+                        (writtenMessages - serviceStatistics.getLastWrittenMessages()) /
+                        (pollingInterval / 1000f));
+                serviceStatistics.setLastReadBytes(readBytes);
+                serviceStatistics.setLastWrittenBytes(writtenBytes);
+                serviceStatistics.setLastReadMessages(readMessages);
+                serviceStatistics.setLastWrittenMessages(writtenMessages);
+
+                // Calculate session throughput.
+                for (IoSession session: service.getManagedSessions()) {
+                    IoStatistics statistics =
+                        (IoStatistics) session.getAttribute(STATISTICS);
+                    if (statistics == null) {
+                        continue;
                     }
+
+                    statistics.setLastPollingTime(System.currentTimeMillis());
+                    statistics.setByteReadThroughput(
+                            (readBytes - statistics.getLastReadBytes()) /
+                            (pollingInterval / 1000f));
+                    statistics.setByteWriteThroughput(
+                            (writtenBytes - statistics.getLastWrittenBytes()) /
+                            (pollingInterval / 1000f));
+                    statistics.setMessageReadThroughput(
+                            (readMessages - statistics.getLastReadMessages()) /
+                            (pollingInterval / 1000f));
+                    statistics.setMessageWriteThroughput(
+                            (writtenMessages - statistics.getLastWrittenMessages()) /
+                            (pollingInterval / 1000f));
+                    statistics.setLastReadBytes(readBytes);
+                    statistics.setLastWrittenBytes(writtenBytes);
+                    statistics.setLastReadMessages(readMessages);
+                    statistics.setLastWrittenMessages(writtenMessages);
                 }
             }
         }

Modified: mina/trunk/integration-jmx/src/main/java/org/apache/mina/integration/jmx/IoServiceManager.java
URL: http://svn.apache.org/viewvc/mina/trunk/integration-jmx/src/main/java/org/apache/mina/integration/jmx/IoServiceManager.java?rev=594785&r1=594784&r2=594785&view=diff
==============================================================================
--- mina/trunk/integration-jmx/src/main/java/org/apache/mina/integration/jmx/IoServiceManager.java (original)
+++ mina/trunk/integration-jmx/src/main/java/org/apache/mina/integration/jmx/IoServiceManager.java Tue Nov 13 22:45:49 2007
@@ -25,7 +25,7 @@
 
 import org.apache.mina.common.IoService;
 import org.apache.mina.common.IoSession;
-import org.apache.mina.management.StatCollector;
+import org.apache.mina.management.IoStatisticsCollector;
 
 /**
  * @author The Apache MINA Project (dev@mina.apache.org)
@@ -33,23 +33,20 @@
  */
 public class IoServiceManager implements IoServiceManagerMBean,
         MBeanRegistration {
-    private IoService service;
-
-    private StatCollector collector = null;
-
-    private int milliSecondsPolling;
-
-    private boolean autoStartCollecting = false;
-
-    public IoServiceManager(IoService service, int milliSecondsPolling,
-            boolean autoStartCollecting) {
-        this.autoStartCollecting = autoStartCollecting;
+    private final IoService service;
+    private volatile IoStatisticsCollector collector;
+    private volatile int pollingInterval;
+    private final boolean autoStart;
+
+    public IoServiceManager(
+            IoService service, int pollingInterval, boolean autoStart) {
+        this.autoStart = autoStart;
         this.service = service;
-        this.milliSecondsPolling = milliSecondsPolling;
+        this.pollingInterval = pollingInterval;
     }
 
-    public IoServiceManager(IoService service, int milliSecondsPolling) {
-        this(service, milliSecondsPolling, false);
+    public IoServiceManager(IoService service, int pollingInterval) {
+        this(service, pollingInterval, false);
     }
 
     public IoServiceManager(IoService service) {
@@ -60,24 +57,24 @@
         return service.getManagedSessions().size();
     }
 
-    public void startCollectingStats() {
+    public void start() {
         if (collector != null && collector.isRunning()) {
-            throw new RuntimeException("Already collecting stats");
+            throw new IllegalStateException("Already collecting stats");
         }
 
-        collector = new StatCollector(service, milliSecondsPolling);
+        collector = new IoStatisticsCollector(service, pollingInterval);
         collector.start();
     }
 
-    public int getStatsPollingInterval() {
-        return milliSecondsPolling;
+    public int getPollingInterval() {
+        return pollingInterval;
     }
 
-    public void setStatsPollingInterval(int millisecondsPolling) {
-        this.milliSecondsPolling = millisecondsPolling;
+    public void setPollingInterval(int pollingInterval) {
+        this.pollingInterval = pollingInterval;
     }
 
-    public void stopCollectingStats() {
+    public void stop() {
         if (collector != null && collector.isRunning()) {
             collector.stop();
         }
@@ -85,36 +82,36 @@
     }
 
     public float getTotalByteReadThroughput() {
-        return collector.getBytesReadThroughput();
+        return collector.getByteReadThroughput();
     }
 
     public float getTotalByteWrittenThroughput() {
-        return collector.getBytesWrittenThroughput();
+        return collector.getByteWriteThroughput();
     }
 
     public float getTotalMessageReadThroughput() {
-        return collector.getMsgReadThroughput();
+        return collector.getMessageReadThroughput();
     }
 
     public float getTotalMessageWrittenThroughput() {
-        return collector.getMsgWrittenThroughput();
+        return collector.getMessageWriteThroughput();
     }
 
     public float getAverageByteReadThroughput() {
-        return collector.getBytesReadThroughput() / collector.getSessionCount();
+        return collector.getByteReadThroughput() / collector.getSessionCount();
     }
 
     public float getAverageByteWrittenThroughput() {
-        return collector.getBytesWrittenThroughput()
+        return collector.getByteWriteThroughput()
                 / collector.getSessionCount();
     }
 
     public float getAverageMessageReadThroughput() {
-        return collector.getMsgReadThroughput() / collector.getSessionCount();
+        return collector.getMessageReadThroughput() / collector.getSessionCount();
     }
 
     public float getAverageMessageWrittenThroughput() {
-        return collector.getMsgWrittenThroughput()
+        return collector.getMessageWriteThroughput()
                 / collector.getSessionCount();
     }
 
@@ -132,8 +129,8 @@
 
     public void postRegister(Boolean registrationDone) {
         if (registrationDone.booleanValue()) {
-            if (autoStartCollecting) {
-                startCollectingStats();
+            if (autoStart) {
+                start();
             }
 
         }
@@ -141,7 +138,7 @@
 
     public void preDeregister() throws Exception {
         if (collector != null && collector.isRunning()) {
-            stopCollectingStats();
+            stop();
         }
     }
 

Modified: mina/trunk/integration-jmx/src/main/java/org/apache/mina/integration/jmx/IoServiceManagerMBean.java
URL: http://svn.apache.org/viewvc/mina/trunk/integration-jmx/src/main/java/org/apache/mina/integration/jmx/IoServiceManagerMBean.java?rev=594785&r1=594784&r2=594785&view=diff
==============================================================================
--- mina/trunk/integration-jmx/src/main/java/org/apache/mina/integration/jmx/IoServiceManagerMBean.java (original)
+++ mina/trunk/integration-jmx/src/main/java/org/apache/mina/integration/jmx/IoServiceManagerMBean.java Tue Nov 13 22:45:49 2007
@@ -33,24 +33,24 @@
     /**
      * start collecting throughput statistics for all the managed sessions
      */
-    void startCollectingStats();
+    void start();
 
     /**
      * get the polling interval for collecting statistics
      * @return configurated polling time in milliseconds
      */
-    int getStatsPollingInterval();
+    int getPollingInterval();
 
     /**
      * set the polling interval for collecting statistics
      * @param millisecondsPolling polling time in milliseconds like 5000 for computing throughput every 5 seconds
      */
-    void setStatsPollingInterval(int millisecondsPolling);
+    void setPollingInterval(int millisecondsPolling);
 
     /**
      * stop collecting throughput statistics
      */
-    void stopCollectingStats();
+    void stop();
 
     /**
      * bytes read per seconds sum of all the managed sessions

Modified: mina/trunk/integration-jmx/src/main/java/org/apache/mina/integration/jmx/IoSessionManager.java
URL: http://svn.apache.org/viewvc/mina/trunk/integration-jmx/src/main/java/org/apache/mina/integration/jmx/IoSessionManager.java?rev=594785&r1=594784&r2=594785&view=diff
==============================================================================
--- mina/trunk/integration-jmx/src/main/java/org/apache/mina/integration/jmx/IoSessionManager.java (original)
+++ mina/trunk/integration-jmx/src/main/java/org/apache/mina/integration/jmx/IoSessionManager.java Tue Nov 13 22:45:49 2007
@@ -26,8 +26,8 @@
 import org.apache.mina.common.IoFilterChain;
 import org.apache.mina.common.IoSession;
 import org.apache.mina.filter.logging.LoggingFilter;
-import org.apache.mina.management.IoSessionStat;
-import org.apache.mina.management.StatCollector;
+import org.apache.mina.management.IoStatistics;
+import org.apache.mina.management.IoStatisticsCollector;
 
 /**
  * @author The Apache MINA Project (dev@mina.apache.org)
@@ -113,8 +113,8 @@
     }
 
     public float getByteReadThroughtput() {
-        IoSessionStat stats = (IoSessionStat) session
-                .getAttribute(StatCollector.KEY);
+        IoStatistics stats = (IoStatistics) session
+                .getAttribute(IoStatisticsCollector.STATISTICS);
         if (stats == null) {
             return Float.NaN;
         } else {
@@ -122,19 +122,19 @@
         }
     }
 
-    public float getByteWrittenThroughtput() {
-        IoSessionStat stats = (IoSessionStat) session
-                .getAttribute(StatCollector.KEY);
+    public float getByteWriteThroughtput() {
+        IoStatistics stats = (IoStatistics) session
+                .getAttribute(IoStatisticsCollector.STATISTICS);
         if (stats == null) {
             return Float.NaN;
         } else {
-            return stats.getByteWrittenThroughput();
+            return stats.getByteWriteThroughput();
         }
     }
 
     public float getMessageReadThroughtput() {
-        IoSessionStat stats = (IoSessionStat) session
-                .getAttribute(StatCollector.KEY);
+        IoStatistics stats = (IoStatistics) session
+                .getAttribute(IoStatisticsCollector.STATISTICS);
         if (stats == null) {
             return Float.NaN;
         } else {
@@ -142,13 +142,13 @@
         }
     }
 
-    public float getMessageWrittenThroughtput() {
-        IoSessionStat stats = (IoSessionStat) session
-                .getAttribute(StatCollector.KEY);
+    public float getMessageWriteThroughtput() {
+        IoStatistics stats = (IoStatistics) session
+                .getAttribute(IoStatisticsCollector.STATISTICS);
         if (stats == null) {
             return Float.NaN;
         } else {
-            return stats.getMessageWrittenThroughput();
+            return stats.getMessageWriteThroughput();
         }
     }
 }

Modified: mina/trunk/integration-jmx/src/main/java/org/apache/mina/integration/jmx/IoSessionManagerMBean.java
URL: http://svn.apache.org/viewvc/mina/trunk/integration-jmx/src/main/java/org/apache/mina/integration/jmx/IoSessionManagerMBean.java?rev=594785&r1=594784&r2=594785&view=diff
==============================================================================
--- mina/trunk/integration-jmx/src/main/java/org/apache/mina/integration/jmx/IoSessionManagerMBean.java (original)
+++ mina/trunk/integration-jmx/src/main/java/org/apache/mina/integration/jmx/IoSessionManagerMBean.java Tue Nov 13 22:45:49 2007
@@ -123,7 +123,7 @@
      * works only if a stat collector is inspecting this session,
      * @return written bytes per seconds
      */
-    public float getByteWrittenThroughtput();
+    public float getByteWriteThroughtput();
 
     /**
      * get the read messages per second throughput
@@ -137,6 +137,6 @@
      * works only if a stat collector is inspecting this session, and only if a ProtocolDecoderFilter is used
      * @return written messages per seconds
      */
-    public float getMessageWrittenThroughtput();
+    public float getMessageWriteThroughtput();
 
 }