Callback prx and time out check

mathglmathgl Member gelin yanOrganization: RoundTech Research CentreProject: large scale vehicle tracing system
Hi All

I have a question about how callback prx can detect time out.. Actually, we have serveral callback proxy objects reside in server,and server will invoke some methods via these objects for sending messages back to clients periodly. My concern is Whether Ice has a way to detect time_out exception during sending?
In other words, Can i use following codes to detect whether this proxy is still valid or not?

MessageCallbackPrx prx = this.callbackManager.getCallback(id);
try
{
prx.ice_timeout(5000).ice_ping();
}
catch (Ice.TimeoutException le)
{
///doing some house-keeping...
}

The purpose is quite simple: i want to know whether the proxy is still available or not.....

BTW: i am using Glacier2 to handle Bi-direction communication.

Thanks for your help...

Comments

  • benoitbenoit Rennes, FranceAdministrators, ZeroC Staff Benoit FoucherOrganization: ZeroC, Inc.Project: Ice ZeroC Staff
    Hi,

    A TimeoutException here, when using Glacier2, would indicate that the server callback invocation on the Glacier2 endpoints failed. This is unlikely unless you have a network issue between the machine that is running Glacier2 and the machine which is running your server.

    In any case, you won't get a TimeoutException if the problem is between the client and Glacier2. You will typically get an UnknownLocalException or ObjectNotExistException depending on the timing at which you sent the call and when the failure was detected by Glacier2. The best is to catch all Ice::LocalException exceptions and consider such exceptions as communication failures with the client.

    Btw, why do you need to know whether or not the client is still running in advance? Can't you just call on the callback proxy when you need to and catch exceptions there to eventually perform some house-keeping?

    Cheers,
    Benoit.
Sign In or Register to comment.