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
|
// **********************************************************************
//
// 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 test.Ice.admin;
import test.Ice.admin.Test.*;
public class RemoteCommunicatorI extends _RemoteCommunicatorDisp implements Ice.PropertiesAdminUpdateCallback
{
RemoteCommunicatorI(Ice.Communicator communicator)
{
_communicator = communicator;
_called = false;
}
@Override
public Ice.ObjectPrx getAdmin(Ice.Current current)
{
return _communicator.getAdmin();
}
@Override
public synchronized java.util.Map<String, String> getChanges(Ice.Current current)
{
//
// The client calls PropertiesAdmin::setProperties() and then invokes
// this operation. Since setProperties() is implemented using AMD, the
// client might receive its reply and then call getChanges() before our
// updated() method is called. We block here to ensure that updated()
// gets called before we return the most recent set of changes.
//
while(!_called)
{
try
{
wait();
}
catch(InterruptedException ex)
{
}
}
_called = false;
return _changes;
}
@Override
public void print(String message, Ice.Current current)
{
_communicator.getLogger().print(message);
}
@Override
public void trace(String category, String message, Ice.Current current)
{
_communicator.getLogger().trace(category, message);
}
@Override
public void warning(String message, Ice.Current current)
{
_communicator.getLogger().warning(message);
}
@Override
public void error(String message, Ice.Current current)
{
_communicator.getLogger().error(message);
}
@Override
public void shutdown(Ice.Current current)
{
_communicator.shutdown();
}
@Override
public void waitForShutdown(Ice.Current current)
{
//
// Note that we are executing in a thread of the *main* communicator,
// not the one that is being shut down.
//
_communicator.waitForShutdown();
}
@Override
public void destroy(Ice.Current current)
{
_communicator.destroy();
}
@Override
public synchronized void updated(java.util.Map<String, String> changes)
{
_changes = changes;
_called = true;
notify();
}
private Ice.Communicator _communicator;
private java.util.Map<String, String> _changes;
private boolean _called;
}
|