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 2015/02/05 11:50:09 UTC

svn commit: r1657527 - /commons/proper/io/trunk/src/main/java/org/apache/commons/io/IOUtils.java

Author: sebb
Date: Thu Feb  5 10:50:08 2015
New Revision: 1657527

URL: http://svn.apache.org/r1657527
Log:
Clarify why skip buffers can be shared

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=1657527&r1=1657526&r2=1657527&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 Thu Feb  5 10:50:08 2015
@@ -144,7 +144,10 @@ public class IOUtils {
 
     // Allocated in the relevant skip method if necessary.
     /*
-     * N.B. no need to synchronize these because:
+     * These buffers are static and are shared between threads.
+     * This is possible because the buffers are write-only - the contents are never read.
+     *
+     * N.B. there is no need to synchronize when creating 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