[jboss-cvs] JBossAS SVN: r89950 - projects/ejb3/trunk/metrics-deployer/src/main/java/org/jboss/ejb3/metrics/deployer.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Sat Jun 6 01:42:24 EDT 2009


Author: ALRubinger
Date: 2009-06-06 01:42:24 -0400 (Sat, 06 Jun 2009)
New Revision: 89950

Added:
   projects/ejb3/trunk/metrics-deployer/src/main/java/org/jboss/ejb3/metrics/deployer/InvocationStatisticMetaMapper.java
   projects/ejb3/trunk/metrics-deployer/src/main/java/org/jboss/ejb3/metrics/deployer/ManagedInvocationStatisticsSessionWrapperBase.java
   projects/ejb3/trunk/metrics-deployer/src/main/java/org/jboss/ejb3/metrics/deployer/ManagedStatefulInvocationStatisticsWrapper.java
   projects/ejb3/trunk/metrics-deployer/src/main/java/org/jboss/ejb3/metrics/deployer/ManagedStatelessInvocationStatisticsWrapper.java
Removed:
   projects/ejb3/trunk/metrics-deployer/src/main/java/org/jboss/ejb3/metrics/deployer/ManagedInvocationStatisticsWrapper.java
Modified:
   projects/ejb3/trunk/metrics-deployer/src/main/java/org/jboss/ejb3/metrics/deployer/Ejb3MetricsDeployer.java
Log:
[EJBTHREE-1839] Put each invocation stats in its own type for SLSB, SFSB, start dev on a metamapper for invocation stats (from Jason)

Modified: projects/ejb3/trunk/metrics-deployer/src/main/java/org/jboss/ejb3/metrics/deployer/Ejb3MetricsDeployer.java
===================================================================
--- projects/ejb3/trunk/metrics-deployer/src/main/java/org/jboss/ejb3/metrics/deployer/Ejb3MetricsDeployer.java	2009-06-06 05:25:47 UTC (rev 89949)
+++ projects/ejb3/trunk/metrics-deployer/src/main/java/org/jboss/ejb3/metrics/deployer/Ejb3MetricsDeployer.java	2009-06-06 05:42:24 UTC (rev 89950)
@@ -181,7 +181,7 @@
                {
                   throw new IllegalStateException("Invocation statistics was null");
                }
-               final ManagedInvocationStatisticsWrapper wrapper = new ManagedInvocationStatisticsWrapper(stats);
+               final ManagedInvocationStatisticsSessionWrapperBase wrapper = new ManagedInvocationStatisticsSessionWrapperBase(stats);
 
                // Add to beanFactories
                final String invocationBeanName = ejbName + BEAN_NAME_METRICS_SUFFIX_INVOCATION;

