How to control the Channel out of Handler object

olekg olekg at pbpolsoft.com.pl
Tue Sep 15 13:56:40 EDT 2009


Hello,

As I written in another thread I try to build Comet/Streaming solution with 
Netty. I have partialy chieved me goal for one-client connection.

The idea for my application is to run timer in singleton object which
updates all registered Event objects, registered in HttpRequestHandler. In
other words when obtain messageReceived event I do not build the response.
Instead I pass the Event object to be many times used to fill client with
data.

Unofortuanately I have lost the control over transmission erreors. I have
the code :

       DefaultHttpChunk chunk = new DefaultHttpChunk( buf);
       ChannelFuture chf = e.getChannel().write(chunk);
       if ( chf.isSuccess() ) {
    	   System.out.println("Wyprowadzono porcję skryptu przez kanał.");       
       } else {
    	   System.out.println("Error");
    	   Throwable thr = chf.getCause();
    	   if( thr != null ) {
    		   System.out.println( thr.getMessage());
    	   } else {
    		   System.out.println("Null error object.");
    		   
    	   }
    	   
       }

Regardless of the data is sent correctly or not I malway obtain "Error"
message and "Null error object". I want to know when client discnnects.

When I am inside HttpRequestHandler the exceptionCaught event is fired
correctly. What if I am outside ?

regards Olek
-- 
View this message in context: http://n2.nabble.com/How-to-control-the-Channel-out-of-Handler-object-tp3650670p3650670.html
Sent from the Netty User Group mailing list archive at Nabble.com.



More information about the netty-users mailing list