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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
|
// **********************************************************************
//
// Copyright (c) 2001
// MutableRealms, Inc.
// Huntsville, AL, USA
//
// All Rights Reserved
//
// **********************************************************************
package Ice;
class CommunicatorI implements Communicator
{
public synchronized void
destroy()
{
if (_instance != null)
{
_instance.destroy();
_instance = null;
}
}
public void
shutdown()
{
//
// No mutex locking here!
//
_threadPool.initiateServerShutdown();
}
public void
waitForShutdown()
{
//
// No mutex locking here, otherwise the communicator is blocked
// while waiting for shutdown.
//
_threadPool.waitUntilServerFinished();
}
public synchronized Ice.ObjectPrx
stringToProxy(String s)
{
if (_instance == null)
{
throw new CommunicatorDestroyedException();
}
return _instance.proxyFactory().stringToProxy(s);
}
public synchronized String
proxyToString(Ice.ObjectPrx proxy)
{
if (_instance == null)
{
throw new CommunicatorDestroyedException();
}
return _instance.proxyFactory().proxyToString(proxy);
}
public synchronized ObjectAdapter
createObjectAdapter(String name)
{
if (_instance == null)
{
throw new CommunicatorDestroyedException();
}
String endpts = _instance.properties().getProperty(
"Ice.Adapter." + name + ".Endpoints");
return createObjectAdapterWithEndpoints(name, endpts);
}
public synchronized ObjectAdapter
createObjectAdapterWithEndpoints(String name, String endpts)
{
if (_instance == null)
{
throw new CommunicatorDestroyedException();
}
return _instance.objectAdapterFactory().createObjectAdapter(
name, endpts);
}
public synchronized void
addObjectFactory(ObjectFactory factory, String id)
{
if (_instance == null)
{
throw new CommunicatorDestroyedException();
}
_instance.servantFactoryManager().add(factory, id);
}
public synchronized void
removeObjectFactory(String id)
{
if (_instance == null)
{
throw new CommunicatorDestroyedException();
}
_instance.servantFactoryManager().remove(id);
}
public synchronized ObjectFactory
findObjectFactory(String id)
{
if (_instance == null)
{
throw new CommunicatorDestroyedException();
}
return _instance.servantFactoryManager().find(id);
}
public synchronized void
addUserExceptionFactory(UserExceptionFactory factory, String id)
{
if (_instance == null)
{
throw new CommunicatorDestroyedException();
}
_instance.userExceptionFactoryManager().add(factory, id);
}
public synchronized void
removeUserExceptionFactory(String id)
{
if (_instance == null)
{
throw new CommunicatorDestroyedException();
}
_instance.userExceptionFactoryManager().remove(id);
}
public synchronized UserExceptionFactory
findUserExceptionFactory(String id)
{
if (_instance == null)
{
throw new CommunicatorDestroyedException();
}
return _instance.userExceptionFactoryManager().find(id);
}
public synchronized Properties
getProperties()
{
if (_instance == null)
{
throw new CommunicatorDestroyedException();
}
return _instance.properties();
}
public synchronized Logger
getLogger()
{
if (_instance == null)
{
throw new CommunicatorDestroyedException();
}
return _instance.logger();
}
public synchronized void
setLogger(Logger logger)
{
if (_instance == null)
{
throw new CommunicatorDestroyedException();
}
_instance.logger(logger);
}
public Stream
createStream()
{
if (_instance == null)
{
throw new CommunicatorDestroyedException();
}
return new StreamI(_instance);
}
CommunicatorI(Properties propertites)
{
_instance = new IceInternal.Instance(this, properties);
_threadPool = _instance.threadPool();
}
protected void
finalize()
throws Throwable
{
if (_instance != null)
{
_instance.logger().warning("communicator has not been destroyed");
}
}
private IceInternal.Instance _instance;
private IceInternal.ThreadPool _threadPool;
}
|