mturk       2005/05/22 23:04:02

  Modified:    util/java/org/apache/tomcat/util/net AprEndpoint.java
  Log:
  Fix checking for return value from Poll.poll. Now when the native is
  fixed the correct value is returned in case of timeup. Also reset the
  addCount if the poller is recycled.
  
  Revision  Changes    Path
  1.30      +24 -12    
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.29
  retrieving revision 1.30
  diff -u -r1.29 -r1.30
  --- AprEndpoint.java  18 May 2005 16:01:46 -0000      1.29
  +++ AprEndpoint.java  23 May 2005 06:04:02 -0000      1.30
  @@ -780,6 +780,7 @@
               keepAliveCount = 0;
               addS = new long[pollerSize];
               addP = new long[pollerSize];
  +            addCount = 0;
           }
   
           /**
  @@ -872,12 +873,17 @@
                               getWorkerThread().assign(desc[n*4+1], 
desc[n*4+2]);
                           }
                           maintainTime += pollTime;
  -                    } else if (rv < -1) {
  -                        log.error(sm.getString("endpoint.poll.fail"));
  -                        // Handle poll critical failure
  -                        synchronized (this) {
  -                            destroy();
  -                            init();
  +                    } else if (rv < 0) {
  +                        /* Any non timeup error is critical */
  +                        if (Status.APR_STATUS_IS_TIMEUP(-rv))
  +                            rv = 0;
  +                        else {
  +                            log.error(sm.getString("endpoint.poll.fail"));
  +                            // Handle poll critical failure
  +                            synchronized (this) {
  +                                destroy();
  +                                init();
  +                            }
                           }
                       }
                       if (rv == 0 || maintainTime > 1000000L) {
  @@ -1252,14 +1258,20 @@
                                   getWorkerThread().assign(desc[n*4+1], 
state.pool);
                               }
                           }
  -                    } else if (rv < -1) {
  -                        log.error(sm.getString("endpoint.poll.fail"));
  -                        // Handle poll critical failure
  -                        synchronized (this) {
  -                            destroy();
  -                            init();
  +                    } else if (rv < 0) {
  +                        /* Any non timeup error is critical */
  +                        if (Status.APR_STATUS_IS_TIMEUP(-rv))
  +                            rv = 0;
  +                        else {                        
  +                            log.error(sm.getString("endpoint.poll.fail"));
  +                            // Handle poll critical failure
  +                            synchronized (this) {
  +                                destroy();
  +                                init();
  +                            }
                           }
                       }
  +                    /* TODO: See if we need to call the maintain for 
sendfile poller */
                   } catch (Throwable t) {
                       log.error(sm.getString("endpoint.poll.error"), t);
                   }
  
  
  

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

Reply via email to