tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r...@apache.org
Subject cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core StandardService.java
Date Mon, 26 Jan 2004 18:14:30 GMT
remm        2004/01/26 10:14:30

  Modified:    catalina/src/share/org/apache/catalina/core
                        StandardService.java
  Log:
  - Implement clean shutdown of the connectors (my third proposal).
  - New shutdwon order:
    - pause connectors
    - wait for a while
    - stop the container (allowing current requests time to complete, as much as possible)
    - stop connectors
  
  Revision  Changes    Path
  1.8       +22 -8     jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardService.java
  
  Index: StandardService.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardService.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- StandardService.java	25 Apr 2003 21:05:21 -0000	1.7
  +++ StandardService.java	26 Jan 2004 18:14:30 -0000	1.8
  @@ -554,26 +554,40 @@
           // Notify our interested LifecycleListeners
           lifecycle.fireLifecycleEvent(BEFORE_STOP_EVENT, null);
   
  -        lifecycle.fireLifecycleEvent(STOP_EVENT, null);
  -
  -        log.info
  -            (sm.getString("standardService.stop.name", this.name));
  -        started = false;
  -
           // Stop our defined Connectors first
           synchronized (connectors) {
               for (int i = 0; i < connectors.length; i++) {
  -                if (connectors[i] instanceof Lifecycle)
  -                    ((Lifecycle) connectors[i]).stop();
  +                connectors[i].pause();
               }
           }
   
  +        // Heuristic: Sleep for a while to ensure pause of the connector
  +        try {
  +            Thread.sleep(1000);
  +        } catch (InterruptedException e) {
  +            // Ignore
  +        }
  +
  +        lifecycle.fireLifecycleEvent(STOP_EVENT, null);
  +
  +        log.info
  +            (sm.getString("standardService.stop.name", this.name));
  +        started = false;
  +
           // Stop our defined Container second
           if (container != null) {
               synchronized (container) {
                   if (container instanceof Lifecycle) {
                       ((Lifecycle) container).stop();
                   }
  +            }
  +        }
  +
  +        // Stop our defined Connectors first
  +        synchronized (connectors) {
  +            for (int i = 0; i < connectors.length; i++) {
  +                if (connectors[i] instanceof Lifecycle)
  +                    ((Lifecycle) connectors[i]).stop();
               }
           }
   
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Mime
View raw message