You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-commits@axis.apache.org by ve...@apache.org on 2014/05/14 22:20:43 UTC

svn commit: r1594701 - in /axis/axis2/java/core/trunk/modules: osgi-tests/src/test/java/OSGiTest.java osgi/src/org/apache/axis2/osgi/deployment/OSGiConfigurationContextFactory.java

Author: veithen
Date: Wed May 14 20:20:43 2014
New Revision: 1594701

URL: http://svn.apache.org/r1594701
Log:
AXIS2-5646: Fixed an IllegalStateException triggered during shutdown of the Axis2 OSGi module:
* Applied the patch submitted by Andy Schmidt (with some minor formatting changes).
* Enabled the regression test for this issue.

Modified:
    axis/axis2/java/core/trunk/modules/osgi-tests/src/test/java/OSGiTest.java
    axis/axis2/java/core/trunk/modules/osgi/src/org/apache/axis2/osgi/deployment/OSGiConfigurationContextFactory.java

Modified: axis/axis2/java/core/trunk/modules/osgi-tests/src/test/java/OSGiTest.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/osgi-tests/src/test/java/OSGiTest.java?rev=1594701&r1=1594700&r2=1594701&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/osgi-tests/src/test/java/OSGiTest.java (original)
+++ axis/axis2/java/core/trunk/modules/osgi-tests/src/test/java/OSGiTest.java Wed May 14 20:20:43 2014
@@ -113,10 +113,8 @@ public class OSGiTest {
             serviceClient.setOptions(options);
             OMElement result = serviceClient.sendReceive(payload);
             assertEquals("getVersionResponse", result.getLocalName());
-            // Stop the Axis2 bundle explicitly here so that we can test that it cleanly shuts down
-            getAxis2Bundle(container).stop();
-            // TODO: Test for AXIS2-5646
-//            stopBundle(getAxis2Bundle(container));
+            // Stop the Axis2 bundle explicitly here so that we can test that it cleanly shuts down (see AXIS2-5646)
+            stopBundle(getAxis2Bundle(container));
         } finally {
             container.stop();
         }

Modified: axis/axis2/java/core/trunk/modules/osgi/src/org/apache/axis2/osgi/deployment/OSGiConfigurationContextFactory.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/osgi/src/org/apache/axis2/osgi/deployment/OSGiConfigurationContextFactory.java?rev=1594701&r1=1594700&r2=1594701&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/osgi/src/org/apache/axis2/osgi/deployment/OSGiConfigurationContextFactory.java (original)
+++ axis/axis2/java/core/trunk/modules/osgi/src/org/apache/axis2/osgi/deployment/OSGiConfigurationContextFactory.java Wed May 14 20:20:43 2014
@@ -56,6 +56,8 @@ public class OSGiConfigurationContextFac
 
     private ServiceRegistration mngServiceRegistration;
 
+    private ServiceRegistration transportServiceRegistration;
+    
     private ConfigurationContext configCtx;
 
     private ServiceRegistration configCtxServiceRegistration;
@@ -72,6 +74,14 @@ public class OSGiConfigurationContextFac
     }
 
     public synchronized void stop() {
+        if (configCtxServiceRegistration != null) {
+            configCtxServiceRegistration.unregister();
+        }
+        
+        if (transportServiceRegistration != null) {
+            transportServiceRegistration.unregister();
+        }
+        
         if (mngServiceRegistration != null) {
             mngServiceRegistration.unregister();
         }
@@ -120,7 +130,7 @@ public class OSGiConfigurationContextFac
             Dictionary prop = new Properties();
             prop.put(PROTOCOL, "http");
             //adding the default listener
-            context.registerService(TransportListener.class.getName(), new HttpListener(context),
+            transportServiceRegistration = context.registerService(TransportListener.class.getName(), new HttpListener(context),
                                     prop);
             log.info("Axis2 environment has started.");
         } catch (AxisFault e) {