olegk       2003/02/27 11:56:46

  Modified:    httpclient/src/java/org/apache/commons/httpclient
                        HttpConnection.java
  Log:
  Addresses the bug 'waitForResponse is using busy wait'
  http://nagoya.apache.org/bugzilla/show_bug.cgi?id=17487
  
  Changelog:
  
  - HttpConection#waitForResponse request thread is suspended for 50ms when polling 
for incoming data
  
  Contributed by Michael Becke & Oleg Kalnichevski
  
  Revision  Changes    Path
  1.48      +10 -4     
jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpConnection.java
  
  Index: HttpConnection.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpConnection.java,v
  retrieving revision 1.47
  retrieving revision 1.48
  diff -u -r1.47 -r1.48
  --- HttpConnection.java       27 Feb 2003 13:38:24 -0000      1.47
  +++ HttpConnection.java       27 Feb 2003 19:56:46 -0000      1.48
  @@ -693,6 +693,12 @@
           while (System.currentTimeMillis() < overtime) {
               if (isResponseAvailable()) {
                   return true;
  +            } else {
  +                synchronized(this) {
  +                    try {
  +                        this.wait(50);
  +                    } catch (InterruptedException e) {}
  +                }
               }
           }
           LOG.debug("Waiting for response timeout");
  
  
  

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

Reply via email to