Added: projects/ejb3/trunk/metrics-deployer/src/main/java/org/jboss/ejb3/metrics/deployer/InvocationStatisticMetaMapper.java
===================================================================
--- projects/ejb3/trunk/metrics-deployer/src/main/java/org/jboss/ejb3/metrics/deployer/InvocationStatisticMetaMapper.java	                        (rev 0)
+++ projects/ejb3/trunk/metrics-deployer/src/main/java/org/jboss/ejb3/metrics/deployer/InvocationStatisticMetaMapper.java	2009-06-06 05:42:24 UTC (rev 89950)
@@ -0,0 +1,127 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+  *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ejb3.metrics.deployer;
+
+import java.lang.reflect.Type;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.jboss.metatype.api.types.CompositeMetaType;
+import org.jboss.metatype.api.types.ImmutableCompositeMetaType;
+import org.jboss.metatype.api.types.MapCompositeMetaType;
+import org.jboss.metatype.api.types.MetaType;
+import org.jboss.metatype.api.types.SimpleMetaType;
+import org.jboss.metatype.api.values.MapCompositeValueSupport;
+import org.jboss.metatype.api.values.MetaValue;
+import org.jboss.metatype.api.values.SimpleValueSupport;
+import org.jboss.metatype.spi.values.MetaMapper;
+
+/**
+ * InvocationStatisticMetaMapper
+ *
+ * {@link MetaMapper} for detyped EJB invocation statistics.
+ *
+ * @author Jason T. Greene
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a> EJB3 Maintenance only
+ * @version $Revision: $
+ */
+public class InvocationStatisticMetaMapper extends MetaMapper<Map<String, Map<String, Long>>>
+{
+   public static final CompositeMetaType TYPE;
+
+   public static final CompositeMetaType METHOD_STATS_TYPE;
+
+   private static String[] rootItemNames;
+
+   private static MapCompositeMetaType METHOD_STATS_MAP_TYPE;
+
+   static
+   {
+      String[] methodItemNames =
+      {"count", "minTime", "maxTime", "totalTime"};
+      String[] methodItemDescriptions =
+      {"the number of invocations", "the minimum invocation time", "the maximum invocation time",
+            "the total invocation time",};
+      MetaType[] methodItemTypes =
+      {SimpleMetaType.LONG, SimpleMetaType.LONG, SimpleMetaType.LONG, SimpleMetaType.LONG,};
+      METHOD_STATS_TYPE = new ImmutableCompositeMetaType("MethodStatistics", "Method invocation statistics",
+            methodItemNames, methodItemDescriptions, methodItemTypes);
+
+      METHOD_STATS_MAP_TYPE = new MapCompositeMetaType(METHOD_STATS_TYPE);
+
+      rootItemNames = new String[]
+      {"concurrentCalls", "maxConcurrentCalls", "lastResetTime", "methodStats"};
+
+      String[] rootItemDescriptions =
+      {"the number of concurrent invocations", "the maximum number of concurrent invocations",
+            "last time statistics were reset", "method statistics",};
+      MetaType[] rootItemTypes =
+      {SimpleMetaType.LONG, SimpleMetaType.LONG, SimpleMetaType.LONG, METHOD_STATS_MAP_TYPE};
+
+      TYPE = new ImmutableCompositeMetaType("InvocationStatistics", "EJB3 invocation statistics", rootItemNames,
+            rootItemDescriptions, rootItemTypes);
+   }
+
+   @Override
+   public MetaType getMetaType()
+   {
+      return TYPE;
+   }
+
+   @Override
+   public Type mapToType()
+   {
+      return Map.class;
+   }
+
+   @Override
+   public MetaValue createMetaValue(MetaType metaType, Map<String, Map<String, Long>> object)
+   {
+      Map<String, MetaValue> methodMap = new HashMap<String, MetaValue>();
+      for (Map.Entry<String, Map<String, Long>> entry : object.entrySet())
+      {
+         if (entry.getKey().charAt(0) == '#')
+            continue;
+
+         MapCompositeValueSupport cvs = new MapCompositeValueSupport(METHOD_STATS_TYPE);
+         for (String name : METHOD_STATS_TYPE.itemSet())
+            cvs.put(name, SimpleValueSupport.wrap(entry.getValue().get(name)));
+
+         methodMap.put(entry.getKey(), cvs);
+      }
+
+      MapCompositeValueSupport root = new MapCompositeValueSupport(TYPE);
+      for (int i = 0; i < 3; i++)
+         root.put(rootItemNames[i], SimpleValueSupport.wrap(object.get("#Global").get(rootItemNames[i])));
+
+      root.put(rootItemNames[3], new MapCompositeValueSupport(methodMap, METHOD_STATS_MAP_TYPE));
+
+      return root;
+   }
+
+   @Override
+   public Map<String, Map<String, Long>> unwrapMetaValue(MetaValue metaValue)
+   {
+      // This is read-only, so not needed
+      return null;
+   }
+}

