Author: sagara Date: Tue Feb 14 08:53:41 2012 New Revision: 1243831 URL: http://svn.apache.org/viewvc?rev=1243831&view=rev Log: Applied patch for AXIS2-4314 with some modifications.
Modified: axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/engine/AxisConfiguration.java Modified: axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/engine/AxisConfiguration.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/engine/AxisConfiguration.java?rev=1243831&r1=1243830&r2=1243831&view=diff ============================================================================== --- axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/engine/AxisConfiguration.java (original) +++ axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/engine/AxisConfiguration.java Tue Feb 14 08:53:41 2012 @@ -506,22 +506,12 @@ public class AxisConfiguration extends A Iterator<AxisService> services = axisServiceGroup.getServices(); boolean isClientSide = false; while (services.hasNext()) { - AxisService axisService = services.next(); - allServices.remove(axisService.getName()); - if (!axisService.isClientSide()) { - notifyObservers(new AxisEvent(AxisEvent.SERVICE_REMOVE , axisService), axisService); - } else { - isClientSide = true; - } + AxisService axisService = services.next(); + isClientSide = axisService.isClientSide()? true : false; //removes the endpoints to this service String serviceName = axisService.getName(); - String key; - - for (String s : axisService.getEndpoints().keySet()) { - key = serviceName + "." + s; - this.allEndpoints.remove(key); - } + removeServiceReferences(axisService.getName()); } removeChild(serviceGroupName); @@ -686,7 +676,7 @@ public class AxisConfiguration extends A * @throws AxisFault */ public synchronized void removeService(String name) throws AxisFault { - AxisService service = allServices.remove(name); + AxisService service = removeServiceReferences(name); if (service != null) { AxisServiceGroup serviceGroup = service.getAxisServiceGroup(); serviceGroup.removeService(name); @@ -1545,4 +1535,23 @@ public class AxisConfiguration extends A } return childFirstClassLoading; } + + private AxisService removeServiceReferences(String serviceName) { + + AxisService axisService = allServices.remove(serviceName); + if (axisService != null) { + if (!axisService.isClientSide()) { + notifyObservers(new AxisEvent(AxisEvent.SERVICE_REMOVE, + axisService), axisService); + } + + // removes the endpoints to this service + for (Iterator<String> iter = axisService.getEndpoints().keySet() + .iterator(); iter.hasNext();) { + String key = serviceName + "." + iter.next(); + this.allEndpoints.remove(key); + } + } + return axisService; + } }