Author: sebb
Date: Tue Sep 27 14:26:50 2011
New Revision: 1176398

URL: http://svn.apache.org/viewvc?rev=1176398&view=rev
Log:
Ensure unlock is called

Modified:
    jakarta/jmeter/trunk/src/core/org/apache/jmeter/threads/JMeterThread.java

Modified: 
jakarta/jmeter/trunk/src/core/org/apache/jmeter/threads/JMeterThread.java
URL: 
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/core/org/apache/jmeter/threads/JMeterThread.java?rev=1176398&r1=1176397&r2=1176398&view=diff
==============================================================================
--- jakarta/jmeter/trunk/src/core/org/apache/jmeter/threads/JMeterThread.java 
(original)
+++ jakarta/jmeter/trunk/src/core/org/apache/jmeter/threads/JMeterThread.java 
Tue Sep 27 14:26:50 2011
@@ -321,13 +321,17 @@ public class JMeterThread implements Run
             log.error("Test failed!", e);
         } finally {
             currentSampler = null; // prevent any further interrupts
-            interruptLock.lock();  // make sure current interrupt is finished, 
prevent another starting yet
-            threadContext.clear();
-            log.info("Thread finished: " + threadName);
-            threadFinished(iterationListener);
-            monitor.threadFinished(this); // Tell the engine we are done
-            JMeterContextService.removeContext(); // Remove the ThreadLocal 
entry
-            interruptLock.unlock(); // Allow any pending interrupt to complete 
(OK because currentSampler == null)
+            try {
+                interruptLock.lock();  // make sure current interrupt is 
finished, prevent another starting yet
+                threadContext.clear();
+                log.info("Thread finished: " + threadName);
+                threadFinished(iterationListener);
+                monitor.threadFinished(this); // Tell the engine we are done
+                JMeterContextService.removeContext(); // Remove the 
ThreadLocal entry
+            }
+            finally {
+                interruptLock.unlock(); // Allow any pending interrupt to 
complete (OK because currentSampler == null)
+            }
         }
     }
 



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to