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. 12
      org.eclipse.jgit/src/org/eclipse/jgit/util/io/StreamCopyThread.java

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

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

Loading…
Cancel
Save