changeset 0:e59e6471ce44

Initial version of a Blitz colocated agent to provide JMX MXBeans access to its statistics
author Dominic Cleal <dominic@computerkb.co.uk>
date Thu, 11 Dec 2008 00:49:28 +0000
parents
children d136d4894ea3
files .classpath .hgignore .project .settings/org.eclipse.jdt.ui.prefs src/net/scatterspace/blitz/jmx/AbstractStatsImpl.java src/net/scatterspace/blitz/jmx/BlockingOpsImpl.java src/net/scatterspace/blitz/jmx/EventQueueImpl.java src/net/scatterspace/blitz/jmx/IOImpl.java src/net/scatterspace/blitz/jmx/InstanceCountImpl.java src/net/scatterspace/blitz/jmx/JmxAgent.java src/net/scatterspace/blitz/jmx/MissedOpsImpl.java src/net/scatterspace/blitz/jmx/OpImpl.java src/net/scatterspace/blitz/jmx/TaskQueueImpl.java src/net/scatterspace/blitz/jmx/TxnImpl.java src/net/scatterspace/blitz/jmx/iface/BlockingOpsMXBean.java src/net/scatterspace/blitz/jmx/iface/EventQueueMXBean.java src/net/scatterspace/blitz/jmx/iface/IOMXBean.java src/net/scatterspace/blitz/jmx/iface/InstanceCountMXBean.java src/net/scatterspace/blitz/jmx/iface/MissedOpsMXBean.java src/net/scatterspace/blitz/jmx/iface/OpMXBean.java src/net/scatterspace/blitz/jmx/iface/TaskQueueMXBean.java src/net/scatterspace/blitz/jmx/iface/TxnMXBean.java
diffstat 22 files changed, 920 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.classpath	Thu Dec 11 00:49:28 2008 +0000
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="src" path="src"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+	<classpathentry kind="lib" path="/home/dominic/work/cdo2/blitz2_0-fcs-binary/lib/blitz.jar"/>
+	<classpathentry kind="lib" path="/lib/thirdparty/jini2_1/jsk-lib.jar" sourcepath="/river-2.1.1/source/src"/>
+	<classpathentry kind="lib" path="/lib/thirdparty/jini2_1/jsk-platform.jar" sourcepath="/jini2_1/source/src"/>
+	<classpathentry kind="output" path="build_ide"/>
+</classpath>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.hgignore	Thu Dec 11 00:49:28 2008 +0000
@@ -0,0 +1,3 @@
+build_ide/
+dist/
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.project	Thu Dec 11 00:49:28 2008 +0000
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>blitz_jmxagent</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+	</natures>
+</projectDescription>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.settings/org.eclipse.jdt.ui.prefs	Thu Dec 11 00:49:28 2008 +0000
@@ -0,0 +1,3 @@
+#Wed Dec 10 12:55:47 GMT 2008
+eclipse.preferences.version=1
+org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\n * @return the ${bare_field_name}\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\n * @param ${param} the ${bare_field_name} to set\n */</template><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\n * ${tags}\n */</template><template autoinsert\="false" context\="filecomment_context" deleted\="false" description\="Comment for created Java files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.filecomment" name\="filecomment">/**\n * Copyright (c) 2008 CDO2 Limited.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions are met\:\n *     * Redistributions of source code must retain the above copyright\n *       notice, this list of conditions and the following disclaimer.\n *     * Redistributions in binary form must reproduce the above copyright\n *       notice, this list of conditions and the following disclaimer in the\n *       documentation and/or other materials provided with the distribution.\n *     * Neither the name of CDO2 Limited nor the names of its contributors\n *       may be used to endorse or promote products derived from this\n *       software without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY CDO2 LIMITED ''AS IS'' AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\n * DISCLAIMED. IN NO EVENT SHALL &lt;copyright holder&gt; BE LIABLE FOR ANY\n * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\n * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\n * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n */</template><template autoinsert\="true" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\n * @author ${user}\n *\n * ${tags}\n */</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for fields" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\n * \n */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\n * ${tags}\n */</template><template autoinsert\="true" context\="overridecomment_context" deleted\="false" description\="Comment for overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name\="overridecomment">/* (non-Javadoc)\n * ${see_to_overridden}\n */</template><template autoinsert\="true" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\n * ${tags}\n * ${see_to_target}\n */</template><template autoinsert\="true" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.newtype" name\="newtype">${filecomment}\n${package_declaration}\n\n${typecomment}\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.classbody" name\="classbody">\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.enumbody" name\="enumbody">\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\n</template><template autoinsert\="true" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block\n${exception_var}.printStackTrace();</template><template autoinsert\="true" context\="methodbody_context" deleted\="false" description\="Code in created method stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodbody" name\="methodbody">// ${todo} Auto-generated method stub\n${body_statement}</template><template autoinsert\="true" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}\n// ${todo} Auto-generated constructor stub</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template></templates>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/net/scatterspace/blitz/jmx/AbstractStatsImpl.java	Thu Dec 11 00:49:28 2008 +0000
@@ -0,0 +1,74 @@
+/**
+ * Copyright (c) 2008 CDO2 Limited.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of CDO2 Limited nor the names of its contributors
+ *       may be used to endorse or promote products derived from this
+ *       software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY CDO2 LIMITED ''AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package net.scatterspace.blitz.jmx;
+
+import java.rmi.RemoteException;
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.dancres.blitz.remote.StatsAdmin;
+import org.dancres.blitz.stats.Stat;
+
+public abstract class AbstractStatsImpl<T extends Stat>
+{
+    private StatsAdmin admin_;
+    private Class<? extends Stat> statClazz_;
+    
+    public AbstractStatsImpl(StatsAdmin admin, Class<T> stat)
+    {
+        admin_ = admin;
+        statClazz_ = stat;
+    }
+    
+    @SuppressWarnings("unchecked")
+    protected Collection<T> getStatistics() throws RemoteException
+    {
+        Collection<T> ret = new ArrayList<T>();
+        for (Stat stat : admin_.getStats())
+        {
+            if (statClazz_.isInstance(stat))
+            {
+                ret.add((T) statClazz_.cast(stat));
+            }
+        }
+        
+        return ret;
+    }
+
+    @Override
+    public String toString()
+    {
+        String name = getClass().getSimpleName();
+        if (name.endsWith("Impl"))
+        {
+            name = name.substring(0, name.length() - 4);
+        }
+        
+        return "type=" + name;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/net/scatterspace/blitz/jmx/BlockingOpsImpl.java	Thu Dec 11 00:49:28 2008 +0000
@@ -0,0 +1,65 @@
+/**
+ * Copyright (c) 2008 CDO2 Limited.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of CDO2 Limited nor the names of its contributors
+ *       may be used to endorse or promote products derived from this
+ *       software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY CDO2 LIMITED ''AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package net.scatterspace.blitz.jmx;
+
+import java.rmi.RemoteException;
+import java.util.Iterator;
+
+import net.scatterspace.blitz.jmx.iface.BlockingOpsMXBean;
+
+import org.dancres.blitz.remote.StatsAdmin;
+import org.dancres.blitz.stats.BlockingOpsStat;
+
+/**
+ * MXBean to interface to {@link BlockingOpsStat}.
+ */
+public class BlockingOpsImpl extends AbstractStatsImpl<BlockingOpsStat>
+                             implements BlockingOpsMXBean
+{
+    public BlockingOpsImpl(StatsAdmin admin)
+    {
+        super(admin, BlockingOpsStat.class);
+    }
+    
+    public int getReaders() throws RemoteException
+    {
+        Iterator<BlockingOpsStat> iter = getStatistics().iterator();
+        if (!iter.hasNext())
+            return 0;
+        
+        return iter.next().getReaders();
+    }
+    
+    public int getTakers() throws RemoteException
+    {
+        Iterator<BlockingOpsStat> iter = getStatistics().iterator();
+        if (!iter.hasNext())
+            return 0;
+        
+        return iter.next().getTakers();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/net/scatterspace/blitz/jmx/EventQueueImpl.java	Thu Dec 11 00:49:28 2008 +0000
@@ -0,0 +1,65 @@
+/**
+ * Copyright (c) 2008 CDO2 Limited.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of CDO2 Limited nor the names of its contributors
+ *       may be used to endorse or promote products derived from this
+ *       software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY CDO2 LIMITED ''AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package net.scatterspace.blitz.jmx;
+
+import java.rmi.RemoteException;
+import java.util.Iterator;
+
+import net.scatterspace.blitz.jmx.iface.EventQueueMXBean;
+
+import org.dancres.blitz.remote.StatsAdmin;
+import org.dancres.blitz.stats.EventQueueStat;
+
+/**
+ * MXBean to interface to {@link EventQueueStat}.
+ */
+public class EventQueueImpl extends AbstractStatsImpl<EventQueueStat>
+                            implements EventQueueMXBean
+{
+    public EventQueueImpl(StatsAdmin admin)
+    {
+        super(admin, EventQueueStat.class);
+    }
+    
+    public int getPersistentCount() throws RemoteException
+    {
+        Iterator<EventQueueStat> iter = getStatistics().iterator();
+        if (!iter.hasNext())
+            return 0;
+        
+        return iter.next().getPersistentCount();
+    }
+    
+    public int getTransientCount() throws RemoteException
+    {
+        Iterator<EventQueueStat> iter = getStatistics().iterator();
+        if (!iter.hasNext())
+            return 0;
+        
+        return iter.next().getTransientCount();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/net/scatterspace/blitz/jmx/IOImpl.java	Thu Dec 11 00:49:28 2008 +0000
@@ -0,0 +1,82 @@
+/**
+ * Copyright (c) 2008 CDO2 Limited.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of CDO2 Limited nor the names of its contributors
+ *       may be used to endorse or promote products derived from this
+ *       software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY CDO2 LIMITED ''AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package net.scatterspace.blitz.jmx;
+
+import java.rmi.RemoteException;
+import java.util.Iterator;
+
+import net.scatterspace.blitz.jmx.iface.IOMXBean;
+
+import org.dancres.blitz.remote.StatsAdmin;
+import org.dancres.blitz.stats.IOStat;
+
+/**
+ * MXBean to interface to {@link IOStat}.
+ */
+public class IOImpl extends AbstractStatsImpl<IOStat> implements IOMXBean
+{
+    public IOImpl(StatsAdmin admin)
+    {
+        super(admin, IOStat.class);
+    }
+    
+    public int getQueueSize() throws RemoteException
+    {
+        Iterator<IOStat> iter = getStatistics().iterator();
+        if (!iter.hasNext())
+            return 0;
+        
+        return iter.next().getQueueSize();
+    }
+    
+    public double getInOutRatio() throws RemoteException
+    {
+        Iterator<IOStat> iter = getStatistics().iterator();
+        if (!iter.hasNext())
+            return 0;
+        
+        return iter.next().getInOutRatio();
+    }
+    
+    public double getTimePerIn() throws RemoteException
+    {
+        Iterator<IOStat> iter = getStatistics().iterator();
+        if (!iter.hasNext())
+            return 0;
+        
+        return iter.next().getTimePerIn();
+    }
+    
+    public double getTimePerOut() throws RemoteException
+    {
+        Iterator<IOStat> iter = getStatistics().iterator();
+        if (!iter.hasNext())
+            return 0;
+        
+        return iter.next().getTimePerOut();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/net/scatterspace/blitz/jmx/InstanceCountImpl.java	Thu Dec 11 00:49:28 2008 +0000
@@ -0,0 +1,64 @@
+/**
+ * Copyright (c) 2008 CDO2 Limited.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of CDO2 Limited nor the names of its contributors
+ *       may be used to endorse or promote products derived from this
+ *       software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY CDO2 LIMITED ''AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package net.scatterspace.blitz.jmx;
+
+import java.rmi.RemoteException;
+import java.util.Iterator;
+
+import net.scatterspace.blitz.jmx.iface.InstanceCountMXBean;
+
+import org.dancres.blitz.remote.StatsAdmin;
+import org.dancres.blitz.stats.InstanceCount;
+
+/**
+ * MXBean to interface to {@link InstanceCount}.
+ */
+public class InstanceCountImpl extends AbstractStatsImpl<InstanceCount> implements InstanceCountMXBean
+{
+    private String type_;
+    
+    public InstanceCountImpl(StatsAdmin admin, String type)
+    {
+        super(admin, InstanceCount.class);
+        type_ = type;
+    }
+    
+    public int getCount() throws RemoteException
+    {
+        Iterator<InstanceCount> iter = getStatistics().iterator();
+        if (!iter.hasNext())
+            return 0;
+        
+        return iter.next().getCount();
+    }
+
+    @Override
+    public String toString()
+    {
+        return super.toString() + ",class=" + type_;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/net/scatterspace/blitz/jmx/JmxAgent.java	Thu Dec 11 00:49:28 2008 +0000
@@ -0,0 +1,154 @@
+/**
+ * Copyright (c) 2008 CDO2 Limited.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of CDO2 Limited nor the names of its contributors
+ *       may be used to endorse or promote products derived from this
+ *       software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY CDO2 LIMITED ''AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package net.scatterspace.blitz.jmx;
+
+import java.lang.management.ManagementFactory;
+import java.rmi.RemoteException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Timer;
+import java.util.TimerTask;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
+
+import net.jini.admin.Administrable;
+import net.jini.space.JavaSpace;
+
+import org.dancres.blitz.remote.StatsAdmin;
+import org.dancres.blitz.remote.user.ColocatedAgent;
+import org.dancres.blitz.stats.OpStat;
+import org.dancres.blitz.stats.Stat;
+
+/**
+ * Agent colocated inside Blitz JavaSpaces that provides JMX beans to monitor
+ * the space statistics and entry statistics.
+ */
+public class JmxAgent implements ColocatedAgent
+{
+    private Logger log_ = Logger.getLogger(getClass().getName());
+    
+    private StatsAdmin stats_;
+
+    private static final long UPDATE_INTERVAL__ = 60000;
+    private Timer updateTimer_ = new Timer("JmxAgent-timer", true);
+    private EntryUpdateTask updateTask_ = new EntryUpdateTask();
+    
+    private MBeanServer mbs_ = ManagementFactory.getPlatformMBeanServer();
+    
+    public void init(JavaSpace space) throws Exception
+    {
+        if (space instanceof Administrable)
+        {
+            Object admin = ((Administrable) space).getAdmin();
+            if (admin instanceof StatsAdmin)
+            {
+                stats_ = (StatsAdmin) admin;
+                log_.log(Level.INFO, "JMX agent loaded with the StatsAdmin");
+                
+                initialiseBeans();
+                updateTimer_.schedule(updateTask_, 0, UPDATE_INTERVAL__);
+            }
+            else
+            {
+                log_.log(Level.SEVERE,
+                         "Admin object is not Blitz StatsAdmin: " + admin);
+            }
+        }
+        else
+        {
+            log_.log(Level.SEVERE,
+                     "Space object is not Administrable: " + space);
+        }
+    }
+    
+    private void initialiseBeans() throws RemoteException
+    {
+        register(new BlockingOpsImpl(stats_));
+        register(new EventQueueImpl(stats_));
+        register(new IOImpl(stats_));
+        register(new MissedOpsImpl(stats_));
+        register(new TaskQueueImpl(stats_, "Events"));
+        register(new TxnImpl(stats_));
+    }
+
+    private void register(Object bean)
+    {
+        try
+        {
+            mbs_.registerMBean(bean,
+                    new ObjectName("BlitzJS:" + bean.toString()));
+        }
+        catch (Exception e)
+        {
+            log_.log(Level.WARNING, "Unable to register bean " + bean, e);
+        }
+    }
+
+    /**
+     * Creates new MXBeans and register them if new entries appear in the stats
+     * interface.
+     */
+    private class EntryUpdateTask extends TimerTask
+    {
+        private Collection<String> knownTypes_ = new ArrayList<String>();
+        
+        @Override
+        public void run()
+        {
+            try
+            {
+                for (Stat stat : stats_.getStats())
+                {
+                    if (stat instanceof OpStat)
+                    {
+                        String type = ((OpStat) stat).getType();
+                        if (!knownTypes_.contains(type))
+                        {
+                            registerType(type);
+                            knownTypes_.add(type);
+                        }
+                    }
+                }
+            }
+            catch (RemoteException e)
+            {
+                log_.log(Level.WARNING,
+                         "Remote exception while updating MXBean types", e);
+            }
+        }
+        
+        public void registerType(String type)
+        {
+            register(new OpImpl(stats_, type));
+            register(new InstanceCountImpl(stats_, type));
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/net/scatterspace/blitz/jmx/MissedOpsImpl.java	Thu Dec 11 00:49:28 2008 +0000
@@ -0,0 +1,65 @@
+/**
+ * Copyright (c) 2008 CDO2 Limited.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of CDO2 Limited nor the names of its contributors
+ *       may be used to endorse or promote products derived from this
+ *       software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY CDO2 LIMITED ''AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package net.scatterspace.blitz.jmx;
+
+import java.rmi.RemoteException;
+import java.util.Iterator;
+
+import net.scatterspace.blitz.jmx.iface.MissedOpsMXBean;
+
+import org.dancres.blitz.remote.StatsAdmin;
+import org.dancres.blitz.stats.MissedOpsStat;
+
+/**
+ * MXBean to interface to {@link MissedOpsStat}.
+ */
+public class MissedOpsImpl extends AbstractStatsImpl<MissedOpsStat>
+                           implements MissedOpsMXBean
+{
+    public MissedOpsImpl(StatsAdmin admin)
+    {
+        super(admin, MissedOpsStat.class);
+    }
+    
+    public long getMissedReads() throws RemoteException
+    {
+        Iterator<MissedOpsStat> iter = getStatistics().iterator();
+        if (!iter.hasNext())
+            return 0;
+        
+        return iter.next().getMissedReads();
+    }
+    
+    public long getMissedTakes() throws RemoteException
+    {
+        Iterator<MissedOpsStat> iter = getStatistics().iterator();
+        if (!iter.hasNext())
+            return 0;
+        
+        return iter.next().getMissedTakes();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/net/scatterspace/blitz/jmx/OpImpl.java	Thu Dec 11 00:49:28 2008 +0000
@@ -0,0 +1,94 @@
+/**
+ * Copyright (c) 2008 CDO2 Limited.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of CDO2 Limited nor the names of its contributors
+ *       may be used to endorse or promote products derived from this
+ *       software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY CDO2 LIMITED ''AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package net.scatterspace.blitz.jmx;
+
+import java.rmi.RemoteException;
+import java.util.Iterator;
+
+import net.scatterspace.blitz.jmx.iface.OpMXBean;
+
+import org.dancres.blitz.remote.StatsAdmin;
+import org.dancres.blitz.stats.OpStat;
+
+/**
+ * MXBean to interface to {@link OpStat}.
+ */
+public class OpImpl extends AbstractStatsImpl<OpStat> implements OpMXBean
+{
+    private String type_;
+    
+    public OpImpl(StatsAdmin admin, String type)
+    {
+        super(admin, OpStat.class);
+        type_ = type;
+    }
+    
+    public long getReads() throws RemoteException
+    {
+        Iterator<OpStat> iter = getStatistics().iterator();
+        while (iter.hasNext())
+        {
+            OpStat op = iter.next();
+            if (op.getOp() == OpStat.READS)
+                return op.getCount();
+        }
+        
+        return 0;
+    }
+    
+    public long getTakes() throws RemoteException
+    {
+        Iterator<OpStat> iter = getStatistics().iterator();
+        while (iter.hasNext())
+        {
+            OpStat op = iter.next();
+            if (op.getOp() == OpStat.TAKES)
+                return op.getCount();
+        }
+        
+        return 0;
+    }
+    
+    public long getWrites() throws RemoteException
+    {
+        Iterator<OpStat> iter = getStatistics().iterator();
+        while (iter.hasNext())
+        {
+            OpStat op = iter.next();
+            if (op.getOp() == OpStat.WRITES)
+                return op.getCount();
+        }
+        
+        return 0;
+    }
+
+    @Override
+    public String toString()
+    {
+        return super.toString() + ",class=" + type_;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/net/scatterspace/blitz/jmx/TaskQueueImpl.java	Thu Dec 11 00:49:28 2008 +0000
@@ -0,0 +1,75 @@
+/**
+ * Copyright (c) 2008 CDO2 Limited.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of CDO2 Limited nor the names of its contributors
+ *       may be used to endorse or promote products derived from this
+ *       software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY CDO2 LIMITED ''AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package net.scatterspace.blitz.jmx;
+
+import java.rmi.RemoteException;
+import java.util.Iterator;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import net.scatterspace.blitz.jmx.iface.TaskQueueMXBean;
+
+import org.dancres.blitz.remote.StatsAdmin;
+import org.dancres.blitz.stats.TaskQueueStat;
+
+/**
+ * MXBean to interface to {@link TaskQueueStat}.
+ */
+public class TaskQueueImpl extends AbstractStatsImpl<TaskQueueStat>
+                           implements TaskQueueMXBean
+{
+    private static Pattern toString_ =
+        Pattern.compile("Queue: (.+) size: ([0-9]+)");
+    private String name_;
+    
+    public TaskQueueImpl(StatsAdmin admin, String name)
+    {
+        super(admin, TaskQueueStat.class);
+        name_ = name;
+    }
+    
+    public long getSize() throws RemoteException
+    {
+        Iterator<TaskQueueStat> iter = getStatistics().iterator();
+        while (iter.hasNext())
+        {
+            TaskQueueStat queue = iter.next();
+            Matcher match = toString_.matcher(queue.toString());
+            
+            if (match.matches() && match.group(1).equals(name_))
+                return Long.parseLong(match.group(2));
+        }
+        
+        return 0;
+    }
+
+    @Override
+    public String toString()
+    {
+        return super.toString() + ",queue=" + name_;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/net/scatterspace/blitz/jmx/TxnImpl.java	Thu Dec 11 00:49:28 2008 +0000
@@ -0,0 +1,55 @@
+/**
+ * Copyright (c) 2008 CDO2 Limited.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above copyright
+ *       notice, this list of conditions and the following disclaimer in the
+ *       documentation and/or other materials provided with the distribution.
+ *     * Neither the name of CDO2 Limited nor the names of its contributors
+ *       may be used to endorse or promote products derived from this
+ *       software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY CDO2 LIMITED ''AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package net.scatterspace.blitz.jmx;
+
+import java.rmi.RemoteException;
+import java.util.Iterator;
+
+import net.scatterspace.blitz.jmx.iface.TxnMXBean;
+
+import org.dancres.blitz.remote.StatsAdmin;
+import org.dancres.blitz.stats.TxnStat;
+
+/**
+ * MXBean to interface to {@link TxnStat}.
+ */
+public class TxnImpl extends AbstractStatsImpl<TxnStat> implements TxnMXBean
+{
+    public TxnImpl(StatsAdmin admin)
+    {
+        super(admin, TxnStat.class);
+    }
+    
+    public int getActiveTxnCount() throws RemoteException
+    {
+        Iterator<TxnStat> iter = getStatistics().iterator();
+        if (!iter.hasNext())
+            return 0;
+        
+        return iter.next().getActiveTxnCount();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/net/scatterspace/blitz/jmx/iface/BlockingOpsMXBean.java	Thu Dec 11 00:49:28 2008 +0000
@@ -0,0 +1,12 @@
+package net.scatterspace.blitz.jmx.iface;
+
+import java.rmi.RemoteException;
+
+public interface BlockingOpsMXBean
+{
+    
+    public int getReaders() throws RemoteException;
+    
+    public int getTakers() throws RemoteException;
+    
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/net/scatterspace/blitz/jmx/iface/EventQueueMXBean.java	Thu Dec 11 00:49:28 2008 +0000
@@ -0,0 +1,12 @@
+package net.scatterspace.blitz.jmx.iface;
+
+import java.rmi.RemoteException;
+
+public interface EventQueueMXBean
+{
+    
+    public int getPersistentCount() throws RemoteException;
+    
+    public int getTransientCount() throws RemoteException;
+    
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/net/scatterspace/blitz/jmx/iface/IOMXBean.java	Thu Dec 11 00:49:28 2008 +0000
@@ -0,0 +1,16 @@
+package net.scatterspace.blitz.jmx.iface;
+
+import java.rmi.RemoteException;
+
+public interface IOMXBean
+{
+    
+    public int getQueueSize() throws RemoteException;
+    
+    public double getInOutRatio() throws RemoteException;
+    
+    public double getTimePerIn() throws RemoteException;
+    
+    public double getTimePerOut() throws RemoteException;
+    
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/net/scatterspace/blitz/jmx/iface/InstanceCountMXBean.java	Thu Dec 11 00:49:28 2008 +0000
@@ -0,0 +1,10 @@
+package net.scatterspace.blitz.jmx.iface;
+
+import java.rmi.RemoteException;
+
+public interface InstanceCountMXBean
+{
+    
+    public int getCount() throws RemoteException;
+    
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/net/scatterspace/blitz/jmx/iface/MissedOpsMXBean.java	Thu Dec 11 00:49:28 2008 +0000
@@ -0,0 +1,12 @@
+package net.scatterspace.blitz.jmx.iface;
+
+import java.rmi.RemoteException;
+
+public interface MissedOpsMXBean
+{
+    
+    public long getMissedReads() throws RemoteException;
+    
+    public long getMissedTakes() throws RemoteException;
+    
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/net/scatterspace/blitz/jmx/iface/OpMXBean.java	Thu Dec 11 00:49:28 2008 +0000
@@ -0,0 +1,14 @@
+package net.scatterspace.blitz.jmx.iface;
+
+import java.rmi.RemoteException;
+
+public interface OpMXBean
+{
+    
+    public long getReads() throws RemoteException;
+    
+    public long getTakes() throws RemoteException;
+    
+    public long getWrites() throws RemoteException;
+    
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/net/scatterspace/blitz/jmx/iface/TaskQueueMXBean.java	Thu Dec 11 00:49:28 2008 +0000
@@ -0,0 +1,9 @@
+package net.scatterspace.blitz.jmx.iface;
+
+import java.rmi.RemoteException;
+
+public interface TaskQueueMXBean
+{
+    public long getSize() throws RemoteException;
+    
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/net/scatterspace/blitz/jmx/iface/TxnMXBean.java	Thu Dec 11 00:49:28 2008 +0000
@@ -0,0 +1,10 @@
+package net.scatterspace.blitz.jmx.iface;
+
+import java.rmi.RemoteException;
+
+public interface TxnMXBean
+{
+    
+    public int getActiveTxnCount() throws RemoteException;
+    
+}
\ No newline at end of file