felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r1687538 - in /felix/trunk/http: base/src/main/java/org/apache/felix/http/base/internal/ itest/ itest/src/test/java/org/apache/felix/http/itest/ jetty/src/main/java/org/apache/felix/http/jetty/internal/
Date Thu, 25 Jun 2015 14:45:05 GMT
Author: cziegeler
Date: Thu Jun 25 14:45:05 2015
New Revision: 1687538

URL: http://svn.apache.org/r1687538
Log:
FELIX-4937 : IllegalArgumentException on shutdown if sessions have been created

Modified:
    felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/EventDispatcher.java
    felix/trunk/http/itest/pom.xml
    felix/trunk/http/itest/src/test/java/org/apache/felix/http/itest/BaseIntegrationTest.java
    felix/trunk/http/jetty/src/main/java/org/apache/felix/http/jetty/internal/JettyService.java

Modified: felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/EventDispatcher.java
URL: http://svn.apache.org/viewvc/felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/EventDispatcher.java?rev=1687538&r1=1687537&r2=1687538&view=diff
==============================================================================
--- felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/EventDispatcher.java
(original)
+++ felix/trunk/http/base/src/main/java/org/apache/felix/http/base/internal/EventDispatcher.java
Thu Jun 25 14:45:05 2015
@@ -36,6 +36,7 @@ import javax.servlet.http.HttpSessionLis
  */
 public class EventDispatcher implements HttpSessionAttributeListener, HttpSessionListener,
HttpSessionIdListener
 {
+    private volatile boolean active = false;
 
     private final HttpServiceController controller;
 
@@ -44,38 +45,61 @@ public class EventDispatcher implements
         this.controller = controller;
     }
 
+    public void setActive(final boolean flag)
+    {
+        this.active = flag;
+    }
+
     @Override
     public void sessionCreated(final HttpSessionEvent se)
     {
-        controller.getSessionListener().sessionCreated(se);
+        if ( this.active )
+        {
+            controller.getSessionListener().sessionCreated(se);
+        }
     }
 
     @Override
     public void sessionDestroyed(final HttpSessionEvent se)
     {
-        controller.getSessionListener().sessionDestroyed(se);
+        if ( this.active )
+        {
+            controller.getSessionListener().sessionDestroyed(se);
+        }
     }
 
     @Override
     public void attributeAdded(final HttpSessionBindingEvent se)
     {
-        controller.getSessionAttributeListener().attributeAdded(se);
+        if ( this.active )
+        {
+            controller.getSessionAttributeListener().attributeAdded(se);
+        }
     }
 
     @Override
     public void attributeRemoved(final HttpSessionBindingEvent se)
     {
-        controller.getSessionAttributeListener().attributeRemoved(se);
+        if ( this.active )
+        {
+            controller.getSessionAttributeListener().attributeRemoved(se);
+        }
     }
 
     @Override
     public void attributeReplaced(final HttpSessionBindingEvent se)
     {
-        controller.getSessionAttributeListener().attributeReplaced(se);
+        if ( this.active )
+        {
+            controller.getSessionAttributeListener().attributeReplaced(se);
+        }
     }
 
     @Override
     public void sessionIdChanged(final HttpSessionEvent event, final String oldSessionId)
{
-        controller.getSessionIdListener().sessionIdChanged(event, oldSessionId);
+        if ( this.active )
+        {
+            controller.getSessionIdListener().sessionIdChanged(event, oldSessionId);
+        }
     }
 }

Modified: felix/trunk/http/itest/pom.xml
URL: http://svn.apache.org/viewvc/felix/trunk/http/itest/pom.xml?rev=1687538&r1=1687537&r2=1687538&view=diff
==============================================================================
--- felix/trunk/http/itest/pom.xml (original)
+++ felix/trunk/http/itest/pom.xml Thu Jun 25 14:45:05 2015
@@ -34,8 +34,26 @@
 	    <felix.java.version>7</felix.java.version>
 		<pax.exam.version>4.4.0</pax.exam.version>
 		<pax.url.aether.version>2.4.1</pax.url.aether.version>
+		<http.api.version>3.0.0-SNAPSHOT</http.api.version>
+		<http.servlet.api.version>1.1.1-SNAPSHOT</http.servlet.api.version>
+		<http.jetty.version>3.0.3-SNAPSHOT</http.jetty.version>
 	</properties>
 
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-surefire-plugin</artifactId>
+                <configuration>
+                    <systemPropertyVariables>                    
+                 		<http.api.version>${http.api.version}</http.api.version>
+ 		                <http.servlet.api.version>${http.servlet.api.version}</http.servlet.api.version>
+                		<http.jetty.version>${http.jetty.version}</http.jetty.version>
+                    </systemPropertyVariables>
+                </configuration>
+            </plugin>  
+        </plugins>
+    </build>
 	<dependencies>
 		<dependency>
 			<groupId>org.osgi</groupId>
@@ -67,19 +85,19 @@
 			<scope>provided</scope>
         </dependency>
 		<dependency>
-			<groupId>${project.groupId}</groupId>
+			<groupId>org.apache.felix</groupId>
 			<artifactId>org.apache.felix.http.api</artifactId>
-			<version>3.0.0-SNAPSHOT</version>
+			<version>${http.api.version}</version>
 		</dependency>
 		<dependency>
-			<groupId>${project.groupId}</groupId>
+			<groupId>org.apache.felix</groupId>
 			<artifactId>org.apache.felix.http.servlet-api</artifactId>
-			<version>1.1.1-SNAPSHOT</version>
+			<version>${http.servlet.api.version}</version>
 		</dependency>
 		<dependency>
-			<groupId>${project.groupId}</groupId>
+			<groupId>org.apache.felix</groupId>
 			<artifactId>org.apache.felix.http.jetty</artifactId>
