You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by tr...@apache.org on 2005/04/21 13:39:22 UTC

svn commit: r164039 - /directory/network/trunk/src/java/org/apache/mina/common/ByteBuffer.java

Author: trustin
Date: Thu Apr 21 04:39:21 2005
New Revision: 164039

URL: http://svn.apache.org/viewcvs?rev=164039&view=rev
Log:
More documentation on Acquire/Release of ByteBuffers.

Modified:
    directory/network/trunk/src/java/org/apache/mina/common/ByteBuffer.java

Modified: directory/network/trunk/src/java/org/apache/mina/common/ByteBuffer.java
URL: http://svn.apache.org/viewcvs/directory/network/trunk/src/java/org/apache/mina/common/ByteBuffer.java?rev=164039&r1=164038&r2=164039&view=diff
==============================================================================
--- directory/network/trunk/src/java/org/apache/mina/common/ByteBuffer.java (original)
+++ directory/network/trunk/src/java/org/apache/mina/common/ByteBuffer.java Thu Apr 21 04:39:21 2005
@@ -69,11 +69,20 @@
  * <h2>Acquire/Release</h2>
  * <p>
  * <b>Please note that you never need to release the allocated buffer because
- * MINA will release it automatically.</b>  But, if you didn't pass it to MINA
- * or called {@link #acquire()} by yourself, you will have to release it manually:
- * <pre>
- * ByteBuffer.release(buf);
- * </pre>
+ * MINA will release it automatically when:
+ * <ul>
+ *   <li>You pass the buffer by calling {@link IoSession#write(ByteBuffer, Object)}.</li>
+ *   <li>You pass the buffer by calling {@link ProtocolEncoderOutput#write(ByteBuffer)}.</li>
+ * </ul>
+ * And, you don't need to release any {@link ByteBuffer} which is passed as a parameter
+ * of <li>{@link IoHandler#dataRead(IoSession, ByteBuffer)} method.  They are released
+ * automatically when the method returns.
+ * <p>
+ * You have to release buffers manually by calling {@link #release()} when:
+ * <ul>
+ *   <li>You allocated a buffer, but didn't pass the buffer to any of two methods above.</li>
+ *   <li>You called {@link #acquire()} to prevent the buffer from being released.</li>
+ * </ul>
  * 
  * <h2>AutoExpand</h2>
  * <p>