summaryrefslogtreecommitdiff
path: root/java/src/IceInternal/ProxyGetConnection.java
blob: 9f5388218db94144b695b77eec6e544e71273368 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
// **********************************************************************
//
// Copyright (c) 2003-2014 ZeroC, Inc. All rights reserved.
//
// This copy of Ice is licensed to you under the terms described in the
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************

package IceInternal;

public class ProxyGetConnection extends ProxyOutgoingAsyncBase
{
    public static ProxyGetConnection check(Ice.AsyncResult r, Ice.ObjectPrx prx, String operation)
    {
        ProxyOutgoingAsyncBase.checkImpl(r, prx, operation);
        try
        {
            return (ProxyGetConnection)r;
        }
        catch(ClassCastException ex)
        {
            throw new IllegalArgumentException("Incorrect AsyncResult object for end_" + operation + " method");
        }
    }

    public ProxyGetConnection(Ice.ObjectPrxHelperBase prx, String operation, CallbackBase cb)
    {
        super(prx, operation, cb);
        _observer = ObserverHelper.get(prx, operation);
    }

    @Override
    public int send(Ice.ConnectionI connection, boolean compress, boolean response)
        throws RetryException
    {
        _cachedConnection = connection;
        if(finished(true))
        {
            invokeCompletedAsync();
        }
        return AsyncStatus.Sent;
    }

    @Override
    public int invokeCollocated(CollocatedRequestHandler handler)
    {
        if(finished(true))
        {
            invokeCompletedAsync();
        }
        return AsyncStatus.Sent;
    }

    public void invoke()
    {
        invokeImpl(true); // userThread = true
    }
}