On Wed, 2013-01-30 at 11:22 +0000, James Shaw wrote:
> I'm having some trouble tracking this down, but I believe that
> httpclient 4.2.3 is clearing the interrupt flag.
> 
> My code looks like this:
> 
> executorService.submit(new Runnable() {
>     @Override public void run() {
>         while (!Thread.currentThread().isInterrupted()) {
>             consume(); // calls AWS SDK which uses Apache HttpClient
>         }
>     }
> });
> 
> Sometimes this loop does not terminate when calling
> Future.cancel(true).  The only piece of diagnostics I have so far is
> this:
> Exception 'java.lang.InterruptedException' occurred in thread
> 'queue-consumer-reader-thread-1' at
> java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.reportInterruptAfterWait(AbstractQueuedSynchronizer.java:2017)
> Exception 'java.lang.InterruptedException' occurred in thread
> 'queue-consumer-reader-thread-1' at
> org.apache.http.impl.conn.tsccm.WaitingThread.await(WaitingThread.java:164)
> Exception 'java.lang.InterruptedException' occurred in thread
> 'queue-consumer-reader-thread-1' at
> org.apache.http.impl.conn.tsccm.ConnPoolByRoute.getEntryBlocking(ConnPoolByRoute.java:410)
> Exception 'java.lang.InterruptedException' occurred in thread
> 'queue-consumer-reader-thread-1' at
> org.apache.http.impl.conn.tsccm.ConnPoolByRoute.getEntryBlocking(ConnPoolByRoute.java:423)
> 
> Should I not expect the interrupt flag to be preserved?  Do you have
> any suggestions how I could isolate this bug (I'm not 100% sure if
> it's in HttpClient or AWS client right now)?
> 
> Thanks
> 

I am not aware of any place in HttpClient where it might meddle with the
interrupt flag. In any case I would recommend using
PoolingClientConnectionManager instead of the deprecated
ThreadSafeClientConnManager. If the problem still persists after
removing all references to deprecated code, the problem is more likely
to be caused by the AWS code.

Oleg



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to