mturk       2005/06/14 01:23:25

  Modified:    util/java/org/apache/tomcat/util/net AprEndpoint.java
  Log:
  Change the way how maintain is called. There is no need to
  call the maintain on each TIMEUP.
  
  Revision  Changes    Path
  1.44      +9 -10     
jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/net/AprEndpoint.java
  
  Index: AprEndpoint.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/net/AprEndpoint.java,v
  retrieving revision 1.43
  retrieving revision 1.44
  diff -u -r1.43 -r1.44
  --- AprEndpoint.java  14 Jun 2005 07:43:29 -0000      1.43
  +++ AprEndpoint.java  14 Jun 2005 08:23:25 -0000      1.44
  @@ -834,12 +834,13 @@
            */
           public void run() {
   
  +            long maintainTime = 0;
               // Loop until we receive a shutdown command
               while (running) {
  -                long maintainTime = 0;
                   // Loop if endpoint is paused
                   while (paused) {
                       try {
  +                        // TODO: We can easly do the maintenance here
                           Thread.sleep(1000);
                       } catch (InterruptedException e) {
                           // Ignore
  @@ -847,6 +848,8 @@
                   }
   
                   while (keepAliveCount < 1 && addCount < 1) {
  +                    // Reset maintain time.
  +                    maintainTime = 0;
                       try {
                           synchronized (addS) {
                               addS.wait();
  @@ -873,6 +876,7 @@
                               addCount = 0;
                           }
                       }
  +                    maintainTime += pollTime;
                       // Pool for the specified interval
                       int rv = Poll.poll(serverPollset, pollTime, desc, true);
                       if (rv > 0) {
  @@ -888,12 +892,9 @@
                               // Hand this socket off to a worker
                               getWorkerThread().assign(desc[n*4+1], 
desc[n*4+2]);
                           }
  -                        maintainTime += pollTime;
                       } else if (rv < 0) {
                           /* Any non timeup error is critical */
  -                        if (-rv == Status.TIMEUP)
  -                            rv = 0;
  -                        else {
  +                        if (-rv != Status.TIMEUP) {
                               log.error(sm.getString("endpoint.poll.fail"));
                               // Handle poll critical failure
                               synchronized (this) {
  @@ -902,11 +903,9 @@
                               }
                           }
                       }
  -                    if (rv == 0 || maintainTime > 1000000L) {
  -                        synchronized (addS) {
  -                            rv = Poll.maintain(serverPollset, desc, true);
  -                            maintainTime = 0;
  -                        }
  +                    if (maintainTime > 1000000L) {
  +                        rv = Poll.maintain(serverPollset, desc, true);
  +                        maintainTime = 0;
                           if (rv > 0) {
                               keepAliveCount -= rv;
                               for (int n = 0; n < rv; n++) {
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to