Exemplo n.º 1
0
    public override Ice.DispatchStatus dispatch(Ice.Request request)
    {
        Ice.Current current = request.getCurrent();
        lastOperation_ = current.operation;

        if(lastOperation_.Equals("addWithRetry"))
        {
            for(int i = 0; i < 10; ++i)
            {
                try
                {
                    servant_.ice_dispatch(request);
                    test(false);
                }
                catch(Test.RetryException)
                {
                    //
                    // Expected, retry
                    //
                }
            }

            current.ctx["retry"] = "no";
        }

        lastStatus_ = servant_.ice_dispatch(request);
        return lastStatus_;
    }
Exemplo n.º 2
0
    public override Ice.DispatchStatus dispatch(Ice.Request request)
    {
        Ice.Current current = request.getCurrent();
        lastOperation_ = current.operation;

        if(lastOperation_.Equals("amdAddWithRetry"))
        {
            for(int i = 0; i < 10; ++i)
            {
                Ice.DispatchInterceptorAsyncCallback cb = new DispatchInterceptorAsyncCallbackI();

                lastStatus_ = servant_.ice_dispatch(request, cb);
                test(lastStatus_ == Ice.DispatchStatus.DispatchAsync);
            }

            request.getCurrent().ctx["retry"] = "no";
        }

        lastStatus_ = servant_.ice_dispatch(request, this);
        return lastStatus_;
    }
Exemplo n.º 3
0
    public override Task<Ice.OutputStream> dispatch(Ice.Request request)
    {
        Ice.Current current = request.getCurrent();
        lastOperation_ = current.operation;

        if(lastOperation_.Equals("addWithRetry") || lastOperation_.Equals("amdAddWithRetry"))
        {
            for(int i = 0; i < 10; ++i)
            {
                try
                {
                    var t = servant_.ice_dispatch(request);
                    if(t != null && t.IsFaulted)
                    {
                        throw t.Exception.InnerException;
                    }
                    else
                    {
                        test(false);
                    }
                }
                catch(Test.RetryException)
                {
                    //
                    // Expected, retry
                    //
                }
            }

            current.ctx["retry"] = "no";
        }

        var task = servant_.ice_dispatch(request);
        lastStatus_ = task != null;
        return task;
    }