You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by ch...@apache.org on 2005/12/22 05:16:50 UTC

svn commit: r358483 - in /webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/server: SimpleConnectionThread.java SimpleHttpServer.java

Author: chinthaka
Date: Wed Dec 21 20:16:40 2005
New Revision: 358483

URL: http://svn.apache.org/viewcvs?rev=358483&view=rev
Log:
Fixing the memory leak in SimpleConnectionThread. 

I ran the profiling test for 30 minutes and now I see no more memory leaks. But I saw lot of hotspots that can be improved (later :) ).

Modified:
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/server/SimpleConnectionThread.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/server/SimpleHttpServer.java

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/server/SimpleConnectionThread.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/server/SimpleConnectionThread.java?rev=358483&r1=358482&r2=358483&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/server/SimpleConnectionThread.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/server/SimpleConnectionThread.java Wed Dec 21 20:16:40 2005
@@ -74,16 +74,14 @@
     }
 
     public synchronized void destroy() {
-        if (this.stopped) {
-            return;
-        }
-
-        this.stopped = true;
-
         if (conn != null) {
             conn.close();
+            this.connpool.removeConnection(this.conn);
             conn = null;
         }
+        this.stopped = true;
+
+
 
         // interrupt();
     }
@@ -108,7 +106,6 @@
             }
         } finally {
             destroy();
-            this.connpool.removeConnection(this.conn);
         }
     }
 }

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/server/SimpleHttpServer.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/server/SimpleHttpServer.java?rev=358483&r1=358482&r2=358483&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/server/SimpleHttpServer.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/transport/http/server/SimpleHttpServer.java Wed Dec 21 20:16:40 2005
@@ -51,7 +51,7 @@
     private ThreadFactory threadPool = null;
     private boolean stopped = false;
     private HttpRequestHandler requestHandler = null;
-    private SimpleConnSet connections = new SimpleConnSet();
+    private SimpleConnSet connectionsPool = new SimpleConnSet();
     private Thread t;
     private ThreadGroup tg;
 
@@ -152,7 +152,7 @@
             }
         }
 
-        this.connections.shutdown();
+        this.connectionsPool.shutdown();
     }
 
     public void run() {
@@ -169,9 +169,9 @@
 
                     SimpleHttpServerConnection conn = new SimpleHttpServerConnection(socket);
 
-                    this.connections.addConnection(conn);
+                    this.connectionsPool.addConnection(conn);
                     this.threadPool.execute(new SimpleConnectionThread(this.testname + " thread "
-                            + this.count, conn, this.connections, this.requestHandler));
+                            + this.count, conn, this.connectionsPool, this.requestHandler));
                 } catch (IOException e) {
                     LOG.debug("I/O error: " + e.getMessage());
                 }