Hi Srikanth,

On 4/12/06, Srikanth Veeramachaneni <[EMAIL PROTECTED]> wrote:
>
> Hi Niklas,
>
> I was looking at your tunneling proxy example.
>
> In AbstractProxyIoHandler.messageReceived() method, is there any
> problem if we do this
> --------------------------------------
>         ByteBuffer rb = ( ByteBuffer ) message;
>         rb.acquire();
>         ( ( IoSession ) session.getAttachment() ).write( rb );
>         SessionLog.info( session, rb.getString( CHARSET.newDecoder() ) );
> --------------------------------------
> instead of
> --------------------------------------
>         ByteBuffer rb = ( ByteBuffer ) message;
>         ByteBuffer wb = ByteBuffer.allocate( rb.remaining() );
>         rb.mark();
>         wb.put( rb );
>         wb.flip();
>         ( ( IoSession ) session.getAttachment() ).write( wb );
>         rb.reset();
>         SessionLog.info( session, rb.getString( CHARSET.newDecoder() ) );
> --------------------------------------
>
> Basically, is there a problem doing an acquire() instead of making a
> copy of the byte buffer when I want to use the byte buffer for writes.


You can do that, of course.  If it doesn't work, please let us know.

HTH,
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

Reply via email to