You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ode.apache.org by mi...@apache.org on 2009/04/18 01:03:06 UTC
svn commit: r766175 -
/ode/branches/APACHE_ODE_1.X/axis2/src/main/java/org/apache/ode/axis2/BindingContextImpl.java
Author: midon
Date: Fri Apr 17 23:03:06 2009
New Revision: 766175
URL: http://svn.apache.org/viewvc?rev=766175&view=rev
Log:
ODE-580: kudos to Ciaran Jessup for the patch
Modified:
ode/branches/APACHE_ODE_1.X/axis2/src/main/java/org/apache/ode/axis2/BindingContextImpl.java
Modified: ode/branches/APACHE_ODE_1.X/axis2/src/main/java/org/apache/ode/axis2/BindingContextImpl.java
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/axis2/src/main/java/org/apache/ode/axis2/BindingContextImpl.java?rev=766175&r1=766174&r2=766175&view=diff
==============================================================================
--- ode/branches/APACHE_ODE_1.X/axis2/src/main/java/org/apache/ode/axis2/BindingContextImpl.java (original)
+++ ode/branches/APACHE_ODE_1.X/axis2/src/main/java/org/apache/ode/axis2/BindingContextImpl.java Fri Apr 17 23:03:06 2009
@@ -20,6 +20,7 @@
package org.apache.ode.axis2;
+import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
@@ -157,7 +158,8 @@
// now, stop the service
_server._axisConfig.stopService(axisServiceName);
// if only this method did a good job of cleaning up after itself
- _server._axisConfig.removeService(axisServiceName);
+ _server._axisConfig.removeService(service.getName());
+ completeCleanup(axisService);
_server._axisConfig.cleanup();
} catch (AxisFault axisFault) {
__log.error("Couldn't destroy service " + serviceName);
@@ -168,6 +170,33 @@
return service;
}
+ /**
+ * /!\ Monkey patching to remove references to the service:
+ * Manually & externally & really really horribly fix for ODE-580/AXIS2-3870
+ * The exception handling is for locked down environment where reflection would not be allowed...
+ *
+ * This patch is needed for Axis2 1.3 and 1.4.1
+ * @param service
+ * @throws AxisFault
+ */
+ private void completeCleanup(AxisService service) {
+ try {
+ Field field= _server._axisConfig.getClass().getDeclaredField("allEndpoints");
+ field.setAccessible(true);
+ synchronized (_server._axisConfig) {
+ //removes the endpoints to this service
+ Map allEndpoints = (Map) field.get(_server._axisConfig);
+
+ //removes the service endpoints
+ for (Iterator<String> iter = service.getEndpoints().keySet().iterator(); iter.hasNext();) {
+ allEndpoints.remove(service.getName() + "." + iter.next());
+ }
+ }
+ } catch(Exception e) {
+ __log.error("Workaround for ODE-580/AXIS2-3870 failed. AxisConfig clean up might be incomplete.", e);
+ }
+ }
+
protected ExternalService createExternalService(ProcessConf pconf, QName serviceName, String portName) throws ContextException {
ExternalService extService = null;