changeset 1:d136d4894ea3

Missing type matching on per-type stats
author Dominic Cleal <dominic-cleal@cdo2.com>
date Thu, 11 Dec 2008 12:16:31 +0000
parents e59e6471ce44
children 1850f751d9de
files src/net/scatterspace/blitz/jmx/InstanceCountImpl.java src/net/scatterspace/blitz/jmx/OpImpl.java
diffstat 2 files changed, 10 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/net/scatterspace/blitz/jmx/InstanceCountImpl.java	Thu Dec 11 00:49:28 2008 +0000
+++ b/src/net/scatterspace/blitz/jmx/InstanceCountImpl.java	Thu Dec 11 12:16:31 2008 +0000
@@ -50,10 +50,14 @@
     public int getCount() throws RemoteException
     {
         Iterator<InstanceCount> iter = getStatistics().iterator();
-        if (!iter.hasNext())
-            return 0;
+        while (iter.hasNext())
+        {
+            InstanceCount inst = iter.next();
+            if (inst.getType().equals(type_))
+                return inst.getCount();
+        }
         
-        return iter.next().getCount();
+        return 0;
     }
 
     @Override
--- a/src/net/scatterspace/blitz/jmx/OpImpl.java	Thu Dec 11 00:49:28 2008 +0000
+++ b/src/net/scatterspace/blitz/jmx/OpImpl.java	Thu Dec 11 12:16:31 2008 +0000
@@ -53,7 +53,7 @@
         while (iter.hasNext())
         {
             OpStat op = iter.next();
-            if (op.getOp() == OpStat.READS)
+            if (op.getType().equals(type_) && op.getOp() == OpStat.READS)
                 return op.getCount();
         }
         
@@ -66,7 +66,7 @@
         while (iter.hasNext())
         {
             OpStat op = iter.next();
-            if (op.getOp() == OpStat.TAKES)
+            if (op.getType().equals(type_) && op.getOp() == OpStat.TAKES)
                 return op.getCount();
         }
         
@@ -79,7 +79,7 @@
         while (iter.hasNext())
         {
             OpStat op = iter.next();
-            if (op.getOp() == OpStat.WRITES)
+            if (op.getType().equals(type_) && op.getOp() == OpStat.WRITES)
                 return op.getCount();
         }