Copied: projects/ejb3/trunk/metrics-deployer/src/main/java/org/jboss/ejb3/metrics/deployer/ManagedInvocationStatisticsSessionWrapperBase.java (from rev 89744, projects/ejb3/trunk/metrics-deployer/src/main/java/org/jboss/ejb3/metrics/deployer/ManagedInvocationStatisticsWrapper.java)
===================================================================
--- projects/ejb3/trunk/metrics-deployer/src/main/java/org/jboss/ejb3/metrics/deployer/ManagedInvocationStatisticsSessionWrapperBase.java	                        (rev 0)
+++ projects/ejb3/trunk/metrics-deployer/src/main/java/org/jboss/ejb3/metrics/deployer/ManagedInvocationStatisticsSessionWrapperBase.java	2009-06-06 05:42:24 UTC (rev 89950)
@@ -0,0 +1,121 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+  *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ejb3.metrics.deployer;
+
+import java.util.Map;
+
+import org.jboss.ejb3.statistics.InvocationStatistics;
+import org.jboss.managed.api.annotation.ManagementOperation;
+import org.jboss.managed.api.annotation.ManagementProperty;
+import org.jboss.managed.api.annotation.ViewUse;
+import org.jboss.metatype.api.annotations.MetaMapping;
+
+/**
+ * ManagedInvocationStatisticsSessionWrapperBase
+ * 
+ * Base class to to delegate to the underlying invocation stats, 
+ * exposing management properties and operations.
+ *
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ * @version $Revision: $
+ */
+class ManagedInvocationStatisticsSessionWrapperBase
+{
+   // --------------------------------------------------------------------------------||
+   // Instance Members ---------------------------------------------------------------||
+   // --------------------------------------------------------------------------------||
+
+   /**
+    * The delegate
+    */
+   private InvocationStatistics delegate;
+
+   // --------------------------------------------------------------------------------||
+   // Constructor --------------------------------------------------------------------||
+   // --------------------------------------------------------------------------------||
+
+   /**
+    * Constructor
+    * 
+    * @param delegate
+    * @throws IllegalArgumentException If the delegate was not supplied
+    */
+   ManagedInvocationStatisticsSessionWrapperBase(final InvocationStatistics delegate) throws IllegalArgumentException
+   {
+      // Precondition check
+      if (delegate == null)
+      {
+         throw new IllegalArgumentException("Supplied delegate was null");
+      }
+
+      this.setDelegate(delegate);
+   }
+
+   // --------------------------------------------------------------------------------||
+   // Delegate Methods ---------------------------------------------------------------||
+   // --------------------------------------------------------------------------------||
+
+   /**
+    * @return
+    * @see org.jboss.ejb3.statistics.InvocationStatistics#getStats()
+    */
+   @ManagementProperty(readOnly = true, use = ViewUse.STATISTIC)
+   //@MetaMapping(value = InvocationStatisticMetaMapper.class)
+   public Map getStats()
+   {
+      return delegate.getStats();
+   }
+
+   /**
+    * 
+    * @see org.jboss.ejb3.statistics.InvocationStatistics#resetStats()
+    */
+   @ManagementOperation
+   public void resetStats()
+   {
+      delegate.resetStats();
+   }
+
+   /**
+    * Exposes the time, represented in milliseconds since the epoch, 
+    * that the stats were last reset
+    * @return
+    */
+   @ManagementProperty(readOnly = true, use = ViewUse.STATISTIC)
+   public long getLastResetTime()
+   {
+      return delegate.lastResetTime;
+   }
+
+   // --------------------------------------------------------------------------------||
+   // Accessors / Mutators -----------------------------------------------------------||
+   // --------------------------------------------------------------------------------||
+
+   /**
+    * @param stats the stats to set
+    */
+   private void setDelegate(final InvocationStatistics stats)
+   {
+      this.delegate = stats;
+   }
+
+}


Property changes on: projects/ejb3/trunk/metrics-deployer/src/main/java/org/jboss/ejb3/metrics/deployer/ManagedInvocationStatisticsSessionWrapperBase.java
___________________________________________________________________
Name: svn:mergeinfo
   + 

