diff options
author | Michael Valenta | 2003-05-06 20:45:01 +0000 |
---|---|---|
committer | Michael Valenta | 2003-05-06 20:45:01 +0000 |
commit | 9df33dc3ca8e7b6fc507f4896c9ca6d095e8b8f3 (patch) | |
tree | 7281d43579ad0b23d3599007dd2831e5127d5547 | |
parent | d46481a6051e93f9473a2aeadede6c2fa208b0fd (diff) | |
download | eclipse.platform.team-9df33dc3ca8e7b6fc507f4896c9ca6d095e8b8f3.tar.gz eclipse.platform.team-9df33dc3ca8e7b6fc507f4896c9ca6d095e8b8f3.tar.xz eclipse.platform.team-9df33dc3ca8e7b6fc507f4896c9ca6d095e8b8f3.zip |
37292: [CVS Core] Unable to synchronize - Cannot close connectionI20030506a
-rw-r--r-- | bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/streams/TimeoutOutputStream.java | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/streams/TimeoutOutputStream.java b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/streams/TimeoutOutputStream.java index d220581f0..0041e6bbd 100644 --- a/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/streams/TimeoutOutputStream.java +++ b/bundles/org.eclipse.team.core/src/org/eclipse/team/internal/core/streams/TimeoutOutputStream.java @@ -250,6 +250,8 @@ public class TimeoutOutputStream extends FilterOutputStream { bytesUntilFlush = length; } } + + // If there are bytes to be written, write them if (len != 0) { // write out all remaining bytes from the buffer before flushing try { @@ -259,12 +261,9 @@ public class TimeoutOutputStream extends FilterOutputStream { } catch (InterruptedIOException e) { len = e.bytesTransferred; } - synchronized (this) { - head = (head + len) % iobuffer.length; - length -= len; - notify(); - } } + + // If there was a pending flush, do it if (bytesUntilFlush >= 0) { bytesUntilFlush -= len; if (bytesUntilFlush <= 0) { @@ -276,6 +275,15 @@ public class TimeoutOutputStream extends FilterOutputStream { bytesUntilFlush = -1; // might have been 0 } } + + // If bytes were written, update the circular buffer + if (len != 0) { + synchronized (this) { + head = (head + len) % iobuffer.length; + length -= len; + notify(); + } + } } } } |