Change WaitingThread class to unblock the lock instead of interrupting the waiting thread
git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk@649217 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
ad9e79c4d9
commit
d3205ff522
|
@ -147,7 +147,7 @@ public class WaitingThread {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aborted)
|
if (aborted)
|
||||||
throw new InterruptedException("interrupted already");
|
throw new InterruptedException("Operation interrupted");
|
||||||
|
|
||||||
this.waiter = Thread.currentThread();
|
this.waiter = Thread.currentThread();
|
||||||
|
|
||||||
|
@ -159,6 +159,8 @@ public class WaitingThread {
|
||||||
this.cond.await();
|
this.cond.await();
|
||||||
success = true;
|
success = true;
|
||||||
}
|
}
|
||||||
|
if (aborted)
|
||||||
|
throw new InterruptedException("Operation interrupted");
|
||||||
} finally {
|
} finally {
|
||||||
this.waiter = null;
|
this.waiter = null;
|
||||||
}
|
}
|
||||||
|
@ -188,9 +190,7 @@ public class WaitingThread {
|
||||||
|
|
||||||
public void interrupt() {
|
public void interrupt() {
|
||||||
aborted = true;
|
aborted = true;
|
||||||
|
this.cond.signalAll();
|
||||||
if (this.waiter != null)
|
|
||||||
this.waiter.interrupt();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue