[jboss-svn-commits] JBL Code SVN: r34422 - labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/java/org/jboss/jbossts/performance/profiler.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Fri Jul 30 11:57:38 EDT 2010


Author: whitingjr
Date: 2010-07-30 11:57:37 -0400 (Fri, 30 Jul 2010)
New Revision: 34422

Modified:
   labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/java/org/jboss/jbossts/performance/profiler/AbstractProfiler.java
Log:
Added behaviour to save offline snapshot.

Modified: labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/java/org/jboss/jbossts/performance/profiler/AbstractProfiler.java
===================================================================
--- labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/java/org/jboss/jbossts/performance/profiler/AbstractProfiler.java	2010-07-30 15:56:55 UTC (rev 34421)
+++ labs/jbosstm/workspace/whitingjr/trunk/performance/src/main/java/org/jboss/jbossts/performance/profiler/AbstractProfiler.java	2010-07-30 15:57:37 UTC (rev 34422)
@@ -22,15 +22,18 @@
 
 package org.jboss.jbossts.performance.profiler;
 
-import java.lang.reflect.Method;
+import java.io.File;
 
 import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang.reflect.MethodUtils;
 import org.apache.log4j.Logger;
 
 public abstract class AbstractProfiler implements Profiler
 {
    private static final Logger logger = Logger.getLogger(AbstractProfiler.class);
    protected Object profilerInstance;
+   protected File file;
+   protected Boolean startProfiling;
    @SuppressWarnings("unchecked")
    protected Class profilerClass;
    
@@ -96,6 +99,8 @@
       invoke(getStartCPURecordingMethodName());
    }
    
+   
+   
    /**
     * Attempt to invoke the method of the concrete profiling API. Try and handle
     * static methods.
@@ -103,14 +108,19 @@
     * @param name
     * @throws Exception
     */
-   @SuppressWarnings("unchecked")
    private void invoke(String name)
       throws Exception
    {
       if (StringUtils.isNotBlank(name))
       {
-         Method profilerMethod = this.profilerClass.getMethod(name); 
-         profilerMethod.invoke(getInstance()); // static methods ignore the instance reference
+         if (usesStaticMethods())
+         {
+            MethodUtils.invokeStaticMethod(this.profilerClass, name, null);
+         }
+         else
+         {
+            MethodUtils.invokeMethod(getInstance(), name, null);
+         }
       }
    }
 
@@ -125,6 +135,27 @@
    protected abstract String getShutDownMethodName();
    protected abstract String getClearMethodName();
    protected abstract String getStartCPURecordingMethodName();
+   protected abstract String getDumpSnapshotMethodName();
    
    protected abstract boolean usesStaticMethods();
+
+   public File getFile()
+   {
+      return file;
+   }
+
+   public void setFile(File file)
+   {
+      this.file = file;
+   }
+
+   public Boolean getStartProfiling()
+   {
+      return startProfiling;
+   }
+
+   public void setStartProfiling(Boolean startProfiling)
+   {
+      this.startProfiling = startProfiling;
+   }
 }



More information about the jboss-svn-commits mailing list