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 ch...@apache.org on 2005/09/06 04:56:48 UTC

svn commit: r278901 - /webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/clientapi/InOutMEPClient.java

Author: chinthaka
Date: Mon Sep  5 19:56:41 2005
New Revision: 278901

URL: http://svn.apache.org/viewcvs?rev=278901&view=rev
Log:
allowing InOutMepClient to set the time out in invokeBlocking case

Modified:
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/clientapi/InOutMEPClient.java

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/clientapi/InOutMEPClient.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/clientapi/InOutMEPClient.java?rev=278901&r1=278900&r2=278901&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/clientapi/InOutMEPClient.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/clientapi/InOutMEPClient.java Mon Sep  5 19:56:41 2005
@@ -31,9 +31,9 @@
 import org.apache.axis2.engine.AxisEngine;
 import org.apache.axis2.i18n.Messages;
 import org.apache.axis2.om.OMException;
+import org.apache.axis2.soap.SOAPBody;
 import org.apache.axis2.soap.SOAPEnvelope;
 import org.apache.axis2.soap.SOAPFault;
-import org.apache.axis2.soap.SOAPBody;
 import org.apache.axis2.transport.TransportListener;
 import org.apache.axis2.util.threadpool.AxisWorker;
 import org.apache.wsdl.WSDLConstants;
@@ -46,6 +46,8 @@
  * MessageContext and the more convients API is provided by the Call
  */
 public class InOutMEPClient extends MEPClient {
+    protected long timeOutInMilliSeconds = 2000;
+
     protected TransportListener listener;
     /**
      * transport that should be used for sending and reciving the message
@@ -136,10 +138,10 @@
             SyncCallBack callback = new SyncCallBack();
             //this method call two channel non blocking method to do the work and wait on the callbck
             invokeNonBlocking(axisop, msgctx, callback);
-            int index = 0;
+            long index = timeOutInMilliSeconds / 100;
             while (!callback.isComplete()) {
                 //wait till the reponse arrives
-                if (index++ < 20) {
+                if (index-- >= 0) {
                     try {
                         Thread.sleep(100);
                     } catch (InterruptedException e) {
@@ -430,6 +432,15 @@
                 callback.reportError(e);
             }
         }
+    }
+
+    /**
+     * This will be used in invoke blocking scenario. Client will wait the amount of time specified here
+     * and if there is no response, call will timeout. This should be given in multiples of 100 and defaults to 2000.
+     * @param timeOutInMilliSeconds
+     */
+    public void setTimeOutInMilliSeconds(long timeOutInMilliSeconds) {
+        this.timeOutInMilliSeconds = timeOutInMilliSeconds;
     }
 
 }