diff options
author | Jonathan Nieder <jrn@google.com> | 2016-11-13 13:26:33 -0800 |
---|---|---|
committer | Jonathan Nieder <jrn@google.com> | 2016-11-13 13:35:16 -0800 |
commit | 96941550deb5c3029b16259044dc95ed50170288 (patch) | |
tree | ef0d684bc9fe53b270dc3b4140573fd1b6f1a25c /org.eclipse.jgit | |
parent | 97f3baa0d3df7ed26a55b2240cc5ce1a04861a4c (diff) | |
download | jgit-96941550deb5c3029b16259044dc95ed50170288.tar.gz jgit-96941550deb5c3029b16259044dc95ed50170288.zip |
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
Diffstat (limited to 'org.eclipse.jgit')
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/util/io/StreamCopyThread.java | 16 |
1 files changed, 3 insertions, 13 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/io/StreamCopyThread.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/io/StreamCopyThread.java index fdb2a036c5..329a7a161f 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/util/io/StreamCopyThread.java +++ b/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) { |