axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ami...@apache.org
Subject svn commit: r697463 - /webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/client/ServiceClient.java
Date Sun, 21 Sep 2008 09:48:48 GMT
Author: amilas
Date: Sun Sep 21 02:48:48 2008
New Revision: 697463

URL: http://svn.apache.org/viewvc?rev=697463&view=rev
Log:
Let users to add AxisService to the AxisConfiguaration and call to the service client.
in this case axisservice is not removed from the configuration context when service client
is garbadge
collected. 

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

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/client/ServiceClient.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/client/ServiceClient.java?rev=697463&r1=697462&r2=697463&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/client/ServiceClient.java
(original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/client/ServiceClient.java
Sun Sep 21 02:48:48 2008
@@ -126,6 +126,8 @@
     
     private int hashCode;
 
+    private boolean removeAxisService;
+
     /**
      * Create a service client configured to work with a specific AxisService.
      * If this service is already in the world that's handed in (in the form of
@@ -168,17 +170,20 @@
 
         // save the axisConfig and service
         axisConfig = configContext.getAxisConfiguration();
+
         if (axisService == null) {
             axisService = createAnonymousService();
         }
         this.axisService = axisService;
+        // axis service is removed from the configuration context
+        // only if user has not added it to configuration context.
         if (axisConfig.getService(axisService.getName()) == null) {
             axisService.setClientSide(true);
             axisConfig.addService(axisService);
+            removeAxisService = true;
         } else {
-            throw new AxisFault(Messages.getMessage(
-                    "twoservicecannothavesamename",
-                    axisService.getName()));
+            axisService.setClientSide(true);
+            removeAxisService = false;
         }
         AxisServiceGroup axisServiceGroup = axisService.getAxisServiceGroup();
         ServiceGroupContext sgc = configContext.createServiceGroupContext(axisServiceGroup);
@@ -811,7 +816,7 @@
             String serviceGroupName = axisService.getAxisServiceGroup().getServiceGroupName();
             AxisConfiguration axisConfiguration = configContext.getAxisConfiguration();
             AxisServiceGroup asg = axisConfiguration.getServiceGroup(serviceGroupName);
-            if (asg != null) {
+            if ((asg != null) && removeAxisService) {
                 axisConfiguration.removeServiceGroup(serviceGroupName);
             }
         } else {



Mime
View raw message