Author: pmouawad
Date: Sat Nov 12 20:39:56 2016
New Revision: 1769418

URL: http://svn.apache.org/viewvc?rev=1769418&view=rev
Log:
Sync on final Lock

Modified:
    
jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/util/accesslog/SessionFilter.java

Modified: 
jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/util/accesslog/SessionFilter.java
URL: 
http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/util/accesslog/SessionFilter.java?rev=1769418&r1=1769417&r2=1769418&view=diff
==============================================================================
--- 
jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/util/accesslog/SessionFilter.java
 (original)
+++ 
jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/util/accesslog/SessionFilter.java
 Sat Nov 12 20:39:56 2016
@@ -49,6 +49,10 @@ public class SessionFilter implements Fi
     private static final Logger log = LoggingManager.getLoggerForClass();
 
     /**
+     * Protects access to managersInUse
+     */
+    private static final Object LOCK = new Object();
+    /**
      * These objects are static across multiple threads in a test, via clone()
      * method.
      */
@@ -159,7 +163,7 @@ public class SessionFilter implements Fi
         CookieManager cm = null;
         // First have to release the cookie we were using so other
         // threads stuck in wait can move on
-        synchronized(managersInUse)
+        synchronized(LOCK)
         {
             if(lastUsed != null)
             {
@@ -175,7 +179,7 @@ public class SessionFilter implements Fi
         // here is the core routine to find appropriate cookie manager and
         // check it's not being used.  If used, wait until whoever's using it 
gives
         // it up
-        synchronized(managersInUse)
+        synchronized(LOCK)
         {
             cm = cookieManagers.get(ipAddr);
             if(cm == null)
@@ -210,7 +214,7 @@ public class SessionFilter implements Fi
      */
     @Override
     public void threadFinished() {
-        synchronized(managersInUse)
+        synchronized(LOCK)
         {
             managersInUse.remove(lastUsed);
             managersInUse.notify();


Reply via email to