Skip to content

Commit 9f52fe4

Browse files
committed
Clarify why skip buffers can be shared
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/io/trunk@1657527 13f79535-47bb-0310-9956-ffa450edef68
1 parent 5509eb7 commit 9f52fe4

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

src/main/java/org/apache/commons/io/IOUtils.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,10 @@ public class IOUtils {
144144

145145
// Allocated in the relevant skip method if necessary.
146146
/*
147-
* N.B. no need to synchronize these because:
147+
* These buffers are static and are shared between threads.
148+
* This is possible because the buffers are write-only - the contents are never read.
149+
*
150+
* N.B. there is no need to synchronize when creating these because:
148151
* - we don't care if the buffer is created multiple times (the data is ignored)
149152
* - we always use the same size buffer, so if it it is recreated it will still be OK
150153
* (if the buffer size were variable, we would need to synch. to ensure some other thread

0 commit comments

Comments
 (0)