This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
Patch: FYI: Minor BufferedWriter tweak
- To: Java Patch List <java-patches at gcc dot gnu dot org>
- Subject: Patch: FYI: Minor BufferedWriter tweak
- From: Tom Tromey <tromey at redhat dot com>
- Date: 23 Oct 2001 10:36:23 -0600
- Reply-To: tromey at redhat dot com
I noticed that BufferedWriter.localFlush is unnecessarily re-acquiring
the lock. This patch removes the redundancy. I'm checking it in.
Tom
Index: ChangeLog
from Tom Tromey <tromey@redhat.com>
* java/io/BufferedWriter.java (localFlush): Don't synchronize.
Index: java/io/BufferedWriter.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/io/BufferedWriter.java,v
retrieving revision 1.7
diff -u -r1.7 BufferedWriter.java
--- java/io/BufferedWriter.java 2001/10/23 06:04:58 1.7
+++ java/io/BufferedWriter.java 2001/10/23 16:17:13
@@ -216,15 +216,13 @@
}
}
+ // This should only be called with the lock held.
private final void localFlush () throws IOException
{
if (count > 0)
{
- synchronized (lock)
- {
- out.write(buffer, 0, count);
- count = 0;
- }
+ out.write(buffer, 0, count);
+ count = 0;
}
}