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 [EMAIL PROTECTED] #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 [EMAIL PROTECTED]
IoSession#write(ByteBuffer, Object)}.</li>
+ * <li>You pass the buffer by calling [EMAIL PROTECTED]
ProtocolEncoderOutput#write(ByteBuffer)}.</li>
+ * </ul>
+ * And, you don't need to release any [EMAIL PROTECTED] ByteBuffer} which is
passed as a parameter
+ * of <li>[EMAIL PROTECTED] IoHandler#dataRead(IoSession, ByteBuffer)} method.
They are released
+ * automatically when the method returns.
+ * <p>
+ * You have to release buffers manually by calling [EMAIL PROTECTED]
#release()} when:
+ * <ul>
+ * <li>You allocated a buffer, but didn't pass the buffer to any of two
methods above.</li>
+ * <li>You called [EMAIL PROTECTED] #acquire()} to prevent the buffer from
being released.</li>
+ * </ul>
*
* <h2>AutoExpand</h2>
* <p>