mina-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From arun kumar <devqu...@yahoo.co.in>
Subject ByteBuffer usage in UDP applications
Date Tue, 06 Mar 2007 18:26:45 GMT
    I am using MINA in a UDP application. My IOHandler's messageReceived() method has a org.apache.mina.common.ByteBuffer
object as the message.
    I am modifying the ByteBuffer with the response message and sending using the session.write(buf)
    However this throws an Exception with the message "Already released buffer.  You released
the buffer too many times."

    If I call buf.aquire() before the session.write() call, I do not get this exception.

I added log messages to buf.aquire() and buf.release() methods and found that the count was
1 and after calling session.write(buf) the buffer is released 2 times.Therefore calling aquire()
before calling session.write(buf) solved the problem.
Is this a safe assumption to make for using the ByteBuffer.
Are there other places within MINA code where release() may be called in other situations
when session.write(buf) is called.

Arun kumar

 Here’s a new way to find what you're looking for - Yahoo! Answers 
  • Unnamed multipart/alternative (inline, 8-Bit, 0 bytes)
View raw message