-			<version>3.0.3-SNAPSHOT</version>
+			<version>${http.jetty.version}</version>
 		</dependency>
         <dependency>
             <groupId>org.ops4j.pax.exam</groupId>

Modified: felix/trunk/http/itest/src/test/java/org/apache/felix/http/itest/BaseIntegrationTest.java
URL: http://svn.apache.org/viewvc/felix/trunk/http/itest/src/test/java/org/apache/felix/http/itest/BaseIntegrationTest.java?rev=1687538&r1=1687537&r2=1687538&view=diff
==============================================================================
--- felix/trunk/http/itest/src/test/java/org/apache/felix/http/itest/BaseIntegrationTest.java
(original)
+++ felix/trunk/http/itest/src/test/java/org/apache/felix/http/itest/BaseIntegrationTest.java
Thu Jun 25 14:45:05 2015
@@ -322,16 +322,16 @@ public abstract class BaseIntegrationTes
             mavenBundle("org.apache.sling", "org.apache.sling.commons.log", "4.0.0"),
             mavenBundle("org.apache.sling", "org.apache.sling.commons.logservice", "1.0.2"),
 
-            mavenBundle("org.apache.felix", "org.apache.felix.http.api").startLevel(START_LEVEL_SYSTEM_BUNDLES),
-            mavenBundle("org.apache.felix", "org.apache.felix.http.servlet-api").startLevel(START_LEVEL_SYSTEM_BUNDLES),
-            mavenBundle("org.apache.felix", ORG_APACHE_FELIX_HTTP_JETTY).startLevel(START_LEVEL_SYSTEM_BUNDLES),
+            mavenBundle("org.apache.felix", "org.apache.felix.http.api", System.getProperty("http.api.version")).startLevel(START_LEVEL_SYSTEM_BUNDLES),
+            mavenBundle("org.apache.felix", "org.apache.felix.http.servlet-api", System.getProperty("http.servlet.api.version")).startLevel(START_LEVEL_SYSTEM_BUNDLES),
+            mavenBundle("org.apache.felix", ORG_APACHE_FELIX_HTTP_JETTY, System.getProperty("http.jetty.version")).startLevel(START_LEVEL_SYSTEM_BUNDLES),
             mavenBundle("org.apache.felix", "org.apache.felix.configadmin").version("1.8.6"),
 
-            mavenBundle("org.apache.httpcomponents", "httpcore-osgi").startLevel(START_LEVEL_SYSTEM_BUNDLES),
-            mavenBundle("org.apache.httpcomponents", "httpclient-osgi").startLevel(START_LEVEL_SYSTEM_BUNDLES),
-            mavenBundle("org.mockito", "mockito-all").startLevel(START_LEVEL_SYSTEM_BUNDLES),
-            mavenBundle("org.objenesis", "objenesis").startLevel(START_LEVEL_SYSTEM_BUNDLES),
-            mavenBundle("com.googlecode.json-simple", "json-simple").startLevel(START_LEVEL_SYSTEM_BUNDLES),
+            mavenBundle("org.apache.httpcomponents", "httpcore-osgi", "4.3.2").startLevel(START_LEVEL_SYSTEM_BUNDLES),
+            mavenBundle("org.apache.httpcomponents", "httpclient-osgi", "4.3.4").startLevel(START_LEVEL_SYSTEM_BUNDLES),
+            mavenBundle("org.mockito", "mockito-all", "1.10.19").startLevel(START_LEVEL_SYSTEM_BUNDLES),
+            mavenBundle("org.objenesis", "objenesis", "2.1").startLevel(START_LEVEL_SYSTEM_BUNDLES),
+            mavenBundle("com.googlecode.json-simple", "json-simple", "1.1.1").startLevel(START_LEVEL_SYSTEM_BUNDLES),
 
             junitBundles(),
             frameworkStartLevel(START_LEVEL_TEST_BUNDLE));

Modified: felix/trunk/http/jetty/src/main/java/org/apache/felix/http/jetty/internal/JettyService.java
URL: http://svn.apache.org/viewvc/felix/trunk/http/jetty/src/main/java/org/apache/felix/http/jetty/internal/JettyService.java?rev=1687538&r1=1687537&r2=1687538&view=diff
==============================================================================
--- felix/trunk/http/jetty/src/main/java/org/apache/felix/http/jetty/internal/JettyService.java
(original)
+++ felix/trunk/http/jetty/src/main/java/org/apache/felix/http/jetty/internal/JettyService.java
Thu Jun 25 14:45:05 2015
@@ -105,7 +105,10 @@ public final class JettyService extends
     private ServiceTracker connectorTracker;
     private EventAdmin eventAdmin;
 
-    public JettyService(BundleContext context, DispatcherServlet dispatcher, EventDispatcher
eventDispatcher, HttpServiceController controller)
+    public JettyService(final BundleContext context,
+            final DispatcherServlet dispatcher,
+            final EventDispatcher eventDispatcher,
+            final HttpServiceController controller)
     {
         this.context = context;
         this.config = new JettyConfig(this.context);
@@ -207,6 +210,7 @@ public final class JettyService extends
     {
         if (this.server != null)
         {
+            this.eventDispatcher.setActive(false);
             if (this.connectorTracker != null)
             {
                 this.connectorTracker.close();
@@ -246,6 +250,7 @@ public final class JettyService extends
             ServletContextHandler context = new ServletContextHandler(this.parent, this.config.getContextPath(),
ServletContextHandler.SESSIONS);
 
             configureSessionManager(context);
+            this.eventDispatcher.setActive(true);
             context.addEventListener(eventDispatcher);
             context.getSessionHandler().addEventListener(eventDispatcher);
             final ServletHolder holder = new ServletHolder(this.dispatcher);



Mime
View raw message