On Wed, 2007-03-07 at 16:21 +0530, Asankha C. Perera wrote: 
> Hi
> 
> The ConnectingIOReactor's connect method returns a SessionRequest, and 
> you are then able to set a callback on this to be notified of the 
> outcome - i.e. a successful completion, fault or timeout.
> 
>     SessionRequest req = ioReactor.connect(remoteAddress, localAddress, 
> Object );
>     req.setCallback(sessionRequestCallback);
> 
> Isn't it better to be able to pass the callback along with the connect() 
> invocation? Else it seems like there maybe a possibility that you 
> encounter a fault during connect, but still does not have the callback 
> to invoke to handle the situation
> 

Hi Asankha,

There are provisions in the SessionRequest impl code that ensure
SessionRequestCallback will fire even if it is set after completion of
the request (successful or unsuccessful). However, since this question
pops up fairly regularly, I do have to admit this may be not obvious
without actually reading the javadocs. I was hesitant whether I should
make connect method take SessionRequestCallback as a parameter, as I
generally tend to dislike methods that take more than 3 parameters, but
in this case this seems justified. Fix coming.

Cheers

Oleg

> thanks
> asankha
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to