cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject git commit: [CXF-5730] Calling Server destroy when thetext is destroyed, applying a slightly modified patch from Florian Léger
Date Tue, 06 May 2014 11:22:02 GMT
Repository: cxf
Updated Branches:
  refs/heads/master 3da0b5c05 -> c91adabdb


[CXF-5730] Calling Server destroy when thetext is destroyed, applying a slightly modified
patch from Florian Léger


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/c91adabd
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/c91adabd
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/c91adabd

Branch: refs/heads/master
Commit: c91adabdbeaf63599ca61e18acf8a13aa385915b
Parents: 3da0b5c
Author: Sergey Beryozkin <sberyozkin@talend.com>
Authored: Tue May 6 12:21:47 2014 +0100
Committer: Sergey Beryozkin <sberyozkin@talend.com>
Committed: Tue May 6 12:21:47 2014 +0100

----------------------------------------------------------------------
 .../java/org/apache/cxf/jaxrs/JAXRSServerFactoryBean.java   | 4 ++++
 .../spring/JAXRSServerFactoryBeanDefinitionParser.java      | 9 +++++++++
 2 files changed, 13 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/c91adabd/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/JAXRSServerFactoryBean.java
----------------------------------------------------------------------
diff --git a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/JAXRSServerFactoryBean.java
b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/JAXRSServerFactoryBean.java
index 1a83179..58b6040 100644
--- a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/JAXRSServerFactoryBean.java
+++ b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/JAXRSServerFactoryBean.java
@@ -217,6 +217,10 @@ public class JAXRSServerFactoryBean extends AbstractJAXRSFactoryBean
{
         return server;
     }
 
+    public Server getServer() {
+        return server;
+    }
+    
     protected ServerProviderFactory setupFactory(Endpoint ep) { 
         ServerProviderFactory factory = ServerProviderFactory.createInstance(getBus()); 
         setBeanInfo(factory);

http://git-wip-us.apache.org/repos/asf/cxf/blob/c91adabd/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/spring/JAXRSServerFactoryBeanDefinitionParser.java
----------------------------------------------------------------------
diff --git a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/spring/JAXRSServerFactoryBeanDefinitionParser.java
b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/spring/JAXRSServerFactoryBeanDefinitionParser.java
index 2744b01..7adfaa5 100644
--- a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/spring/JAXRSServerFactoryBeanDefinitionParser.java
+++ b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/spring/JAXRSServerFactoryBeanDefinitionParser.java
@@ -35,6 +35,7 @@ import org.apache.cxf.bus.spring.BusWiringBeanFactoryPostProcessor;
 import org.apache.cxf.common.util.ClasspathScanner;
 import org.apache.cxf.common.util.StringUtils;
 import org.apache.cxf.configuration.spring.AbstractBeanDefinitionParser;
+import org.apache.cxf.endpoint.Server;
 import org.apache.cxf.jaxrs.JAXRSServerFactoryBean;
 import org.apache.cxf.jaxrs.JAXRSServiceFactoryBean;
 import org.apache.cxf.jaxrs.lifecycle.ResourceProvider;
@@ -120,6 +121,7 @@ public class JAXRSServerFactoryBeanDefinitionParser extends AbstractBeanDefiniti
         super.doParse(element, ctx, bean);
 
         bean.setInitMethodName("create");
+        bean.setDestroyMethodName("destroy");
         
         // We don't really want to delay the registration of our Server
         bean.setLazyInit(false);
@@ -157,6 +159,13 @@ public class JAXRSServerFactoryBeanDefinitionParser extends AbstractBeanDefiniti
             super(sf);
         }
         
+        public void destroy() {
+            Server server = super.getServer();
+            if (server != null && server.isStarted()) {
+                server.destroy();
+            }
+        }
+        
         public void setBasePackages(List<String> basePackages) {
             this.basePackages = basePackages;
         }


Mime
View raw message