Deleted: projects/ejb3/trunk/metrics-deployer/src/main/java/org/jboss/ejb3/metrics/deployer/ManagedInvocationStatisticsWrapper.java
===================================================================
--- projects/ejb3/trunk/metrics-deployer/src/main/java/org/jboss/ejb3/metrics/deployer/ManagedInvocationStatisticsWrapper.java	2009-06-06 05:25:47 UTC (rev 89949)
+++ projects/ejb3/trunk/metrics-deployer/src/main/java/org/jboss/ejb3/metrics/deployer/ManagedInvocationStatisticsWrapper.java	2009-06-06 05:42:24 UTC (rev 89950)
@@ -1,123 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2009, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
-  *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.ejb3.metrics.deployer;
-
-import java.util.Map;
-
-import org.jboss.ejb3.statistics.InvocationStatistics;
-import org.jboss.managed.api.annotation.ManagementComponent;
-import org.jboss.managed.api.annotation.ManagementObject;
-import org.jboss.managed.api.annotation.ManagementOperation;
-import org.jboss.managed.api.annotation.ManagementProperties;
-import org.jboss.managed.api.annotation.ManagementProperty;
-import org.jboss.managed.api.annotation.ViewUse;
-
-/**
- * ManagedInvocationStatistics
- * 
- * Simple wrapper to delegate to the underlying invocation stats, 
- * exposing as a managed object
- *
- * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
- * @version $Revision: $
- */
- at ManagementObject(isRuntime = true, properties = ManagementProperties.EXPLICIT, description = "Session Bean Invocation Metrics", componentType = @ManagementComponent(type = "EJB3", subtype = "Session"))
-public class ManagedInvocationStatisticsWrapper
-{
-   // --------------------------------------------------------------------------------||
-   // Instance Members ---------------------------------------------------------------||
-   // --------------------------------------------------------------------------------||
-
-   /**
-    * The delegate
-    */
-   private InvocationStatistics delegate;
-
-   // --------------------------------------------------------------------------------||
-   // Constructor --------------------------------------------------------------------||
-   // --------------------------------------------------------------------------------||
-
-   /**
-    * Constructor
-    * 
-    * @param delegate
-    * @throws IllegalArgumentException If the delegate was not supplied
-    */
-   public ManagedInvocationStatisticsWrapper(final InvocationStatistics delegate) throws IllegalArgumentException
-   {
-      // Precondition check
-      if (delegate == null)
-      {
-         throw new IllegalArgumentException("Supplied delegate was null");
-      }
-
-      this.setDelegate(delegate);
-   }
-
-   // --------------------------------------------------------------------------------||
-   // Delegate Methods ---------------------------------------------------------------||
-   // --------------------------------------------------------------------------------||
-
-   /**
-    * @return
-    * @see org.jboss.ejb3.statistics.InvocationStatistics#getStats()
-    */
-   @ManagementProperty(readOnly = true, use = ViewUse.STATISTIC)
-   public Map getStats()
-   {
-      return delegate.getStats();
-   }
-
-   /**
-    * 
-    * @see org.jboss.ejb3.statistics.InvocationStatistics#resetStats()
-    */
-   @ManagementOperation
-   public void resetStats()
-   {
-      delegate.resetStats();
-   }
-
-   /**
-    * Exposes the time, represented in milliseconds since the epoch, 
-    * that the stats were last reset
-    * @return
-    */
-   @ManagementProperty(readOnly = true, use = ViewUse.STATISTIC)
-   public long getLastResetTime()
-   {
-      return delegate.lastResetTime;
-   }
-
-   // --------------------------------------------------------------------------------||
-   // Accessors / Mutators -----------------------------------------------------------||
-   // --------------------------------------------------------------------------------||
-
-   /**
-    * @param stats the stats to set
-    */
-   private void setDelegate(final InvocationStatistics stats)
-   {
-      this.delegate = stats;
-   }
-
-}

