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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
|
// **********************************************************************
//
// 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;
//
// Base class for handling asynchronous invocations. This class is
// responsible for the handling of the output stream and the child
// invocation observer.
//
public abstract class OutgoingAsyncBase extends IceInternal.AsyncResultI
{
public int send(Ice.ConnectionI connection, boolean compress, boolean response) throws RetryException
{
assert(false); // This should be overriden if this object is used with a request handler
return AsyncStatus.Queued;
}
public int invokeCollocated(CollocatedRequestHandler handler)
{
assert(false); // This should be overriden if this object is used with a request handler
return AsyncStatus.Queued;
}
public boolean sent()
{
return sent(true);
}
public boolean completed(Ice.Exception ex)
{
return finished(ex);
}
public final void attachRemoteObserver(Ice.ConnectionInfo info, Ice.Endpoint endpt, int requestId)
{
if(_observer != null)
{
final int size = _os.size() - IceInternal.Protocol.headerSize - 4;
_childObserver = getObserver().getRemoteObserver(info, endpt, requestId, size);
if(_childObserver != null)
{
_childObserver.attach();
}
}
}
public final void attachCollocatedObserver(Ice.ObjectAdapter adapter, int requestId)
{
if(_observer != null)
{
final int size = _os.size() - IceInternal.Protocol.headerSize - 4;
_childObserver = getObserver().getCollocatedObserver(adapter, requestId, size);
if(_childObserver != null)
{
_childObserver.attach();
}
}
}
public final IceInternal.BasicStream getOs()
{
return _os;
}
protected OutgoingAsyncBase(Ice.Communicator com, Instance instance, String op, CallbackBase del)
{
super(com, instance, op, del);
_os = new BasicStream(instance, Protocol.currentProtocolEncoding);
}
protected OutgoingAsyncBase(Ice.Communicator com, Instance instance, String op, CallbackBase del, BasicStream os)
{
super(com, instance, op, del);
_os = os;
}
@Override
protected boolean sent(boolean done)
{
if(done)
{
if(_childObserver != null)
{
_childObserver.detach();
_childObserver = null;
}
}
return super.sent(done);
}
@Override
protected boolean finished(Ice.Exception ex)
{
if(_childObserver != null)
{
_childObserver.failed(ex.ice_name());
_childObserver.detach();
_childObserver = null;
}
return super.finished(ex);
}
protected BasicStream _os;
protected Ice.Instrumentation.ChildInvocationObserver _childObserver;
}
|