You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by lq...@apache.org on 2015/11/13 16:12:05 UTC

svn commit: r1714220 - in /qpid/java/trunk/perftests/src: main/java/org/apache/qpid/disttest/client/ProducerParticipant.java test/java/org/apache/qpid/disttest/client/ProducerParticipantTest.java

Author: lquack
Date: Fri Nov 13 15:12:04 2015
New Revision: 1714220

URL: http://svn.apache.org/viewvc?rev=1714220&view=rev
Log:
QPID-6804: [Java Perftests] Ensure ProducerParticipant stop sending messages before closing the session.

Modified:
    qpid/java/trunk/perftests/src/main/java/org/apache/qpid/disttest/client/ProducerParticipant.java
    qpid/java/trunk/perftests/src/test/java/org/apache/qpid/disttest/client/ProducerParticipantTest.java

Modified: qpid/java/trunk/perftests/src/main/java/org/apache/qpid/disttest/client/ProducerParticipant.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/perftests/src/main/java/org/apache/qpid/disttest/client/ProducerParticipant.java?rev=1714220&r1=1714219&r2=1714220&view=diff
==============================================================================
--- qpid/java/trunk/perftests/src/main/java/org/apache/qpid/disttest/client/ProducerParticipant.java (original)
+++ qpid/java/trunk/perftests/src/main/java/org/apache/qpid/disttest/client/ProducerParticipant.java Fri Nov 13 15:12:04 2015
@@ -46,6 +46,7 @@ public class ProducerParticipant impleme
 
     private final CountDownLatch _startDataCollectionLatch = new CountDownLatch(1);
     private final CountDownLatch _stopTestLatch = new CountDownLatch(1);
+    private final CountDownLatch _hasStoppedLatch = new CountDownLatch(1);
     private final long _maximumDuration;
     private final long _numberOfMessages;
     private final int _batchSize;
@@ -146,6 +147,7 @@ public class ProducerParticipant impleme
                 }
             }
         }
+        _hasStoppedLatch.countDown();
     }
 
     private ParticipantResult finaliseResults(final String registeredClientName,
@@ -194,6 +196,22 @@ public class ProducerParticipant impleme
     @Override
     public void stopTest()
     {
+        stopTestAsync();
+        try
+        {
+            while (!_hasStoppedLatch.await(1, TimeUnit.SECONDS))
+            {
+                LOGGER.debug("Producer {} still waiting for shutdown", getName());
+            }
+        }
+        catch (InterruptedException e)
+        {
+            Thread.currentThread().interrupt();
+        }
+    }
+
+    void stopTestAsync()
+    {
         _stopTestLatch.countDown();
     }
 

Modified: qpid/java/trunk/perftests/src/test/java/org/apache/qpid/disttest/client/ProducerParticipantTest.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/perftests/src/test/java/org/apache/qpid/disttest/client/ProducerParticipantTest.java?rev=1714220&r1=1714219&r2=1714220&view=diff
==============================================================================
--- qpid/java/trunk/perftests/src/test/java/org/apache/qpid/disttest/client/ProducerParticipantTest.java (original)
+++ qpid/java/trunk/perftests/src/test/java/org/apache/qpid/disttest/client/ProducerParticipantTest.java Fri Nov 13 15:12:04 2015
@@ -82,7 +82,7 @@ public class ProducerParticipantTest ext
             public void reportResult(final ParticipantResult theResult)
             {
                 result[0] = theResult;
-                _producer.stopTest();
+                _producer.stopTestAsync();
             }
         };
         _producer.startTest(CLIENT_NAME, resultReporter);



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org