Author: sebb
Date: Fri Dec 10 23:33:41 2010
New Revision: 1044536

URL: http://svn.apache.org/viewvc?rev=1044536&view=rev
Log:
Use internal lock for synch.

Modified:
    
jakarta/jmeter/trunk/src/protocol/mail/org/apache/jmeter/protocol/smtp/sampler/protocol/SynchronousTransportListener.java

Modified: 
jakarta/jmeter/trunk/src/protocol/mail/org/apache/jmeter/protocol/smtp/sampler/protocol/SynchronousTransportListener.java
URL: 
http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/protocol/mail/org/apache/jmeter/protocol/smtp/sampler/protocol/SynchronousTransportListener.java?rev=1044536&r1=1044535&r2=1044536&view=diff
==============================================================================
--- 
jakarta/jmeter/trunk/src/protocol/mail/org/apache/jmeter/protocol/smtp/sampler/protocol/SynchronousTransportListener.java
 (original)
+++ 
jakarta/jmeter/trunk/src/protocol/mail/org/apache/jmeter/protocol/smtp/sampler/protocol/SynchronousTransportListener.java
 Fri Dec 10 23:33:41 2010
@@ -37,6 +37,8 @@ public class SynchronousTransportListene
 
     private boolean finished = false;
 
+    private final Object LOCK = new Object();
+    
     /**
      * Creates a new instance of SynchronousTransportListener
      */
@@ -75,17 +77,22 @@ public class SynchronousTransportListene
      *
      * @throws InterruptedException
      */
-    public synchronized void attend() throws InterruptedException {
-        if (!finished)
-            wait();
+    public void attend() throws InterruptedException {
+        synchronized(LOCK) {
+            while (!finished) {
+                LOCK.wait();            
+            }
+        }
     }
 
     /**
      * Synchronized-method
      */
-    public synchronized void finish() {
+    public void finish() {
         finished = true;
-        notify();
+        synchronized(LOCK) {
+            LOCK.notify();
+        }
     }
 
 }



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

Reply via email to