jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pmoua...@apache.org
Subject svn commit: r1208827 - /jmeter/trunk/src/reports/org/apache/jmeter/gui/ReportGuiPackage.java
Date Wed, 30 Nov 2011 22:03:18 GMT
Author: pmouawad
Date: Wed Nov 30 22:03:17 2011
New Revision: 1208827

URL: http://svn.apache.org/viewvc?rev=1208827&view=rev
Log:
Fixed potential double init if method is called concurrently

Modified:
    jmeter/trunk/src/reports/org/apache/jmeter/gui/ReportGuiPackage.java

Modified: jmeter/trunk/src/reports/org/apache/jmeter/gui/ReportGuiPackage.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/reports/org/apache/jmeter/gui/ReportGuiPackage.java?rev=1208827&r1=1208826&r2=1208827&view=diff
==============================================================================
--- jmeter/trunk/src/reports/org/apache/jmeter/gui/ReportGuiPackage.java (original)
+++ jmeter/trunk/src/reports/org/apache/jmeter/gui/ReportGuiPackage.java Wed Nov 30 22:03:17
2011
@@ -54,6 +54,8 @@ public final class ReportGuiPackage impl
     /** Logging. */
     private static final Logger log = LoggingManager.getLoggerForClass();
 
+	private static final Object LOCK = new Object();
+
     /** Singleton instance. */
     private static ReportGuiPackage guiPack;
 
@@ -128,9 +130,13 @@ public final class ReportGuiPackage impl
      */
     public static ReportGuiPackage getInstance(ReportTreeListener listener, ReportTreeModel
treeModel) {
         if (guiPack == null) {
-            guiPack = new ReportGuiPackage();
-            guiPack.setTreeListener(listener);
-            guiPack.setTreeModel(treeModel);
+        	synchronized (LOCK) {
+        		if(guiPack== null) {
+	                guiPack = new ReportGuiPackage();
+	                guiPack.setTreeListener(listener);
+	                guiPack.setTreeModel(treeModel);				
+        		}
+			}
         }
         return guiPack;
     }



Mime
View raw message