From 96941550deb5c3029b16259044dc95ed50170288 Mon Sep 17 00:00:00 2001 From: Jonathan Nieder Date: Sun, 13 Nov 2016 13:26:33 -0800 Subject: [PATCH] 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 --- .../eclipse/jgit/util/io/StreamCopyThread.java | 16 +++------------- 1 file 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) { -- 2.39.5