You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by se...@apache.org on 2012/03/13 02:47:17 UTC
svn commit: r1299949 -
/commons/proper/io/trunk/src/main/java/org/apache/commons/io/IOUtils.java
Author: sebb
Date: Tue Mar 13 01:47:17 2012
New Revision: 1299949
URL: http://svn.apache.org/viewvc?rev=1299949&view=rev
Log:
Document why safe to create skip buffers without synch
Modified:
commons/proper/io/trunk/src/main/java/org/apache/commons/io/IOUtils.java
Modified: commons/proper/io/trunk/src/main/java/org/apache/commons/io/IOUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/main/java/org/apache/commons/io/IOUtils.java?rev=1299949&r1=1299948&r2=1299949&view=diff
==============================================================================
--- commons/proper/io/trunk/src/main/java/org/apache/commons/io/IOUtils.java (original)
+++ commons/proper/io/trunk/src/main/java/org/apache/commons/io/IOUtils.java Tue Mar 13 01:47:17 2012
@@ -127,7 +127,14 @@ public class IOUtils {
*/
private static final int SKIP_BUFFER_SIZE = 2048;
- // Allocated in the skip method if necessary.
+ // Allocated in the relevant skip method if necessary.
+ /*
+ * N.B. no need to synchronize these because:
+ * - we don't care if the buffer is created multiple times (the data is ignored)
+ * - we always use the same size buffer, so if it it is recreated it will still be OK
+ * (if the buffer size were variable, we would need to synch. to ensure some other thread
+ * did not create a smaller one)
+ */
private static char[] SKIP_CHAR_BUFFER;
private static byte[] SKIP_BYTE_BUFFER;