axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sami...@apache.org
Subject svn commit: r386572 - /webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/ServiceClient.java
Date Fri, 17 Mar 2006 08:54:49 GMT
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) {



Mime
View raw message