Added: projects/ejb3/trunk/metrics-deployer/src/main/java/org/jboss/ejb3/metrics/deployer/ManagedStatefulInvocationStatisticsWrapper.java
===================================================================
--- projects/ejb3/trunk/metrics-deployer/src/main/java/org/jboss/ejb3/metrics/deployer/ManagedStatefulInvocationStatisticsWrapper.java	                        (rev 0)
+++ projects/ejb3/trunk/metrics-deployer/src/main/java/org/jboss/ejb3/metrics/deployer/ManagedStatefulInvocationStatisticsWrapper.java	2009-06-06 05:42:24 UTC (rev 89950)
@@ -0,0 +1,57 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+  *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ejb3.metrics.deployer;
+
+import org.jboss.ejb3.statistics.InvocationStatistics;
+import org.jboss.managed.api.annotation.ManagementComponent;
+import org.jboss.managed.api.annotation.ManagementObject;
+import org.jboss.managed.api.annotation.ManagementProperties;
+
+/**
+ * ManagedStatefulInvocationStatisticsWrapper
+ * 
+ * @ManagementObject wrapper to expose SFSB invocation statistics
+ *
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ * @version $Revision: $
+ */
+ at ManagementObject(isRuntime = true, properties = ManagementProperties.EXPLICIT, description = "Stateless Session Bean Invocation Metrics", componentType = @ManagementComponent(type = "EJB3", subtype = "SFSB"))
+public class ManagedStatefulInvocationStatisticsWrapper extends ManagedInvocationStatisticsSessionWrapperBase
+{
+
+   // --------------------------------------------------------------------------------||
+   // Constructor --------------------------------------------------------------------||
+   // --------------------------------------------------------------------------------||
+
+   /**
+    * Constructor
+    * 
+    * @param delegate
+    * @throws IllegalArgumentException If the delegate was not supplied
+    */
+   public ManagedStatefulInvocationStatisticsWrapper(final InvocationStatistics delegate)
+         throws IllegalArgumentException
+   {
+      super(delegate);
+   }
+
+}

Added: projects/ejb3/trunk/metrics-deployer/src/main/java/org/jboss/ejb3/metrics/deployer/ManagedStatelessInvocationStatisticsWrapper.java
===================================================================
--- projects/ejb3/trunk/metrics-deployer/src/main/java/org/jboss/ejb3/metrics/deployer/ManagedStatelessInvocationStatisticsWrapper.java	                        (rev 0)
+++ projects/ejb3/trunk/metrics-deployer/src/main/java/org/jboss/ejb3/metrics/deployer/ManagedStatelessInvocationStatisticsWrapper.java	2009-06-06 05:42:24 UTC (rev 89950)
@@ -0,0 +1,57 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+  *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ejb3.metrics.deployer;
+
+import org.jboss.ejb3.statistics.InvocationStatistics;
+import org.jboss.managed.api.annotation.ManagementComponent;
+import org.jboss.managed.api.annotation.ManagementObject;
+import org.jboss.managed.api.annotation.ManagementProperties;
+
+/**
+ * ManagedStatelessInvocationStatisticsWrapper
+ * 
+ * @ManagementObject wrapper to expose SLSB invocation statistics
+ *
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ * @version $Revision: $
+ */
+ at ManagementObject(isRuntime = true, properties = ManagementProperties.EXPLICIT, description = "Stateless Session Bean Invocation Metrics", componentType = @ManagementComponent(type = "EJB3", subtype = "SLSB"))
+public class ManagedStatelessInvocationStatisticsWrapper extends ManagedInvocationStatisticsSessionWrapperBase
+{
+
+   // --------------------------------------------------------------------------------||
+   // Constructor --------------------------------------------------------------------||
+   // --------------------------------------------------------------------------------||
+
+   /**
+    * Constructor
+    * 
+    * @param delegate
+    * @throws IllegalArgumentException If the delegate was not supplied
+    */
+   public ManagedStatelessInvocationStatisticsWrapper(final InvocationStatistics delegate)
+         throws IllegalArgumentException
+   {
+      super(delegate);
+   }
+
+}




More information about the jboss-cvs-commits mailing list