Chris Allen wrote:
> Hey Guys,
> 
> It looks like I'm running into a very similar problem with my application,
> at least it's similar symptoms.  I think it must have to do with me storing
> another ByteBuffer in the IoSession for access by all of my
> ProtocolDecoders. It basically is there to handle the case were I get one
> message sent in multiple packets and I want to wait to send the complete
> message through to the IoHandler.  I just put the incomplete message into
> this ByteBuffer and when the next packet comes in (in the decode() method) I
> combine the "in" ByteBuffer with the one that is in my IoSession.  If this
> new ByteBuffer is complete, I decode it and pass it on using out.write
> (myCompleteMessage);

FYI, there's already a ProtocolDecoder implementation included in MINA
which does exactly what you are doing: CumulativeProtocolDecoder. Using
that as a basis for your own ProtocolDecoder you won't have to care
about maintaining the incomplete messages in a buffer tied to the
session. MINA will take care of that for you.

> So, with this in mind, would this patch potentially fix my issue?  And if
> so, how do I go about applying it?  If not, any other ideas on what might be
> going on here?  I would be glad to send a more concrete example (code) if
> that will help.

The patch mentioned can, IIUC, only be used to display statistics on
things such as memory usage through JMX.

I suggest that you refactor your ProtocolDecoder to use
CumulativeProtocolDecoder first to see if that fixes the problem. Maybe
you're not releasing the buffers correctly?

> Also, on another note, I wanted to download the source and take a look at
> things but the SVN link listed on your site doesn't seem to work:
> http://svn.apache.org/viewcvs.cgi/directory/network/trunk/?root=Apache-SVN
> Any ideas?

Sorry about that. We've had a reorganization of the svn repository since
the last update of the web site. The correct URL is
https://svn.apache.org/viewcvs.cgi/directory/trunks/mina/.

HTH
/Niklas

> 
> Thanks as always for your great work.
> 
> -Chris
> 
> On 2/20/06, Trustin Lee <[EMAIL PROTECTED]> wrote:
> 
>>On 2/21/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>>
>>>Hi all!
>>>I'm working now with an app. that uses many direct bytebuffer in mina,
>>
>>and
>>
>>>I
>>>have a question:
>>>
>>>mina ByteBuffer pool are a "increase" only pool, when a new buffer is
>>>needed
>>>if there is not another buffer in the pool, then it will be allocated.
>>>But what happend at bytebuffers that are used once and then are
>>
>>forgotten
>>
>>>into the pool?
>>>
>>>My problem is that my app memory usage on taskmanager always increases,
>>>until app crashes, but my used heap memory is always the same.
>>>So I think that all that memory can be used by direct byte buffer, but I
>>>can't see if it is true because I have no tool to get the direct memory
>>>usage, also with new java.lang.management.
>>>
>>>It can be useful if mina ByteBuffer would have method that return some
>>>basic
>>>statistics about the pool.
>>>Maybe I'm wrong, what can I do?
>>
>>
>>There's a patch for this issue:
>>
>>http://issues.apache.org/jira/browse/DIRMINA-29
>>
>>But we also need to provide an efficient way to specify the maximum size
>>of
>>the pool.  Any idea?
>>
>>Trustin
>>--
>>what we call human nature is actually human habit
>>--
>>http://gleamynode.net/
>>--
>>PGP key fingerprints:
>>* E167 E6AF E73A CBCE EE41  4A29 544D DE48 FE95 4E7E
>>* B693 628E 6047 4F8F CFA4  455E 1C62 A7DC 0255 ECA6
>>
>>
> 
> 


-- 
Med vänlig hälsning

Niklas Therning
Software Architect

[EMAIL PROTECTED]
Mobil: +46 739 75 05 73

Trillian - Software Design at its best
www.trillian.se

Reply via email to