[jboss-cvs] JBoss Profiler SVN: r489 - branches/JBossProfiler2/src/main/org/jboss/profiler/shared.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Oct 24 08:35:43 EDT 2008


Author: jesper.pedersen
Date: 2008-10-24 08:35:43 -0400 (Fri, 24 Oct 2008)
New Revision: 489

Modified:
   branches/JBossProfiler2/src/main/org/jboss/profiler/shared/FrameInfo.java
Log:
Synchronize on children when adding/closing to the list

Modified: branches/JBossProfiler2/src/main/org/jboss/profiler/shared/FrameInfo.java
===================================================================
--- branches/JBossProfiler2/src/main/org/jboss/profiler/shared/FrameInfo.java	2008-10-23 21:14:32 UTC (rev 488)
+++ branches/JBossProfiler2/src/main/org/jboss/profiler/shared/FrameInfo.java	2008-10-24 12:35:43 UTC (rev 489)
@@ -242,14 +242,16 @@
       setEndTime(System.nanoTime());
     }
 
-    List<FrameInfo> l = getChildren();
-    if (l != null) {
-      for (FrameInfo child: l) {
-        child.close();
+    synchronized (children) {
+      List<FrameInfo> l = getChildren();
+      if (l != null) {
+        for (FrameInfo child: l) {
+          child.close();
+        }
       }
+
+      childMap = null;
     }
-
-    childMap = null;
   }
 
   /**
@@ -290,12 +292,14 @@
    * @param fi The child
    */
   private void addChild(MethodInfo mi, FrameInfo fi) {
-    if (children == null || childMap == null) {
-      initChildren();
+    synchronized (children) {
+      if (children == null || childMap == null) {
+        initChildren();
+      }
+
+      children.add(fi);
+      childMap.put(mi, Integer.valueOf(children.size() - 1));
+      netTime = -1;
     }
-
-    children.add(fi);
-    childMap.put(mi, Integer.valueOf(children.size() - 1));
-    netTime = -1;
   }
 }




More information about the jboss-cvs-commits mailing list