Browse Source

StreamCopyThread: flush cannot interrupt a write

Because flush calls interrupt with writeLock held, it cannot interrupt
a write.  Simplify by no longer defending against that.

Change-Id: Ib0b39b425335ff7b0ea1b1733562da5392576a15
stable-4.6
Jonathan Nieder 8 years ago
parent
commit
96941550de
  1. 16
      org.eclipse.jgit/src/org/eclipse/jgit/util/io/StreamCopyThread.java

16
org.eclipse.jgit/src/org/eclipse/jgit/util/io/StreamCopyThread.java

@ -146,19 +146,9 @@ public class StreamCopyThread extends Thread {
synchronized (writeLock) {
boolean writeInterrupted = Thread.interrupted();
for (;;) {
try {
dst.write(buf, 0, n);
} catch (InterruptedIOException wakey) {
writeInterrupted = true;
continue;
}
// set interrupt status, which will be checked
// when we block in src.read
if (writeInterrupted)
interrupt();
break;
dst.write(buf, 0, n);
if (writeInterrupted) {
interrupt();
}
}
} catch (IOException e) {

Loading…
Cancel
Save