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 de...@apache.org on 2006/04/18 15:17:35 UTC

svn commit: r394936 - in /webservices/axis2/trunk/java/modules/core/src/org/apache/axis2: client/ServiceClient.java deployment/DeploymentEngine.java

Author: deepal
Date: Tue Apr 18 06:17:32 2006
New Revision: 394936

URL: http://svn.apache.org/viewcvs?rev=394936&view=rev
Log:
applying the patch http://issues.apache.org/jira/browse/AXIS2-572
- it wont create modules and services directories in side repo if they not found

Modified:
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/client/ServiceClient.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/DeploymentEngine.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=394936&r1=394935&r2=394936&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 Tue Apr 18 06:17:32 2006
@@ -7,7 +7,6 @@
 import org.apache.axiom.soap.SOAPFactory;
 import org.apache.axiom.soap.SOAPHeader;
 import org.apache.axis2.AxisFault;
-import org.apache.axis2.wsdl.WSDLConstants;
 import org.apache.axis2.addressing.EndpointReference;
 import org.apache.axis2.client.async.AsyncResult;
 import org.apache.axis2.client.async.Callback;
@@ -17,6 +16,7 @@
 import org.apache.axis2.engine.ListenerManager;
 import org.apache.axis2.i18n.Messages;
 import org.apache.axis2.util.CallbackReceiver;
+import org.apache.axis2.wsdl.WSDLConstants;
 
 import javax.wsdl.Definition;
 import javax.xml.namespace.QName;
@@ -419,14 +419,24 @@
             // this method call two channel non blocking method to do the work
             // and wait on the callbck
             sendReceiveNonBlocking(operation, elem, callback);
+
             long timeout = options.getTimeOutInMilliSeconds();
+            long waitTime = timeout;
+            long startTime = System.currentTimeMillis();
+
             synchronized (callback) {
-                try {
-                    callback.wait(timeout);
-                } catch (InterruptedException e) {
-                    throw new AxisFault(Messages
-                            .getMessage("responseTimeOut"));
+                while (! callback.isComplete() && waitTime >= 0) {
+                    try {
+                        callback.wait(timeout);
+                    } catch (InterruptedException e) {
+                        // We were interrupted for some reason, keep waiting
+                        // or throw new AxisFault( "Callback was interrupted by someone?" );
+                    }
+                    // The wait finished, compute remaining time
+                    // - wait can end prematurly, see Object.wait( int timeout )
+                    waitTime = timeout - (System.currentTimeMillis() - startTime);
                 }
+
             }
             // process the resule of the invocation
             if (callback.envelope != null) {
@@ -437,9 +447,12 @@
             } else {
                 if (callback.error instanceof AxisFault) {
                     throw (AxisFault) callback.error;
-                } else {
+                } else if (callback.error != null) {
                     throw new AxisFault(callback.error);
-                }
+                } else if (! callback.isComplete()) {
+                    throw new AxisFault(Messages.getMessage("responseTimeOut"));
+                } else
+                    throw new AxisFault("Callback completed but there was no envelope or error");
             }
         } else {
             MessageContext mc = new MessageContext();
@@ -598,6 +611,10 @@
         public void onComplete(AsyncResult result) {
             this.envelope = result.getResponseEnvelope();
             this.msgctx = result.getResponseMessageContext();
+        }
+
+        public void setComplete(boolean complete) {
+            super.setComplete(complete);
             synchronized (this) {
                 notify();
             }

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/DeploymentEngine.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/DeploymentEngine.java?rev=394936&r1=394935&r2=394936&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/DeploymentEngine.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/DeploymentEngine.java Tue Apr 18 06:17:32 2006
@@ -932,12 +932,10 @@
         File repository = new File(repositoryName);
         File services = new File(repository, DIRECTORY_SERVICES);
         if (!services.exists()) {
-            services.mkdirs();
             log.info(Messages.getMessage("noservicedirfound"));
         }
         File modules = new File(repository, DIRECTORY_MODULES);
         if (!modules.exists()) {
-            modules.mkdirs();
             log.info(Messages.getMessage("nomoduledirfound"));
         }
     }