cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ningji...@apache.org
Subject svn commit: r546431 - /incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/ManagedEndpoint.java
Date Tue, 12 Jun 2007 09:10:27 GMT
Author: ningjiang
Date: Tue Jun 12 02:10:26 2007
New Revision: 546431

URL: http://svn.apache.org/viewvc?view=rev&rev=546431
Log:
CXF-719 Fixed the memory leak of Endpoint.stop()

Modified:
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/ManagedEndpoint.java

Modified: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/ManagedEndpoint.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/ManagedEndpoint.java?view=diff&rev=546431&r1=546430&r2=546431
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/ManagedEndpoint.java
(original)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/ManagedEndpoint.java
Tue Jun 12 02:10:26 2007
@@ -48,6 +48,13 @@
 
     @ManagedOperation        
     public void start() {
+        if (state == State.STARTED) {
+            return;
+        }
+        ServerLifeCycleManager mgr = bus.getExtension(ServerLifeCycleManager.class);
+        if (mgr != null) {
+            mgr.registerListener(this);
+        }
         server.start();
     }
     
@@ -96,7 +103,12 @@
 
     public void stopServer(Server s) {
         if (server.equals(s)) {
-            state = State.STOPPED;            
+            state = State.STOPPED;
+            // unregister server to avoid the memory leak
+            ServerLifeCycleManager mgr = bus.getExtension(ServerLifeCycleManager.class);
+            if (mgr != null) {
+                mgr.unRegisterListener(this);                
+            }
         }
     }    
     



Mime
View raw message