You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@mina.apache.org by Les Hazlewood <lh...@apache.org> on 2009/10/31 01:34:40 UTC
Mina Proxy example - AbstractProxyIoHandler
Hi folks,
In the AbstractProxyIoHandler here:
http://mina.apache.org/report/trunk/xref/org/apache/mina/example/proxy/AbstractProxyIoHandler.html
the messageReceived method creates a copy of of the incoming IoBuffer
and sends the copy to the paired Session. Why is this necessary? Can
you just send the incoming IoBuffer directly to the paired session (no
copy)?
In my preliminary testing with an HTTP proxy, I've change the code to
*not* use the copy, and all seems fine. I just want to make sure this
is OK before I stick with it :)
Thanks for the feedback!
Cheers,
Les
Re: Mina Proxy example - AbstractProxyIoHandler
Posted by Les Hazlewood <lh...@apache.org>.
Cool, thanks Emmanuel. Any concrete yes or no would be appreciated if
you have the time.
Just to be on the safe side, I only make the copy if logging is
enabled. This way I ensure that the logging operation does not
collide with the processing operation since both ops could be
asynchronous.
When logging is disabled, my assumption is that a copy is not
necessary (since the only operation is to pass it through immediately
to the paired session), so I just pass on the original buffer. I
haven't experienced any problems yet, but I haven't put it under any
reasonable concurrent load yet. That comes next week. ;)
Thanks,
Les
On Fri, Nov 6, 2009 at 11:12 AM, Emmanuel Lecharny <el...@apache.org> wrote:
> Les Hazlewood wrote:
>>
>> Bump!
>>
>> Any ideas? A Mina dev could probably answer this in about 3 seconds :)
>>
>> Thanks in advance!
>>
>
> Not sure it's necessary. Don't have time to check that right now (ApacheCpon
> going on), but will check later.
>
> Thanks !
>
> --
> --
> cordialement, regards,
> Emmanuel Lécharny
> www.iktek.com
> directory.apache.org
>
>
>
Re: Mina Proxy example - AbstractProxyIoHandler
Posted by Emmanuel Lecharny <el...@apache.org>.
Les Hazlewood wrote:
> Bump!
>
> Any ideas? A Mina dev could probably answer this in about 3 seconds :)
>
> Thanks in advance!
>
Not sure it's necessary. Don't have time to check that right now
(ApacheCpon going on), but will check later.
Thanks !
--
--
cordialement, regards,
Emmanuel Lécharny
www.iktek.com
directory.apache.org
Re: Mina Proxy example - AbstractProxyIoHandler
Posted by Les Hazlewood <lh...@apache.org>.
Bump!
Any ideas? A Mina dev could probably answer this in about 3 seconds :)
Thanks in advance!
Regards,
Les
On Fri, Oct 30, 2009 at 7:34 PM, Les Hazlewood <lh...@apache.org> wrote:
> Hi folks,
>
> In the AbstractProxyIoHandler here:
>
> http://mina.apache.org/report/trunk/xref/org/apache/mina/example/proxy/AbstractProxyIoHandler.html
>
> the messageReceived method creates a copy of of the incoming IoBuffer
> and sends the copy to the paired Session. Why is this necessary? Can
> you just send the incoming IoBuffer directly to the paired session (no
> copy)?
>
> In my preliminary testing with an HTTP proxy, I've change the code to
> *not* use the copy, and all seems fine. I just want to make sure this
> is OK before I stick with it :)
>
> Thanks for the feedback!
>
> Cheers,
>
> Les
>
Re: Mina Proxy example - AbstractProxyIoHandler
Posted by Les Hazlewood <lh...@apache.org>.
Thanks Emmanuel and Julien. Have a great weekend :)
Best,
Les
On Fri, Nov 6, 2009 at 11:25 AM, Julien Vermillard
<jv...@archean.fr> wrote:
> Le Fri, 30 Oct 2009 20:34:40 -0400,
> Les Hazlewood <lh...@apache.org> a écrit :
>
>> Hi folks,
>>
>> In the AbstractProxyIoHandler here:
>>
>> http://mina.apache.org/report/trunk/xref/org/apache/mina/example/proxy/AbstractProxyIoHandler.html
>>
>> the messageReceived method creates a copy of of the incoming IoBuffer
>> and sends the copy to the paired Session. Why is this necessary? Can
>> you just send the incoming IoBuffer directly to the paired session (no
>> copy)?
>>
>> In my preliminary testing with an HTTP proxy, I've change the code to
>> *not* use the copy, and all seems fine. I just want to make sure this
>> is OK before I stick with it :)
>>
>> Thanks for the feedback!
>>
>> Cheers,
>>
>> Les
>
> Hi,
> I think it was mandatory when we was using DirectBuffer, now with Heap
> buffer I don't see the problem, just flip the buffer and send it back.
>
> Julien
>
Re: Mina Proxy example - AbstractProxyIoHandler
Posted by Julien Vermillard <jv...@archean.fr>.
Le Fri, 30 Oct 2009 20:34:40 -0400,
Les Hazlewood <lh...@apache.org> a écrit :
> Hi folks,
>
> In the AbstractProxyIoHandler here:
>
> http://mina.apache.org/report/trunk/xref/org/apache/mina/example/proxy/AbstractProxyIoHandler.html
>
> the messageReceived method creates a copy of of the incoming IoBuffer
> and sends the copy to the paired Session. Why is this necessary? Can
> you just send the incoming IoBuffer directly to the paired session (no
> copy)?
>
> In my preliminary testing with an HTTP proxy, I've change the code to
> *not* use the copy, and all seems fine. I just want to make sure this
> is OK before I stick with it :)
>
> Thanks for the feedback!
>
> Cheers,
>
> Les
Hi,
I think it was mandatory when we was using DirectBuffer, now with Heap
buffer I don't see the problem, just flip the buffer and send it back.
Julien