You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by lneves <lu...@gmail.com> on 2006/08/29 16:28:46 UTC

SocketIoProcessor, bug or misunderstood behaviour?

Hello all.

I'm looking at the read() method of the SocketIoProcessor class and I don't get why 
is the Buffer allocation outside the try/catch block... in case of a OOM error the 
allocation will fail and the IOSession will not be notified.

I propose the following change:

      private void read( SocketSessionImpl session )
      {
-        ByteBuffer buf = ByteBuffer.allocate( session.getReadBufferSize() );
-        SocketChannel ch = session.getChannel();
-
+    	ByteBuffer buf = null;
          try
          {
+            buf = ByteBuffer.allocate( session.getReadBufferSize() );
+            SocketChannel ch = session.getChannel();


Regards,
Luis Neves




Re: SocketIoProcessor, bug or misunderstood behaviour?

Posted by Trustin Lee <tr...@gmail.com>.
Hi Ineves,

On 8/29/06, lneves <lu...@gmail.com> wrote:
>
>
> Hello all.
>
> I'm looking at the read() method of the SocketIoProcessor class and I
> don't get why
> is the Buffer allocation outside the try/catch block... in case of a OOM
> error the
> allocation will fail and the IOSession will not be notified.


Actually it will be notified to GlobalExceptionListener because it's not a
problem of specific session.

Trustn
-- 
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