zeroc-ice-x86-mingw 3.6b1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/ICE_LICENSE +54 -0
- data/LICENSE +339 -0
- data/bin/slice2rb +17 -0
- data/ice-x86-mingw.gemspec +41 -0
- data/lib/Glacier2.rb +12 -0
- data/lib/Glacier2/Metrics.rb +99 -0
- data/lib/Glacier2/PermissionsVerifier.rb +168 -0
- data/lib/Glacier2/PermissionsVerifierF.rb +34 -0
- data/lib/Glacier2/Router.rb +141 -0
- data/lib/Glacier2/RouterF.rb +29 -0
- data/lib/Glacier2/SSLInfo.rb +79 -0
- data/lib/Glacier2/Session.rb +470 -0
- data/lib/Ice.rb +659 -0
- data/lib/Ice/BuiltinSequences.rb +64 -0
- data/lib/Ice/Communicator.rb +93 -0
- data/lib/Ice/CommunicatorF.rb +28 -0
- data/lib/Ice/Connection.rb +414 -0
- data/lib/Ice/ConnectionF.rb +36 -0
- data/lib/Ice/Current.rb +152 -0
- data/lib/Ice/Endpoint.rb +265 -0
- data/lib/Ice/EndpointF.rb +52 -0
- data/lib/Ice/EndpointTypes.rb +77 -0
- data/lib/Ice/FacetMap.rb +28 -0
- data/lib/Ice/Identity.rb +70 -0
- data/lib/Ice/ImplicitContext.rb +59 -0
- data/lib/Ice/ImplicitContextF.rb +28 -0
- data/lib/Ice/Instrumentation.rb +425 -0
- data/lib/Ice/InstrumentationF.rb +35 -0
- data/lib/Ice/LocalException.rb +1081 -0
- data/lib/Ice/Locator.rb +314 -0
- data/lib/Ice/LocatorF.rb +34 -0
- data/lib/Ice/Logger.rb +57 -0
- data/lib/Ice/LoggerF.rb +28 -0
- data/lib/Ice/Metrics.rb +696 -0
- data/lib/Ice/ObjectAdapterF.rb +28 -0
- data/lib/Ice/ObjectFactory.rb +53 -0
- data/lib/Ice/ObjectFactoryF.rb +28 -0
- data/lib/Ice/Plugin.rb +87 -0
- data/lib/Ice/PluginF.rb +32 -0
- data/lib/Ice/Process.rb +93 -0
- data/lib/Ice/ProcessF.rb +29 -0
- data/lib/Ice/Properties.rb +65 -0
- data/lib/Ice/PropertiesAdmin.rb +104 -0
- data/lib/Ice/PropertiesF.rb +33 -0
- data/lib/Ice/Router.rb +163 -0
- data/lib/Ice/RouterF.rb +29 -0
- data/lib/Ice/SliceChecksumDict.rb +28 -0
- data/lib/Ice/Version.rb +100 -0
- data/lib/IceBox.rb +10 -0
- data/lib/IceBox/IceBox.rb +272 -0
- data/lib/IceGrid.rb +17 -0
- data/lib/IceGrid/Admin.rb +1076 -0
- data/lib/IceGrid/Descriptor.rb +1505 -0
- data/lib/IceGrid/Exception.rb +401 -0
- data/lib/IceGrid/FileParser.rb +105 -0
- data/lib/IceGrid/Locator.rb +105 -0
- data/lib/IceGrid/Observer.rb +571 -0
- data/lib/IceGrid/Query.rb +168 -0
- data/lib/IceGrid/Registry.rb +120 -0
- data/lib/IceGrid/Session.rb +114 -0
- data/lib/IceGrid/UserAccountMapper.rb +101 -0
- data/lib/IcePatch2.rb +10 -0
- data/lib/IcePatch2/FileInfo.rb +75 -0
- data/lib/IcePatch2/FileServer.rb +141 -0
- data/lib/IceRuby.so +0 -0
- data/lib/IceStorm.rb +11 -0
- data/lib/IceStorm/IceStorm.rb +463 -0
- data/lib/IceStorm/Metrics.rb +155 -0
- data/slice/Freeze/BackgroundSaveEvictor.ice +111 -0
- data/slice/Freeze/CatalogData.ice +49 -0
- data/slice/Freeze/Connection.ice +111 -0
- data/slice/Freeze/ConnectionF.ice +20 -0
- data/slice/Freeze/DB.ice +37 -0
- data/slice/Freeze/Evictor.ice +339 -0
- data/slice/Freeze/EvictorF.ice +22 -0
- data/slice/Freeze/EvictorStorage.ice +72 -0
- data/slice/Freeze/Exception.ice +100 -0
- data/slice/Freeze/Transaction.ice +57 -0
- data/slice/Freeze/TransactionalEvictor.ice +50 -0
- data/slice/Glacier2/Metrics.ice +77 -0
- data/slice/Glacier2/PermissionsVerifier.ice +105 -0
- data/slice/Glacier2/PermissionsVerifierF.ice +21 -0
- data/slice/Glacier2/Router.ice +178 -0
- data/slice/Glacier2/RouterF.ice +20 -0
- data/slice/Glacier2/SSLInfo.ice +50 -0
- data/slice/Glacier2/Session.ice +273 -0
- data/slice/Ice/BuiltinSequences.ice +48 -0
- data/slice/Ice/Communicator.ice +567 -0
- data/slice/Ice/CommunicatorF.ice +20 -0
- data/slice/Ice/Connection.ice +323 -0
- data/slice/Ice/ConnectionF.ice +22 -0
- data/slice/Ice/Current.ice +160 -0
- data/slice/Ice/Endpoint.ice +227 -0
- data/slice/Ice/EndpointF.ice +32 -0
- data/slice/Ice/EndpointTypes.ice +38 -0
- data/slice/Ice/FacetMap.ice +25 -0
- data/slice/Ice/Identity.ice +59 -0
- data/slice/Ice/ImplicitContext.ice +109 -0
- data/slice/Ice/ImplicitContextF.ice +20 -0
- data/slice/Ice/Instrumentation.ice +499 -0
- data/slice/Ice/InstrumentationF.ice +26 -0
- data/slice/Ice/LocalException.ice +1015 -0
- data/slice/Ice/Locator.ice +227 -0
- data/slice/Ice/LocatorF.ice +21 -0
- data/slice/Ice/Logger.ice +86 -0
- data/slice/Ice/LoggerF.ice +20 -0
- data/slice/Ice/Metrics.ice +422 -0
- data/slice/Ice/ObjectAdapter.ice +673 -0
- data/slice/Ice/ObjectAdapterF.ice +20 -0
- data/slice/Ice/ObjectFactory.ice +60 -0
- data/slice/Ice/ObjectFactoryF.ice +20 -0
- data/slice/Ice/Plugin.ice +117 -0
- data/slice/Ice/PluginF.ice +21 -0
- data/slice/Ice/Process.ice +54 -0
- data/slice/Ice/ProcessF.ice +20 -0
- data/slice/Ice/Properties.ice +228 -0
- data/slice/Ice/PropertiesAdmin.ice +75 -0
- data/slice/Ice/PropertiesF.ice +21 -0
- data/slice/Ice/RemoteLogger.ice +232 -0
- data/slice/Ice/Router.ice +83 -0
- data/slice/Ice/RouterF.ice +20 -0
- data/slice/Ice/ServantLocator.ice +117 -0
- data/slice/Ice/ServantLocatorF.ice +20 -0
- data/slice/Ice/SliceChecksumDict.ice +25 -0
- data/slice/Ice/Version.ice +39 -0
- data/slice/IceBox/IceBox.ice +194 -0
- data/slice/IceDiscovery/IceDiscovery.ice +32 -0
- data/slice/IceGrid/Admin.ice +1578 -0
- data/slice/IceGrid/Descriptor.ice +1079 -0
- data/slice/IceGrid/Discovery.ice +73 -0
- data/slice/IceGrid/Exception.ice +383 -0
- data/slice/IceGrid/FileParser.ice +61 -0
- data/slice/IceGrid/Locator.ice +56 -0
- data/slice/IceGrid/Observer.ice +394 -0
- data/slice/IceGrid/PluginFacade.ice +316 -0
- data/slice/IceGrid/Query.ice +130 -0
- data/slice/IceGrid/Registry.ice +138 -0
- data/slice/IceGrid/Session.ice +124 -0
- data/slice/IceGrid/UserAccountMapper.ice +58 -0
- data/slice/IcePatch2/FileInfo.ice +49 -0
- data/slice/IcePatch2/FileServer.ice +129 -0
- data/slice/IceSSL/ConnectionInfo.ice +34 -0
- data/slice/IceSSL/EndpointInfo.ice +41 -0
- data/slice/IceStorm/IceStorm.ice +405 -0
- data/slice/IceStorm/Metrics.ice +71 -0
- metadata +207 -0
data/lib/Ice.rb
ADDED
@@ -0,0 +1,659 @@
|
|
1
|
+
# **********************************************************************
|
2
|
+
#
|
3
|
+
# Copyright (c) 2003-2014 ZeroC, Inc. All rights reserved.
|
4
|
+
#
|
5
|
+
# This copy of Ice is licensed to you under the terms described in the
|
6
|
+
# ICE_LICENSE file included in this distribution.
|
7
|
+
#
|
8
|
+
# **********************************************************************
|
9
|
+
|
10
|
+
require 'IceRuby'
|
11
|
+
require 'thread'
|
12
|
+
|
13
|
+
module Ice
|
14
|
+
|
15
|
+
#
|
16
|
+
# Convenience function for locating the directory containing the
|
17
|
+
# Slice files.
|
18
|
+
#
|
19
|
+
def Ice.getSliceDir
|
20
|
+
#
|
21
|
+
# Get the parent of the directory containing this file
|
22
|
+
# (Ice.rb).
|
23
|
+
#
|
24
|
+
rbHome = File::join(File::dirname(__FILE__), "..")
|
25
|
+
|
26
|
+
#
|
27
|
+
# For an installation from a source distribution, a binary
|
28
|
+
# tarball, or a Windows installer, the "slice" directory is a
|
29
|
+
# sibling of the "rb" directory.
|
30
|
+
#
|
31
|
+
dir = File::join(rbHome, "slice")
|
32
|
+
if File::exists?(dir)
|
33
|
+
return File::expand_path(dir)
|
34
|
+
end
|
35
|
+
|
36
|
+
#
|
37
|
+
# In a source distribution, the "slice" directory is one level
|
38
|
+
# higher.
|
39
|
+
#
|
40
|
+
dir = File::join(rbHome, "..", "slice")
|
41
|
+
if File::exists?(dir)
|
42
|
+
return File::expand_path(dir)
|
43
|
+
end
|
44
|
+
|
45
|
+
if RUBY_PLATFORM =~ /linux/i
|
46
|
+
iceVer = Ice::stringVersion
|
47
|
+
#
|
48
|
+
# Check the default RPM location.
|
49
|
+
#
|
50
|
+
dir = File::join("/", "usr", "share", "Ice-" + iceVer, "slice")
|
51
|
+
if File::exists?(dir)
|
52
|
+
return dir
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
return nil
|
57
|
+
end
|
58
|
+
|
59
|
+
#
|
60
|
+
# Exceptions.
|
61
|
+
#
|
62
|
+
class Exception < ::StandardError
|
63
|
+
def ice_name
|
64
|
+
to_s
|
65
|
+
end
|
66
|
+
|
67
|
+
def inspect
|
68
|
+
return ::Ice::__stringifyException(self)
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
class UserException < Exception
|
73
|
+
end
|
74
|
+
|
75
|
+
class LocalException < Exception
|
76
|
+
end
|
77
|
+
|
78
|
+
#
|
79
|
+
# Object.
|
80
|
+
#
|
81
|
+
T_Object = Ice.__declareClass('::Ice::Object')
|
82
|
+
T_ObjectPrx = Ice.__declareProxy('::Ice::Object')
|
83
|
+
|
84
|
+
module Object_mixin
|
85
|
+
def ice_isA(id, current=nil)
|
86
|
+
return ice_ids().include?(id)
|
87
|
+
end
|
88
|
+
|
89
|
+
def ice_ping(current=nil)
|
90
|
+
end
|
91
|
+
|
92
|
+
attr_accessor :_ice_slicedData # Only used for instances of preserved classes.
|
93
|
+
end
|
94
|
+
|
95
|
+
class Object
|
96
|
+
include Object_mixin
|
97
|
+
|
98
|
+
def Object.ice_staticId()
|
99
|
+
'::Ice::Object'
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
T_Object.defineClass(nil, -1, true, false, nil, [], [])
|
104
|
+
Object_mixin::ICE_TYPE = T_Object
|
105
|
+
|
106
|
+
T_ObjectPrx.defineProxy(ObjectPrx, T_Object)
|
107
|
+
ObjectPrx::ICE_TYPE = T_ObjectPrx
|
108
|
+
|
109
|
+
#
|
110
|
+
# LocalObject.
|
111
|
+
#
|
112
|
+
T_LocalObject = Ice.__declareLocalClass('::Ice::LocalObject')
|
113
|
+
T_LocalObject.defineClass(nil, -1, true, false, nil, [], [])
|
114
|
+
|
115
|
+
#
|
116
|
+
# UnknownSlicedObject.
|
117
|
+
#
|
118
|
+
class UnknownSlicedObject
|
119
|
+
include ::Ice::Object_mixin
|
120
|
+
|
121
|
+
attr_accessor :unknownTypeId
|
122
|
+
end
|
123
|
+
T_UnknownSlicedObject = Ice.__declareClass('::Ice::UnknownSlicedObject')
|
124
|
+
T_UnknownSlicedObject.defineClass(UnknownSlicedObject, -1, false, true, nil, [], [])
|
125
|
+
UnknownSlicedObject::ICE_TYPE = T_UnknownSlicedObject
|
126
|
+
|
127
|
+
#
|
128
|
+
# InitializationData.
|
129
|
+
#
|
130
|
+
class InitializationData
|
131
|
+
def initialize(properties=nil, logger=nil)
|
132
|
+
@properties = properties
|
133
|
+
@logger = logger
|
134
|
+
end
|
135
|
+
|
136
|
+
attr_accessor :properties, :logger
|
137
|
+
end
|
138
|
+
|
139
|
+
#
|
140
|
+
# SlicedData
|
141
|
+
#
|
142
|
+
class SlicedData
|
143
|
+
attr_accessor :slices # array of SliceInfo
|
144
|
+
end
|
145
|
+
|
146
|
+
#
|
147
|
+
# SliceInfo
|
148
|
+
#
|
149
|
+
class SliceInfo
|
150
|
+
attr_accessor :typeId, :bytes, :objects
|
151
|
+
end
|
152
|
+
|
153
|
+
class FormatType
|
154
|
+
include Comparable
|
155
|
+
|
156
|
+
def initialize(val)
|
157
|
+
fail("invalid value #{val} for FormatType") unless(val >= 0 and val < 3)
|
158
|
+
@val = val
|
159
|
+
end
|
160
|
+
|
161
|
+
def FormatType.from_int(val)
|
162
|
+
raise IndexError, "#{val} is out of range 0..2" if(val < 0 || val > 2)
|
163
|
+
@@_values[val]
|
164
|
+
end
|
165
|
+
|
166
|
+
def to_s
|
167
|
+
@@_names[@val]
|
168
|
+
end
|
169
|
+
|
170
|
+
def to_i
|
171
|
+
@val
|
172
|
+
end
|
173
|
+
|
174
|
+
def <=>(other)
|
175
|
+
other.is_a?(FormatType) or raise ArgumentError, "value must be a FormatType"
|
176
|
+
@val <=> other.to_i
|
177
|
+
end
|
178
|
+
|
179
|
+
def hash
|
180
|
+
@val.hash
|
181
|
+
end
|
182
|
+
|
183
|
+
def inspect
|
184
|
+
@@_names[@val] + "(#{@val})"
|
185
|
+
end
|
186
|
+
|
187
|
+
def FormatType.each(&block)
|
188
|
+
@@_values.each(&block)
|
189
|
+
end
|
190
|
+
|
191
|
+
@@_names = ['DefaultFormat', 'CompactFormat', 'SlicedFormat']
|
192
|
+
@@_values = [FormatType.new(0), FormatType.new(1), FormatType.new(2)]
|
193
|
+
|
194
|
+
DefaultFormat = @@_values[0]
|
195
|
+
CompactFormat = @@_values[1]
|
196
|
+
SlicedFormat = @@_values[2]
|
197
|
+
|
198
|
+
private_class_method :new
|
199
|
+
end
|
200
|
+
|
201
|
+
#
|
202
|
+
# Slice checksum dictionary.
|
203
|
+
#
|
204
|
+
SliceChecksums = {}
|
205
|
+
end
|
206
|
+
|
207
|
+
#
|
208
|
+
# Include certain generated files.
|
209
|
+
#
|
210
|
+
require 'Ice/BuiltinSequences.rb'
|
211
|
+
require 'Ice/Current.rb'
|
212
|
+
require 'Ice/EndpointTypes.rb'
|
213
|
+
require 'Ice/LocalException.rb'
|
214
|
+
require 'Ice/Locator.rb'
|
215
|
+
require 'Ice/Logger.rb'
|
216
|
+
require 'Ice/ObjectFactory.rb'
|
217
|
+
require 'Ice/Process.rb'
|
218
|
+
require 'Ice/Router.rb'
|
219
|
+
require 'Ice/Connection.rb'
|
220
|
+
require 'Ice/Version.rb'
|
221
|
+
require 'Ice/Instrumentation.rb'
|
222
|
+
require 'Ice/Metrics.rb'
|
223
|
+
|
224
|
+
module Ice
|
225
|
+
#
|
226
|
+
# Reopen Identity to add the <=> method.
|
227
|
+
#
|
228
|
+
class Identity
|
229
|
+
def <=>(other)
|
230
|
+
n = self.name <=> other.name
|
231
|
+
if n == 0
|
232
|
+
return self.category <=> other.category
|
233
|
+
else
|
234
|
+
return n
|
235
|
+
end
|
236
|
+
end
|
237
|
+
end
|
238
|
+
|
239
|
+
#
|
240
|
+
# Note the interface is the same as the C++ CtrlCHandler
|
241
|
+
# implementation, however, the implementation is different.
|
242
|
+
#
|
243
|
+
class CtrlCHandler
|
244
|
+
def initialize
|
245
|
+
if @@_self != nil
|
246
|
+
raise RuntimeError, "Only a single instance of a CtrlCHandler can be instantiated."
|
247
|
+
end
|
248
|
+
@@_self = self
|
249
|
+
|
250
|
+
# State variables. These are not class static variables.
|
251
|
+
@condVar = ConditionVariable.new
|
252
|
+
@mutex = Mutex.new
|
253
|
+
@queue = Array.new
|
254
|
+
@done = false
|
255
|
+
@callback = nil
|
256
|
+
|
257
|
+
#
|
258
|
+
# Setup and install signal handlers
|
259
|
+
#
|
260
|
+
if Signal.list.has_key?('HUP')
|
261
|
+
Signal.trap('HUP') { signalHandler('HUP') }
|
262
|
+
end
|
263
|
+
Signal.trap('INT') { signalHandler('INT') }
|
264
|
+
Signal.trap('TERM') { signalHandler('TERM') }
|
265
|
+
|
266
|
+
@thr = Thread.new { main }
|
267
|
+
end
|
268
|
+
|
269
|
+
# Dequeue and dispatch signals.
|
270
|
+
def main
|
271
|
+
while true
|
272
|
+
sig, callback = @mutex.synchronize {
|
273
|
+
while @queue.empty? and not @done
|
274
|
+
@condVar.wait(@mutex)
|
275
|
+
end
|
276
|
+
if @done
|
277
|
+
return
|
278
|
+
end
|
279
|
+
@queue.shift
|
280
|
+
}
|
281
|
+
if callback
|
282
|
+
callback.call(sig)
|
283
|
+
end
|
284
|
+
end
|
285
|
+
end
|
286
|
+
|
287
|
+
# Destroy the object. Wait for the thread to terminate and cleanup
|
288
|
+
# the internal state.
|
289
|
+
def destroy
|
290
|
+
@mutex.synchronize {
|
291
|
+
@done = true
|
292
|
+
@condVar.signal
|
293
|
+
}
|
294
|
+
|
295
|
+
# Wait for the thread to terminate
|
296
|
+
@thr.join
|
297
|
+
|
298
|
+
#
|
299
|
+
# Cleanup any state set by the CtrlCHandler.
|
300
|
+
#
|
301
|
+
if Signal.list.has_key?('HUP')
|
302
|
+
Signal.trap('HUP', 'SIG_DFL')
|
303
|
+
end
|
304
|
+
Signal.trap('INT', 'SIG_DFL')
|
305
|
+
Signal.trap('TERM', 'SIG_DFL')
|
306
|
+
@@_self = nil
|
307
|
+
end
|
308
|
+
|
309
|
+
def setCallback(callback)
|
310
|
+
@mutex.synchronize {
|
311
|
+
@callback = callback
|
312
|
+
}
|
313
|
+
end
|
314
|
+
|
315
|
+
def getCallback
|
316
|
+
@mutex.synchronize {
|
317
|
+
return @callback
|
318
|
+
}
|
319
|
+
end
|
320
|
+
|
321
|
+
# Private. Only called by the signal handling mechanism.
|
322
|
+
def signalHandler(sig)
|
323
|
+
@mutex.synchronize {
|
324
|
+
#
|
325
|
+
# The signal AND the current callback are queued together.
|
326
|
+
#
|
327
|
+
@queue = @queue.push([sig, @callback])
|
328
|
+
@condVar.signal
|
329
|
+
}
|
330
|
+
end
|
331
|
+
@@_self = nil
|
332
|
+
end
|
333
|
+
|
334
|
+
#
|
335
|
+
# Ice::Application.
|
336
|
+
#
|
337
|
+
class Application
|
338
|
+
def initialize(signalPolicy=HandleSignals)
|
339
|
+
@@_signalPolicy = signalPolicy
|
340
|
+
end
|
341
|
+
|
342
|
+
def main(args, configFile=nil, initData=nil)
|
343
|
+
if @@_communicator
|
344
|
+
Ice::getProcessLogger().error($0 + ": only one instance of the Application class can be used")
|
345
|
+
return false
|
346
|
+
end
|
347
|
+
if @@_signalPolicy == HandleSignals
|
348
|
+
@@_ctrlCHandler = CtrlCHandler.new
|
349
|
+
end
|
350
|
+
|
351
|
+
@@_interrupted = false
|
352
|
+
@@_appName = $0
|
353
|
+
|
354
|
+
status = 0
|
355
|
+
|
356
|
+
begin
|
357
|
+
if initData.nil?
|
358
|
+
initData = InitializationData.new
|
359
|
+
end
|
360
|
+
if configFile
|
361
|
+
initData.properties = Ice::createProperties
|
362
|
+
initData.properties.load(configFile)
|
363
|
+
end
|
364
|
+
initData.properties = Ice::createProperties(args, initData.properties)
|
365
|
+
@@_appName = initData.properties.getPropertyWithDefault("Ice.ProgramName", @@_appName)
|
366
|
+
@@_application = self
|
367
|
+
@@_communicator = Ice::initialize(args, initData)
|
368
|
+
@@_destroyed = false
|
369
|
+
|
370
|
+
#
|
371
|
+
# Used by destroyOnInterruptCallback.
|
372
|
+
#
|
373
|
+
@@_nohup = @@_communicator.getProperties().getPropertyAsInt("Ice.Nohup") > 0
|
374
|
+
|
375
|
+
#
|
376
|
+
# The default is to destroy when a signal is received.
|
377
|
+
#
|
378
|
+
if @@_signalPolicy == HandleSignals
|
379
|
+
Application::destroyOnInterrupt
|
380
|
+
end
|
381
|
+
|
382
|
+
status = run(args)
|
383
|
+
rescue => ex
|
384
|
+
Ice::getProcessLogger().error($!.inspect + "\n" + ex.backtrace.join("\n"))
|
385
|
+
status = 1
|
386
|
+
end
|
387
|
+
|
388
|
+
#
|
389
|
+
# Don't want any new interrupt and at this point (post-run),
|
390
|
+
# it would not make sense to release a held signal to run
|
391
|
+
# shutdown or destroy.
|
392
|
+
#
|
393
|
+
if @@_signalPolicy == HandleSignals
|
394
|
+
Application::ignoreInterrupt
|
395
|
+
end
|
396
|
+
|
397
|
+
@@_mutex.synchronize {
|
398
|
+
while @@_callbackInProgress
|
399
|
+
@@_condVar.wait(@@_mutex)
|
400
|
+
end
|
401
|
+
if @@_destroyed
|
402
|
+
@@_communicator = nil
|
403
|
+
else
|
404
|
+
@@_destroyed = true
|
405
|
+
end
|
406
|
+
#
|
407
|
+
# And _communicator != 0, meaning will be destroyed
|
408
|
+
# next, _destroyed = true also ensures that any
|
409
|
+
# remaining callback won't do anything
|
410
|
+
#
|
411
|
+
@@_application = nil
|
412
|
+
}
|
413
|
+
|
414
|
+
if @@_communicator
|
415
|
+
begin
|
416
|
+
@@_communicator.destroy()
|
417
|
+
rescue => ex
|
418
|
+
Ice::getProcessLogger().error($!.inspect + "\n" + ex.backtrace.join("\n"))
|
419
|
+
status = 1
|
420
|
+
end
|
421
|
+
|
422
|
+
@@_communicator = nil
|
423
|
+
end
|
424
|
+
|
425
|
+
if @@_signalPolicy == HandleSignals
|
426
|
+
@@_ctrlCHandler.destroy()
|
427
|
+
@@_ctrlCHandler = nil
|
428
|
+
end
|
429
|
+
|
430
|
+
return status
|
431
|
+
end
|
432
|
+
|
433
|
+
def interruptCallback(sig)
|
434
|
+
end
|
435
|
+
|
436
|
+
def Application.appName
|
437
|
+
@@_appName
|
438
|
+
end
|
439
|
+
|
440
|
+
def Application.communicator
|
441
|
+
@@_communicator
|
442
|
+
end
|
443
|
+
|
444
|
+
def Application.destroyOnInterrupt
|
445
|
+
if @@_signalPolicy == HandleSignals
|
446
|
+
@@_mutex.synchronize {
|
447
|
+
if @@_ctrlCHandler.getCallback == @@_holdInterruptCallbackProc
|
448
|
+
@@_released = true
|
449
|
+
@@_condVar.signal
|
450
|
+
end
|
451
|
+
@@_ctrlCHandler.setCallback(@@_destroyOnInterruptCallbackProc)
|
452
|
+
}
|
453
|
+
else
|
454
|
+
Ice::getProcessLogger().error(@@_appName + ": warning: interrupt method called on Application configured to not handle interrupts.")
|
455
|
+
end
|
456
|
+
end
|
457
|
+
|
458
|
+
# No support for this since no server side in Ice for ruby.
|
459
|
+
#def Application.shutdownOnInterrupt
|
460
|
+
#end
|
461
|
+
|
462
|
+
def Application.ignoreInterrupt
|
463
|
+
if @@_signalPolicy == HandleSignals
|
464
|
+
@@_mutex.synchronize {
|
465
|
+
if @@_ctrlCHandler.getCallback == @@_holdInterruptCallbackProc
|
466
|
+
@@_released = true
|
467
|
+
@@_condVar.signal
|
468
|
+
end
|
469
|
+
@@_ctrlCHandler.setCallback(nil)
|
470
|
+
}
|
471
|
+
else
|
472
|
+
Ice::getProcessLogger().error(@@_appName + ": warning: interrupt method called on Application configured to not handle interrupts.")
|
473
|
+
end
|
474
|
+
end
|
475
|
+
|
476
|
+
def Application.callbackOnInterrupt()
|
477
|
+
if @@_signalPolicy == HandleSignals
|
478
|
+
@@_mutex.synchronize {
|
479
|
+
if @@_ctrlCHandler.getCallback == @@_holdInterruptCallbackProc
|
480
|
+
@@_released = true
|
481
|
+
@@_condVar.signal
|
482
|
+
end
|
483
|
+
@@_ctrlCHandler.setCallback(@@_callbackOnInterruptCallbackProc)
|
484
|
+
}
|
485
|
+
else
|
486
|
+
Ice::getProcessLogger().error(@@_appName + ": warning: interrupt method called on Application configured to not handle interrupts.")
|
487
|
+
end
|
488
|
+
end
|
489
|
+
|
490
|
+
def Application.holdInterrupt
|
491
|
+
if @@_signalPolicy == HandleSignals
|
492
|
+
@@_mutex.synchronize {
|
493
|
+
if @@_ctrlCHandler.getCallback != @@_holdInterruptCallbackProc
|
494
|
+
@@_previousCallback = @@_ctrlCHandler.getCallback
|
495
|
+
@@_released = false
|
496
|
+
@@_ctrlCHandler.setCallback(@@_holdInterruptCallbackProc)
|
497
|
+
end
|
498
|
+
# else, we were already holding signals
|
499
|
+
}
|
500
|
+
else
|
501
|
+
Ice::getProcessLogger().error(@@_appName + ": warning: interrupt method called on Application configured to not handle interrupts.")
|
502
|
+
end
|
503
|
+
end
|
504
|
+
|
505
|
+
def Application.releaseInterrupt
|
506
|
+
if @@_signalPolicy == HandleSignals
|
507
|
+
@@_mutex.synchronize {
|
508
|
+
if @@_ctrlCHandler.getCallback == @@_holdInterruptCallbackProc
|
509
|
+
#
|
510
|
+
# Note that it's very possible no signal is held;
|
511
|
+
# in this case the callback is just replaced and
|
512
|
+
# setting _released to true and signalling _condVar
|
513
|
+
# do no harm.
|
514
|
+
#
|
515
|
+
@@_released = true
|
516
|
+
@@_ctrlCHandler.setCallback(@@_previousCallback)
|
517
|
+
@@_condVar.signal
|
518
|
+
end
|
519
|
+
# Else nothing to release.
|
520
|
+
}
|
521
|
+
else
|
522
|
+
Ice::getProcessLogger().error(@@_appName + ": warning: interrupt method called on Application configured to not handle interrupts.")
|
523
|
+
end
|
524
|
+
end
|
525
|
+
|
526
|
+
def Application.interrupted
|
527
|
+
@@_mutex.synchronize {
|
528
|
+
return @@_interrupted
|
529
|
+
}
|
530
|
+
end
|
531
|
+
|
532
|
+
def Application.holdInterruptCallback(sig)
|
533
|
+
callback = @@_mutex.synchronize {
|
534
|
+
while not @@_released
|
535
|
+
@@_condVar.wait(@@_mutex)
|
536
|
+
end
|
537
|
+
if @@_destroyed
|
538
|
+
return
|
539
|
+
end
|
540
|
+
@@_ctrlCHandler.getCallback
|
541
|
+
}
|
542
|
+
|
543
|
+
#
|
544
|
+
# Use the current callback to process this (old) signal.
|
545
|
+
#
|
546
|
+
if callback
|
547
|
+
callback.call(sig)
|
548
|
+
end
|
549
|
+
end
|
550
|
+
|
551
|
+
def Application.destroyOnInterruptCallback(sig)
|
552
|
+
@@_mutex.synchronize {
|
553
|
+
if @@_destroyed or @@_nohup and sig == 'HUP'
|
554
|
+
return
|
555
|
+
end
|
556
|
+
@@_callbackInProcess = true
|
557
|
+
@@_interrupted = true
|
558
|
+
@@_destroyed = true
|
559
|
+
}
|
560
|
+
|
561
|
+
begin
|
562
|
+
@@_communicator.destroy()
|
563
|
+
rescue => ex
|
564
|
+
Ice::getProcessLogger().error($!.inspect + "\n" + @@_appName + " (while destroying in response to signal " + sig + "):\n" + ex.backtrace.join("\n"))
|
565
|
+
end
|
566
|
+
@@_mutex.synchronize {
|
567
|
+
@@_callbackInProcess = false
|
568
|
+
@@_condVar.signal
|
569
|
+
}
|
570
|
+
end
|
571
|
+
|
572
|
+
def Application.callbackOnInterruptCallback(sig)
|
573
|
+
# For SIGHUP the user callback is always called. It can
|
574
|
+
# decide what to do.
|
575
|
+
@@_mutex.synchronize {
|
576
|
+
if @@_destroyed
|
577
|
+
#
|
578
|
+
# Being destroyed by main thread.
|
579
|
+
#
|
580
|
+
return
|
581
|
+
end
|
582
|
+
@@_interrupted = true
|
583
|
+
@@_callbackInProcess = true
|
584
|
+
}
|
585
|
+
|
586
|
+
begin
|
587
|
+
@@_application.interruptCallback(sig)
|
588
|
+
rescue => ex
|
589
|
+
Ice::getProcessLogger().error($!.inspect + "\n" + @@_appName + " (while interrupting in response to signal " + sig + "):\n" + ex.backtrace.join("\n"))
|
590
|
+
end
|
591
|
+
@@_mutex.synchronize {
|
592
|
+
@@_callbackInProcess = false
|
593
|
+
@@_condVar.signal
|
594
|
+
}
|
595
|
+
end
|
596
|
+
|
597
|
+
HandleSignals = 0
|
598
|
+
NoSignalHandling = 1
|
599
|
+
|
600
|
+
@@_appName = nil
|
601
|
+
@@_communicator = nil
|
602
|
+
@@_application = nil
|
603
|
+
@@_ctrlCHandler = nil
|
604
|
+
@@_previousCallback = nil
|
605
|
+
@@_interrupted = false
|
606
|
+
@@_released = false
|
607
|
+
@@_destroyed = false
|
608
|
+
@@_callbackInProgress = false
|
609
|
+
@@_condVar = ConditionVariable.new
|
610
|
+
@@_mutex = Mutex.new
|
611
|
+
@@_holdInterruptCallbackProc = Proc.new { |sig| Application::holdInterruptCallback(sig) }
|
612
|
+
@@_destroyOnInterruptCallbackProc = Proc.new { |sig| Application::destroyOnInterruptCallback(sig) }
|
613
|
+
@@_callbackOnInterruptCallbackProc = Proc.new { |sig| Application::callbackOnInterruptCallback(sig) }
|
614
|
+
@@_signalPolicy = HandleSignals
|
615
|
+
end
|
616
|
+
|
617
|
+
#
|
618
|
+
# Proxy comparison functions.
|
619
|
+
#
|
620
|
+
def Ice.proxyIdentityCompare(lhs, rhs)
|
621
|
+
if (lhs && !lhs.is_a?(ObjectPrx)) || (rhs && !rhs.is_a?(ObjectPrx))
|
622
|
+
raise TypeError, 'argument is not a proxy'
|
623
|
+
end
|
624
|
+
if lhs.nil? && rhs.nil?
|
625
|
+
return 0
|
626
|
+
elsif lhs.nil? && rhs
|
627
|
+
return -1
|
628
|
+
elsif lhs && rhs.nil?
|
629
|
+
return 1
|
630
|
+
else
|
631
|
+
return lhs.ice_getIdentity() <=> rhs.ice_getIdentity()
|
632
|
+
end
|
633
|
+
end
|
634
|
+
|
635
|
+
def Ice.proxyIdentityEqual(lhs, rhs)
|
636
|
+
return proxyIdentityCompare(lhs, rhs) == 0
|
637
|
+
end
|
638
|
+
|
639
|
+
def Ice.proxyIdentityAndFacetCompare(lhs, rhs)
|
640
|
+
n = proxyIdentityCompare(lhs, rhs)
|
641
|
+
if n == 0 && lhs && rhs
|
642
|
+
n = lhs.ice_getFacet() <=> rhs.ice_getFacet()
|
643
|
+
end
|
644
|
+
return n
|
645
|
+
end
|
646
|
+
|
647
|
+
def Ice.proxyIdentityAndFacetEqual(lhs, rhs)
|
648
|
+
return proxyIdentityAndFacetCompare(lhs, rhs) == 0
|
649
|
+
end
|
650
|
+
|
651
|
+
Protocol_1_0 = ProtocolVersion.new(1, 0)
|
652
|
+
Encoding_1_0 = EncodingVersion.new(1, 0)
|
653
|
+
Encoding_1_1 = EncodingVersion.new(1, 1)
|
654
|
+
end
|
655
|
+
|
656
|
+
Ice::Object_mixin::OP_ice_isA = ::Ice::__defineOperation('ice_isA', ::Ice::OperationMode::Idempotent, ::Ice::OperationMode::Nonmutating, false, nil, [[::Ice::T_string, false, 0]], [], [::Ice::T_bool, false, 0], [])
|
657
|
+
Ice::Object_mixin::OP_ice_ping = ::Ice::__defineOperation('ice_ping', ::Ice::OperationMode::Idempotent, ::Ice::OperationMode::Nonmutating, false, nil, [], [], nil, [])
|
658
|
+
Ice::Object_mixin::OP_ice_ids = ::Ice::__defineOperation('ice_ids', ::Ice::OperationMode::Idempotent, ::Ice::OperationMode::Nonmutating, false, nil, [], [], [::Ice::T_StringSeq, false, 0], [])
|
659
|
+
Ice::Object_mixin::OP_ice_id = ::Ice::__defineOperation('ice_id', ::Ice::OperationMode::Idempotent, ::Ice::OperationMode::Nonmutating, false, nil, [], [], [::Ice::T_string, false, 0], [])
|