Java Mailing List Archive

http://www.junlu.com/

Home » dev.tomcat »

svn commit: r992200 -
/tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java

Mladen Turk

2010-09-03


Author LoginPost Reply
Author: mturk
Date: Fri Sep 3 04:36:46 2010
New Revision: 992200

URL: http://svn.apache.org/viewvc?rev=992200&view=rev
Log:
Make sure we exit the thread if not running. Otherwise the thread will block in run until the VM shuts down

Modified:
  tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java

Modified: tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java?rev=992200&r1=992199&r2=992200&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/net/AprEndpoint.java Fri Sep 3 04:36:46 2010
@@(protected)
        while (running) {

          // Loop if endpoint is paused
-           while (paused) {
+           while (paused && running) {
             try {
                Thread.sleep(1000);
             } catch (InterruptedException e) {
@@(protected)
             }
          }

+           if (!running) {
+             break;
+           }
          try {
             // Accept the next incoming connection from the server socket
             long socket = Socket.accept(serverSock);
@@(protected)
        // Loop until we receive a shutdown command
        while (running) {
          // Loop if endpoint is paused
-           while (paused) {
+           while (paused && running) {
             try {
                Thread.sleep(1000);
             } catch (InterruptedException e) {
@@(protected)
             }
          }

+           if (!running) {
+             break;
+           }
          if (keepAliveCount < 1 && addCount < 1) {
             synchronized (this) {
-                while (keepAliveCount < 1 && addCount < 1) {
+                while (keepAliveCount < 1 && addCount < 1 && running) {
                  // Reset maintain time.
                  maintainTime = 0;
                  try {
@@(protected)
             }
          }

+           if (!running) {
+             break;
+           }
          try {
             // Add sockets which are waiting to the poller
             if (addCount > 0) {
@@(protected)
          SendfileData data = addS.get(i);
          Socket.destroy(data.socket);
        }
+        addS.clear();
        // Close all sockets still in the poller
        int rv = Poll.pollset(sendfilePollset, desc);
        if (rv > 0) {
@@(protected)
        while (running) {

          // Loop if endpoint is paused
-           while (paused) {
+           while (paused && running) {
             try {
                Thread.sleep(1000);
             } catch (InterruptedException e) {
@@(protected)
             }
          }

+           if (!running) {
+             break;
+           }
          if (sendfileCount < 1 && addCount < 1) {
             synchronized (this) {
-                while (sendfileCount < 1 && addS.size() < 1) {
+                while (sendfileCount < 1 && addS.size() < 1 && running) {
                  // Reset maintain time.
                  maintainTime = 0;
                  try {
@@(protected)
             }
          }

+           if (!running) {
+             break;
+           }
          try {
             // Add socket to the poller
             if (addCount > 0) {



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@(protected)
For additional commands, e-mail: dev-help@(protected)

©2008 junlu.com - Jax Systems, LLC, U.S.A.