[jboss-cvs] JBoss Profiler SVN: r517 - in branches/JBossProfiler2/src/main/org/jboss/profiler: shared and 1 other directory.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Dec 4 20:55:21 EST 2008


Author: jesper.pedersen
Date: 2008-12-04 20:55:20 -0500 (Thu, 04 Dec 2008)
New Revision: 517

Modified:
   branches/JBossProfiler2/src/main/org/jboss/profiler/agent/Profiler.java
   branches/JBossProfiler2/src/main/org/jboss/profiler/agent/ProfilerThreadImpl.java
   branches/JBossProfiler2/src/main/org/jboss/profiler/shared/MethodRepository.java
Log:
[JBPROFILER-67] NPE in Util.getPrettyName()

Modified: branches/JBossProfiler2/src/main/org/jboss/profiler/agent/Profiler.java
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/agent/Profiler.java	2008-12-01 13:25:16 UTC (rev 516)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/agent/Profiler.java	2008-12-05 01:55:20 UTC (rev 517)
@@ -80,6 +80,9 @@
   /** Running */
   private static AtomicBoolean running = new AtomicBoolean(false);
 
+  /** Method repository */
+  private static MethodRepository methodRepository;
+
   /**
    * Constructor
    */
@@ -94,7 +97,7 @@
       profilerThreadMap = new ConcurrentHashMap<Long, ProfilerThreadImpl>();
       from = new Date();
 
-      MethodRepository.getInstance().clear();
+      methodRepository = new MethodRepository();
 
       if (!Agent.isMemoryStore()) {
         Calendar c = Calendar.getInstance();
@@ -169,7 +172,7 @@
           Snapshot snapshot = new Snapshot(threadInfos,
                                            new ArrayList<AllocationInfo>(allocationInfos.values()),
                                            classList,
-                                           MethodRepository.getInstance(),
+                                           methodRepository,
                                            from,
                                            to);
           snapshots.add(snapshot);
@@ -203,7 +206,7 @@
             Snapshot snapshot = new Snapshot(null,
                                              new ArrayList<AllocationInfo>(allocationInfos.values()),
                                              classList,
-                                             MethodRepository.getInstance(),
+                                             methodRepository,
                                              from,
                                              to);
             SnapshotHelper.save(snapshot, new File(root, "data"));
@@ -334,4 +337,12 @@
   static File getRoot() {
     return root;
   }
+
+  /**
+   * Get the method repository
+   * @return The method repository
+   */
+  static MethodRepository getMethodRepository() {
+    return methodRepository;
+  }
 }

Modified: branches/JBossProfiler2/src/main/org/jboss/profiler/agent/ProfilerThreadImpl.java
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/agent/ProfilerThreadImpl.java	2008-12-01 13:25:16 UTC (rev 516)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/agent/ProfilerThreadImpl.java	2008-12-05 01:55:20 UTC (rev 517)
@@ -110,7 +110,7 @@
       return;
     }
 
-    Integer mi = MethodRepository.getInstance().getId(className, methodName);
+    Integer mi = Profiler.getMethodRepository().getId(className, methodName);
     
     FrameInfo parent = activeFrame;
     FrameInfo fi = null;
@@ -224,7 +224,7 @@
       
     // Constructor delegation
     if (fi != null) {
-      MethodInfo mi = MethodRepository.getInstance().getInfo(fi.getMethod());
+      MethodInfo mi = Profiler.getMethodRepository().getInfo(fi.getMethod());
       if (mi.getClassName().equals(className) && "<init>".equals(mi.getMethodName())) {
         return;
       }
@@ -273,7 +273,7 @@
     FrameInfo fi = activeFrame;
     
     while (fi != null) {
-      MethodInfo mi = MethodRepository.getInstance().getInfo(fi.getMethod());
+      MethodInfo mi = Profiler.getMethodRepository().getInfo(fi.getMethod());
       if (mi.getClassName().equals(className) 
           && mi.getMethodName().equals(methodName)) {
         // Found the first frame

Modified: branches/JBossProfiler2/src/main/org/jboss/profiler/shared/MethodRepository.java
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/shared/MethodRepository.java	2008-12-01 13:25:16 UTC (rev 516)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/shared/MethodRepository.java	2008-12-05 01:55:20 UTC (rev 517)
@@ -32,37 +32,19 @@
 public class MethodRepository implements Serializable {
 
   /** Serial version UID */
-  static final long serialVersionUID = 5622833197888854580L;
+  static final long serialVersionUID = -8088834763036458711L;
 
-  /** The instance */
-  private static final MethodRepository instance = new MethodRepository();
-
   /** The methods */
   private ConcurrentMap<Integer, MethodInfo> methods;
 
   /**
    * Constructor
    */
-  private MethodRepository() {
+  public MethodRepository() {
     methods = new ConcurrentHashMap<Integer, MethodInfo>();
   }
 
   /**
-   * Get the instance
-   * @return The instance
-   */
-  public static MethodRepository getInstance() {
-    return instance;
-  }
-
-  /**
-   * Clear the method information
-   */
-  public void clear() {
-    methods.clear();
-  }
-
-  /**
    * Get the method id
    * @param className The class name
    * @param methodName The method name




More information about the jboss-cvs-commits mailing list