public static<T> T      callWithRetry(CuratorZookeeperClient client, Mode mode, Callable<T> proc) throws Exception
    {
        T                       result = null;
        SessionFailRetryLoop    retryLoop = client.newSessionFailRetryLoop(mode);
        retryLoop.start();
        try
        {
            while ( retryLoop.shouldContinue() )
            {
                try
                {
                    result = proc.call();
                }
                catch ( Exception e )
                {
                    ThreadUtils.checkInterrupted(e);
                    retryLoop.takeException(e);
                }
            }
        }
        finally
        {
            retryLoop.close();
        }
        return result;
    }
public static < T > T callWithRetry ( CuratorZookeeperClient client , Mode mode , Callable < T > proc ) throws Exception { T result = null ; SessionFailRetryLoop retryLoop = client . newSessionFailRetryLoop ( mode ) ; retryLoop . start ( ) ; try { while ( retryLoop . shouldContinue ( ) ) { try { result = proc . call ( ) ; } catch ( Exception e ) { ThreadUtils . checkInterrupted ( e ) ; retryLoop . takeException ( e ) ; } } } finally { retryLoop . close ( ) ; } return result ; }
Convenience utility: creates a "session fail" retry loop calling the given proc

@param client Zookeeper
@param mode how to handle session failures
@param proc procedure to call with retry
@param <T> return type
@return procedure result
@throws Exception any non-retriable errors