Home Help Center

How to keep retrying when server is down?

sfxusfxu Member Shifu XuOrganization: Argonne National LabProject: EPICS CA
Hello,

I'd like the client keep retrying to reconnect without stop, for example retry every 2 minutes.

Using Ice.RetryIntervals can only retry a limited times.

What can we do to implement this?

Thanks
sfxu

Comments

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

    Yes, you can't specify an infinite number of retries with Ice.RetryIntervals. You'll have to implement the retry yourself, for example:
    while(true)
    {
         try
         {
              proxy->sayHello();
              break;
         }
         catch(const Ice::CommunicatorDestroyedException&)
         {
              throw;
         }
         catch(const Ice::LocalException&)
         {
              IceUtil::ThreadControl::sleep(IceUtil::Time::seconds(2));
         }
    }
    

    Cheers,
    Benoit.
Sign In or Register to comment.