You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-commits@axis.apache.org by ve...@apache.org on 2017/04/23 18:45:16 UTC

svn commit: r1792383 - in /axis/axis2/java/core/branches/1_7: ./ modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/AsyncExecutorTests.java

Author: veithen
Date: Sun Apr 23 18:45:16 2017
New Revision: 1792383

URL: http://svn.apache.org/viewvc?rev=1792383&view=rev
Log:
Merge r1792376 to the 1.7 branch.

Modified:
    axis/axis2/java/core/branches/1_7/   (props changed)
    axis/axis2/java/core/branches/1_7/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/AsyncExecutorTests.java

Propchange: axis/axis2/java/core/branches/1_7/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Sun Apr 23 18:45:16 2017
@@ -1,4 +1,4 @@
 /axis/axis2/java/core/branches/1_6:1295540
 /axis/axis2/java/core/branches/AXIOM-420:1334386-1336397
 /axis/axis2/java/core/branches/AXIS2-4318:1230452,1295542,1324772,1327468,1329571,1332141,1335355,1335357,1340985
-/axis/axis2/java/core/trunk:1726494,1726509,1726513,1727171,1727174,1727177,1727180,1729891,1730095,1730139,1730180,1730186,1730195,1730197,1730222,1730300,1730308,1730310,1730317,1730322,1730335,1730369,1730427,1730618,1731425,1731441,1731446,1731448,1732354,1733137,1733663,1733713,1733766,1733770,1733773,1733850,1734176,1735331,1735795,1736512,1736543,1737030,1737567,1739001,1739186,1739343,1739346,1739348,1739493,1739592,1739594-1739595,1739815,1739826,1740693-1740694,1741976,1742201,1743824,1745826,1745860,1745869,1745875,1745912,1745924,1745929,1745941,1746001,1746028,1746109,1746782,1746784,1746787,1746813,1746842,1746880,1746883,1746889,1746894,1747448,1747466,1747503,1747575,1747578,1747601,1747773,1747920,1751057,1752039,1765132,1765183,1765188,1765193,1775081,1775102,1776253,1776585,1776594,1778204,1780290,1789058,1792353
+/axis/axis2/java/core/trunk:1726494,1726509,1726513,1727171,1727174,1727177,1727180,1729891,1730095,1730139,1730180,1730186,1730195,1730197,1730222,1730300,1730308,1730310,1730317,1730322,1730335,1730369,1730427,1730618,1731425,1731441,1731446,1731448,1732354,1733137,1733663,1733713,1733766,1733770,1733773,1733850,1734176,1735331,1735795,1736512,1736543,1737030,1737567,1739001,1739186,1739343,1739346,1739348,1739493,1739592,1739594-1739595,1739815,1739826,1740693-1740694,1741976,1742201,1743824,1745826,1745860,1745869,1745875,1745912,1745924,1745929,1745941,1746001,1746028,1746109,1746782,1746784,1746787,1746813,1746842,1746880,1746883,1746889,1746894,1747448,1747466,1747503,1747575,1747578,1747601,1747773,1747920,1751057,1752039,1765132,1765183,1765188,1765193,1775081,1775102,1776253,1776585,1776594,1778204,1780290,1789058,1792353,1792376

Modified: axis/axis2/java/core/branches/1_7/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/AsyncExecutorTests.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/1_7/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/AsyncExecutorTests.java?rev=1792383&r1=1792382&r2=1792383&view=diff
==============================================================================
--- axis/axis2/java/core/branches/1_7/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/AsyncExecutorTests.java (original)
+++ axis/axis2/java/core/branches/1_7/modules/jaxws-integration/test/org/apache/axis2/jaxws/sample/AsyncExecutorTests.java Sun Apr 23 18:45:16 2017
@@ -347,6 +347,22 @@ public class AsyncExecutorTests extends
         }
     }
     
+    static void withRetry(Runnable runnable) throws InterruptedException {
+        int retries = 0;
+        while (true) {
+            try {
+                runnable.run();
+                return;
+            } catch (AssertionError ex) {
+                if (retries++ > 60) {
+                    throw ex;
+                } else {
+                    Thread.sleep(500);
+                }
+            }
+        }
+    }
+    
     /**
      * Thread that verifies the request sent by a different thread was recieved by the service and
      * then verify the response.  Another thread will have previously sent the request. Note that
@@ -380,21 +396,22 @@ public class AsyncExecutorTests extends
         }
 
         private void receiveResponse() throws Exception {
-            String title = myClassName + " : ReceiveClientResponse : ";
-            String request1 = monitor.request;
+            final String title = myClassName + " : ReceiveClientResponse : ";
+            final String request1 = monitor.request;
             
             AsyncService service = new AsyncService();
-            AsyncPort port = getPort(service);
+            final AsyncPort port = getPort(service);
 
-            // wait a bit to make sure that the server has the request;
-            Thread.sleep(1000);
-            
-            // check the waiting request 
-            TestLogger.logger.debug(title + " port.isAsleep(" + request1 + ") #1 being submitted....");
-            String asleepWithCallback1 = port.isAsleep(request1);
-            TestLogger.logger.debug(
-                    title + " port.isAsleep(" + request1 + ") #1 = [" + asleepWithCallback1 + "]");
-            assertEquals(request1, asleepWithCallback1);
+            withRetry(new Runnable() {
+                public void run() {
+                    // check the waiting request 
+                    TestLogger.logger.debug(title + " port.isAsleep(" + request1 + ") #1 being submitted....");
+                    String asleepWithCallback1 = port.isAsleep(request1);
+                    TestLogger.logger.debug(
+                            title + " port.isAsleep(" + request1 + ") #1 = [" + asleepWithCallback1 + "]");
+                    assertEquals(request1, asleepWithCallback1);
+                }
+            });
             
             // wakeup the waiting request
             TestLogger.logger.debug(title + " port.wakeUp(request1) #1 being submitted....");
@@ -403,13 +420,15 @@ public class AsyncExecutorTests extends
             assertEquals(request1, wake1);
             TestLogger.logger.debug(title + " port.wakeUp(" + request1 + ") #1 = [" + wake1 + "]");
 
-            // wait a bit..
-            Thread.sleep(2000);
-
-            // check the Future
-            Future<?> sr1 = monitor.futureResponse;
+            final Future<?> sr1 = monitor.futureResponse;
             CallbackHandler<SleepResponse> sleepCallbackHandler1 = monitor.callbackHandler;
-            assertTrue("Response is not done!", sr1.isDone());
+            
+            withRetry(new Runnable() {
+                public void run() {
+                    // check the Future
+                    assertTrue("Response is not done!", sr1.isDone());
+                }
+            });
 
             // try to get the response
             try {