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 the context is destroyed, applying a slightly modified patch from Florian Léger
Date Tue, 06 May 2014 11:33:38 GMT
Repository: cxf
Updated Branches:
  refs/heads/2.7.x-fixes 709b8aae5 -> c23e47661


[CXF-5730] Calling Server destroy when the context 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/c23e4766
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/c23e4766
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/c23e4766

Branch: refs/heads/2.7.x-fixes
Commit: c23e47661c4cde048558a8e4e52fca20910e4e64
Parents: 709b8aa
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:33:11 2014 +0100

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


http://git-wip-us.apache.org/repos/asf/cxf/blob/c23e4766/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 790482e..3161783 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
@@ -216,6 +216,9 @@ public class JAXRSServerFactoryBean extends AbstractJAXRSFactoryBean {
         return server;
     }
 
+    public Server getServer() {
+        return server;
+    }
 
     protected void setBeanInfo(ProviderFactory factory) {
         List<ClassResourceInfo> cris = serviceFactory.getClassResourceInfo();

http://git-wip-us.apache.org/repos/asf/cxf/blob/c23e4766/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 3c58cfc..874504e 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
@@ -29,6 +29,7 @@ import org.w3c.dom.Element;
 import org.apache.cxf.bus.spring.BusWiringBeanFactoryPostProcessor;
 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;
@@ -110,6 +111,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);
@@ -146,6 +148,13 @@ public class JAXRSServerFactoryBeanDefinitionParser extends AbstractBeanDefiniti
             super(sf);
         }
         
+        public void destroy() {
+            Server server = super.getServer();
+            if (server != null && server.isStarted()) {
+                server.destroy();
+            }
+        }
+
         public void setTempResourceProviders(List<SpringResourceFactory> providers)
{
             tempFactories = providers;
         }


Mime
View raw message