You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by sa...@apache.org on 2006/03/17 09:54:49 UTC

svn commit: r386572 - /webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/ServiceClient.java

Author: saminda
Date: Fri Mar 17 00:54:48 2006
New Revision: 386572

URL: http://svn.apache.org/viewcvs?rev=386572&view=rev
Log:
- fixing TCP test failures
- fixing sleep loop in serviceClient(convert that to wait notify) , thx Snajiva for fixing that

Modified:
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/ServiceClient.java

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/ServiceClient.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/ServiceClient.java?rev=386572&r1=386571&r2=386572&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/ServiceClient.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/ServiceClient.java Fri Mar 17 00:54:48 2006
@@ -427,14 +427,10 @@
             // and wait on the callbck
             sendReceiveNonBlocking(operation, elem, callback);
             long timeout = options.getTimeOutInMilliSeconds();
-            long startTime = System.currentTimeMillis();
-            long currentTime;
-            while (true) {
-                if (callback.isComplete()) {
-                    break;
-                }
-                currentTime = System.currentTimeMillis();
-                if (currentTime - startTime > timeout) {
+            synchronized (callback) {
+                try {
+                    callback.wait(timeout);
+                } catch (InterruptedException e) {
                     throw new AxisFault(Messages
                             .getMessage("responseTimeOut"));
                 }
@@ -609,6 +605,9 @@
         public void onComplete(AsyncResult result) {
             this.envelope = result.getResponseEnvelope();
             this.msgctx = result.getResponseMessageContext();
+            synchronized (this){
+                notify();
+            }
         }
 
         public void onError(Exception e) {