summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Spruiell <mes@zeroc.com>2011-05-09 16:24:52 -0700
committerMark Spruiell <mes@zeroc.com>2011-05-09 16:24:52 -0700
commit5d7de7f8f909d7a4910531a077e514955a1b0fdc (patch)
tree77b437188795dab60de6fbc5212528b0d88c182f
parentIce 3.4.2 installer updates (diff)
downloadice-5d7de7f8f909d7a4910531a077e514955a1b0fdc.tar.bz2
ice-5d7de7f8f909d7a4910531a077e514955a1b0fdc.tar.xz
ice-5d7de7f8f909d7a4910531a077e514955a1b0fdc.zip
merging .NET Compact Framework support
-rw-r--r--config/PropertyNames.xml1
-rwxr-xr-xconfig/makeprops.py8
-rw-r--r--cpp/src/Ice/PropertyNames.cpp3
-rw-r--r--cpp/src/Ice/PropertyNames.h2
-rwxr-xr-xcs/allTests.py4
-rw-r--r--cs/config/Make.rules.mak.cs27
-rw-r--r--cs/demo/Glacier2/callback/Client.cs8
-rw-r--r--cs/demo/Glacier2/callback/Server.cs8
-rw-r--r--[-rwxr-xr-x]cs/demo/Glacier2/chat/App.xaml.cs0
-rw-r--r--[-rwxr-xr-x]cs/demo/Glacier2/chat/CancelDialog.xaml.cs0
-rw-r--r--[-rwxr-xr-x]cs/demo/Glacier2/chat/ChatCommands.cs0
-rw-r--r--[-rwxr-xr-x]cs/demo/Glacier2/chat/ChatWindow.xaml.cs0
-rw-r--r--[-rwxr-xr-x]cs/demo/Glacier2/chat/LoginDialog.xaml.cs0
-rw-r--r--[-rwxr-xr-x]cs/demo/Glacier2/chat/Properties/AssemblyInfo.cs0
-rw-r--r--[-rwxr-xr-x]cs/demo/Glacier2/chat/Properties/Resources.Designer.cs0
-rw-r--r--[-rwxr-xr-x]cs/demo/Glacier2/chat/Properties/Settings.Designer.cs0
-rw-r--r--[-rwxr-xr-x]cs/demo/Glacier2/chat/config.client0
-rw-r--r--cs/demo/Ice/async/Client.cs8
-rw-r--r--cs/demo/Ice/async/Server.cs8
-rw-r--r--cs/demo/Ice/async/WorkQueue.cs50
-rw-r--r--cs/demo/Ice/async/config.client6
-rw-r--r--cs/demo/Ice/bidir/CallbackSenderI.cs64
-rw-r--r--cs/demo/Ice/bidir/Client.cs8
-rw-r--r--cs/demo/Ice/bidir/Server.cs8
-rw-r--r--cs/demo/Ice/callback/Client.cs8
-rw-r--r--cs/demo/Ice/callback/Server.cs8
-rw-r--r--cs/demo/Ice/hello/Client.cs8
-rw-r--r--cs/demo/Ice/hello/Server.cs8
-rw-r--r--cs/demo/Ice/invoke/Client.cs8
-rw-r--r--cs/demo/Ice/invoke/Server.cs8
-rw-r--r--cs/demo/Ice/invoke/config.client6
-rw-r--r--cs/demo/Ice/invoke/config.server6
-rw-r--r--cs/demo/Ice/latency/Client.cs8
-rw-r--r--cs/demo/Ice/latency/Server.cs8
-rw-r--r--cs/demo/Ice/minimal/Client.cs5
-rw-r--r--cs/demo/Ice/minimal/Server.cs5
-rw-r--r--cs/demo/Ice/multicast/Client.cs8
-rw-r--r--cs/demo/Ice/multicast/DiscoverReplyI.cs44
-rw-r--r--cs/demo/Ice/multicast/Server.cs8
-rw-r--r--cs/demo/Ice/nested/Client.cs8
-rw-r--r--cs/demo/Ice/nested/Server.cs8
-rw-r--r--cs/demo/Ice/plugin/Client.cs8
-rw-r--r--cs/demo/Ice/plugin/Server.cs8
-rw-r--r--cs/demo/Ice/serialize/Client.cs8
-rw-r--r--[-rwxr-xr-x]cs/demo/Ice/serialize/MyGreeting.cs0
-rw-r--r--cs/demo/Ice/serialize/Server.cs8
-rw-r--r--cs/demo/Ice/session/Client.cs51
-rw-r--r--cs/demo/Ice/session/ReapThread.cs75
-rw-r--r--cs/demo/Ice/session/Server.cs8
-rw-r--r--cs/demo/Ice/throughput/Client.cs8
-rw-r--r--cs/demo/Ice/throughput/Server.cs8
-rw-r--r--cs/demo/Ice/value/Client.cs10
-rw-r--r--cs/demo/Ice/value/Server.cs8
-rw-r--r--cs/demo/Ice/value/config.client6
-rw-r--r--[-rwxr-xr-x]cs/demo/Ice/wpf/Properties/AssemblyInfo.cs0
-rw-r--r--[-rwxr-xr-x]cs/demo/Ice/wpf/Properties/Resources.Designer.cs0
-rw-r--r--[-rwxr-xr-x]cs/demo/Ice/wpf/Properties/Settings.Designer.cs0
-rw-r--r--cs/demo/IceBox/hello/Client.cs12
-rw-r--r--cs/demo/IceGrid/icebox/Client.cs8
-rw-r--r--cs/demo/IceGrid/simple/Client.cs8
-rw-r--r--cs/demo/IceGrid/simple/Server.cs8
-rw-r--r--cs/demo/IceStorm/clock/Publisher.cs8
-rw-r--r--cs/demo/IceStorm/clock/Subscriber.cs8
-rw-r--r--cs/demo/book/lifecycle/Client.cs13
-rw-r--r--cs/demo/book/lifecycle/Parser.cs16
-rw-r--r--cs/demo/book/lifecycle/Server.cs4
-rw-r--r--cs/demo/book/printer/Client.cs7
-rw-r--r--cs/demo/book/printer/Server.cs7
-rw-r--r--cs/demo/book/simple_filesystem/Client.cs19
-rw-r--r--cs/demo/book/simple_filesystem/Server.cs8
-rw-r--r--cs/src/Glacier2/Application.cs40
-rw-r--r--cs/src/Glacier2/SessionHelper.cs39
-rw-r--r--cs/src/Ice/Application.cs150
-rw-r--r--cs/src/Ice/AssemblyUtil.cs66
-rw-r--r--cs/src/Ice/AsyncIOThread.cs28
-rw-r--r--cs/src/Ice/BasicStream.cs24
-rw-r--r--cs/src/Ice/ByteBuffer.cs80
-rw-r--r--cs/src/Ice/ConnectRequestHandler.cs123
-rw-r--r--cs/src/Ice/ConnectionFactory.cs198
-rw-r--r--cs/src/Ice/ConnectionI.cs238
-rw-r--r--cs/src/Ice/DefaultsAndOverrides.cs5
-rw-r--r--cs/src/Ice/EndpointHostResolver.cs29
-rw-r--r--cs/src/Ice/HashSet.cs114
-rw-r--r--cs/src/Ice/Instance.cs21
-rw-r--r--cs/src/Ice/LinkedList.cs4
-rw-r--r--cs/src/Ice/LocatorInfo.cs40
-rw-r--r--cs/src/Ice/LoggerI.cs42
-rw-r--r--cs/src/Ice/Makefile1
-rw-r--r--cs/src/Ice/Makefile.mak2
-rw-r--r--cs/src/Ice/Monitor.cs270
-rw-r--r--cs/src/Ice/Network.cs28
-rw-r--r--cs/src/Ice/ObjectAdapterFactory.cs69
-rw-r--r--cs/src/Ice/ObjectAdapterI.cs285
-rw-r--r--cs/src/Ice/Outgoing.cs90
-rw-r--r--cs/src/Ice/OutgoingAsync.cs158
-rw-r--r--cs/src/Ice/PluginManagerI.cs18
-rw-r--r--cs/src/Ice/PropertiesI.cs4
-rw-r--r--cs/src/Ice/PropertyNames.cs3
-rw-r--r--cs/src/Ice/ProtocolPluginFacade.cs16
-rw-r--r--cs/src/Ice/Proxy.cs7
-rw-r--r--cs/src/Ice/SliceChecksums.cs2
-rw-r--r--cs/src/Ice/StringUtil.cs11
-rw-r--r--cs/src/Ice/TcpAcceptor.cs4
-rw-r--r--cs/src/Ice/TcpConnector.cs2
-rw-r--r--cs/src/Ice/TcpTransceiver.cs17
-rw-r--r--cs/src/Ice/ThreadPool.cs73
-rw-r--r--cs/src/Ice/Timer.cs58
-rw-r--r--cs/src/Ice/UdpTransceiver.cs18
-rw-r--r--cs/src/Ice/Util.cs11
-rw-r--r--cs/src/Ice/ValueWriter.cs4
-rw-r--r--cs/src/IceBox/Server.cs4
-rw-r--r--cs/src/IceBox/ServiceManagerI.cs63
-rw-r--r--cs/src/IceSSL/Instance.cs4
-rw-r--r--[-rwxr-xr-x]cs/src/IceSSL/TransceiverI.cs0
-rw-r--r--cs/src/Makefile.mak3
-rw-r--r--cs/test/Glacier2/router/CallbackI.cs19
-rw-r--r--cs/test/Glacier2/router/Client.cs53
-rw-r--r--cs/test/Glacier2/router/Server.cs21
-rw-r--r--cs/test/Glacier2/sessionHelper/Client.cs97
-rw-r--r--cs/test/Glacier2/sessionHelper/Server.cs10
-rw-r--r--cs/test/Ice/adapterDeactivation/Client.cs10
-rw-r--r--cs/test/Ice/adapterDeactivation/Collocated.cs10
-rw-r--r--cs/test/Ice/adapterDeactivation/Server.cs10
-rw-r--r--cs/test/Ice/adapterDeactivation/TestI.cs2
-rw-r--r--cs/test/Ice/ami/AllTests.cs19
-rw-r--r--cs/test/Ice/ami/Client.cs22
-rw-r--r--cs/test/Ice/ami/Server.cs15
-rw-r--r--cs/test/Ice/ami/TestI.cs28
-rw-r--r--cs/test/Ice/application/Client.cs10
-rw-r--r--cs/test/Ice/background/AllTests.cs826
-rw-r--r--cs/test/Ice/background/BackgroundControllerI.cs30
-rw-r--r--cs/test/Ice/background/Client.cs9
-rw-r--r--cs/test/Ice/background/Server.cs9
-rw-r--r--cs/test/Ice/binding/AllTests.cs106
-rw-r--r--cs/test/Ice/binding/Client.cs17
-rw-r--r--cs/test/Ice/binding/Server.cs17
-rw-r--r--cs/test/Ice/checksum/Client.cs15
-rw-r--r--cs/test/Ice/checksum/Makefile.mak2
-rw-r--r--cs/test/Ice/checksum/server/Server.cs9
-rw-r--r--cs/test/Ice/defaultServant/Client.cs10
-rw-r--r--cs/test/Ice/defaultValue/Client.cs9
-rw-r--r--cs/test/Ice/dictMapping/Client.cs9
-rw-r--r--cs/test/Ice/dictMapping/Collocated.cs9
-rw-r--r--cs/test/Ice/dictMapping/Server.cs9
-rw-r--r--cs/test/Ice/dictMapping/TwowaysAMI.cs19
-rw-r--r--cs/test/Ice/dictMapping/TwowaysNewAMI.cs19
-rw-r--r--cs/test/Ice/dispatcher/AllTests.cs19
-rw-r--r--cs/test/Ice/dispatcher/Client.cs17
-rw-r--r--cs/test/Ice/dispatcher/Dispatcher.cs64
-rw-r--r--cs/test/Ice/dispatcher/Server.cs19
-rw-r--r--cs/test/Ice/exceptions/AllTests.cs19
-rw-r--r--cs/test/Ice/exceptions/Client.cs30
-rw-r--r--cs/test/Ice/exceptions/Collocated.cs19
-rw-r--r--cs/test/Ice/exceptions/Server.cs17
-rw-r--r--cs/test/Ice/facets/Client.cs17
-rw-r--r--cs/test/Ice/facets/Collocated.cs19
-rw-r--r--cs/test/Ice/facets/Server.cs21
-rw-r--r--cs/test/Ice/faultTolerance/AllTests.cs19
-rw-r--r--cs/test/Ice/faultTolerance/Client.cs23
-rw-r--r--cs/test/Ice/faultTolerance/Server.cs27
-rw-r--r--cs/test/Ice/hold/AllTests.cs25
-rw-r--r--cs/test/Ice/hold/Client.cs15
-rw-r--r--cs/test/Ice/hold/HoldI.cs42
-rw-r--r--cs/test/Ice/hold/Server.cs9
-rw-r--r--cs/test/Ice/info/AllTests.cs4
-rw-r--r--cs/test/Ice/info/Client.cs17
-rw-r--r--cs/test/Ice/info/Makefile.mak4
-rw-r--r--cs/test/Ice/info/Server.cs9
-rw-r--r--cs/test/Ice/inheritance/Client.cs28
-rw-r--r--cs/test/Ice/inheritance/Collocated.cs19
-rw-r--r--cs/test/Ice/inheritance/Server.cs17
-rw-r--r--cs/test/Ice/interceptor/Client.cs32
-rw-r--r--cs/test/Ice/invoke/AllTests.cs19
-rw-r--r--cs/test/Ice/invoke/Client.cs24
-rw-r--r--cs/test/Ice/invoke/Server.cs9
-rw-r--r--cs/test/Ice/location/AllTests.cs10
-rw-r--r--cs/test/Ice/location/Client.cs17
-rw-r--r--cs/test/Ice/location/Server.cs27
-rw-r--r--cs/test/Ice/objects/Client.cs26
-rw-r--r--cs/test/Ice/objects/Collocated.cs19
-rw-r--r--cs/test/Ice/objects/Server.cs17
-rw-r--r--cs/test/Ice/operations/Client.cs21
-rw-r--r--cs/test/Ice/operations/Collocated.cs19
-rw-r--r--cs/test/Ice/operations/OnewaysAMI.cs19
-rw-r--r--cs/test/Ice/operations/OnewaysNewAMI.cs19
-rw-r--r--cs/test/Ice/operations/Server.cs19
-rw-r--r--cs/test/Ice/operations/TwowaysAMI.cs19
-rw-r--r--cs/test/Ice/operations/TwowaysNewAMI.cs19
-rw-r--r--cs/test/Ice/properties/Client.cs7
-rw-r--r--cs/test/Ice/proxy/Client.cs21
-rw-r--r--cs/test/Ice/proxy/Collocated.cs19
-rw-r--r--cs/test/Ice/proxy/Server.cs19
-rw-r--r--cs/test/Ice/retry/AllTests.cs19
-rw-r--r--cs/test/Ice/retry/Client.cs11
-rw-r--r--cs/test/Ice/retry/Server.cs9
-rw-r--r--cs/test/Ice/seqMapping/Client.cs20
-rw-r--r--cs/test/Ice/seqMapping/Collocated.cs9
-rw-r--r--cs/test/Ice/seqMapping/Makefile2
-rw-r--r--cs/test/Ice/seqMapping/Makefile.mak2
-rw-r--r--[-rwxr-xr-x]cs/test/Ice/seqMapping/Serializable.cs0
-rw-r--r--cs/test/Ice/seqMapping/Server.cs20
-rw-r--r--cs/test/Ice/seqMapping/ServerAMD.cs77
-rw-r--r--cs/test/Ice/seqMapping/Twoways.cs2
-rw-r--r--cs/test/Ice/seqMapping/TwowaysAMI.cs24
-rw-r--r--cs/test/Ice/seqMapping/TwowaysNewAMI.cs23
-rw-r--r--cs/test/Ice/servantLocator/Client.cs22
-rw-r--r--cs/test/Ice/servantLocator/Collocated.cs12
-rw-r--r--cs/test/Ice/servantLocator/Server.cs12
-rw-r--r--cs/test/Ice/slicing/exceptions/AllTests.cs119
-rw-r--r--cs/test/Ice/slicing/exceptions/Client.cs28
-rw-r--r--cs/test/Ice/slicing/exceptions/Server.cs17
-rw-r--r--cs/test/Ice/slicing/objects/AllTests.cs391
-rw-r--r--cs/test/Ice/slicing/objects/Client.cs28
-rw-r--r--cs/test/Ice/slicing/objects/Makefile2
-rw-r--r--cs/test/Ice/slicing/objects/Makefile.mak2
-rw-r--r--cs/test/Ice/slicing/objects/Server.cs28
-rw-r--r--cs/test/Ice/slicing/objects/ServerAMD.cs71
-rw-r--r--cs/test/Ice/stream/Client.cs28
-rw-r--r--cs/test/Ice/stream/Makefile.mak4
-rw-r--r--[-rwxr-xr-x]cs/test/Ice/stream/Serializable.cs0
-rw-r--r--cs/test/Ice/stream/Test.ice7
-rw-r--r--cs/test/Ice/threadPoolPriority/Client.cs9
-rw-r--r--cs/test/Ice/threadPoolPriority/Server.cs21
-rw-r--r--cs/test/Ice/timeout/AllTests.cs23
-rw-r--r--cs/test/Ice/timeout/Client.cs9
-rw-r--r--cs/test/Ice/timeout/Server.cs9
-rw-r--r--cs/test/Ice/udp/AllTests.cs34
-rw-r--r--cs/test/Ice/udp/Client.cs13
-rw-r--r--cs/test/Ice/udp/Server.cs11
-rw-r--r--cs/test/IceBox/configuration/Client.cs12
-rw-r--r--cs/test/IceGrid/simple/AllTests.cs19
-rw-r--r--cs/test/IceGrid/simple/Client.cs12
-rw-r--r--cs/test/IceGrid/simple/Server.cs10
-rw-r--r--[-rwxr-xr-x]cs/test/IceSSL/configuration/AllTests.cs0
-rw-r--r--cs/test/IceSSL/configuration/Client.cs7
-rw-r--r--cs/test/IceSSL/configuration/Server.cs7
-rw-r--r--cs/test/IceUtil/inputUtil/Client.cs2
-rw-r--r--cs/test/Makefile.mak6
-rw-r--r--cs/test/Slice/keyword/Client.cs9
-rw-r--r--cs/test/Slice/structure/Client.cs9
-rw-r--r--java/src/IceInternal/PropertyNames.java3
-rwxr-xr-xscripts/TestUtil.py36
242 files changed, 4660 insertions, 2133 deletions
diff --git a/config/PropertyNames.xml b/config/PropertyNames.xml
index 3b0dc3bf10e..4bc4e911855 100644
--- a/config/PropertyNames.xml
+++ b/config/PropertyNames.xml
@@ -322,6 +322,7 @@ generated from the section label.
<property name="IPv4" />
<property name="IPv6" />
<property name="EventLog.Source" />
+ <property name="FactoryAssemblies" />
<property name="GC.Interval" />
<property name="ImplicitContext" />
<property name="InitPlugins" />
diff --git a/config/makeprops.py b/config/makeprops.py
index 183113c5394..1723b29a31b 100755
--- a/config/makeprops.py
+++ b/config/makeprops.py
@@ -316,8 +316,8 @@ class CppPropertyHandler(PropertyHandler):
os.remove(self.className + ".cpp")
def startFiles(self):
- self.hFile = open(self.className + ".h", "w")
- self.cppFile = open(self.className + ".cpp", "w")
+ self.hFile = open(self.className + ".h", "wb")
+ self.cppFile = open(self.className + ".cpp", "wb")
self.hFile.write(cppHeaderPreamble % {'inputfile' : self.inputfile, 'classname' : self.className})
self.cppFile.write(cppSrcPreamble % {'inputfile' : self.inputfile, 'classname' : self.className})
@@ -393,7 +393,7 @@ class JavaPropertyHandler(PropertyHandler):
os.remove(self.className + ".java")
def startFiles(self):
- self.srcFile = file(self.className + ".java", "w")
+ self.srcFile = file(self.className + ".java", "wb")
self.srcFile.write(javaPreamble % {'inputfile' : self.inputfile, 'classname' : self.className})
def closeFiles(self):
@@ -463,7 +463,7 @@ class CSPropertyHandler(PropertyHandler):
os.remove(self.className + ".cs")
def startFiles(self):
- self.srcFile = file(self.className + ".cs", "w")
+ self.srcFile = file(self.className + ".cs", "wb")
self.srcFile.write(csPreamble % {'inputfile' : self.inputfile, 'classname' : self.className})
def closeFiles(self):
diff --git a/cpp/src/Ice/PropertyNames.cpp b/cpp/src/Ice/PropertyNames.cpp
index 9310e6db4e6..5cac08a23f8 100644
--- a/cpp/src/Ice/PropertyNames.cpp
+++ b/cpp/src/Ice/PropertyNames.cpp
@@ -8,7 +8,7 @@
// **********************************************************************
//
-// Generated by makeprops.py from file ./config/PropertyNames.xml, Mon Mar 7 23:28:12 2011
+// Generated by makeprops.py from file ..\config\PropertyNames.xml, Mon May 09 07:39:43 2011
// IMPORTANT: Do not edit this file -- any edits made here will be lost!
@@ -73,6 +73,7 @@ const IceInternal::Property IcePropsData[] =
IceInternal::Property("Ice.IPv4", false, 0),
IceInternal::Property("Ice.IPv6", false, 0),
IceInternal::Property("Ice.EventLog.Source", false, 0),
+ IceInternal::Property("Ice.FactoryAssemblies", false, 0),
IceInternal::Property("Ice.GC.Interval", false, 0),
IceInternal::Property("Ice.ImplicitContext", false, 0),
IceInternal::Property("Ice.InitPlugins", false, 0),
diff --git a/cpp/src/Ice/PropertyNames.h b/cpp/src/Ice/PropertyNames.h
index 63fa5199607..0ccaa988ac1 100644
--- a/cpp/src/Ice/PropertyNames.h
+++ b/cpp/src/Ice/PropertyNames.h
@@ -8,7 +8,7 @@
// **********************************************************************
//
-// Generated by makeprops.py from file ./config/PropertyNames.xml, Mon Mar 7 23:28:12 2011
+// Generated by makeprops.py from file ..\config\PropertyNames.xml, Mon May 09 07:39:43 2011
// IMPORTANT: Do not edit this file -- any edits made here will be lost!
diff --git a/cs/allTests.py b/cs/allTests.py
index c08f1b2be98..25d9defe6d3 100755
--- a/cs/allTests.py
+++ b/cs/allTests.py
@@ -43,7 +43,7 @@ tests = [
("Ice/adapterDeactivation", ["core"]),
("Ice/slicing/exceptions", ["core"]),
("Ice/slicing/objects", ["core"]),
- ("Ice/checksum", ["core"]),
+ ("Ice/checksum", ["core", "nocompact"]),
("Ice/dispatcher", ["core"]),
("Ice/stream", ["core"]),
("Ice/retry", ["core"]),
@@ -62,7 +62,7 @@ tests = [
("Glacier2/router", ["service"]),
("Glacier2/sessionHelper", ["service"]),
("IceGrid/simple", ["service"]),
- ("IceSSL/configuration", ["once", "novista", "nomono"]),
+ ("IceSSL/configuration", ["once", "novista", "nomono", "nocompact"]),
]
if __name__ == "__main__":
diff --git a/cs/config/Make.rules.mak.cs b/cs/config/Make.rules.mak.cs
index 92256165331..bf35f40d936 100644
--- a/cs/config/Make.rules.mak.cs
+++ b/cs/config/Make.rules.mak.cs
@@ -27,6 +27,21 @@ prefix = C:\Ice-$(VERSION)
#MANAGED = yes
#
+# Enable support for the .NET Compact Framework. This setting disables the
+# following features:
+#
+# - Protocol compression
+# - Signal processing in the Ice.Application class
+# - Dynamic loading of Slice-generated class and exception factories
+# - IceSSL
+# - ICE_CONFIG environment variable
+# - Dynamic loading of Slice checksums
+# - Ice.TCP.SndSize and Ice.TCP.RcvSize
+#
+
+#COMPACT = yes
+
+#
# Define DEBUG as yes if you want to build with debug information and
# assertions enabled.
#
@@ -40,7 +55,7 @@ DEBUG = yes
OPTIMIZE = yes
#
-# Define FRAMEWORK as 3.5 to force .NET 3.5 build in Visual Studio 2010
+# Define FRAMEWORK as 3.5 to force a .NET 3.5 build with Visual Studio 2010.
#
#FRAMEWORK = 3.5
@@ -110,6 +125,16 @@ MCSFLAGS = $(MCSFLAGS) /reference:"$(FRAMEWORKDIR)\v2.0.50727\System.dll"
MCSFLAGS = $(MCSFLAGS) /reference:"$(FRAMEWORKDIR)\v2.0.50727\System.Data.dll"
MCSFLAGS = $(MCSFLAGS) /reference:"$(PROGRAMFILES)\Reference Assemblies\Microsoft\Framework\v3.5\System.Core.dll"
MCSFLAGS = $(MCSFLAGS) /reference:"$(PROGRAMFILES)\Reference Assemblies\Microsoft\Framework\v3.0\System.Runtime.Serialization.dll"
+!elseif "$(COMPACT)" == "yes"
+!if "$(PROCESSOR_ARCHITECTURE)" == "AMD64" || "$(PROCESSOR_ARCHITECTUREW6432)" == "AMD64"
+NETCF_HOME = $(PROGRAMFILES) (x86)\Microsoft.NET\SDK\CompactFramework\v3.5\WindowsCE
+!else
+NETCF_HOME = $(PROGRAMFILES)\Microsoft.NET\SDK\CompactFramework\v3.5\WindowsCE
+!endif
+NETCF_REFS = "/r:$(NETCF_HOME)\mscorlib.dll" \
+ "/r:$(NETCF_HOME)\System.dll" \
+ "/r:$(NETCF_HOME)\System.Runtime.Serialization.dll"
+MCSFLAGS = $(MCSFLAGS) -noconfig -nostdlib -define:COMPACT $(NETCF_REFS)
!endif
!if "$(ice_src_dist)" != ""
diff --git a/cs/demo/Glacier2/callback/Client.cs b/cs/demo/Glacier2/callback/Client.cs
index 9ec17962f70..b2f18d12f2c 100644
--- a/cs/demo/Glacier2/callback/Client.cs
+++ b/cs/demo/Glacier2/callback/Client.cs
@@ -226,13 +226,9 @@ public class Client
}
}
- public static void Main(string[] args)
+ public static int Main(string[] args)
{
App app = new App();
- int status = app.main(args, "config.client");
- if(status != 0)
- {
- System.Environment.Exit(status);
- }
+ return app.main(args, "config.client");
}
}
diff --git a/cs/demo/Glacier2/callback/Server.cs b/cs/demo/Glacier2/callback/Server.cs
index 51a844027a1..91fe0a120d3 100644
--- a/cs/demo/Glacier2/callback/Server.cs
+++ b/cs/demo/Glacier2/callback/Server.cs
@@ -37,13 +37,9 @@ public class Server
}
}
- public static void Main(string[] args)
+ public static int Main(string[] args)
{
App app = new App();
- int status = app.main(args, "config.server");
- if(status != 0)
- {
- System.Environment.Exit(status);
- }
+ return app.main(args, "config.server");
}
}
diff --git a/cs/demo/Glacier2/chat/App.xaml.cs b/cs/demo/Glacier2/chat/App.xaml.cs
index c344795a1ac..c344795a1ac 100755..100644
--- a/cs/demo/Glacier2/chat/App.xaml.cs
+++ b/cs/demo/Glacier2/chat/App.xaml.cs
diff --git a/cs/demo/Glacier2/chat/CancelDialog.xaml.cs b/cs/demo/Glacier2/chat/CancelDialog.xaml.cs
index 366335811a4..366335811a4 100755..100644
--- a/cs/demo/Glacier2/chat/CancelDialog.xaml.cs
+++ b/cs/demo/Glacier2/chat/CancelDialog.xaml.cs
diff --git a/cs/demo/Glacier2/chat/ChatCommands.cs b/cs/demo/Glacier2/chat/ChatCommands.cs
index 1530adbfb27..1530adbfb27 100755..100644
--- a/cs/demo/Glacier2/chat/ChatCommands.cs
+++ b/cs/demo/Glacier2/chat/ChatCommands.cs
diff --git a/cs/demo/Glacier2/chat/ChatWindow.xaml.cs b/cs/demo/Glacier2/chat/ChatWindow.xaml.cs
index 569b79c06f8..569b79c06f8 100755..100644
--- a/cs/demo/Glacier2/chat/ChatWindow.xaml.cs
+++ b/cs/demo/Glacier2/chat/ChatWindow.xaml.cs
diff --git a/cs/demo/Glacier2/chat/LoginDialog.xaml.cs b/cs/demo/Glacier2/chat/LoginDialog.xaml.cs
index 2d4b96e8745..2d4b96e8745 100755..100644
--- a/cs/demo/Glacier2/chat/LoginDialog.xaml.cs
+++ b/cs/demo/Glacier2/chat/LoginDialog.xaml.cs
diff --git a/cs/demo/Glacier2/chat/Properties/AssemblyInfo.cs b/cs/demo/Glacier2/chat/Properties/AssemblyInfo.cs
index 031ce1e01a4..031ce1e01a4 100755..100644
--- a/cs/demo/Glacier2/chat/Properties/AssemblyInfo.cs
+++ b/cs/demo/Glacier2/chat/Properties/AssemblyInfo.cs
diff --git a/cs/demo/Glacier2/chat/Properties/Resources.Designer.cs b/cs/demo/Glacier2/chat/Properties/Resources.Designer.cs
index 33bbc28e6a8..33bbc28e6a8 100755..100644
--- a/cs/demo/Glacier2/chat/Properties/Resources.Designer.cs
+++ b/cs/demo/Glacier2/chat/Properties/Resources.Designer.cs
diff --git a/cs/demo/Glacier2/chat/Properties/Settings.Designer.cs b/cs/demo/Glacier2/chat/Properties/Settings.Designer.cs
index 472165a6cde..472165a6cde 100755..100644
--- a/cs/demo/Glacier2/chat/Properties/Settings.Designer.cs
+++ b/cs/demo/Glacier2/chat/Properties/Settings.Designer.cs
diff --git a/cs/demo/Glacier2/chat/config.client b/cs/demo/Glacier2/chat/config.client
index 46cdd0d9b20..46cdd0d9b20 100755..100644
--- a/cs/demo/Glacier2/chat/config.client
+++ b/cs/demo/Glacier2/chat/config.client
diff --git a/cs/demo/Ice/async/Client.cs b/cs/demo/Ice/async/Client.cs
index b30597a784a..a1350c63974 100644
--- a/cs/demo/Ice/async/Client.cs
+++ b/cs/demo/Ice/async/Client.cs
@@ -115,13 +115,9 @@ public class Client
}
}
- public static void Main(string[] args)
+ public static int Main(string[] args)
{
App app = new App();
- int status = app.main(args, "config.client");
- if(status != 0)
- {
- System.Environment.Exit(status);
- }
+ return app.main(args, "config.client");
}
}
diff --git a/cs/demo/Ice/async/Server.cs b/cs/demo/Ice/async/Server.cs
index 0107d9cdde2..b89c4502997 100644
--- a/cs/demo/Ice/async/Server.cs
+++ b/cs/demo/Ice/async/Server.cs
@@ -51,13 +51,9 @@ public class Server
private WorkQueue _workQueue;
}
- public static void Main(string[] args)
+ public static int Main(string[] args)
{
App app = new App();
- int status = app.main(args, "config.server");
- if(status != 0)
- {
- System.Environment.Exit(status);
- }
+ return app.main(args, "config.server");
}
}
diff --git a/cs/demo/Ice/async/WorkQueue.cs b/cs/demo/Ice/async/WorkQueue.cs
index 884dd5f9743..9a35053727b 100644
--- a/cs/demo/Ice/async/WorkQueue.cs
+++ b/cs/demo/Ice/async/WorkQueue.cs
@@ -33,13 +33,22 @@ public class WorkQueue
public void Run()
{
+#if COMPACT
+ _m.Lock();
+ try
+#else
lock(this)
+#endif
{
while(!_done)
{
if(_callbacks.Count == 0)
{
+#if COMPACT
+ _m.Wait();
+#else
Monitor.Wait(this);
+#endif
}
if(_callbacks.Count != 0)
@@ -54,7 +63,11 @@ public class WorkQueue
// emulate a process that takes a significant period of
// time to complete.
//
+#if COMPACT
+ _m.TimedWait(entry.delay);
+#else
Monitor.Wait(this, entry.delay);
+#endif
if(!_done)
{
@@ -73,11 +86,22 @@ public class WorkQueue
e.cb.ice_exception(new RequestCanceledException());
}
}
+#if COMPACT
+ finally
+ {
+ _m.Unlock();
+ }
+#endif
}
public void Add(AMD_Hello_sayHello cb, int delay)
{
+#if COMPACT
+ _m.Lock();
+ try
+#else
lock(this)
+#endif
{
if(!_done)
{
@@ -90,7 +114,11 @@ public class WorkQueue
if(_callbacks.Count == 0)
{
+#if COMPACT
+ _m.Notify();
+#else
Monitor.Pulse(this);
+#endif
}
_callbacks.Add(entry);
}
@@ -102,18 +130,40 @@ public class WorkQueue
cb.ice_exception(new RequestCanceledException());
}
}
+#if COMPACT
+ finally
+ {
+ _m.Unlock();
+ }
+#endif
}
public void destroy()
{
+#if COMPACT
+ _m.Lock();
+ try
+ {
+ _done = true;
+ _m.Notify();
+ }
+ finally
+ {
+ _m.Unlock();
+ }
+#else
lock(this)
{
_done = true;
Monitor.Pulse(this);
}
+#endif
}
private ArrayList _callbacks = new ArrayList();
private bool _done = false;
private Thread thread_;
+#if COMPACT
+ private readonly IceUtilInternal.Monitor _m = new IceUtilInternal.Monitor();
+#endif
}
diff --git a/cs/demo/Ice/async/config.client b/cs/demo/Ice/async/config.client
index 0cea3d3bc26..5341b8cc48d 100644
--- a/cs/demo/Ice/async/config.client
+++ b/cs/demo/Ice/async/config.client
@@ -26,3 +26,9 @@ Ice.Warn.Connections=1
# 1 = trace protocol messages
#
#Ice.Trace.Protocol=1
+
+#
+# When using Ice for .NET Compact Framework, we need to specify
+# the assembly so that Ice can locate classes and exceptions.
+#
+Ice.FactoryAssemblies=client
diff --git a/cs/demo/Ice/bidir/CallbackSenderI.cs b/cs/demo/Ice/bidir/CallbackSenderI.cs
index 992e9328ce5..5e5468bdd4f 100644
--- a/cs/demo/Ice/bidir/CallbackSenderI.cs
+++ b/cs/demo/Ice/bidir/CallbackSenderI.cs
@@ -22,6 +22,20 @@ class CallbackSenderI : CallbackSenderDisp_
public void destroy()
{
+#if COMPACT
+ _m.Lock();
+ try
+ {
+ System.Console.Out.WriteLine("destroying callback sender");
+ _destroy = true;
+
+ _m.Notify();
+ }
+ finally
+ {
+ _m.Unlock();
+ }
+#else
lock(this)
{
System.Console.Out.WriteLine("destroying callback sender");
@@ -29,10 +43,26 @@ class CallbackSenderI : CallbackSenderDisp_
System.Threading.Monitor.Pulse(this);
}
+#endif
}
public override void addClient(Ice.Identity ident, Ice.Current current)
{
+#if COMPACT
+ _m.Lock();
+ try
+ {
+ System.Console.Out.WriteLine("adding client `" + _communicator.identityToString(ident) + "'");
+
+ Ice.ObjectPrx @base = current.con.createProxy(ident);
+ CallbackReceiverPrx client = CallbackReceiverPrxHelper.uncheckedCast(@base);
+ _clients.Add(client);
+ }
+ finally
+ {
+ _m.Unlock();
+ }
+#else
lock(this)
{
System.Console.Out.WriteLine("adding client `" + _communicator.identityToString(ident) + "'");
@@ -41,6 +71,7 @@ class CallbackSenderI : CallbackSenderDisp_
CallbackReceiverPrx client = CallbackReceiverPrxHelper.uncheckedCast(@base);
_clients.Add(client);
}
+#endif
}
public void Run()
@@ -49,6 +80,23 @@ class CallbackSenderI : CallbackSenderDisp_
while(true)
{
ArrayList clients;
+#if COMPACT
+ _m.Lock();
+ try
+ {
+ _m.TimedWait(2000);
+ if(_destroy)
+ {
+ break;
+ }
+
+ clients = new ArrayList(_clients);
+ }
+ finally
+ {
+ _m.Unlock();
+ }
+#else
lock(this)
{
System.Threading.Monitor.Wait(this, 2000);
@@ -59,6 +107,7 @@ class CallbackSenderI : CallbackSenderDisp_
clients = new ArrayList(_clients);
}
+#endif
if(clients.Count > 0)
{
@@ -74,10 +123,22 @@ class CallbackSenderI : CallbackSenderDisp_
Console.Error.WriteLine("removing client `" +
_communicator.identityToString(c.ice_getIdentity()) + "':\n" + ex);
+#if COMPACT
+ _m.Lock();
+ try
+ {
+ _clients.Remove(c);
+ }
+ finally
+ {
+ _m.Unlock();
+ }
+#else
lock(this)
{
_clients.Remove(c);
}
+#endif
}
}
}
@@ -87,4 +148,7 @@ class CallbackSenderI : CallbackSenderDisp_
private Ice.Communicator _communicator;
private bool _destroy;
private ArrayList _clients;
+#if COMPACT
+ private readonly IceUtilInternal.Monitor _m = new IceUtilInternal.Monitor();
+#endif
}
diff --git a/cs/demo/Ice/bidir/Client.cs b/cs/demo/Ice/bidir/Client.cs
index cc86e1b6b73..be754ef088d 100644
--- a/cs/demo/Ice/bidir/Client.cs
+++ b/cs/demo/Ice/bidir/Client.cs
@@ -51,13 +51,9 @@ public class Client
}
}
- public static void Main(string[] args)
+ public static int Main(string[] args)
{
App app = new App();
- int status = app.main(args, "config.client");
- if(status != 0)
- {
- System.Environment.Exit(status);
- }
+ return app.main(args, "config.client");
}
}
diff --git a/cs/demo/Ice/bidir/Server.cs b/cs/demo/Ice/bidir/Server.cs
index 643e1f13112..acfc0ccb0b9 100644
--- a/cs/demo/Ice/bidir/Server.cs
+++ b/cs/demo/Ice/bidir/Server.cs
@@ -52,13 +52,9 @@ public class Server
}
}
- public static void Main(string[] args)
+ public static int Main(string[] args)
{
App app = new App();
- int status = app.main(args, "config.server");
- if(status != 0)
- {
- System.Environment.Exit(status);
- }
+ return app.main(args, "config.server");
}
}
diff --git a/cs/demo/Ice/callback/Client.cs b/cs/demo/Ice/callback/Client.cs
index ba5f405071b..d7af1f135ea 100644
--- a/cs/demo/Ice/callback/Client.cs
+++ b/cs/demo/Ice/callback/Client.cs
@@ -101,13 +101,9 @@ public class Client
}
}
- public static void Main(string[] args)
+ public static int Main(string[] args)
{
App app = new App();
- int status = app.main(args, "config.client");
- if(status != 0)
- {
- System.Environment.Exit(status);
- }
+ return app.main(args, "config.client");
}
}
diff --git a/cs/demo/Ice/callback/Server.cs b/cs/demo/Ice/callback/Server.cs
index 903130eb229..834b3dfd3f5 100644
--- a/cs/demo/Ice/callback/Server.cs
+++ b/cs/demo/Ice/callback/Server.cs
@@ -37,13 +37,9 @@ public class Server
}
}
- public static void Main(string[] args)
+ public static int Main(string[] args)
{
App app = new App();
- int status = app.main(args, "config.server");
- if(status != 0)
- {
- System.Environment.Exit(status);
- }
+ return app.main(args, "config.server");
}
}
diff --git a/cs/demo/Ice/hello/Client.cs b/cs/demo/Ice/hello/Client.cs
index 7b23910b31d..57520225c8e 100644
--- a/cs/demo/Ice/hello/Client.cs
+++ b/cs/demo/Ice/hello/Client.cs
@@ -222,13 +222,9 @@ public class Client
private static bool _haveSSL = false;
}
- public static void Main(string[] args)
+ public static int Main(string[] args)
{
App app = new App();
- int status = app.main(args, "config.client");
- if(status != 0)
- {
- System.Environment.Exit(status);
- }
+ return app.main(args, "config.client");
}
}
diff --git a/cs/demo/Ice/hello/Server.cs b/cs/demo/Ice/hello/Server.cs
index 07a6bc397aa..776a7583933 100644
--- a/cs/demo/Ice/hello/Server.cs
+++ b/cs/demo/Ice/hello/Server.cs
@@ -36,13 +36,9 @@ public class Server
}
}
- public static void Main(string[] args)
+ public static int Main(string[] args)
{
App app = new App();
- int status = app.main(args, "config.server");
- if(status != 0)
- {
- System.Environment.Exit(status);
- }
+ return app.main(args, "config.server");
}
}
diff --git a/cs/demo/Ice/invoke/Client.cs b/cs/demo/Ice/invoke/Client.cs
index a69e293ba8f..16ddea54af2 100644
--- a/cs/demo/Ice/invoke/Client.cs
+++ b/cs/demo/Ice/invoke/Client.cs
@@ -299,13 +299,9 @@ public class Client
}
}
- public static void Main(string[] args)
+ public static int Main(string[] args)
{
App app = new App();
- int status = app.main(args, "config.client");
- if(status != 0)
- {
- System.Environment.Exit(status);
- }
+ return app.main(args, "config.client");
}
}
diff --git a/cs/demo/Ice/invoke/Server.cs b/cs/demo/Ice/invoke/Server.cs
index ded69d747fe..d4f6a347a73 100644
--- a/cs/demo/Ice/invoke/Server.cs
+++ b/cs/demo/Ice/invoke/Server.cs
@@ -37,13 +37,9 @@ public class Server
}
}
- public static void Main(string[] args)
+ public static int Main(string[] args)
{
App app = new App();
- int status = app.main(args, "config.server");
- if(status != 0)
- {
- System.Environment.Exit(status);
- }
+ return app.main(args, "config.server");
}
}
diff --git a/cs/demo/Ice/invoke/config.client b/cs/demo/Ice/invoke/config.client
index 5ca467e762e..460ef5085fc 100644
--- a/cs/demo/Ice/invoke/config.client
+++ b/cs/demo/Ice/invoke/config.client
@@ -26,3 +26,9 @@ Ice.Warn.Connections=1
# 1 = trace protocol messages
#
#Ice.Trace.Protocol=1
+
+#
+# When using Ice for .NET Compact Framework, we need to specify
+# the assembly so that Ice can locate classes and exceptions.
+#
+Ice.FactoryAssemblies=client
diff --git a/cs/demo/Ice/invoke/config.server b/cs/demo/Ice/invoke/config.server
index 28a7cadc4ec..f6df7856678 100644
--- a/cs/demo/Ice/invoke/config.server
+++ b/cs/demo/Ice/invoke/config.server
@@ -27,3 +27,9 @@ Ice.Warn.Connections=1
# 1 = trace protocol messages
#
#Ice.Trace.Protocol=1
+
+#
+# When using Ice for .NET Compact Framework, we need to specify
+# the assembly so that Ice can locate classes and exceptions.
+#
+Ice.FactoryAssemblies=server
diff --git a/cs/demo/Ice/latency/Client.cs b/cs/demo/Ice/latency/Client.cs
index 5ca92faf66a..5307c34faf9 100644
--- a/cs/demo/Ice/latency/Client.cs
+++ b/cs/demo/Ice/latency/Client.cs
@@ -70,13 +70,9 @@ public class Client
}
}
- public static void Main(string[] args)
+ public static int Main(string[] args)
{
App app = new App();
- int status = app.main(args, "config.client");
- if(status != 0)
- {
- System.Environment.Exit(status);
- }
+ return app.main(args, "config.client");
}
}
diff --git a/cs/demo/Ice/latency/Server.cs b/cs/demo/Ice/latency/Server.cs
index 4a2552c87ef..877551f52bc 100644
--- a/cs/demo/Ice/latency/Server.cs
+++ b/cs/demo/Ice/latency/Server.cs
@@ -37,13 +37,9 @@ public class Server
}
}
- public static void Main(string[] args)
+ public static int Main(string[] args)
{
App app = new App();
- int status = app.main(args, "config.server");
- if(status != 0)
- {
- System.Environment.Exit(status);
- }
+ return app.main(args, "config.server");
}
}
diff --git a/cs/demo/Ice/minimal/Client.cs b/cs/demo/Ice/minimal/Client.cs
index e2e7f33b3e9..2a96ca7cbdb 100644
--- a/cs/demo/Ice/minimal/Client.cs
+++ b/cs/demo/Ice/minimal/Client.cs
@@ -11,7 +11,7 @@ using Demo;
public class Client
{
- public static void Main(string[] args)
+ public static int Main(string[] args)
{
try
{
@@ -19,11 +19,12 @@ public class Client
HelloPrx hello = HelloPrxHelper.checkedCast(communicator.stringToProxy("hello:tcp -p 10000"));
hello.sayHello();
communicator.destroy();
+ return 0;
}
catch(System.Exception ex)
{
System.Console.Error.WriteLine(ex);
- System.Environment.Exit(1);
+ return 1;
}
}
}
diff --git a/cs/demo/Ice/minimal/Server.cs b/cs/demo/Ice/minimal/Server.cs
index 158e672da7d..43dd9108c01 100644
--- a/cs/demo/Ice/minimal/Server.cs
+++ b/cs/demo/Ice/minimal/Server.cs
@@ -9,7 +9,7 @@
public class Server
{
- public static void Main(string[] args)
+ public static int Main(string[] args)
{
try
{
@@ -19,11 +19,12 @@ public class Server
adapter.activate();
communicator.waitForShutdown();
communicator.destroy();
+ return 0;
}
catch(System.Exception ex)
{
System.Console.Error.WriteLine(ex);
- System.Environment.Exit(1);
+ return 1;
}
}
}
diff --git a/cs/demo/Ice/multicast/Client.cs b/cs/demo/Ice/multicast/Client.cs
index 39cd8c30433..90725901748 100644
--- a/cs/demo/Ice/multicast/Client.cs
+++ b/cs/demo/Ice/multicast/Client.cs
@@ -53,14 +53,10 @@ public class Client
}
}
- public static void Main(string[] args)
+ public static int Main(string[] args)
{
App app = new App();
- int status = app.main(args, "config.client");
- if(status != 0)
- {
- System.Environment.Exit(status);
- }
+ return app.main(args, "config.client");
}
}
diff --git a/cs/demo/Ice/multicast/DiscoverReplyI.cs b/cs/demo/Ice/multicast/DiscoverReplyI.cs
index a9784a61a50..a7cfd8f0d82 100644
--- a/cs/demo/Ice/multicast/DiscoverReplyI.cs
+++ b/cs/demo/Ice/multicast/DiscoverReplyI.cs
@@ -15,6 +15,21 @@ public class DiscoverReplyI : DiscoverReplyDisp_
public override void
reply(Ice.ObjectPrx obj, Ice.Current current)
{
+#if COMPACT
+ _m.Lock();
+ try
+ {
+ if(_obj == null)
+ {
+ _obj = obj;
+ }
+ _m.Notify();
+ }
+ finally
+ {
+ _m.Unlock();
+ }
+#else
lock(this)
{
if(_obj == null)
@@ -23,11 +38,36 @@ public class DiscoverReplyI : DiscoverReplyDisp_
}
Monitor.Pulse(this);
}
+#endif
}
public Ice.ObjectPrx
waitReply(long timeout)
{
+#if COMPACT
+ _m.Lock();
+ try
+ {
+ long end = System.DateTime.Now.Ticks / 1000 + timeout;
+ while(_obj == null)
+ {
+ int delay = (int)(end - System.DateTime.Now.Ticks / 1000);
+ if(delay > 0)
+ {
+ _m.TimedWait(delay);
+ }
+ else
+ {
+ break;
+ }
+ }
+ return _obj;
+ }
+ finally
+ {
+ _m.Unlock();
+ }
+#else
lock(this)
{
long end = System.DateTime.Now.Ticks / 1000 + timeout;
@@ -45,7 +85,11 @@ public class DiscoverReplyI : DiscoverReplyDisp_
}
return _obj;
}
+#endif
}
private Ice.ObjectPrx _obj;
+#if COMPACT
+ private readonly IceUtilInternal.Monitor _m = new IceUtilInternal.Monitor();
+#endif
}
diff --git a/cs/demo/Ice/multicast/Server.cs b/cs/demo/Ice/multicast/Server.cs
index 19fe6d7ccea..8dabcc3e2d8 100644
--- a/cs/demo/Ice/multicast/Server.cs
+++ b/cs/demo/Ice/multicast/Server.cs
@@ -39,13 +39,9 @@ public class Server
}
}
- public static void Main(string[] args)
+ public static int Main(string[] args)
{
App app = new App();
- int status = app.main(args, "config.server");
- if(status != 0)
- {
- System.Environment.Exit(status);
- }
+ return app.main(args, "config.server");
}
}
diff --git a/cs/demo/Ice/nested/Client.cs b/cs/demo/Ice/nested/Client.cs
index 4bafea60715..38dc911512e 100644
--- a/cs/demo/Ice/nested/Client.cs
+++ b/cs/demo/Ice/nested/Client.cs
@@ -80,13 +80,9 @@ public class Client
}
}
- public static void Main(string[] args)
+ public static int Main(string[] args)
{
App app = new App();
- int status = app.main(args, "config.client");
- if(status != 0)
- {
- System.Environment.Exit(status);
- }
+ return app.main(args, "config.client");
}
}
diff --git a/cs/demo/Ice/nested/Server.cs b/cs/demo/Ice/nested/Server.cs
index a511a2e96bf..87d3e2aa8d1 100644
--- a/cs/demo/Ice/nested/Server.cs
+++ b/cs/demo/Ice/nested/Server.cs
@@ -39,13 +39,9 @@ public class Server
}
}
- public static void Main(string[] args)
+ public static int Main(string[] args)
{
App app = new App();
- int status = app.main(args, "config.server");
- if(status != 0)
- {
- System.Environment.Exit(status);
- }
+ return app.main(args, "config.server");
}
}
diff --git a/cs/demo/Ice/plugin/Client.cs b/cs/demo/Ice/plugin/Client.cs
index e81e13cedff..6d718963aca 100644
--- a/cs/demo/Ice/plugin/Client.cs
+++ b/cs/demo/Ice/plugin/Client.cs
@@ -93,13 +93,9 @@ public class Client
}
}
- public static void Main(string[] args)
+ public static int Main(string[] args)
{
App app = new App();
- int status = app.main(args, "config.client");
- if(status != 0)
- {
- System.Environment.Exit(status);
- }
+ return app.main(args, "config.client");
}
}
diff --git a/cs/demo/Ice/plugin/Server.cs b/cs/demo/Ice/plugin/Server.cs
index b60d0fd843a..fc84ffe2fda 100644
--- a/cs/demo/Ice/plugin/Server.cs
+++ b/cs/demo/Ice/plugin/Server.cs
@@ -33,13 +33,9 @@ public class Server
}
}
- public static void Main(string[] args)
+ public static int Main(string[] args)
{
App app = new App();
- int status = app.main(args, "config.server");
- if(status != 0)
- {
- System.Environment.Exit(status);
- }
+ return app.main(args, "config.server");
}
}
diff --git a/cs/demo/Ice/serialize/Client.cs b/cs/demo/Ice/serialize/Client.cs
index a079fd15e1d..b329fb5b282 100644
--- a/cs/demo/Ice/serialize/Client.cs
+++ b/cs/demo/Ice/serialize/Client.cs
@@ -111,13 +111,9 @@ public class Client
}
}
- public static void Main(string[] args)
+ public static int Main(string[] args)
{
App app = new App();
- int status = app.main(args, "config.client");
- if(status != 0)
- {
- System.Environment.Exit(status);
- }
+ return app.main(args, "config.client");
}
}
diff --git a/cs/demo/Ice/serialize/MyGreeting.cs b/cs/demo/Ice/serialize/MyGreeting.cs
index 4651078b1e7..4651078b1e7 100755..100644
--- a/cs/demo/Ice/serialize/MyGreeting.cs
+++ b/cs/demo/Ice/serialize/MyGreeting.cs
diff --git a/cs/demo/Ice/serialize/Server.cs b/cs/demo/Ice/serialize/Server.cs
index 203fba354e8..21aa3a376b5 100644
--- a/cs/demo/Ice/serialize/Server.cs
+++ b/cs/demo/Ice/serialize/Server.cs
@@ -36,13 +36,9 @@ public class Server
}
}
- public static void Main(string[] args)
+ public static int Main(string[] args)
{
App app = new App();
- int status = app.main(args, "config.server");
- if(status != 0)
- {
- System.Environment.Exit(status);
- }
+ return app.main(args, "config.server");
}
}
diff --git a/cs/demo/Ice/session/Client.cs b/cs/demo/Ice/session/Client.cs
index c3fe092d18d..2e6a0553e78 100644
--- a/cs/demo/Ice/session/Client.cs
+++ b/cs/demo/Ice/session/Client.cs
@@ -35,6 +35,32 @@ public class Client
public void run()
{
+#if COMPACT
+ _m.Lock();
+ try
+ {
+ while(!_terminated)
+ {
+ _m.TimedWait(_timeout);
+ if(!_terminated)
+ {
+ try
+ {
+ _session.refresh();
+ }
+ catch(Ice.Exception ex)
+ {
+ _logger.warning("SessionRefreshThread: " + ex);
+ _terminated = true;
+ }
+ }
+ }
+ }
+ finally
+ {
+ _m.Unlock();
+ }
+#else
lock(this)
{
while(!_terminated)
@@ -54,21 +80,38 @@ public class Client
}
}
}
+#endif
}
public void terminate()
{
+#if COMPACT
+ _m.Lock();
+ try
+ {
+ _terminated = true;
+ _m.Notify();
+ }
+ finally
+ {
+ _m.Unlock();
+ }
+#else
lock(this)
{
_terminated = true;
Monitor.Pulse(this);
}
+#endif
}
private Ice.Logger _logger;
private SessionPrx _session;
private int _timeout;
private bool _terminated;
+#if COMPACT
+ private readonly IceUtilInternal.Monitor _m = new IceUtilInternal.Monitor();
+#endif
}
public override int run(string[] args)
@@ -221,13 +264,9 @@ public class Client
}
}
- public static void Main(string[] args)
+ public static int Main(string[] args)
{
App app = new App();
- int status = app.main(args, "config.client");
- if(status != 0)
- {
- System.Environment.Exit(status);
- }
+ return app.main(args, "config.client");
}
}
diff --git a/cs/demo/Ice/session/ReapThread.cs b/cs/demo/Ice/session/ReapThread.cs
index 58203339caa..89df57f5b79 100644
--- a/cs/demo/Ice/session/ReapThread.cs
+++ b/cs/demo/Ice/session/ReapThread.cs
@@ -35,6 +35,50 @@ public class ReapThread
public void run()
{
+#if COMPACT
+ _m.Lock();
+ try
+ {
+ while(!_terminated)
+ {
+ _m.TimedWait(1000);
+ if(!_terminated)
+ {
+ ArrayList tmp = new ArrayList();
+ foreach(SessionProxyPair p in _sessions)
+ {
+ try
+ {
+ //
+ // Session destruction may take time in a
+ // real-world example. Therefore the current time
+ // is computed for each iteration.
+ //
+ if((System.DateTime.Now - p.session.timestamp()) > _timeout)
+ {
+ string name = p.proxy.getName();
+ p.proxy.destroy();
+ Console.Out.WriteLine("The session " + name + " has timed out.");
+ }
+ else
+ {
+ tmp.Add(p);
+ }
+ }
+ catch(Ice.ObjectNotExistException)
+ {
+ // Ignore.
+ }
+ }
+ _sessions = tmp;
+ }
+ }
+ }
+ finally
+ {
+ _m.Unlock();
+ }
+#else
lock(this)
{
while(!_terminated)
@@ -72,10 +116,25 @@ public class ReapThread
}
}
}
+#endif
}
public void terminate()
{
+#if COMPACT
+ _m.Lock();
+ try
+ {
+ _terminated = true;
+ _m.Notify();
+
+ _sessions.Clear();
+ }
+ finally
+ {
+ _m.Unlock();
+ }
+#else
lock(this)
{
_terminated = true;
@@ -83,17 +142,33 @@ public class ReapThread
_sessions.Clear();
}
+#endif
}
public void add(SessionPrx proxy, SessionI session)
{
+#if COMPACT
+ _m.Lock();
+ try
+ {
+ _sessions.Add(new SessionProxyPair(proxy, session));
+ }
+ finally
+ {
+ _m.Unlock();
+ }
+#else
lock(this)
{
_sessions.Add(new SessionProxyPair(proxy, session));
}
+#endif
}
private bool _terminated;
private System.TimeSpan _timeout;
private ArrayList _sessions;
+#if COMPACT
+ private readonly IceUtilInternal.Monitor _m = new IceUtilInternal.Monitor();
+#endif
}
diff --git a/cs/demo/Ice/session/Server.cs b/cs/demo/Ice/session/Server.cs
index f959b7e97fb..eaca100e8e4 100644
--- a/cs/demo/Ice/session/Server.cs
+++ b/cs/demo/Ice/session/Server.cs
@@ -47,13 +47,9 @@ public class Server
}
}
- public static void Main(string[] args)
+ public static int Main(string[] args)
{
App app = new App();
- int status = app.main(args, "config.server");
- if(status != 0)
- {
- System.Environment.Exit(status);
- }
+ return app.main(args, "config.server");
}
}
diff --git a/cs/demo/Ice/throughput/Client.cs b/cs/demo/Ice/throughput/Client.cs
index aab92ce7272..828a6dd1247 100644
--- a/cs/demo/Ice/throughput/Client.cs
+++ b/cs/demo/Ice/throughput/Client.cs
@@ -432,13 +432,9 @@ public class Client
}
}
- public static void Main(string[] args)
+ public static int Main(string[] args)
{
App app = new App();
- int status = app.main(args, "config.client");
- if(status != 0)
- {
- System.Environment.Exit(status);
- }
+ return app.main(args, "config.client");
}
}
diff --git a/cs/demo/Ice/throughput/Server.cs b/cs/demo/Ice/throughput/Server.cs
index 4c2a05e3614..dae754beca9 100644
--- a/cs/demo/Ice/throughput/Server.cs
+++ b/cs/demo/Ice/throughput/Server.cs
@@ -36,13 +36,9 @@ public class Server
}
}
- public static void Main(string[] args)
+ public static int Main(string[] args)
{
App app = new App();
- int status = app.main(args, "config.server");
- if(status != 0)
- {
- System.Environment.Exit(status);
- }
+ return app.main(args, "config.server");
}
}
diff --git a/cs/demo/Ice/value/Client.cs b/cs/demo/Ice/value/Client.cs
index c90e1a18f23..fb3cdbae047 100644
--- a/cs/demo/Ice/value/Client.cs
+++ b/cs/demo/Ice/value/Client.cs
@@ -60,7 +60,7 @@ public class Client
{
initial.getPrinter(out printer, out printerProxy);
Console.Error.WriteLine("Did not get the expected NoObjectFactoryException!");
- Environment.Exit(1);
+ return 1;
}
catch(Ice.NoObjectFactoryException ex)
{
@@ -165,13 +165,9 @@ public class Client
}
}
- public static void Main(string[] args)
+ public static int Main(string[] args)
{
App app = new App();
- int status = app.main(args, "config.client");
- if(status != 0)
- {
- System.Environment.Exit(status);
- }
+ return app.main(args, "config.client");
}
}
diff --git a/cs/demo/Ice/value/Server.cs b/cs/demo/Ice/value/Server.cs
index abf305883cb..9104a23a120 100644
--- a/cs/demo/Ice/value/Server.cs
+++ b/cs/demo/Ice/value/Server.cs
@@ -37,13 +37,9 @@ public class Server
}
}
- public static void Main(string[] args)
+ public static int Main(string[] args)
{
App app = new App();
- int status = app.main(args, "config.server");
- if(status != 0)
- {
- System.Environment.Exit(status);
- }
+ return app.main(args, "config.server");
}
}
diff --git a/cs/demo/Ice/value/config.client b/cs/demo/Ice/value/config.client
index aa0dc669ca1..bc6251fbdcc 100644
--- a/cs/demo/Ice/value/config.client
+++ b/cs/demo/Ice/value/config.client
@@ -8,3 +8,9 @@ Initial.Proxy=initial:default -p 10000
# Warn about connection exceptions
#
Ice.Warn.Connections=1
+
+#
+# When using Ice for .NET Compact Framework, we need to specify
+# the assembly so that Ice can locate classes and exceptions.
+#
+Ice.FactoryAssemblies=client
diff --git a/cs/demo/Ice/wpf/Properties/AssemblyInfo.cs b/cs/demo/Ice/wpf/Properties/AssemblyInfo.cs
index a4393ba1e71..a4393ba1e71 100755..100644
--- a/cs/demo/Ice/wpf/Properties/AssemblyInfo.cs
+++ b/cs/demo/Ice/wpf/Properties/AssemblyInfo.cs
diff --git a/cs/demo/Ice/wpf/Properties/Resources.Designer.cs b/cs/demo/Ice/wpf/Properties/Resources.Designer.cs
index 4ffd3bcc16d..4ffd3bcc16d 100755..100644
--- a/cs/demo/Ice/wpf/Properties/Resources.Designer.cs
+++ b/cs/demo/Ice/wpf/Properties/Resources.Designer.cs
diff --git a/cs/demo/Ice/wpf/Properties/Settings.Designer.cs b/cs/demo/Ice/wpf/Properties/Settings.Designer.cs
index 93df3f41bc1..93df3f41bc1 100755..100644
--- a/cs/demo/Ice/wpf/Properties/Settings.Designer.cs
+++ b/cs/demo/Ice/wpf/Properties/Settings.Designer.cs
diff --git a/cs/demo/IceBox/hello/Client.cs b/cs/demo/IceBox/hello/Client.cs
index eec6b82e940..0d0e4ce1f05 100644
--- a/cs/demo/IceBox/hello/Client.cs
+++ b/cs/demo/IceBox/hello/Client.cs
@@ -33,10 +33,10 @@ public class Client
"f: flush all batch requests\n");
if(_haveSSL)
{
- Console.Write("\nS: switch secure mode on/off");
+ Console.Write("S: switch secure mode on/off\n");
}
Console.WriteLine(
- "\nx: exit\n" +
+ "x: exit\n" +
"?: help\n");
}
@@ -169,13 +169,9 @@ public class Client
private static bool _haveSSL = false;
}
- public static void Main(string[] args)
+ public static int Main(string[] args)
{
App app = new App();
- int status = app.main(args, "config.client");
- if(status != 0)
- {
- System.Environment.Exit(status);
- }
+ return app.main(args, "config.client");
}
}
diff --git a/cs/demo/IceGrid/icebox/Client.cs b/cs/demo/IceGrid/icebox/Client.cs
index 4afc0a05f1e..944116066fe 100644
--- a/cs/demo/IceGrid/icebox/Client.cs
+++ b/cs/demo/IceGrid/icebox/Client.cs
@@ -42,13 +42,9 @@ public class Client
}
}
- public static void Main(string[] args)
+ public static int Main(string[] args)
{
App app = new App();
- int status = app.main(args, "config.client");
- if(status != 0)
- {
- System.Environment.Exit(status);
- }
+ return app.main(args, "config.client");
}
}
diff --git a/cs/demo/IceGrid/simple/Client.cs b/cs/demo/IceGrid/simple/Client.cs
index f1b3280daaf..7ce69fbf1b9 100644
--- a/cs/demo/IceGrid/simple/Client.cs
+++ b/cs/demo/IceGrid/simple/Client.cs
@@ -103,13 +103,9 @@ public class Client
}
}
- public static void Main(string[] args)
+ public static int Main(string[] args)
{
App app = new App();
- int status = app.main(args, "config.client");
- if(status != 0)
- {
- System.Environment.Exit(status);
- }
+ return app.main(args, "config.client");
}
}
diff --git a/cs/demo/IceGrid/simple/Server.cs b/cs/demo/IceGrid/simple/Server.cs
index b1cab998656..eec0eecb714 100644
--- a/cs/demo/IceGrid/simple/Server.cs
+++ b/cs/demo/IceGrid/simple/Server.cs
@@ -38,13 +38,9 @@ public class Server
}
}
- static public void Main(string[] args)
+ static public int Main(string[] args)
{
App app = new App();
- int status = app.main(args);
- if(status != 0)
- {
- System.Environment.Exit(status);
- }
+ return app.main(args);
}
}
diff --git a/cs/demo/IceStorm/clock/Publisher.cs b/cs/demo/IceStorm/clock/Publisher.cs
index b09b2e638ad..decb4e13681 100644
--- a/cs/demo/IceStorm/clock/Publisher.cs
+++ b/cs/demo/IceStorm/clock/Publisher.cs
@@ -139,13 +139,9 @@ public class Publisher
}
}
- public static void Main(string[] args)
+ public static int Main(string[] args)
{
App app = new App();
- int status = app.main(args, "config.pub");
- if(status != 0)
- {
- System.Environment.Exit(status);
- }
+ return app.main(args, "config.pub");
}
}
diff --git a/cs/demo/IceStorm/clock/Subscriber.cs b/cs/demo/IceStorm/clock/Subscriber.cs
index c646f9c9511..1b5f9cbd322 100644
--- a/cs/demo/IceStorm/clock/Subscriber.cs
+++ b/cs/demo/IceStorm/clock/Subscriber.cs
@@ -244,13 +244,9 @@ public class Subscriber
}
}
- public static void Main(string[] args)
+ public static int Main(string[] args)
{
App app = new App();
- int status = app.main(args, "config.sub");
- if(status != 0)
- {
- System.Environment.Exit(status);
- }
+ return app.main(args, "config.sub");
}
}
diff --git a/cs/demo/book/lifecycle/Client.cs b/cs/demo/book/lifecycle/Client.cs
index 7f707729cbd..de44260113c 100644
--- a/cs/demo/book/lifecycle/Client.cs
+++ b/cs/demo/book/lifecycle/Client.cs
@@ -55,9 +55,18 @@ public class Client
}
}
- static public void Main(String[] args)
+ static public int Main(String[] args)
{
App app = new App();
- app.main(args);
+ Ice.InitializationData data = new Ice.InitializationData();
+#if COMPACT
+ //
+ // When using Ice for .NET Compact Framework, we need to specify
+ // the assembly so that Ice can locate classes and exceptions.
+ //
+ data.properties = Ice.Util.createProperties();
+ data.properties.setProperty("Ice.FactoryAssemblies", "client,version=1.0.0.0");
+#endif
+ return app.main(args, data);
}
}
diff --git a/cs/demo/book/lifecycle/Parser.cs b/cs/demo/book/lifecycle/Parser.cs
index 52ae27893a6..7a6409381d3 100644
--- a/cs/demo/book/lifecycle/Parser.cs
+++ b/cs/demo/book/lifecycle/Parser.cs
@@ -314,18 +314,12 @@ class Parser
internal virtual int parse()
{
+#if COMPACT
+ _in = Console.In;
+#else
_in = new StreamReader(new StreamReader(Console.OpenStandardInput(), Encoding.Default).BaseStream,
new StreamReader(Console.OpenStandardInput(), Encoding.Default).CurrentEncoding);
-
- Grammar g = new Grammar(this);
- g.parse();
-
- return 0;
- }
-
- internal virtual int parse(StreamReader in_Renamed)
- {
- _in = in_Renamed;
+#endif
Grammar g = new Grammar(this);
g.parse();
@@ -335,5 +329,5 @@ class Parser
private ArrayList _dirs;
- private StreamReader _in;
+ private TextReader _in;
}
diff --git a/cs/demo/book/lifecycle/Server.cs b/cs/demo/book/lifecycle/Server.cs
index ce1fb2e7d47..38e383cf1e0 100644
--- a/cs/demo/book/lifecycle/Server.cs
+++ b/cs/demo/book/lifecycle/Server.cs
@@ -60,9 +60,9 @@ public class Server
}
}
- static public void Main(string[] args)
+ static public int Main(string[] args)
{
App app = new App();
- app.main(args);
+ return app.main(args);
}
}
diff --git a/cs/demo/book/printer/Client.cs b/cs/demo/book/printer/Client.cs
index fef569a77a8..29b53a6e412 100644
--- a/cs/demo/book/printer/Client.cs
+++ b/cs/demo/book/printer/Client.cs
@@ -19,7 +19,7 @@ using System.Reflection;
public class Client
{
- public static void Main(string[] args)
+ public static int Main(string[] args)
{
int status = 0;
Ice.Communicator ic = null;
@@ -52,9 +52,6 @@ public class Client
status = 1;
}
}
- if(status != 0)
- {
- System.Environment.Exit(status);
- }
+ return status;
}
}
diff --git a/cs/demo/book/printer/Server.cs b/cs/demo/book/printer/Server.cs
index 3320b9d4ce2..7f95c2d16f7 100644
--- a/cs/demo/book/printer/Server.cs
+++ b/cs/demo/book/printer/Server.cs
@@ -26,7 +26,7 @@ public class PrinterI : Demo.PrinterDisp_
public class Server
{
- public static void Main(string[] args)
+ public static int Main(string[] args)
{
int status = 0;
Ice.Communicator ic = null;
@@ -57,9 +57,6 @@ public class Server
status = 1;
}
}
- if(status != 0)
- {
- System.Environment.Exit(status);
- }
+ return status;
}
}
diff --git a/cs/demo/book/simple_filesystem/Client.cs b/cs/demo/book/simple_filesystem/Client.cs
index 36fde24c2fe..06b9709e545 100644
--- a/cs/demo/book/simple_filesystem/Client.cs
+++ b/cs/demo/book/simple_filesystem/Client.cs
@@ -49,16 +49,26 @@ public class Client
}
}
- public static void Main(string[] args)
+ public static int Main(string[] args)
{
int status = 0;
Ice.Communicator ic = null;
try
{
+ Ice.InitializationData data = new Ice.InitializationData();
+#if COMPACT
+ //
+ // When using Ice for .NET Compact Framework, we need to specify
+ // the assembly so that Ice can locate classes and exceptions.
+ //
+ data.properties = Ice.Util.createProperties();
+ data.properties.setProperty("Ice.FactoryAssemblies", "client,version=1.0.0.0");
+#endif
+
//
// Create a communicator
//
- ic = Ice.Util.initialize(ref args);
+ ic = Ice.Util.initialize(ref args, data);
//
// Create a proxy for the root directory
@@ -97,9 +107,6 @@ public class Client
status = 1;
}
}
- if(status != 0)
- {
- System.Environment.Exit(status);
- }
+ return status;
}
}
diff --git a/cs/demo/book/simple_filesystem/Server.cs b/cs/demo/book/simple_filesystem/Server.cs
index 26c2d6f5dd2..ac92353aae4 100644
--- a/cs/demo/book/simple_filesystem/Server.cs
+++ b/cs/demo/book/simple_filesystem/Server.cs
@@ -100,13 +100,9 @@ public class Server
}
}
- public static void Main(string[] args)
+ public static int Main(string[] args)
{
App app = new App();
- int status = app.main(args);
- if(status != 0)
- {
- Environment.Exit(status);
- }
+ return app.main(args);
}
}
diff --git a/cs/src/Glacier2/Application.cs b/cs/src/Glacier2/Application.cs
index f45ca47544d..e3460fd1a3e 100644
--- a/cs/src/Glacier2/Application.cs
+++ b/cs/src/Glacier2/Application.cs
@@ -189,7 +189,8 @@ public abstract class Application : Ice.Application
throw new SessionNotExistException();
}
- lock(this)
+ mutex__.Lock();
+ try
{
if(_adapter == null)
{
@@ -197,6 +198,10 @@ public abstract class Application : Ice.Application
_adapter.activate();
}
}
+ finally
+ {
+ mutex__.Unlock();
+ }
return _adapter;
}
@@ -243,7 +248,8 @@ public abstract class Application : Ice.Application
public void
run()
{
- lock(this)
+ _m.Lock();
+ try
{
while(!_done)
{
@@ -261,29 +267,39 @@ public abstract class Application : Ice.Application
if(!_done)
{
- Monitor.Wait(this, (int)_period);
+ _m.TimedWait((int)_period);
}
}
}
+ finally
+ {
+ _m.Unlock();
+ }
}
public void
done()
{
- lock(this)
+ _m.Lock();
+ try
{
if(!_done)
{
_done = true;
- Monitor.PulseAll(this);
+ _m.NotifyAll();
}
}
+ finally
+ {
+ _m.Unlock();
+ }
}
private Application _app;
private Glacier2.RouterPrx _router;
private long _period;
private bool _done = false;
+ private readonly IceUtilInternal.Monitor _m = new IceUtilInternal.Monitor();
}
protected override int
@@ -434,11 +450,12 @@ public abstract class Application : Ice.Application
ignoreInterrupt();
}
- lock(mutex__)
+ mutex__.Lock();
+ try
{
while(callbackInProgress__)
{
- Monitor.Wait(mutex__);
+ mutex__.Wait();
}
if(destroyed__)
@@ -455,6 +472,10 @@ public abstract class Application : Ice.Application
//
}
}
+ finally
+ {
+ mutex__.Unlock();
+ }
if(ping != null)
{
@@ -462,6 +483,10 @@ public abstract class Application : Ice.Application
ping = null;
while(true)
{
+#if COMPACT
+ pingThread.Join();
+ break;
+#else
try
{
pingThread.Join();
@@ -470,6 +495,7 @@ public abstract class Application : Ice.Application
catch(ThreadInterruptedException)
{
}
+#endif
}
pingThread = null;
}
diff --git a/cs/src/Glacier2/SessionHelper.cs b/cs/src/Glacier2/SessionHelper.cs
index 4faaf4ab467..05e19d1ca58 100644
--- a/cs/src/Glacier2/SessionHelper.cs
+++ b/cs/src/Glacier2/SessionHelper.cs
@@ -56,7 +56,8 @@ public class SessionHelper
public void
run()
{
- lock(this)
+ _m.Lock();
+ try
{
while(true)
{
@@ -74,13 +75,17 @@ public class SessionHelper
if(!_done)
{
+#if COMPACT
+ _m.TimedWait(_period);
+#else
try
{
- System.Threading.Monitor.Wait(this, _period);
+ _m.TimedWait(_period);
}
catch(ThreadInterruptedException)
{
}
+#endif
}
if(_done)
@@ -89,25 +94,36 @@ public class SessionHelper
}
}
}
+ finally
+ {
+ _m.Unlock();
+ }
}
public void
done()
{
- lock(this)
+ _m.Lock();
+ try
{
if(!_done)
{
_done = true;
- System.Threading.Monitor.Pulse(this);
+ _m.Notify();
}
}
+ finally
+ {
+ _m.Unlock();
+ }
}
private SessionHelper _session;
private Glacier2.RouterPrx _router;
private int _period;
private bool _done = false;
+
+ private readonly IceUtilInternal.Monitor _m = new IceUtilInternal.Monitor();
}
/// <summary>
@@ -430,6 +446,10 @@ public class SessionHelper
sessionRefresh.done();
while(true)
{
+#if COMPACT
+ _refreshThread.Join();
+ break;
+#else
try
{
_refreshThread.Join();
@@ -438,6 +458,7 @@ public class SessionHelper
catch(ThreadInterruptedException)
{
}
+#endif
}
_refreshThread = null;
}
@@ -511,8 +532,13 @@ public class SessionHelper
})).Start();
}
+#if COMPACT
+ private void
+ dispatchCallback(Ice.VoidAction callback, Ice.Connection conn)
+#else
private void
dispatchCallback(System.Action callback, Ice.Connection conn)
+#endif
{
if(_initData.dispatcher != null)
{
@@ -524,8 +550,13 @@ public class SessionHelper
}
}
+#if COMPACT
+ private void
+ dispatchCallbackAndWait(Ice.VoidAction callback)
+#else
private void
dispatchCallbackAndWait(System.Action callback)
+#endif
{
if(_initData.dispatcher != null)
{
diff --git a/cs/src/Ice/Application.cs b/cs/src/Ice/Application.cs
index b4e97a53cd8..bc27cc0ade7 100644
--- a/cs/src/Ice/Application.cs
+++ b/cs/src/Ice/Application.cs
@@ -18,14 +18,17 @@ namespace Ice
internal static class NativeMethods
{
+#if !COMPACT
//
- // It's not necessary to wrap DllImport in conditional compilation. The binding occurs
- // at run time, and it will never be executed on Mono.
+ // Technically it's not necessary to wrap DllImport in conditional compilation because
+ // the binding occurs at run time and it will never be executed on Mono. However, it
+ // causes problems for the Compact Framework.
//
[DllImport("kernel32.dll")]
[return: MarshalAsAttribute(UnmanagedType.Bool)]
internal static extern bool
SetConsoleCtrlHandler(CtrlCEventHandler eh, [MarshalAsAttribute(UnmanagedType.Bool)]bool add);
+#endif
}
/// <summary>
@@ -204,6 +207,9 @@ namespace Ice
int status;
+#if COMPACT
+ status = doMain(args, initData);
+#else
if(signalPolicy__ == SignalPolicy.HandleSignals)
{
if(IceInternal.AssemblyUtil.platform_ == IceInternal.AssemblyUtil.Platform.Windows)
@@ -224,6 +230,7 @@ namespace Ice
{
status = doMain(args, initData);
}
+#endif
return status;
}
@@ -259,15 +266,20 @@ namespace Ice
{
if(signalPolicy__ == SignalPolicy.HandleSignals)
{
- lock(mutex__)
+ mutex__.Lock();
+ try
{
if(_callback == _holdCallback)
{
released__ = true;
- Monitor.Pulse(mutex__);
+ mutex__.Notify();
}
_callback = _destroyCallback;
}
+ finally
+ {
+ mutex__.Unlock();
+ }
}
else
{
@@ -283,15 +295,20 @@ namespace Ice
{
if(signalPolicy__ == SignalPolicy.HandleSignals)
{
- lock(mutex__)
+ mutex__.Lock();
+ try
{
if(_callback == _holdCallback)
{
released__ = true;
- Monitor.Pulse(mutex__);
+ mutex__.Notify();
}
_callback = _shutdownCallback;
}
+ finally
+ {
+ mutex__.Unlock();
+ }
}
else
{
@@ -307,15 +324,20 @@ namespace Ice
{
if(signalPolicy__ == SignalPolicy.HandleSignals)
{
- lock(mutex__)
+ mutex__.Lock();
+ try
{
if(_callback == _holdCallback)
{
released__ = true;
- Monitor.Pulse(mutex__);
+ mutex__.Notify();
}
_callback = null;
}
+ finally
+ {
+ mutex__.Unlock();
+ }
}
else
{
@@ -332,15 +354,20 @@ namespace Ice
{
if(signalPolicy__ == SignalPolicy.HandleSignals)
{
- lock(mutex__)
+ mutex__.Lock();
+ try
{
if(_callback == _holdCallback)
{
released__ = true;
- Monitor.Pulse(mutex__);
+ mutex__.Notify();
}
_callback = _userCallback;
}
+ finally
+ {
+ mutex__.Unlock();
+ }
}
else
{
@@ -356,7 +383,8 @@ namespace Ice
{
if(signalPolicy__ == SignalPolicy.HandleSignals)
{
- lock(mutex__)
+ mutex__.Lock();
+ try
{
if(_callback != _holdCallback)
{
@@ -366,6 +394,10 @@ namespace Ice
}
// else, we were already holding signals
}
+ finally
+ {
+ mutex__.Unlock();
+ }
}
else
{
@@ -382,7 +414,8 @@ namespace Ice
{
if(signalPolicy__ == SignalPolicy.HandleSignals)
{
- lock(mutex__)
+ mutex__.Lock();
+ try
{
if(_callback == _holdCallback)
{
@@ -395,10 +428,14 @@ namespace Ice
released__ = true;
_callback = _previousCallback;
- Monitor.Pulse(mutex__);
+ mutex__.Notify();
}
// Else nothing to release.
}
+ finally
+ {
+ mutex__.Unlock();
+ }
}
else
{
@@ -414,10 +451,15 @@ namespace Ice
/// <returns>True if a signal caused the communicator to shut down; false otherwise.</returns>
public static bool interrupted()
{
- lock(mutex__)
+ mutex__.Lock();
+ try
{
return interrupted__;
}
+ finally
+ {
+ mutex__.Unlock();
+ }
}
protected virtual int doMain(string[] args, InitializationData initData)
@@ -474,11 +516,12 @@ namespace Ice
ignoreInterrupt();
}
- lock(mutex__)
+ mutex__.Lock();
+ try
{
while(callbackInProgress__)
{
- Monitor.Wait(mutex__);
+ mutex__.Wait();
}
if(destroyed__)
{
@@ -495,6 +538,10 @@ namespace Ice
}
_application = null;
}
+ finally
+ {
+ mutex__.Unlock();
+ }
if(communicator__ != null)
{
@@ -524,10 +571,17 @@ namespace Ice
private static void signalHandler(int sig)
{
Callback callback;
- lock(mutex__)
+
+ mutex__.Lock();
+ try
{
callback = _callback;
}
+ finally
+ {
+ mutex__.Unlock();
+ }
+
if(callback != null)
{
try
@@ -547,11 +601,12 @@ namespace Ice
private static void holdInterruptCallback(int sig)
{
Callback callback = null;
- lock(mutex__)
+ mutex__.Lock();
+ try
{
while(!released__)
{
- Monitor.Wait(mutex__);
+ mutex__.Wait();
}
if(destroyed__)
@@ -564,6 +619,10 @@ namespace Ice
callback = _callback;
}
+ finally
+ {
+ mutex__.Unlock();
+ }
if(callback != null)
{
@@ -576,7 +635,8 @@ namespace Ice
//
private static void destroyOnInterruptCallback(int sig)
{
- lock(mutex__)
+ mutex__.Lock();
+ try
{
if(destroyed__)
{
@@ -595,6 +655,10 @@ namespace Ice
interrupted__ = true;
destroyed__ = true;
}
+ finally
+ {
+ mutex__.Unlock();
+ }
try
{
@@ -606,16 +670,22 @@ namespace Ice
Util.getProcessLogger().error("(while destroying in response to signal " + sig + "):\n" + ex);
}
- lock(mutex__)
+ mutex__.Lock();
+ try
{
callbackInProgress__ = false;
- Monitor.Pulse(mutex__);
+ mutex__.Notify();
+ }
+ finally
+ {
+ mutex__.Unlock();
}
}
private static void shutdownOnInterruptCallback(int sig)
{
- lock(mutex__)
+ mutex__.Lock();
+ try
{
if(destroyed__)
{
@@ -633,6 +703,10 @@ namespace Ice
callbackInProgress__ = true;
interrupted__ = true;
}
+ finally
+ {
+ mutex__.Unlock();
+ }
try
{
@@ -644,16 +718,22 @@ namespace Ice
Util.getProcessLogger().error("(while shutting down in response to signal " + sig + "):\n" + ex);
}
- lock(mutex__)
+ mutex__.Lock();
+ try
{
callbackInProgress__ = false;
- Monitor.Pulse(mutex__);
+ mutex__.Notify();
+ }
+ finally
+ {
+ mutex__.Unlock();
}
}
private static void userCallbackOnInterruptCallback(int sig)
{
- lock(mutex__)
+ mutex__.Lock();
+ try
{
if(destroyed__)
{
@@ -668,6 +748,10 @@ namespace Ice
callbackInProgress__ = true;
interrupted__ = true;
}
+ finally
+ {
+ mutex__.Unlock();
+ }
try
{
@@ -679,14 +763,19 @@ namespace Ice
Util.getProcessLogger().error("(while interrupting in response to signal " + sig + "):\n" + ex);
}
- lock(mutex__)
+ mutex__.Lock();
+ try
{
callbackInProgress__ = false;
- Monitor.Pulse(mutex__);
+ mutex__.Notify();
+ }
+ finally
+ {
+ mutex__.Unlock();
}
}
- protected static readonly object mutex__ = new object();
+ protected static readonly IceUtilInternal.Monitor mutex__ = new IceUtilInternal.Monitor();
protected static bool callbackInProgress__ = false;
protected static bool destroyed__ = false;
@@ -727,6 +816,7 @@ namespace Ice
private delegate void SignalHandler(int sig);
private static readonly SignalHandler _handler = new SignalHandler(signalHandler);
+#if !COMPACT
private Signals _signals;
private interface Signals
@@ -816,9 +906,9 @@ namespace Ice
_handler(sig);
return true;
}
-
#endif
}
+#endif
}
delegate bool CtrlCEventHandler(int sig);
diff --git a/cs/src/Ice/AssemblyUtil.cs b/cs/src/Ice/AssemblyUtil.cs
index 41b7b5ab717..389669de568 100644
--- a/cs/src/Ice/AssemblyUtil.cs
+++ b/cs/src/Ice/AssemblyUtil.cs
@@ -12,6 +12,7 @@ namespace IceInternal
using System;
using System.Collections;
+ using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Threading;
@@ -55,6 +56,32 @@ namespace IceInternal
xp_ = v.Major == 5 && v.Minor == 1; // Are we running on XP?
osx_ = false;
+
+#if COMPACT
+ //
+ // Populate the _iceAssemblies list with the fully-qualified names
+ // of the standard Ice assemblies. The fully-qualified name looks
+ // like this:
+ //
+ // Ice, Version=X.Y.Z.0, Culture=neutral, PublicKeyToken=...
+ //
+ string name = Assembly.GetExecutingAssembly().FullName;
+ _iceAssemblies.Add(name);
+ int pos = name.IndexOf(',');
+ if(pos >= 0 && pos < name.Length - 1)
+ {
+ //
+ // Strip off the leading assembly name and use the remainder of the
+ // string to compose the names of the other standard assemblies.
+ //
+ string suffix = name.Substring(pos + 1);
+ _iceAssemblies.Add("Glacier2," + suffix);
+ _iceAssemblies.Add("IceBox," + suffix);
+ _iceAssemblies.Add("IceGrid," + suffix);
+ _iceAssemblies.Add("IcePatch2," + suffix);
+ _iceAssemblies.Add("IceStorm," + suffix);
+ }
+#else
if(platform_ == Platform.NonWindows)
{
try
@@ -81,11 +108,14 @@ namespace IceInternal
{
}
}
+#endif
}
- public static Type findType(string csharpId)
+ public static Type findType(Instance instance, string csharpId)
{
+#if !COMPACT
loadAssemblies(); // Lazy initialization
+#endif
lock(_mutex)
{
@@ -94,6 +124,33 @@ namespace IceInternal
{
return t;
}
+#if COMPACT
+ string[] assemblies = instance.factoryAssemblies();
+ for(int i = 0; i < assemblies.Length; ++i)
+ {
+ string s = csharpId + "," + assemblies[i];
+ if((t = Type.GetType(s)) != null)
+ {
+ _typeTable[csharpId] = t;
+ return t;
+ }
+ }
+ //
+ // As a last resort, look for the type in the standard Ice assemblies.
+ // This avoids the need for a program to set a property such as:
+ //
+ // Ice.FactoryAssemblies=Ice
+ //
+ foreach(string a in _iceAssemblies)
+ {
+ string s = csharpId + "," + a;
+ if((t = Type.GetType(s)) != null)
+ {
+ _typeTable[csharpId] = t;
+ return t;
+ }
+ }
+#else
foreach(Assembly a in _loadedAssemblies.Values)
{
if((t = a.GetType(csharpId)) != null)
@@ -102,10 +159,12 @@ namespace IceInternal
return t;
}
}
+#endif
}
return null;
}
+#if !COMPACT
public static Type[] findTypesWithPrefix(string prefix)
{
IceUtilInternal.LinkedList l = new IceUtilInternal.LinkedList();
@@ -134,6 +193,7 @@ namespace IceInternal
}
return result;
}
+#endif
public static object createInstance(Type t)
{
@@ -156,6 +216,7 @@ namespace IceInternal
return t.GetConstructor(constructor).Invoke(new object[]{});
}
+#if !COMPACT
//
// Make sure that all assemblies that are referenced by this process
// are actually loaded. This is necessary so we can use reflection
@@ -208,6 +269,9 @@ namespace IceInternal
private static bool _assembliesLoaded = false;
private static Hashtable _loadedAssemblies = new Hashtable(); // <string, Assembly> pairs.
+#else
+ private static List<string> _iceAssemblies = new List<string>();
+#endif
private static Hashtable _typeTable = new Hashtable(); // <type name, Type> pairs.
private static Mutex _mutex = new Mutex();
diff --git a/cs/src/Ice/AsyncIOThread.cs b/cs/src/Ice/AsyncIOThread.cs
index 9b00acc8298..fbd06625de9 100644
--- a/cs/src/Ice/AsyncIOThread.cs
+++ b/cs/src/Ice/AsyncIOThread.cs
@@ -37,21 +37,31 @@ namespace IceInternal
public void queue(ThreadPoolWorkItem callback)
{
- lock(this)
+ _m.Lock();
+ try
{
Debug.Assert(!_destroyed);
_queue.AddLast(callback);
- Monitor.Pulse(this);
+ _m.Notify();
+ }
+ finally
+ {
+ _m.Unlock();
}
}
public void destroy()
{
- lock(this)
+ _m.Lock();
+ try
{
Debug.Assert(!_destroyed);
_destroyed = true;
- Monitor.Pulse(this);
+ _m.Notify();
+ }
+ finally
+ {
+ _m.Unlock();
}
}
@@ -68,7 +78,8 @@ namespace IceInternal
LinkedList<ThreadPoolWorkItem> queue = new LinkedList<ThreadPoolWorkItem>();
while(true)
{
- lock(this)
+ _m.Lock();
+ try
{
if(_destroyed && _queue.Count == 0)
{
@@ -77,13 +88,17 @@ namespace IceInternal
while(!_destroyed && _queue.Count == 0)
{
- Monitor.Wait(this);
+ _m.Wait();
}
LinkedList<ThreadPoolWorkItem> tmp = queue;
queue = _queue;
_queue = tmp;
}
+ finally
+ {
+ _m.Unlock();
+ }
foreach(ThreadPoolWorkItem cb in queue)
{
@@ -148,5 +163,6 @@ namespace IceInternal
}
private HelperThread _thread;
+ private readonly IceUtilInternal.Monitor _m = new IceUtilInternal.Monitor();
}
}
diff --git a/cs/src/Ice/BasicStream.cs b/cs/src/Ice/BasicStream.cs
index 50c4dd12328..145077735e6 100644
--- a/cs/src/Ice/BasicStream.cs
+++ b/cs/src/Ice/BasicStream.cs
@@ -15,12 +15,14 @@ namespace IceInternal
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
+#if !COMPACT
using System.Runtime.InteropServices;
using System.Runtime.Serialization;
using System.Runtime.Serialization.Formatters.Binary;
+#endif
using System.Threading;
-#if !MANAGED
+#if !MANAGED && !COMPACT
internal static class NativeMethods
{
[DllImport("bzip2.dll")]
@@ -50,7 +52,7 @@ namespace IceInternal
static BasicStream()
{
-#if MANAGED
+#if MANAGED || COMPACT
//
// Protocol compression is not supported when using managed code.
//
@@ -767,6 +769,7 @@ namespace IceInternal
public virtual void writeSerializable(object o)
{
+#if !COMPACT
if(o == null)
{
writeSize(0);
@@ -783,6 +786,9 @@ namespace IceInternal
{
throw new Ice.MarshalException("cannot serialize object:", ex);
}
+#else
+ throw new Ice.MarshalException("serialization not supported");
+#endif
}
public virtual byte readByte()
@@ -868,6 +874,7 @@ namespace IceInternal
public virtual object readSerializable()
{
+#if !COMPACT
int sz = readAndCheckSeqSize(1);
if(sz == 0)
{
@@ -883,6 +890,9 @@ namespace IceInternal
{
throw new Ice.MarshalException("cannot deserialize object:", ex);
}
+#else
+ throw new Ice.MarshalException("serialization not supported");
+#endif
}
public virtual void writeBool(bool v)
@@ -2509,7 +2519,7 @@ namespace IceInternal
_readEncapsStack.patchMap.Remove(patchIndex);
}
-#if !MANAGED
+#if !MANAGED && !COMPACT
static string getBZ2Error(int error)
{
string rc;
@@ -2578,7 +2588,7 @@ namespace IceInternal
public bool compress(ref BasicStream cstream, int headerSize, int compressionLevel)
{
-#if MANAGED
+#if MANAGED || COMPACT
cstream = this;
return false;
#else
@@ -2646,7 +2656,7 @@ namespace IceInternal
public BasicStream uncompress(int headerSize)
{
-#if MANAGED
+#if MANAGED || COMPACT
return this;
#else
if(!_bzlibInstalled)
@@ -2743,7 +2753,7 @@ namespace IceInternal
try
{
- Type c = AssemblyUtil.findType(typeToClass(id));
+ Type c = AssemblyUtil.findType(instance_, typeToClass(id));
if(c == null)
{
return null;
@@ -2832,7 +2842,7 @@ namespace IceInternal
{
try
{
- Type c = AssemblyUtil.findType(typeToClass(id));
+ Type c = AssemblyUtil.findType(instance_, typeToClass(id));
if(c == null)
{
return null;
diff --git a/cs/src/Ice/ByteBuffer.cs b/cs/src/Ice/ByteBuffer.cs
index 828d875e647..7f4034ea6ce 100644
--- a/cs/src/Ice/ByteBuffer.cs
+++ b/cs/src/Ice/ByteBuffer.cs
@@ -42,7 +42,7 @@ namespace IceInternal
{
if(capacity < 0)
{
- throw new ArgumentOutOfRangeException("capacity", capacity, "capacity must be non-negative");
+ throwOutOfRange("capacity", capacity, "capacity must be non-negative");
}
ByteBuffer ret = new ByteBuffer();
ret._position = 0;
@@ -62,11 +62,11 @@ namespace IceInternal
{
if(pos < 0)
{
- throw new ArgumentOutOfRangeException("pos", pos, "position must be non-negative");
+ throwOutOfRange("pos", pos, "position must be non-negative");
}
if(pos > _limit)
{
- throw new ArgumentOutOfRangeException("pos", pos, "position must be less than limit");
+ throwOutOfRange("pos", pos, "position must be less than limit");
}
_position = pos;
return this;
@@ -81,11 +81,11 @@ namespace IceInternal
{
if(newLimit < 0)
{
- throw new ArgumentOutOfRangeException("newLimit", newLimit, "limit must be non-negative");
+ throwOutOfRange("newLimit", newLimit, "limit must be non-negative");
}
if(newLimit > _capacity)
{
- throw new ArgumentOutOfRangeException("newLimit", newLimit, "limit must be less than capacity");
+ throwOutOfRange("newLimit", newLimit, "limit must be less than capacity");
}
_limit = newLimit;
return this;
@@ -124,16 +124,15 @@ namespace IceInternal
{
if(startIndex < 0)
{
- throw new ArgumentOutOfRangeException("startIndex", startIndex, "startIndex must be non-negative");
+ throwOutOfRange("startIndex", startIndex, "startIndex must be non-negative");
}
if(startIndex >= _position)
{
- throw new ArgumentOutOfRangeException("startIndex", startIndex,
- "startIndex must be less than position");
+ throwOutOfRange("startIndex", startIndex, "startIndex must be less than position");
}
if(length < 0)
{
- throw new ArgumentOutOfRangeException("length", length, "length must be non-negative");
+ throwOutOfRange("length", length, "length must be non-negative");
}
if(startIndex + length > _position)
{
@@ -168,12 +167,11 @@ namespace IceInternal
{
if(offset < 0)
{
- throw new ArgumentOutOfRangeException("offset", offset, "offset must be non-negative");
+ throwOutOfRange("offset", offset, "offset must be non-negative");
}
if(offset + length > System.Buffer.ByteLength(b))
{
- throw new ArgumentOutOfRangeException("length", length,
- "insufficient room beyond given offset in destination array");
+ throwOutOfRange("length", length, "insufficient room beyond given offset in destination array");
}
checkUnderflow(length);
System.Buffer.BlockCopy(_bytes, _position, b, offset, length);
@@ -197,12 +195,11 @@ namespace IceInternal
{
if(offset < 0)
{
- throw new ArgumentOutOfRangeException("offset", offset, "offset must be non-negative");
+ throwOutOfRange("offset", offset, "offset must be non-negative");
}
if(offset + length > System.Buffer.ByteLength(b))
{
- throw new ArgumentOutOfRangeException("length", length,
- "insufficient data beyond given offset in source array");
+ throwOutOfRange("length", length, "insufficient data beyond given offset in source array");
}
if(length > 0)
{
@@ -276,7 +273,7 @@ namespace IceInternal
public byte b7;
}
-#if !MANAGED
+#if !MANAGED && !COMPACT
unsafe
#endif
public short getShort()
@@ -284,7 +281,7 @@ namespace IceInternal
checkUnderflow(2);
if(NO._o == _order)
{
-#if !MANAGED
+#if !MANAGED && !COMPACT
fixed(byte* p = &_bytes[_position])
{
_valBytes.shortVal = *((short*)p);
@@ -324,7 +321,7 @@ namespace IceInternal
_position += len;
}
-#if !MANAGED
+#if !MANAGED && !COMPACT
unsafe
#endif
public ByteBuffer putShort(short val)
@@ -333,7 +330,7 @@ namespace IceInternal
_valBytes.shortVal = val;
if(NO._o == _order)
{
-#if !MANAGED
+#if !MANAGED && !COMPACT
fixed(byte* p = &_bytes[_position])
{
*((short*)p) = _valBytes.shortVal;
@@ -374,7 +371,7 @@ namespace IceInternal
return this;
}
-#if !MANAGED
+#if !MANAGED && !COMPACT
unsafe
#endif
public int getInt()
@@ -382,7 +379,7 @@ namespace IceInternal
checkUnderflow(4);
if(NO._o == _order)
{
-#if !MANAGED
+#if !MANAGED && !COMPACT
fixed(byte* p = &_bytes[_position])
{
_valBytes.intVal = *((int*)p);
@@ -435,23 +432,23 @@ namespace IceInternal
return this;
}
-#if !MANAGED
+#if !MANAGED && !COMPACT
unsafe
#endif
public ByteBuffer putInt(int pos, int val)
{
if(pos < 0)
{
- throw new ArgumentOutOfRangeException("pos", pos, "position must be non-negative");
+ throwOutOfRange("pos", pos, "position must be non-negative");
}
if(pos + 4 > _limit)
{
- throw new ArgumentOutOfRangeException("pos", pos, "position must be less than limit - 4");
+ throwOutOfRange("pos", pos, "position must be less than limit - 4");
}
_valBytes.intVal = val;
if(NO._o == _order)
{
-#if !MANAGED
+#if !MANAGED && !COMPACT
fixed(byte* p = &_bytes[pos])
{
*((int*)p) = _valBytes.intVal;
@@ -497,7 +494,7 @@ namespace IceInternal
return this;
}
-#if !MANAGED
+#if !MANAGED && !COMPACT
unsafe
#endif
public long getLong()
@@ -505,7 +502,7 @@ namespace IceInternal
checkUnderflow(8);
if(NO._o == _order)
{
-#if !MANAGED
+#if !MANAGED && !COMPACT
fixed(byte* p = &_bytes[_position])
{
_valBytes.longVal = *((long*)p);
@@ -563,7 +560,7 @@ namespace IceInternal
_position += len;
}
-#if !MANAGED
+#if !MANAGED && !COMPACT
unsafe
#endif
public ByteBuffer putLong(long val)
@@ -572,7 +569,7 @@ namespace IceInternal
_valBytes.longVal = val;
if(NO._o == _order)
{
-#if !MANAGED
+#if !MANAGED && !COMPACT
fixed(byte* p = &_bytes[_position])
{
*((long*)p) = _valBytes.longVal;
@@ -631,7 +628,7 @@ namespace IceInternal
return this;
}
-#if !MANAGED
+#if !MANAGED && !COMPACT
unsafe
#endif
public float getFloat()
@@ -639,7 +636,7 @@ namespace IceInternal
checkUnderflow(4);
if(NO._o == _order)
{
-#if !MANAGED
+#if !MANAGED && !COMPACT
fixed(byte* p = &_bytes[_position])
{
_valBytes.floatVal = *((float*)p);
@@ -685,7 +682,7 @@ namespace IceInternal
_position += len;
}
-#if !MANAGED
+#if !MANAGED && !COMPACT
unsafe
#endif
public ByteBuffer putFloat(float val)
@@ -694,7 +691,7 @@ namespace IceInternal
_valBytes.floatVal = val;
if(NO._o == _order)
{
-#if !MANAGED
+#if !MANAGED && !COMPACT
fixed(byte* p = &_bytes[_position])
{
*((float*)p) = _valBytes.floatVal;
@@ -741,7 +738,7 @@ namespace IceInternal
return this;
}
-#if !MANAGED
+#if !MANAGED && !COMPACT
unsafe
#endif
public double getDouble()
@@ -749,7 +746,7 @@ namespace IceInternal
checkUnderflow(8);
if(NO._o == _order)
{
-#if !MANAGED
+#if !MANAGED && !COMPACT
fixed(byte* p = &_bytes[_position])
{
_valBytes.doubleVal = *((double*)p);
@@ -807,7 +804,7 @@ namespace IceInternal
_position += len;
}
-#if !MANAGED
+#if !MANAGED && !COMPACT
unsafe
#endif
public ByteBuffer putDouble(double val)
@@ -816,7 +813,7 @@ namespace IceInternal
_valBytes.doubleVal = val;
if(NO._o == _order)
{
-#if !MANAGED
+#if !MANAGED && !COMPACT
fixed(byte* p = &_bytes[_position])
{
*((double*)p) = _valBytes.doubleVal;
@@ -926,5 +923,14 @@ namespace IceInternal
{
}
}
+
+ private static void throwOutOfRange(string param, object value, string message)
+ {
+#if COMPACT
+ throw new ArgumentOutOfRangeException(param, message);
+#else
+ throw new ArgumentOutOfRangeException(param, value, message);
+#endif
+ }
}
}
diff --git a/cs/src/Ice/ConnectRequestHandler.cs b/cs/src/Ice/ConnectRequestHandler.cs
index fd07078e3b7..df5f91265ef 100644
--- a/cs/src/Ice/ConnectRequestHandler.cs
+++ b/cs/src/Ice/ConnectRequestHandler.cs
@@ -45,7 +45,8 @@ namespace IceInternal
{
_reference.getConnection(this);
- lock(this)
+ _m.Lock();
+ try
{
if(initialized())
{
@@ -59,15 +60,20 @@ namespace IceInternal
return this;
}
}
+ finally
+ {
+ _m.Unlock();
+ }
}
public void prepareBatchRequest(BasicStream os)
{
- lock(this)
+ _m.Lock();
+ try
{
while(_batchRequestInProgress)
{
- Monitor.Wait(this);
+ _m.Wait();
}
if(!initialized())
@@ -77,18 +83,23 @@ namespace IceInternal
return;
}
}
+ finally
+ {
+ _m.Unlock();
+ }
_connection.prepareBatchRequest(os);
}
public void finishBatchRequest(BasicStream os)
{
- lock(this)
+ _m.Lock();
+ try
{
if(!initialized())
{
Debug.Assert(_batchRequestInProgress);
_batchRequestInProgress = false;
- Monitor.PulseAll(this);
+ _m.NotifyAll();
_batchStream.swap(os);
@@ -102,18 +113,23 @@ namespace IceInternal
return;
}
}
+ finally
+ {
+ _m.Unlock();
+ }
_connection.finishBatchRequest(os, _compress);
}
public void abortBatchRequest()
{
- lock(this)
+ _m.Lock();
+ try
{
if(!initialized())
{
Debug.Assert(_batchRequestInProgress);
_batchRequestInProgress = false;
- Monitor.PulseAll(this);
+ _m.NotifyAll();
BasicStream dummy = new BasicStream(_reference.getInstance(), _batchAutoFlush);
_batchStream.swap(dummy);
@@ -122,6 +138,10 @@ namespace IceInternal
return;
}
}
+ finally
+ {
+ _m.Unlock();
+ }
_connection.abortBatchRequest();
}
@@ -141,7 +161,8 @@ namespace IceInternal
public bool sendAsyncRequest(OutgoingAsync @out, out Ice.AsyncCallback sentCallback)
{
- lock(this)
+ _m.Lock();
+ try
{
if(!initialized())
{
@@ -150,6 +171,10 @@ namespace IceInternal
return false;
}
}
+ finally
+ {
+ _m.Unlock();
+ }
return _connection.sendAsyncRequest(@out, _compress, _response, out sentCallback);
}
@@ -160,7 +185,8 @@ namespace IceInternal
public bool flushAsyncBatchRequests(BatchOutgoingAsync @out, out Ice.AsyncCallback sentCallback)
{
- lock(this)
+ _m.Lock();
+ try
{
if(!initialized())
{
@@ -169,31 +195,45 @@ namespace IceInternal
return false;
}
}
+ finally
+ {
+ _m.Unlock();
+ }
return _connection.flushAsyncBatchRequests(@out, out sentCallback);
}
public Outgoing getOutgoing(string operation, Ice.OperationMode mode, Dictionary<string, string> context)
{
- lock(this)
+ _m.Lock();
+ try
{
if(!initialized())
{
return new IceInternal.Outgoing(this, operation, mode, context);
}
}
+ finally
+ {
+ _m.Unlock();
+ }
return _connection.getOutgoing(this, operation, mode, context);
}
public void reclaimOutgoing(Outgoing og)
{
- lock(this)
+ _m.Lock();
+ try
{
if(_connection == null)
{
return;
}
}
+ finally
+ {
+ _m.Unlock();
+ }
_connection.reclaimOutgoing(og);
}
@@ -207,16 +247,21 @@ namespace IceInternal
{
if(waitInit)
{
- lock(this)
+ _m.Lock();
+ try
{
//
// Wait for the connection establishment to complete or fail.
//
while(!_initialized && _exception == null)
{
- Monitor.Wait(this);
+ _m.Wait();
}
}
+ finally
+ {
+ _m.Unlock();
+ }
}
if(_exception != null)
@@ -236,7 +281,8 @@ namespace IceInternal
public void setConnection(Ice.ConnectionI connection, bool compress)
{
- lock(this)
+ _m.Lock();
+ try
{
Debug.Assert(_exception == null && _connection == null);
Debug.Assert(_updateRequestHandler || _requests.Count == 0);
@@ -244,6 +290,10 @@ namespace IceInternal
_connection = connection;
_compress = compress;
}
+ finally
+ {
+ _m.Unlock();
+ }
//
// If this proxy is for a non-local object, and we are using a router, then
@@ -263,7 +313,8 @@ namespace IceInternal
public void setException(Ice.LocalException ex)
{
- lock(this)
+ _m.Lock();
+ try
{
Debug.Assert(!_initialized && _exception == null);
Debug.Assert(_updateRequestHandler || _requests.Count == 0);
@@ -285,7 +336,11 @@ namespace IceInternal
});
}
- Monitor.PulseAll(this);
+ _m.NotifyAll();
+ }
+ finally
+ {
+ _m.Unlock();
}
}
@@ -328,7 +383,7 @@ namespace IceInternal
{
while(_flushing && _exception == null)
{
- Monitor.Wait(this);
+ _m.Wait();
}
if(_exception != null)
@@ -344,13 +399,14 @@ namespace IceInternal
private void flushRequests()
{
- lock(this)
+ _m.Lock();
+ try
{
Debug.Assert(_connection != null && !_initialized);
while(_batchRequestInProgress)
{
- Monitor.Wait(this);
+ _m.Wait();
}
//
@@ -360,6 +416,10 @@ namespace IceInternal
//
_flushing = true;
}
+ finally
+ {
+ _m.Unlock();
+ }
LinkedList<Request> sentCallbacks = new LinkedList<Request>();
try
@@ -411,7 +471,8 @@ namespace IceInternal
}
catch(LocalExceptionWrapper ex)
{
- lock(this)
+ _m.Lock();
+ try
{
Debug.Assert(_exception == null && _requests.Count > 0);
_exception = ex.get();
@@ -420,10 +481,15 @@ namespace IceInternal
flushRequestsWithException(ex);
});
}
+ finally
+ {
+ _m.Unlock();
+ }
}
catch(Ice.LocalException ex)
{
- lock(this)
+ _m.Lock();
+ try
{
Debug.Assert(_exception == null && _requests.Count > 0);
_exception = ex;
@@ -432,6 +498,10 @@ namespace IceInternal
flushRequestsWithException(ex);
});
}
+ finally
+ {
+ _m.Unlock();
+ }
}
if(sentCallbacks.Count > 0)
@@ -467,7 +537,8 @@ namespace IceInternal
_proxy.setRequestHandler__(_delegate, new ConnectionRequestHandler(_reference, _connection, _compress));
}
- lock(this)
+ _m.Lock();
+ try
{
Debug.Assert(!_initialized);
if(_exception == null)
@@ -477,7 +548,11 @@ namespace IceInternal
}
_proxy = null; // Break cyclic reference count.
_delegate = null; // Break cyclic reference count.
- Monitor.PulseAll(this);
+ _m.NotifyAll();
+ }
+ finally
+ {
+ _m.Unlock();
}
}
@@ -534,5 +609,7 @@ namespace IceInternal
private int _batchRequestsSize;
private BasicStream _batchStream;
private bool _updateRequestHandler;
+
+ private readonly IceUtilInternal.Monitor _m = new IceUtilInternal.Monitor();
}
}
diff --git a/cs/src/Ice/ConnectionFactory.cs b/cs/src/Ice/ConnectionFactory.cs
index 0b908a0d73e..11b72a87553 100644
--- a/cs/src/Ice/ConnectionFactory.cs
+++ b/cs/src/Ice/ConnectionFactory.cs
@@ -54,7 +54,8 @@ namespace IceInternal
public void destroy()
{
- lock(this)
+ _m.Lock();
+ try
{
if(_destroyed)
{
@@ -70,14 +71,19 @@ namespace IceInternal
}
_destroyed = true;
- Monitor.PulseAll(this);
+ _m.NotifyAll();
+ }
+ finally
+ {
+ _m.Unlock();
}
}
public void waitUntilFinished()
{
Dictionary<Connector, ICollection<Ice.ConnectionI>> connections = null;
- lock(this)
+ _m.Lock();
+ try
{
//
// First we wait until the factory is destroyed. We also
@@ -87,7 +93,7 @@ namespace IceInternal
//
while(!_destroyed || _pending.Count > 0 || _pendingConnectCount > 0)
{
- Monitor.Wait(this);
+ _m.Wait();
}
//
@@ -96,6 +102,10 @@ namespace IceInternal
//
connections = new Dictionary<Connector, ICollection<Ice.ConnectionI>>(_connections);
}
+ finally
+ {
+ _m.Unlock();
+ }
//
// Now we wait until the destruction of each connection is finished.
@@ -108,7 +118,8 @@ namespace IceInternal
}
}
- lock(this)
+ _m.Lock();
+ try
{
// Ensure all the connections are finished and reapable at this point.
ICollection<Ice.ConnectionI> cons = _reaper.swapConnections();
@@ -129,6 +140,10 @@ namespace IceInternal
Debug.Assert(_connectionsByEndpoint.Count == 0);
}
}
+ finally
+ {
+ _m.Unlock();
+ }
}
public Ice.ConnectionI create(EndpointI[] endpts, bool hasMore, Ice.EndpointSelectionType selType,
@@ -317,7 +332,8 @@ namespace IceInternal
public void setRouterInfo(IceInternal.RouterInfo routerInfo)
{
- lock(this)
+ _m.Lock();
+ try
{
if(_destroyed)
{
@@ -370,11 +386,16 @@ namespace IceInternal
}
}
}
+ finally
+ {
+ _m.Unlock();
+ }
}
public void removeAdapter(Ice.ObjectAdapter adapter)
{
- lock(this)
+ _m.Lock();
+ try
{
if(_destroyed)
{
@@ -392,13 +413,18 @@ namespace IceInternal
}
}
}
+ finally
+ {
+ _m.Unlock();
+ }
}
public void flushAsyncBatchRequests(CommunicatorBatchOutgoingAsync outAsync)
{
ICollection<Ice.ConnectionI> c = new List<Ice.ConnectionI>();
- lock(this)
+ _m.Lock();
+ try
{
if(!_destroyed)
{
@@ -414,6 +440,10 @@ namespace IceInternal
}
}
}
+ finally
+ {
+ _m.Unlock();
+ }
foreach(Ice.ConnectionI conn in c)
{
@@ -462,7 +492,8 @@ namespace IceInternal
private Ice.ConnectionI findConnection(List<EndpointI> endpoints, out bool compress)
{
- lock(this)
+ _m.Lock();
+ try
{
if(_destroyed)
{
@@ -500,6 +531,10 @@ namespace IceInternal
compress = false; // Satisfy the compiler
return null;
}
+ finally
+ {
+ _m.Unlock();
+ }
}
//
@@ -552,7 +587,8 @@ namespace IceInternal
// the asynchronous requests waiting on a connection to be established.
//
- lock(this)
+ _m.Lock();
+ try
{
if(_destroyed)
{
@@ -560,24 +596,34 @@ namespace IceInternal
}
++_pendingConnectCount;
}
+ finally
+ {
+ _m.Unlock();
+ }
}
internal void decPendingConnectCount()
{
- lock(this)
+ _m.Lock();
+ try
{
--_pendingConnectCount;
Debug.Assert(_pendingConnectCount >= 0);
if(_destroyed && _pendingConnectCount == 0)
{
- Monitor.PulseAll(this);
+ _m.NotifyAll();
}
}
+ finally
+ {
+ _m.Unlock();
+ }
}
private Ice.ConnectionI getConnection(List<ConnectorInfo> connectors, ConnectCallback cb, out bool compress)
{
- lock(this)
+ _m.Lock();
+ try
{
if(_destroyed)
{
@@ -629,7 +675,7 @@ namespace IceInternal
//
if(cb == null)
{
- Monitor.Wait(this);
+ _m.Wait();
}
else
{
@@ -647,6 +693,10 @@ namespace IceInternal
}
}
}
+ finally
+ {
+ _m.Unlock();
+ }
//
// At this point, we're responsible for establishing the connection to one of
@@ -665,7 +715,8 @@ namespace IceInternal
private Ice.ConnectionI createConnection(Transceiver transceiver, ConnectorInfo ci)
{
- lock(this)
+ _m.Lock();
+ try
{
Debug.Assert(_pending.ContainsKey(ci.connector) && transceiver != null);
@@ -703,6 +754,10 @@ namespace IceInternal
_connectionsByEndpoint.Add(connection.endpoint().compress(true), connection);
return connection;
}
+ finally
+ {
+ _m.Unlock();
+ }
}
private void finishGetConnection(List<ConnectorInfo> connectors,
@@ -717,7 +772,8 @@ namespace IceInternal
}
HashSet<ConnectCallback> callbacks = new HashSet<ConnectCallback>();
- lock(this)
+ _m.Lock();
+ try
{
foreach(ConnectorInfo c in connectors)
{
@@ -748,7 +804,11 @@ namespace IceInternal
{
cc.removeFromPending();
}
- Monitor.PulseAll(this);
+ _m.NotifyAll();
+ }
+ finally
+ {
+ _m.Unlock();
}
bool compress;
@@ -781,7 +841,8 @@ namespace IceInternal
}
HashSet<ConnectCallback> callbacks = new HashSet<ConnectCallback>();
- lock(this)
+ _m.Lock();
+ try
{
foreach(ConnectorInfo c in connectors)
{
@@ -808,7 +869,11 @@ namespace IceInternal
Debug.Assert(!failedCallbacks.Contains(cc));
cc.removeFromPending();
}
- Monitor.PulseAll(this);
+ _m.NotifyAll();
+ }
+ finally
+ {
+ _m.Unlock();
}
foreach(ConnectCallback cc in callbacks)
@@ -1205,39 +1270,57 @@ namespace IceInternal
private int _pendingConnectCount;
private static System.Random rand_ = new System.Random(unchecked((int)System.DateTime.Now.Ticks));
+
+ private readonly IceUtilInternal.Monitor _m = new IceUtilInternal.Monitor();
}
public sealed class IncomingConnectionFactory : EventHandler, Ice.ConnectionI.StartCallback
{
public void activate()
{
- lock(this)
+ _m.Lock();
+ try
{
setState(StateActive);
}
+ finally
+ {
+ _m.Unlock();
+ }
}
public void hold()
{
- lock(this)
+ _m.Lock();
+ try
{
setState(StateHolding);
}
+ finally
+ {
+ _m.Unlock();
+ }
}
public void destroy()
{
- lock(this)
+ _m.Lock();
+ try
{
setState(StateClosed);
}
+ finally
+ {
+ _m.Unlock();
+ }
}
public void waitUntilHolding()
{
ICollection<Ice.ConnectionI> connections;
- lock(this)
+ _m.Lock();
+ try
{
//
// First we wait until the connection factory itself is in
@@ -1245,7 +1328,7 @@ namespace IceInternal
//
while(_state < StateHolding)
{
- Monitor.Wait(this);
+ _m.Wait();
}
//
@@ -1254,6 +1337,10 @@ namespace IceInternal
//
connections = new List<Ice.ConnectionI>(_connections);
}
+ finally
+ {
+ _m.Unlock();
+ }
//
// Now we wait until each connection is in holding state.
@@ -1268,7 +1355,8 @@ namespace IceInternal
{
ICollection<Ice.ConnectionI> connections = null;
- lock(this)
+ _m.Lock();
+ try
{
//
// First we wait until the factory is destroyed. If we are using
@@ -1276,7 +1364,7 @@ namespace IceInternal
//
while(_state != StateFinished)
{
- Monitor.Wait(this);
+ _m.Wait();
}
//
@@ -1290,13 +1378,18 @@ namespace IceInternal
//
connections = new List<Ice.ConnectionI>(_connections);
}
+ finally
+ {
+ _m.Unlock();
+ }
foreach(Ice.ConnectionI connection in connections)
{
connection.waitUntilFinished();
}
- lock(this)
+ _m.Lock();
+ try
{
// Ensure all the connections are finished and reapable at this point.
ICollection<Ice.ConnectionI> cons = _reaper.swapConnections();
@@ -1307,6 +1400,10 @@ namespace IceInternal
}
_connections.Clear();
}
+ finally
+ {
+ _m.Unlock();
+ }
}
public EndpointI endpoint()
@@ -1317,7 +1414,8 @@ namespace IceInternal
public ICollection<Ice.ConnectionI> connections()
{
- lock(this)
+ _m.Lock();
+ try
{
ICollection<Ice.ConnectionI> connections = new List<Ice.ConnectionI>();
@@ -1334,6 +1432,10 @@ namespace IceInternal
return connections;
}
+ finally
+ {
+ _m.Unlock();
+ }
}
public void flushAsyncBatchRequests(CommunicatorBatchOutgoingAsync outAsync)
@@ -1378,7 +1480,9 @@ namespace IceInternal
}
finally
{
+#if !COMPACT
System.Environment.FailFast(s);
+#endif
}
return false;
}
@@ -1403,7 +1507,9 @@ namespace IceInternal
}
finally
{
+#if !COMPACT
System.Environment.FailFast(s);
+#endif
}
return false;
}
@@ -1421,9 +1527,10 @@ namespace IceInternal
{
Ice.ConnectionI connection = null;
- ThreadPoolMessage msg = new ThreadPoolMessage(this);
+ ThreadPoolMessage msg = new ThreadPoolMessage(_m);
- lock(this)
+ _m.Lock();
+ try
{
if(!msg.startIOScope(ref current))
{
@@ -1472,7 +1579,9 @@ namespace IceInternal
}
finally
{
+#if !COMPACT
System.Environment.FailFast(s);
+#endif
}
}
@@ -1520,6 +1629,10 @@ namespace IceInternal
msg.finishIOScope(ref current);
}
}
+ finally
+ {
+ _m.Unlock();
+ }
Debug.Assert(connection != null);
connection.start(this);
@@ -1527,11 +1640,16 @@ namespace IceInternal
public override void finished(ref ThreadPoolCurrent current)
{
- lock(this)
+ _m.Lock();
+ try
{
Debug.Assert(_state == StateClosed);
setState(StateFinished);
}
+ finally
+ {
+ _m.Unlock();
+ }
}
public override string ToString()
@@ -1550,7 +1668,8 @@ namespace IceInternal
//
public void connectionStartCompleted(Ice.ConnectionI connection)
{
- lock(this)
+ _m.Lock();
+ try
{
//
// Initially, connections are in the holding state. If the factory is active
@@ -1561,11 +1680,16 @@ namespace IceInternal
connection.activate();
}
}
+ finally
+ {
+ _m.Unlock();
+ }
}
public void connectionStartFailed(Ice.ConnectionI connection, Ice.LocalException ex)
{
- lock(this)
+ _m.Lock();
+ try
{
if(_state >= StateClosed)
{
@@ -1577,6 +1701,10 @@ namespace IceInternal
warning(ex);
}
}
+ finally
+ {
+ _m.Unlock();
+ }
}
public IncomingConnectionFactory(Instance instance, EndpointI endpoint, Ice.ObjectAdapter adapter,
@@ -1739,7 +1867,7 @@ namespace IceInternal
}
_state = state;
- Monitor.PulseAll(this);
+ _m.NotifyAll();
}
private void warning(Ice.LocalException ex)
@@ -1762,6 +1890,8 @@ namespace IceInternal
private HashSet<Ice.ConnectionI> _connections;
private int _state;
+
+ private readonly IceUtilInternal.Monitor _m = new IceUtilInternal.Monitor();
}
}
diff --git a/cs/src/Ice/ConnectionI.cs b/cs/src/Ice/ConnectionI.cs
index c4aee3ae6fa..46b3f1f34f6 100644
--- a/cs/src/Ice/ConnectionI.cs
+++ b/cs/src/Ice/ConnectionI.cs
@@ -42,7 +42,8 @@ namespace Ice
{
try
{
- lock(this)
+ _m.Lock();
+ try
{
//
// The connection might already be closed if the communicator was destroyed.
@@ -66,7 +67,7 @@ namespace Ice
//
while(_state <= StateNotValidated)
{
- Monitor.Wait(this);
+ _m.Wait();
}
if(_state >= StateClosing)
@@ -81,6 +82,10 @@ namespace Ice
//
setState(StateHolding);
}
+ finally
+ {
+ _m.Unlock();
+ }
}
catch(LocalException ex)
{
@@ -105,7 +110,8 @@ namespace Ice
public void activate()
{
- lock(this)
+ _m.Lock();
+ try
{
if(_state <= StateNotValidated)
{
@@ -119,11 +125,16 @@ namespace Ice
setState(StateActive);
}
+ finally
+ {
+ _m.Unlock();
+ }
}
public void hold()
{
- lock(this)
+ _m.Lock();
+ try
{
if(_state <= StateNotValidated)
{
@@ -132,6 +143,10 @@ namespace Ice
setState(StateHolding);
}
+ finally
+ {
+ _m.Unlock();
+ }
}
// DestructionReason.
@@ -140,7 +155,8 @@ namespace Ice
public void destroy(int reason)
{
- lock(this)
+ _m.Lock();
+ try
{
switch(reason)
{
@@ -157,11 +173,16 @@ namespace Ice
}
}
}
+ finally
+ {
+ _m.Unlock();
+ }
}
public void close(bool force)
{
- lock(this)
+ _m.Lock();
+ try
{
if(force)
{
@@ -178,20 +199,29 @@ namespace Ice
//
while(_requests.Count != 0 || _asyncRequests.Count != 0)
{
- Monitor.Wait(this);
+ _m.Wait();
}
setState(StateClosing, new CloseConnectionException());
}
}
+ finally
+ {
+ _m.Unlock();
+ }
}
public bool isActiveOrHolding()
{
- lock(this)
+ _m.Lock();
+ try
{
return _state > StateNotValidated && _state < StateClosing;
}
+ finally
+ {
+ _m.Unlock();
+ }
}
public bool isFinished()
@@ -201,7 +231,7 @@ namespace Ice
// threads operating in this connection object, connection
// destruction is considered as not yet finished.
//
- if(!Monitor.TryEnter(this))
+ if(!_m.TryLock())
{
return false;
}
@@ -217,14 +247,15 @@ namespace Ice
}
finally
{
- Monitor.Exit(this);
+ _m.Unlock();
}
return true;
}
public void throwException()
{
- lock(this)
+ _m.Lock();
+ try
{
if(_exception != null)
{
@@ -232,22 +263,32 @@ namespace Ice
throw _exception;
}
}
+ finally
+ {
+ _m.Unlock();
+ }
}
public void waitUntilHolding()
{
- lock(this)
+ _m.Lock();
+ try
{
while(_state < StateHolding || _dispatchCount > 0)
{
- Monitor.Wait(this);
+ _m.Wait();
}
}
+ finally
+ {
+ _m.Unlock();
+ }
}
public void waitUntilFinished()
{
- lock(this)
+ _m.Lock();
+ try
{
//
// We wait indefinitely until the connection is finished and all
@@ -257,7 +298,7 @@ namespace Ice
//
while(_state < StateFinished || _dispatchCount > 0)
{
- Monitor.Wait(this);
+ _m.Wait();
}
Debug.Assert(_state == StateFinished && _dispatchCount == 0);
@@ -267,11 +308,15 @@ namespace Ice
//
_adapter = null;
}
+ finally
+ {
+ _m.Unlock();
+ }
}
public void monitor(long now)
{
- if(!Monitor.TryEnter(this))
+ if(!_m.TryLock())
{
return;
}
@@ -302,7 +347,7 @@ namespace Ice
}
finally
{
- Monitor.Exit(this);
+ _m.Unlock();
}
}
@@ -310,7 +355,8 @@ namespace Ice
{
IceInternal.BasicStream os = og.ostr();
- lock(this)
+ _m.Lock();
+ try
{
if(_exception != null)
{
@@ -377,6 +423,10 @@ namespace Ice
return sent;
}
+ finally
+ {
+ _m.Unlock();
+ }
}
public bool sendAsyncRequest(IceInternal.OutgoingAsync og, bool compress, bool response,
@@ -384,7 +434,8 @@ namespace Ice
{
IceInternal.BasicStream os = og.ostr__;
- lock(this)
+ _m.Lock();
+ try
{
if(_exception != null)
{
@@ -448,18 +499,23 @@ namespace Ice
}
return sent;
}
+ finally
+ {
+ _m.Unlock();
+ }
}
public void prepareBatchRequest(IceInternal.BasicStream os)
{
- lock(this)
+ _m.Lock();
+ try
{
//
// Wait if flushing is currently in progress.
//
while(_batchStreamInUse && _exception == null)
{
- Monitor.Wait(this);
+ _m.Wait();
}
if(_exception != null)
@@ -504,13 +560,18 @@ namespace Ice
// finishBatchRequest() or abortBatchRequest() is called.
//
}
+ finally
+ {
+ _m.Unlock();
+ }
}
public void finishBatchRequest(IceInternal.BasicStream os, bool compress)
{
try
{
- lock(this)
+ _m.Lock();
+ try
{
//
// Get the batch stream back.
@@ -624,7 +685,11 @@ namespace Ice
//
Debug.Assert(_batchStreamInUse);
_batchStreamInUse = false;
- Monitor.PulseAll(this);
+ _m.NotifyAll();
+ }
+ finally
+ {
+ _m.Unlock();
}
}
catch(LocalException)
@@ -636,7 +701,8 @@ namespace Ice
public void abortBatchRequest()
{
- lock(this)
+ _m.Lock();
+ try
{
_batchStream = new IceInternal.BasicStream(_instance, _batchAutoFlush);
_batchRequestNum = 0;
@@ -645,7 +711,11 @@ namespace Ice
Debug.Assert(_batchStreamInUse);
_batchStreamInUse = false;
- Monitor.PulseAll(this);
+ _m.NotifyAll();
+ }
+ finally
+ {
+ _m.Unlock();
}
}
@@ -698,11 +768,12 @@ namespace Ice
public bool flushBatchRequests(IceInternal.BatchOutgoing @out)
{
- lock(this)
+ _m.Lock();
+ try
{
while(_batchStreamInUse && _exception == null)
{
- Monitor.Wait(this);
+ _m.Wait();
}
if(_exception != null)
@@ -747,15 +818,20 @@ namespace Ice
return sent;
}
+ finally
+ {
+ _m.Unlock();
+ }
}
public bool flushAsyncBatchRequests(IceInternal.BatchOutgoingAsync outAsync, out Ice.AsyncCallback sentCallback)
{
- lock(this)
+ _m.Lock();
+ try
{
while(_batchStreamInUse && _exception == null)
{
- Monitor.Wait(this);
+ _m.Wait();
}
if(_exception != null)
@@ -803,11 +879,16 @@ namespace Ice
_batchMarker = 0;
return sent;
}
+ finally
+ {
+ _m.Unlock();
+ }
}
public void sendResponse(IceInternal.BasicStream os, byte compressFlag)
{
- lock(this)
+ _m.Lock();
+ try
{
Debug.Assert(_state > StateNotValidated);
@@ -819,7 +900,7 @@ namespace Ice
{
_reaper.add(this);
}
- Monitor.PulseAll(this);
+ _m.NotifyAll();
}
if(_state >= StateClosed)
@@ -840,11 +921,16 @@ namespace Ice
setState(StateClosed, ex);
}
}
+ finally
+ {
+ _m.Unlock();
+ }
}
public void sendNoResponse()
{
- lock(this)
+ _m.Lock();
+ try
{
Debug.Assert(_state > StateNotValidated);
@@ -856,7 +942,7 @@ namespace Ice
{
_reaper.add(this);
}
- Monitor.PulseAll(this);
+ _m.NotifyAll();
}
if(_state >= StateClosed)
@@ -875,6 +961,10 @@ namespace Ice
setState(StateClosed, ex);
}
}
+ finally
+ {
+ _m.Unlock();
+ }
}
public IceInternal.EndpointI endpoint()
@@ -889,7 +979,8 @@ namespace Ice
public void setAdapter(ObjectAdapter adapter)
{
- lock(this)
+ _m.Lock();
+ try
{
if(_state <= StateNotValidated || _state >= StateClosing)
{
@@ -917,14 +1008,23 @@ namespace Ice
// registered, even if we add or remove an object adapter.
//
}
+ finally
+ {
+ _m.Unlock();
+ }
}
public ObjectAdapter getAdapter()
{
- lock(this)
+ _m.Lock();
+ try
{
return _adapter;
}
+ finally
+ {
+ _m.Unlock();
+ }
}
public Endpoint getEndpoint()
@@ -1002,8 +1102,9 @@ namespace Ice
Queue<OutgoingMessage> sentCBs = null;
MessageInfo info = new MessageInfo();
- IceInternal.ThreadPoolMessage msg = new IceInternal.ThreadPoolMessage(this);
- lock(this)
+ IceInternal.ThreadPoolMessage msg = new IceInternal.ThreadPoolMessage(_m);
+ _m.Lock();
+ try
{
if(!msg.startIOScope(ref current))
{
@@ -1259,6 +1360,10 @@ namespace Ice
msg.destroy(ref c);
});
}
+ finally
+ {
+ _m.Unlock();
+ }
}
private void dispatch(StartCallback startCB, Queue<OutgoingMessage> sentCBs, MessageInfo info)
@@ -1308,7 +1413,8 @@ namespace Ice
//
if(sentCBs != null || info.outAsync != null)
{
- lock(this)
+ _m.Lock();
+ try
{
if(--_dispatchCount == 0)
{
@@ -1327,19 +1433,28 @@ namespace Ice
{
_reaper.add(this);
}
- Monitor.PulseAll(this);
+ _m.NotifyAll();
}
}
+ finally
+ {
+ _m.Unlock();
+ }
}
}
public override void finished(ref IceInternal.ThreadPoolCurrent current)
{
- lock(this)
+ _m.Lock();
+ try
{
Debug.Assert(_state == StateClosed);
unscheduleTimeout(IceInternal.SocketOperation.Read | IceInternal.SocketOperation.Write);
}
+ finally
+ {
+ _m.Unlock();
+ }
//
// If there are no callbacks to call, we don't call ioCompleted() since we're not going
@@ -1454,7 +1569,8 @@ namespace Ice
// This must be done last as this will cause waitUntilFinished() to return (and communicator
// objects such as the timer might be destroyed too).
//
- lock(this)
+ _m.Lock();
+ try
{
setState(StateFinished);
if(_dispatchCount == 0)
@@ -1462,6 +1578,10 @@ namespace Ice
_reaper.add(this);
}
}
+ finally
+ {
+ _m.Unlock();
+ }
}
public override string ToString()
@@ -1471,7 +1591,8 @@ namespace Ice
public void timedOut()
{
- lock(this)
+ _m.Lock();
+ try
{
if(_state <= StateNotValidated)
{
@@ -1486,6 +1607,10 @@ namespace Ice
setState(StateClosed, new CloseTimeoutException());
}
}
+ finally
+ {
+ _m.Unlock();
+ }
}
public string type()
@@ -1501,7 +1626,8 @@ namespace Ice
public ConnectionInfo
getInfo()
{
- lock(this)
+ _m.Lock();
+ try
{
if(_state >= StateClosed)
{
@@ -1512,6 +1638,10 @@ namespace Ice
info.incoming = _connector == null;
return info;
}
+ finally
+ {
+ _m.Unlock();
+ }
}
public string ice_toString_()
@@ -1521,10 +1651,15 @@ namespace Ice
public void exception(LocalException ex)
{
- lock(this)
+ _m.Lock();
+ try
{
setState(StateClosed, ex);
}
+ finally
+ {
+ _m.Unlock();
+ }
}
public void invokeException(LocalException ex, int invokeNum)
@@ -1534,7 +1669,8 @@ namespace Ice
// called in case of a fatal exception we decrement _dispatchCount here.
//
- lock(this)
+ _m.Lock();
+ try
{
setState(StateClosed, ex);
@@ -1549,10 +1685,14 @@ namespace Ice
{
_reaper.add(this);
}
- Monitor.PulseAll(this);
+ _m.NotifyAll();
}
}
}
+ finally
+ {
+ _m.Unlock();
+ }
}
static ConnectionI()
@@ -1845,7 +1985,7 @@ namespace Ice
_state = state;
- Monitor.PulseAll(this);
+ _m.NotifyAll();
if(_state == StateClosing && _dispatchCount == 0)
{
@@ -2335,7 +2475,7 @@ namespace Ice
}
_asyncRequests.Remove(info.requestId);
}
- Monitor.PulseAll(this); // Notify threads blocked in close(false)
+ _m.NotifyAll(); // Notify threads blocked in close(false)
break;
}
@@ -2743,5 +2883,7 @@ namespace Ice
private static bool _compressionSupported;
private bool _cacheBuffers;
+
+ private readonly IceUtilInternal.Monitor _m = new IceUtilInternal.Monitor();
}
}
diff --git a/cs/src/Ice/DefaultsAndOverrides.cs b/cs/src/Ice/DefaultsAndOverrides.cs
index 24586a453cc..4ddd401754e 100644
--- a/cs/src/Ice/DefaultsAndOverrides.cs
+++ b/cs/src/Ice/DefaultsAndOverrides.cs
@@ -66,6 +66,10 @@ namespace IceInternal
overrideCloseTimeoutValue = -1;
}
+#if COMPACT
+ overrideCompress = false;
+ overrideCompressValue = false;
+#else
val = properties.getProperty("Ice.Override.Compress");
if(val.Length > 0)
{
@@ -83,6 +87,7 @@ namespace IceInternal
overrideCompress = !BasicStream.compressible();
overrideCompressValue = false;
}
+#endif
val = properties.getProperty("Ice.Override.Secure");
if(val.Length > 0)
diff --git a/cs/src/Ice/EndpointHostResolver.cs b/cs/src/Ice/EndpointHostResolver.cs
index 983e18c0128..8edfd620446 100644
--- a/cs/src/Ice/EndpointHostResolver.cs
+++ b/cs/src/Ice/EndpointHostResolver.cs
@@ -54,7 +54,8 @@ namespace IceInternal
return;
}
- lock(this)
+ _m.Lock();
+ try
{
Debug.Assert(!_destroyed);
@@ -64,17 +65,26 @@ namespace IceInternal
entry.endpoint = endpoint;
entry.callback = callback;
_queue.AddLast(entry);
- Monitor.Pulse(this);
+ _m.Notify();
+ }
+ finally
+ {
+ _m.Unlock();
}
}
public void destroy()
{
- lock(this)
+ _m.Lock();
+ try
{
Debug.Assert(!_destroyed);
_destroyed = true;
- Monitor.Pulse(this);
+ _m.Notify();
+ }
+ finally
+ {
+ _m.Unlock();
}
}
@@ -91,11 +101,12 @@ namespace IceInternal
while(true)
{
ResolveEntry resolve;
- lock(this)
+ _m.Lock();
+ try
{
while(!_destroyed && _queue.Count == 0)
{
- Monitor.Wait(this);
+ _m.Wait();
}
if(_destroyed)
@@ -106,6 +117,10 @@ namespace IceInternal
resolve = _queue.First.Value;
_queue.RemoveFirst();
}
+ finally
+ {
+ _m.Unlock();
+ }
try
{
@@ -184,5 +199,7 @@ namespace IceInternal
}
private HelperThread _thread;
+
+ private readonly IceUtilInternal.Monitor _m = new IceUtilInternal.Monitor();
}
}
diff --git a/cs/src/Ice/HashSet.cs b/cs/src/Ice/HashSet.cs
new file mode 100644
index 00000000000..7fe6453451f
--- /dev/null
+++ b/cs/src/Ice/HashSet.cs
@@ -0,0 +1,114 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2010 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.
+//
+// **********************************************************************
+
+#if COMPACT
+
+//
+// System.Collections.Generic.HashSet is not available in the .NET Compact Framework.
+// This class is a minimal implementation that provides only the methods required by
+// Ice internals.
+//
+using System;
+using System.Collections.Generic;
+
+namespace IceInternal
+{
+ public class HashSet<T> : ICollection<T>
+ {
+ public HashSet()
+ {
+ entries_ = new Dictionary<T, bool>();
+ }
+
+ public HashSet(int capacity)
+ {
+ entries_ = new Dictionary<T, bool>(capacity);
+ }
+
+ void ICollection<T>.Add(T item)
+ {
+ try
+ {
+ entries_.Add(item, false);
+ }
+ catch(ArgumentException)
+ {
+ // Item already present.
+ }
+ }
+
+ public bool Add(T item)
+ {
+ try
+ {
+ entries_.Add(item, false);
+ }
+ catch(ArgumentException)
+ {
+ return false; // Item already present.
+ }
+ return true;
+ }
+
+ public void Clear()
+ {
+ entries_.Clear();
+ }
+
+ public bool Contains(T item)
+ {
+ return entries_.ContainsKey(item);
+ }
+
+ public void CopyTo(T[] a, int idx)
+ {
+ entries_.Keys.CopyTo(a, idx);
+ }
+
+ public void CopyTo(T[] a)
+ {
+ entries_.Keys.CopyTo(a, 0);
+ }
+
+ System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
+ {
+ return entries_.Keys.GetEnumerator();
+ }
+
+ public IEnumerator<T> GetEnumerator()
+ {
+ return entries_.Keys.GetEnumerator();
+ }
+
+ public bool Remove(T item)
+ {
+ return entries_.Remove(item);
+ }
+
+ public int Count
+ {
+ get
+ {
+ return entries_.Count;
+ }
+ }
+
+ public bool IsReadOnly
+ {
+ get
+ {
+ return false;
+ }
+ }
+
+ private Dictionary<T, bool> entries_;
+ }
+}
+
+#endif
diff --git a/cs/src/Ice/Instance.cs b/cs/src/Ice/Instance.cs
index 94904edb5c6..7450d2b5f36 100644
--- a/cs/src/Ice/Instance.cs
+++ b/cs/src/Ice/Instance.cs
@@ -48,7 +48,14 @@ namespace IceInternal
Debug.Assert(_defaultsAndOverrides != null);
return _defaultsAndOverrides;
}
-
+
+#if COMPACT
+ public string[] factoryAssemblies()
+ {
+ return _factoryAssemblies;
+ }
+#endif
+
public RouterManager routerManager()
{
lock(this)
@@ -664,8 +671,7 @@ namespace IceInternal
else if(logfile.Length != 0 || Ice.Util.getProcessLogger() is Ice.LoggerI)
{
//
- // If Ice.LogFile set, default ConsoleTraceListener disabled.
- // Otherwise default enabled.
+ // Ice.ConsoleListener is enabled by default unless Ice.LogFile is set.
//
bool console =
_initData.properties.getPropertyAsIntWithDefault("Ice.ConsoleListener",
@@ -682,7 +688,11 @@ namespace IceInternal
_traceLevels = new TraceLevels(_initData.properties);
_defaultsAndOverrides = new DefaultsAndOverrides(_initData.properties);
-
+
+#if COMPACT
+ _factoryAssemblies = _initData.properties.getPropertyAsList("Ice.FactoryAssemblies");
+#endif
+
{
const int defaultMessageSizeMax = 1024;
int num =
@@ -1072,6 +1082,9 @@ namespace IceInternal
private Ice.InitializationData _initData; // Immutable, not reset by destroy().
private TraceLevels _traceLevels; // Immutable, not reset by destroy().
private DefaultsAndOverrides _defaultsAndOverrides; // Immutable, not reset by destroy().
+#if COMPACT
+ private string[] _factoryAssemblies; // Immutable, not reset by destroy().
+#endif
private int _messageSizeMax; // Immutable, not reset by destroy().
private int _clientACM; // Immutable, not reset by destroy().
private int _serverACM; // Immutable, not reset by destroy().
diff --git a/cs/src/Ice/LinkedList.cs b/cs/src/Ice/LinkedList.cs
index a5c227114cc..b9d2aa846e5 100644
--- a/cs/src/Ice/LinkedList.cs
+++ b/cs/src/Ice/LinkedList.cs
@@ -71,7 +71,11 @@ namespace IceUtilInternal
}
if(index < 0)
{
+#if COMPACT
+ throw new ArgumentOutOfRangeException("index", "index must not be less than zero");
+#else
throw new ArgumentOutOfRangeException("index", _count, "index must not be less than zero");
+#endif
}
if(index >= array.Length)
{
diff --git a/cs/src/Ice/LocatorInfo.cs b/cs/src/Ice/LocatorInfo.cs
index 0268d767b62..236c02aab6b 100644
--- a/cs/src/Ice/LocatorInfo.cs
+++ b/cs/src/Ice/LocatorInfo.cs
@@ -84,14 +84,15 @@ namespace IceInternal
readonly Reference _ref;
readonly int _ttl;
readonly GetEndpointsCallback _callback;
- };
+ }
private abstract class Request
{
public void
addCallback(Reference @ref, Reference wellKnownRef, int ttl, GetEndpointsCallback cb)
{
- lock(this)
+ _m.Lock();
+ try
{
RequestCallback callback = new RequestCallback(@ref, ttl, cb);
if(_response)
@@ -117,12 +118,17 @@ namespace IceInternal
}
}
}
+ finally
+ {
+ _m.Unlock();
+ }
}
public EndpointI[]
getEndpoints(Reference @ref, Reference wellKnownRef, int ttl, out bool cached)
{
- lock(this)
+ _m.Lock();
+ try
{
if(!_response || _exception == null)
{
@@ -139,7 +145,7 @@ namespace IceInternal
while(!_response && _exception == null)
{
- Monitor.Wait(this);
+ _m.Wait();
}
}
@@ -175,6 +181,10 @@ namespace IceInternal
}
return endpoints == null ? new EndpointI[0] : endpoints;
}
+ finally
+ {
+ _m.Unlock();
+ }
}
public Request(LocatorInfo locatorInfo, Reference @ref)
@@ -188,7 +198,8 @@ namespace IceInternal
public void
response(Ice.ObjectPrx proxy)
{
- lock(this)
+ _m.Lock();
+ try
{
_locatorInfo.finishRequest(_ref, _wellKnownRefs, proxy, false);
_response = true;
@@ -197,7 +208,11 @@ namespace IceInternal
{
callback.response(_locatorInfo, proxy);
}
- Monitor.PulseAll(this);
+ _m.NotifyAll();
+ }
+ finally
+ {
+ _m.Unlock();
}
}
@@ -210,7 +225,8 @@ namespace IceInternal
return;
}
- lock(this)
+ _m.Lock();
+ try
{
_locatorInfo.finishRequest(_ref, _wellKnownRefs, null, ex is Ice.UserException);
_exception = ex;
@@ -218,7 +234,11 @@ namespace IceInternal
{
callback.exception(_locatorInfo, ex);
}
- Monitor.PulseAll(this);
+ _m.NotifyAll();
+ }
+ finally
+ {
+ _m.Unlock();
}
}
@@ -233,7 +253,9 @@ namespace IceInternal
private bool _response;
private Ice.ObjectPrx _proxy;
private Ice.Exception _exception;
- };
+
+ private readonly IceUtilInternal.Monitor _m = new IceUtilInternal.Monitor();
+ }
private class ObjectRequest : Request
{
diff --git a/cs/src/Ice/LoggerI.cs b/cs/src/Ice/LoggerI.cs
index 5c5cdce9520..877dd4ebcf6 100644
--- a/cs/src/Ice/LoggerI.cs
+++ b/cs/src/Ice/LoggerI.cs
@@ -13,6 +13,9 @@ namespace Ice
{
using System.Diagnostics;
using System.Globalization;
+#if COMPACT
+ using System.IO;
+#endif
public abstract class LoggerI : Logger
{
@@ -119,17 +122,53 @@ namespace Ice
}
}
+#if COMPACT
public sealed class TraceLoggerI : LoggerI
{
public TraceLoggerI(string prefix, string file, bool console)
: base(prefix)
{
+ _console = console;
+
if(file.Length != 0)
{
_file = file;
- Trace.Listeners.Add(new TextWriterTraceListener(file));
+ FileStream fs = new FileStream(file, FileMode.Append, FileAccess.Write, FileShare.None);
+ _writer = new StreamWriter(fs);
+ }
+ else
+ {
+ _writer = System.Console.Error;
}
+ }
+
+ public override Logger cloneWithPrefix(string prefix)
+ {
+ return new TraceLoggerI(prefix, _file, _console);
+ }
+
+ protected override void write(string message)
+ {
+ _writer.WriteLine(message);
+ }
+
+ private string _file = "";
+ private bool _console = false;
+ private TextWriter _writer;
+ }
+#else
+ public sealed class TraceLoggerI : LoggerI
+ {
+ public TraceLoggerI(string prefix, string file, bool console)
+ : base(prefix)
+ {
_console = console;
+
+ if(file.Length != 0)
+ {
+ _file = file;
+ Trace.Listeners.Add(new TextWriterTraceListener(file));
+ }
if(console && !Trace.Listeners.Contains(_consoleListener))
{
Trace.Listeners.Add(_consoleListener);
@@ -151,4 +190,5 @@ namespace Ice
private bool _console = false;
internal static ConsoleTraceListener _consoleListener = new ConsoleTraceListener(true);
}
+#endif
}
diff --git a/cs/src/Ice/Makefile b/cs/src/Ice/Makefile
index cff91416406..f7615ae6841 100644
--- a/cs/src/Ice/Makefile
+++ b/cs/src/Ice/Makefile
@@ -55,6 +55,7 @@ SRCS = Acceptor.cs \
LocatorInfo.cs \
LoggerI.cs \
LoggerPlugin.cs \
+ Monitor.cs \
Network.cs \
ObjectAdapterFactory.cs \
ObjectAdapterI.cs \
diff --git a/cs/src/Ice/Makefile.mak b/cs/src/Ice/Makefile.mak
index 06f752780b4..035d07faae5 100644
--- a/cs/src/Ice/Makefile.mak
+++ b/cs/src/Ice/Makefile.mak
@@ -46,6 +46,7 @@ SRCS = Acceptor.cs \
EndpointHostResolver.cs \
EventHandler.cs \
Exception.cs \
+ HashSet.cs \
ImplicitContextI.cs \
IncomingAsync.cs \
Incoming.cs \
@@ -55,6 +56,7 @@ SRCS = Acceptor.cs \
LocatorInfo.cs \
LoggerI.cs \
LoggerPlugin.cs \
+ Monitor.cs \
Network.cs \
ObjectAdapterFactory.cs \
ObjectAdapterI.cs \
diff --git a/cs/src/Ice/Monitor.cs b/cs/src/Ice/Monitor.cs
new file mode 100644
index 00000000000..b722cf36ecd
--- /dev/null
+++ b/cs/src/Ice/Monitor.cs
@@ -0,0 +1,270 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2010 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.
+//
+// **********************************************************************
+
+//
+// The System.Threading.Monitor class in the Compact Framework does not
+// support the Wait/Pulse/PulseAll methods, so we implement our own
+// Monitor here.
+//
+// For non-CF builds, our Monitor simply wraps the standard Monitor class.
+//
+// All code that uses a monitor for waiting/signaling must now use the
+// following locking style:
+//
+// IceUtilInternal.Monitor mon = new IceUtilInternal.Monitor();
+// mon.Lock();
+// try
+// {
+// // Wait or Notify ...
+// }
+// finally
+// {
+// mon.Unlock();
+// }
+//
+namespace IceUtilInternal
+{
+#if COMPACT
+
+ using System;
+ using System.Collections.Generic;
+ using System.Diagnostics;
+
+ public class Monitor
+ {
+ public Monitor()
+ {
+ _waitQueue = new LinkedList<System.Threading.EventWaitHandle>();
+ _mutex = new System.Threading.Mutex();
+ _lockCount = 0;
+ }
+
+ public void Lock()
+ {
+ _mutex.WaitOne();
+ _lockCount++; // Keep track of recursive locks.
+ }
+
+ public void Unlock()
+ {
+ _lockCount--; // Keep track of recursive locks.
+ _mutex.ReleaseMutex();
+ }
+
+ public bool TryLock()
+ {
+ bool result = _mutex.WaitOne(0, false);
+ if(result)
+ {
+ _lockCount++; // Keep track of recursive locks.
+ }
+ return result;
+ }
+
+ public void Wait()
+ {
+ //
+ // Push an event onto the wait queue. Eventually, a call to Notify or NotifyAll
+ // will remove the event from the wait queue and signal it.
+ //
+ System.Threading.EventWaitHandle e = new System.Threading.AutoResetEvent(false);
+ _waitQueue.AddLast(e);
+
+ //
+ // Preserve the lock count until we reaquire the lock.
+ //
+ int lockCount = _lockCount;
+ _lockCount = 0;
+
+ //
+ // Fully release the lock.
+ //
+ for(int i = 0; i < lockCount; ++i)
+ {
+ _mutex.ReleaseMutex();
+ }
+
+ //
+ // Wait for the event to be set.
+ //
+ e.WaitOne();
+
+ //
+ // Reacquire the lock the same number of times.
+ //
+ for(int i = 0; i < lockCount; ++i)
+ {
+ _mutex.WaitOne();
+ }
+
+ _lockCount = lockCount;
+
+ //
+ // It is safe to close the event now because no other thread will use it (Notify
+ // or NotifyAll has already removed the event from the wait queue).
+ //
+ e.Close();
+ }
+
+ public bool TimedWait(int timeout)
+ {
+ //
+ // Push an event onto the wait queue. The event is removed from the queue if
+ // Notify or NotifyAll is called, otherwise we have to remove it explicitly.
+ // We use a LinkedListNode here because we can remove it in O(1) time.
+ //
+ System.Threading.EventWaitHandle e = new System.Threading.AutoResetEvent(false);
+ LinkedListNode<System.Threading.EventWaitHandle> node =
+ new LinkedListNode<System.Threading.EventWaitHandle>(e);
+ _waitQueue.AddLast(node);
+
+ //
+ // Preserve the lock count until we reaquire the lock.
+ //
+ int lockCount = _lockCount;
+ _lockCount = 0;
+
+ //
+ // Fully release the lock.
+ //
+ for(int i = 0; i < lockCount; ++i)
+ {
+ _mutex.ReleaseMutex();
+ }
+
+ //
+ // Wait for the event to be set or the timeout to expire.
+ //
+ bool b = e.WaitOne(timeout, false);
+
+ //
+ // NOTE: There's a race here if the timeout expired: another thread could
+ // acquire the lock and call Notify. In turn, Notify could remove this event
+ // from the wait queue and set it. Now we have a situation where the timeout
+ // technically expired but the event was actually set. If we still treat this
+ // as an expired timeout then the Notify will have been lost.
+ //
+ // The timeout isn't precise because we also have to wait an indeterminate
+ // time to reacquire the lock. The simplest solution therefore is to check
+ // the event one more time after acquiring the lock - if it's set now, we
+ // act as if the wait succeeded. This might be an issue for a general-purpose
+ // monitor implementation, but for Ice it shouldn't cause any problems.
+ //
+
+ //
+ // Reacquire the lock the same number of times.
+ //
+ for(int i = 0; i < lockCount; ++i)
+ {
+ _mutex.WaitOne();
+ }
+
+ _lockCount = lockCount;
+
+ //
+ // In the case of a timeout, check the event one more time to work around the
+ // race condition described above.
+ //
+ if(!b)
+ {
+ b = e.WaitOne(0, false);
+ }
+
+ //
+ // If our event was not signaled, we need to remove it from the wait queue.
+ //
+ if(!b)
+ {
+ Debug.Assert(node.List != null); // The node must still be in the wait queue.
+ _waitQueue.Remove(node);
+ }
+
+ //
+ // It is safe to close the event now because no other thread will use it.
+ //
+ e.Close();
+
+ return b;
+ }
+
+ public void Notify()
+ {
+ if(_waitQueue.Count > 0)
+ {
+ //
+ // Set the first event in the wait queue.
+ //
+ System.Threading.EventWaitHandle h = _waitQueue.First.Value;
+ _waitQueue.RemoveFirst();
+ h.Set();
+ }
+ }
+
+ public void NotifyAll()
+ {
+ //
+ // Set all the events in the wait queue.
+ //
+ foreach(System.Threading.EventWaitHandle h in _waitQueue)
+ {
+ h.Set();
+ }
+ _waitQueue.Clear();
+ }
+
+ private LinkedList<System.Threading.EventWaitHandle> _waitQueue;
+ private System.Threading.Mutex _mutex;
+ private int _lockCount;
+ }
+
+#else
+
+ //
+ // This implementation is just a wrapper around System.Threading.Monitor.
+ //
+ public class Monitor
+ {
+ public void Lock()
+ {
+ System.Threading.Monitor.Enter(this);
+ }
+
+ public void Unlock()
+ {
+ System.Threading.Monitor.Exit(this);
+ }
+
+ public bool TryLock()
+ {
+ return System.Threading.Monitor.TryEnter(this);
+ }
+
+ public void Wait()
+ {
+ System.Threading.Monitor.Wait(this);
+ }
+
+ public bool TimedWait(int timeout)
+ {
+ return System.Threading.Monitor.Wait(this, timeout);
+ }
+
+ public void Notify()
+ {
+ System.Threading.Monitor.Pulse(this);
+ }
+
+ public void NotifyAll()
+ {
+ System.Threading.Monitor.PulseAll(this);
+ }
+ }
+
+#endif
+}
diff --git a/cs/src/Ice/Network.cs b/cs/src/Ice/Network.cs
index 2c26552ba15..08c607926cb 100644
--- a/cs/src/Ice/Network.cs
+++ b/cs/src/Ice/Network.cs
@@ -15,7 +15,9 @@ namespace IceInternal
using System.ComponentModel;
using System.Diagnostics;
using System.Net;
+#if !COMPACT
using System.Net.NetworkInformation;
+#endif
using System.Net.Sockets;
using System.Runtime.InteropServices;
using System.Threading;
@@ -97,7 +99,11 @@ namespace IceInternal
{
}
+#if COMPACT
+ foreach(IPAddress a in Dns.GetHostEntry(host).AddressList)
+#else
foreach(IPAddress a in Dns.GetHostAddresses(host))
+#endif
{
if((a.AddressFamily == AddressFamily.InterNetwork && protocol != EnableIPv6) ||
(a.AddressFamily == AddressFamily.InterNetworkV6 && protocol != EnableIPv4))
@@ -270,7 +276,11 @@ namespace IceInternal
public static bool isMulticast(IPEndPoint addr)
{
+#if COMPACT
+ string ip = addr.Address.ToString().ToUpper();
+#else
string ip = addr.Address.ToString().ToUpperInvariant();
+#endif
if(addr.AddressFamily == AddressFamily.InterNetwork)
{
char[] splitChars = { '.' };
@@ -816,7 +826,11 @@ namespace IceInternal
}
}
+#if COMPACT
+ foreach(IPAddress a in Dns.GetHostEntry(host).AddressList)
+#else
foreach(IPAddress a in Dns.GetHostAddresses(host))
+#endif
{
if((a.AddressFamily == AddressFamily.InterNetwork && protocol != EnableIPv6) ||
(a.AddressFamily == AddressFamily.InterNetworkV6 && protocol != EnableIPv4))
@@ -866,6 +880,7 @@ namespace IceInternal
try
{
addresses = new ArrayList();
+#if !COMPACT
if(AssemblyUtil.runtime_ != AssemblyUtil.Runtime.Mono)
{
NetworkInterface[] nics = NetworkInterface.GetAllNetworkInterfaces();
@@ -887,8 +902,13 @@ namespace IceInternal
}
}
else
+#endif
{
+#if COMPACT
+ foreach(IPAddress a in Dns.GetHostEntry(Dns.GetHostName()).AddressList)
+#else
foreach(IPAddress a in Dns.GetHostAddresses(Dns.GetHostName()))
+#endif
{
if((a.AddressFamily == AddressFamily.InterNetwork && protocol != EnableIPv6) ||
(a.AddressFamily == AddressFamily.InterNetworkV6 && protocol != EnableIPv4))
@@ -989,7 +1009,11 @@ namespace IceInternal
IPAddress[] addrs = getLocalAddresses(protocol);
foreach(IPAddress a in addrs)
{
+#if COMPACT
+ if(!IPAddress.IsLoopback(a))
+#else
if(!a.IsIPv6LinkLocal)
+#endif
{
hosts.Add(a.ToString());
}
@@ -1092,6 +1116,7 @@ namespace IceInternal
private static int
getInterfaceIndex(string name)
{
+#if !COMPACT
NetworkInterface[] nics = NetworkInterface.GetAllNetworkInterfaces();
foreach(NetworkInterface ni in nics)
{
@@ -1105,12 +1130,14 @@ namespace IceInternal
}
}
}
+#endif
return 0;
}
private static IPAddress
getInterfaceAddress(string name)
{
+#if !COMPACT
NetworkInterface[] nics = NetworkInterface.GetAllNetworkInterfaces();
foreach(NetworkInterface ni in nics)
{
@@ -1127,6 +1154,7 @@ namespace IceInternal
}
}
}
+#endif
return IPAddress.Any;
}
}
diff --git a/cs/src/Ice/ObjectAdapterFactory.cs b/cs/src/Ice/ObjectAdapterFactory.cs
index 90a95d31d5b..d5776d74da7 100644
--- a/cs/src/Ice/ObjectAdapterFactory.cs
+++ b/cs/src/Ice/ObjectAdapterFactory.cs
@@ -19,7 +19,8 @@ namespace IceInternal
public void shutdown()
{
List<Ice.ObjectAdapterI> adapters;
- lock(this)
+ _m.Lock();
+ try
{
//
// Ignore shutdown requests if the object adapter factory has
@@ -35,7 +36,11 @@ namespace IceInternal
instance_ = null;
_communicator = null;
- System.Threading.Monitor.PulseAll(this);
+ _m.NotifyAll();
+ }
+ finally
+ {
+ _m.Unlock();
}
//
@@ -51,18 +56,23 @@ namespace IceInternal
public void waitForShutdown()
{
List<Ice.ObjectAdapterI> adapters;
- lock(this)
+ _m.Lock();
+ try
{
//
// First we wait for the shutdown of the factory itself.
//
while(instance_ != null)
{
- System.Threading.Monitor.Wait(this);
+ _m.Wait();
}
adapters = new List<Ice.ObjectAdapterI>(_adapters);
}
+ finally
+ {
+ _m.Unlock();
+ }
//
// Now we wait for deactivation of each object adapter.
@@ -75,10 +85,15 @@ namespace IceInternal
public bool isShutdown()
{
- lock(this)
+ _m.Lock();
+ try
{
return instance_ == null;
}
+ finally
+ {
+ _m.Unlock();
+ }
}
public void destroy()
@@ -89,25 +104,36 @@ namespace IceInternal
waitForShutdown();
List<Ice.ObjectAdapterI> adapters;
- lock(this)
+ _m.Lock();
+ try
{
adapters = new List<Ice.ObjectAdapterI>(_adapters);
}
+ finally
+ {
+ _m.Unlock();
+ }
foreach(Ice.ObjectAdapter adapter in adapters)
{
adapter.destroy();
}
- lock(this)
+ _m.Lock();
+ try
{
_adapters.Clear();
}
+ finally
+ {
+ _m.Unlock();
+ }
}
public Ice.ObjectAdapter createObjectAdapter(string name, Ice.RouterPrx router)
{
- lock(this)
+ _m.Lock();
+ try
{
if(instance_ == null)
{
@@ -135,12 +161,17 @@ namespace IceInternal
_adapters.Add(adapter);
return adapter;
}
+ finally
+ {
+ _m.Unlock();
+ }
}
public Ice.ObjectAdapter findObjectAdapter(Ice.ObjectPrx proxy)
{
List<Ice.ObjectAdapterI> adapters;
- lock(this)
+ _m.Lock();
+ try
{
if(instance_ == null)
{
@@ -149,6 +180,10 @@ namespace IceInternal
adapters = new List<Ice.ObjectAdapterI>(_adapters);
}
+ finally
+ {
+ _m.Unlock();
+ }
foreach(Ice.ObjectAdapterI adapter in adapters)
{
@@ -170,7 +205,8 @@ namespace IceInternal
public void removeObjectAdapter(Ice.ObjectAdapterI adapter)
{
- lock(this)
+ _m.Lock();
+ try
{
if(instance_ == null)
{
@@ -180,15 +216,24 @@ namespace IceInternal
_adapters.Remove(adapter);
_adapterNamesInUse.Remove(adapter.getName());
}
+ finally
+ {
+ _m.Unlock();
+ }
}
public void flushAsyncBatchRequests(CommunicatorBatchOutgoingAsync outAsync)
{
List<Ice.ObjectAdapterI> adapters;
- lock(this)
+ _m.Lock();
+ try
{
adapters = new List<Ice.ObjectAdapterI>(_adapters);
}
+ finally
+ {
+ _m.Unlock();
+ }
foreach(Ice.ObjectAdapterI adapter in adapters)
{
@@ -211,6 +256,8 @@ namespace IceInternal
private Ice.Communicator _communicator;
private HashSet<string> _adapterNamesInUse;
private List<Ice.ObjectAdapterI> _adapters;
+
+ private readonly IceUtilInternal.Monitor _m = new IceUtilInternal.Monitor();
}
}
diff --git a/cs/src/Ice/ObjectAdapterI.cs b/cs/src/Ice/ObjectAdapterI.cs
index 7a280e9b9b9..49fd56c85ea 100644
--- a/cs/src/Ice/ObjectAdapterI.cs
+++ b/cs/src/Ice/ObjectAdapterI.cs
@@ -36,7 +36,8 @@ namespace Ice
bool registerProcess = false;
bool printAdapterReady = false;
- lock(this)
+ _m.Lock();
+ try
{
checkForDeactivation();
@@ -77,6 +78,10 @@ namespace Ice
printAdapterReady = properties.getPropertyAsInt("Ice.PrintAdapterReady") > 0;
}
}
+ finally
+ {
+ _m.Unlock();
+ }
try
{
@@ -92,10 +97,15 @@ namespace Ice
// allow to user code to retry activating the adapter
// later.
//
- lock(this)
+ _m.Lock();
+ try
{
_waitForActivate = false;
- System.Threading.Monitor.PulseAll(this);
+ _m.NotifyAll();
+ }
+ finally
+ {
+ _m.Unlock();
}
throw;
}
@@ -105,7 +115,8 @@ namespace Ice
System.Console.Out.WriteLine(_name + " ready");
}
- lock(this)
+ _m.Lock();
+ try
{
Debug.Assert(!_deactivated); // Not possible if _waitForActivate = true;
@@ -113,7 +124,7 @@ namespace Ice
// Signal threads waiting for the activation.
//
_waitForActivate = false;
- System.Threading.Monitor.PulseAll(this);
+ _m.NotifyAll();
_activateOneOffDone = true;
@@ -122,11 +133,16 @@ namespace Ice
icf.activate();
}
}
+ finally
+ {
+ _m.Unlock();
+ }
}
public void hold()
{
- lock(this)
+ _m.Lock();
+ try
{
checkForDeactivation();
@@ -135,6 +151,10 @@ namespace Ice
factory.hold();
}
}
+ finally
+ {
+ _m.Unlock();
+ }
}
public void waitForHold()
@@ -142,7 +162,8 @@ namespace Ice
while(true)
{
List<IceInternal.IncomingConnectionFactory> incomingConnectionFactories;
- lock(this)
+ _m.Lock();
+ try
{
checkForDeactivation();
@@ -151,17 +172,22 @@ namespace Ice
++_waitForHold;
}
+ finally
+ {
+ _m.Unlock();
+ }
foreach(IceInternal.IncomingConnectionFactory factory in incomingConnectionFactories)
{
factory.waitUntilHolding();
}
- lock(this)
+ _m.Lock();
+ try
{
if(--_waitForHold == 0)
{
- System.Threading.Monitor.PulseAll(this);
+ _m.NotifyAll();
}
//
@@ -181,11 +207,15 @@ namespace Ice
while(_waitForHold > 0)
{
checkForDeactivation();
- System.Threading.Monitor.Wait(this);
+ _m.Wait();
}
_waitForHoldRetry = false;
}
}
+ finally
+ {
+ _m.Unlock();
+ }
}
}
@@ -195,7 +225,8 @@ namespace Ice
List<IceInternal.IncomingConnectionFactory> incomingConnectionFactories;
IceInternal.LocatorInfo locatorInfo;
- lock(this)
+ _m.Lock();
+ try
{
//
// Ignore deactivation requests if the object adapter has
@@ -213,7 +244,7 @@ namespace Ice
//
while(_waitForActivate)
{
- System.Threading.Monitor.Wait(this);
+ _m.Wait();
}
if(_routerInfo != null)
@@ -235,7 +266,11 @@ namespace Ice
locatorInfo = _locatorInfo;
_deactivated = true;
- System.Threading.Monitor.PulseAll(this);
+ _m.NotifyAll();
+ }
+ finally
+ {
+ _m.Unlock();
}
try
@@ -271,7 +306,8 @@ namespace Ice
public void waitForDeactivate()
{
IceInternal.IncomingConnectionFactory[] incomingConnectionFactories = null;
- lock(this)
+ _m.Lock();
+ try
{
if(_destroyed)
{
@@ -285,11 +321,15 @@ namespace Ice
//
while(!_deactivated || _directCount > 0)
{
- System.Threading.Monitor.Wait(this);
+ _m.Wait();
}
incomingConnectionFactories = _incomingConnectionFactories.ToArray();
}
+ finally
+ {
+ _m.Unlock();
+ }
//
// Now we wait for until all incoming connection factories are
@@ -303,15 +343,21 @@ namespace Ice
public bool isDeactivated()
{
- lock(this)
+ _m.Lock();
+ try
{
return _deactivated;
}
+ finally
+ {
+ _m.Unlock();
+ }
}
public void destroy()
{
- lock(this)
+ _m.Lock();
+ try
{
//
// Another thread is in the process of destroying the object
@@ -319,7 +365,7 @@ namespace Ice
//
while(_destroying)
{
- System.Threading.Monitor.Wait(this);
+ _m.Wait();
}
//
@@ -332,6 +378,10 @@ namespace Ice
_destroying = true;
}
+ finally
+ {
+ _m.Unlock();
+ }
//
// Deactivate and wait for completion.
@@ -356,14 +406,15 @@ namespace Ice
IceInternal.ObjectAdapterFactory objectAdapterFactory;
- lock(this)
+ _m.Lock();
+ try
{
//
// Signal that destroying is complete.
//
_destroying = false;
_destroyed = true;
- System.Threading.Monitor.PulseAll(this);
+ _m.NotifyAll();
//
// We're done, now we can throw away all incoming connection
@@ -385,6 +436,10 @@ namespace Ice
objectAdapterFactory = _objectAdapterFactory;
_objectAdapterFactory = null;
}
+ finally
+ {
+ _m.Unlock();
+ }
if(objectAdapterFactory != null)
{
@@ -399,7 +454,8 @@ namespace Ice
public ObjectPrx addFacet(Ice.Object obj, Identity ident, string facet)
{
- lock(this)
+ _m.Lock();
+ try
{
checkForDeactivation();
checkIdentity(ident);
@@ -416,6 +472,10 @@ namespace Ice
return newProxy(id, facet);
}
+ finally
+ {
+ _m.Unlock();
+ }
}
public ObjectPrx addWithUUID(Ice.Object obj)
@@ -434,12 +494,17 @@ namespace Ice
public void addDefaultServant(Ice.Object servant, string category)
{
- lock(this)
+ _m.Lock();
+ try
{
checkForDeactivation();
_servantManager.addDefaultServant(servant, category);
}
+ finally
+ {
+ _m.Unlock();
+ }
}
public Ice.Object remove(Identity ident)
@@ -449,34 +514,49 @@ namespace Ice
public Ice.Object removeFacet(Identity ident, string facet)
{
- lock(this)
+ _m.Lock();
+ try
{
checkForDeactivation();
checkIdentity(ident);
return _servantManager.removeServant(ident, facet);
}
+ finally
+ {
+ _m.Unlock();
+ }
}
public Dictionary<string, Ice.Object> removeAllFacets(Identity ident)
{
- lock(this)
+ _m.Lock();
+ try
{
checkForDeactivation();
checkIdentity(ident);
return _servantManager.removeAllFacets(ident);
}
+ finally
+ {
+ _m.Unlock();
+ }
}
public Ice.Object removeDefaultServant(string category)
{
- lock(this)
+ _m.Lock();
+ try
{
checkForDeactivation();
return _servantManager.removeDefaultServant(category);
}
+ finally
+ {
+ _m.Unlock();
+ }
}
public Ice.Object find(Identity ident)
@@ -486,118 +566,173 @@ namespace Ice
public Ice.Object findFacet(Identity ident, string facet)
{
- lock(this)
+ _m.Lock();
+ try
{
checkForDeactivation();
checkIdentity(ident);
return _servantManager.findServant(ident, facet);
}
+ finally
+ {
+ _m.Unlock();
+ }
}
public Dictionary<string, Ice.Object> findAllFacets(Identity ident)
{
- lock(this)
+ _m.Lock();
+ try
{
checkForDeactivation();
checkIdentity(ident);
return _servantManager.findAllFacets(ident);
}
+ finally
+ {
+ _m.Unlock();
+ }
}
public Ice.Object findByProxy(ObjectPrx proxy)
{
- lock(this)
+ _m.Lock();
+ try
{
checkForDeactivation();
IceInternal.Reference @ref = ((ObjectPrxHelperBase)proxy).reference__();
return findFacet(@ref.getIdentity(), @ref.getFacet());
}
+ finally
+ {
+ _m.Unlock();
+ }
}
public Ice.Object findDefaultServant(string category)
{
- lock(this)
+ _m.Lock();
+ try
{
checkForDeactivation();
return _servantManager.findDefaultServant(category);
}
+ finally
+ {
+ _m.Unlock();
+ }
}
public void addServantLocator(ServantLocator locator, string prefix)
{
- lock(this)
+ _m.Lock();
+ try
{
checkForDeactivation();
_servantManager.addServantLocator(locator, prefix);
}
+ finally
+ {
+ _m.Unlock();
+ }
}
public ServantLocator removeServantLocator(string prefix)
{
- lock(this)
+ _m.Lock();
+ try
{
checkForDeactivation();
return _servantManager.removeServantLocator(prefix);
}
+ finally
+ {
+ _m.Unlock();
+ }
}
public ServantLocator findServantLocator(string prefix)
{
- lock(this)
+ _m.Lock();
+ try
{
checkForDeactivation();
return _servantManager.findServantLocator(prefix);
}
+ finally
+ {
+ _m.Unlock();
+ }
}
public ObjectPrx createProxy(Identity ident)
{
- lock(this)
+ _m.Lock();
+ try
{
checkForDeactivation();
checkIdentity(ident);
return newProxy(ident, "");
}
+ finally
+ {
+ _m.Unlock();
+ }
}
public ObjectPrx createDirectProxy(Identity ident)
{
- lock(this)
+ _m.Lock();
+ try
{
checkForDeactivation();
checkIdentity(ident);
return newDirectProxy(ident, "");
}
+ finally
+ {
+ _m.Unlock();
+ }
}
public ObjectPrx createIndirectProxy(Identity ident)
{
- lock(this)
+ _m.Lock();
+ try
{
checkForDeactivation();
checkIdentity(ident);
return newIndirectProxy(ident, "", _id);
}
+ finally
+ {
+ _m.Unlock();
+ }
}
public void setLocator(LocatorPrx locator)
{
- lock(this)
+ _m.Lock();
+ try
{
checkForDeactivation();
_locatorInfo = instance_.locatorManager().get(locator);
}
+ finally
+ {
+ _m.Unlock();
+ }
}
public void refreshPublishedEndpoints()
@@ -606,7 +741,8 @@ namespace Ice
bool registerProcess = false;
List<IceInternal.EndpointI> oldPublishedEndpoints;
- lock(this)
+ _m.Lock();
+ try
{
checkForDeactivation();
@@ -620,6 +756,10 @@ namespace Ice
instance_.initializationData().properties.getPropertyAsInt(_name + ".RegisterProcess") > 0;
}
}
+ finally
+ {
+ _m.Unlock();
+ }
try
{
@@ -629,7 +769,8 @@ namespace Ice
}
catch(Ice.LocalException)
{
- lock(this)
+ _m.Lock();
+ try
{
//
// Restore the old published endpoints.
@@ -637,12 +778,17 @@ namespace Ice
_publishedEndpoints = oldPublishedEndpoints;
throw;
}
+ finally
+ {
+ _m.Unlock();
+ }
}
}
public Endpoint[] getEndpoints()
{
- lock(this)
+ _m.Lock();
+ try
{
List<Endpoint> endpoints = new List<Endpoint>();
foreach(IceInternal.IncomingConnectionFactory factory in _incomingConnectionFactories)
@@ -651,14 +797,23 @@ namespace Ice
}
return endpoints.ToArray();
}
+ finally
+ {
+ _m.Unlock();
+ }
}
public Endpoint[] getPublishedEndpoints()
{
- lock(this)
+ _m.Lock();
+ try
{
return _publishedEndpoints.ToArray();
}
+ finally
+ {
+ _m.Unlock();
+ }
}
public bool isLocal(ObjectPrx proxy)
@@ -689,7 +844,8 @@ namespace Ice
{
IceInternal.EndpointI[] endpoints = r.getEndpoints();
- lock(this)
+ _m.Lock();
+ try
{
checkForDeactivation();
@@ -737,16 +893,25 @@ namespace Ice
return false;
}
+ finally
+ {
+ _m.Unlock();
+ }
}
}
public void flushAsyncBatchRequests(IceInternal.CommunicatorBatchOutgoingAsync outAsync)
{
List<IceInternal.IncomingConnectionFactory> f;
- lock(this)
+ _m.Lock();
+ try
{
f = new List<IceInternal.IncomingConnectionFactory>(_incomingConnectionFactories);
}
+ finally
+ {
+ _m.Unlock();
+ }
foreach(IceInternal.IncomingConnectionFactory factory in f)
{
@@ -756,18 +921,24 @@ namespace Ice
public void incDirectCount()
{
- lock(this)
+ _m.Lock();
+ try
{
checkForDeactivation();
Debug.Assert(_directCount >= 0);
++_directCount;
}
+ finally
+ {
+ _m.Unlock();
+ }
}
public void decDirectCount()
{
- lock(this)
+ _m.Lock();
+ try
{
// Not check for deactivation here!
@@ -776,9 +947,13 @@ namespace Ice
Debug.Assert(_directCount > 0);
if(--_directCount == 0)
{
- System.Threading.Monitor.PulseAll(this);
+ _m.NotifyAll();
}
}
+ finally
+ {
+ _m.Unlock();
+ }
}
public IceInternal.ThreadPool getThreadPool()
@@ -1227,6 +1402,16 @@ namespace Ice
IceInternal.EndpointI endp = instance_.endpointFactoryManager().create(s, oaEndpoints);
if(endp == null)
{
+#if COMPACT
+ if(s.StartsWith("ssl", StringComparison.Ordinal))
+ {
+ instance_.initializationData().logger.warning(
+ "SSL endpoint `" + s +
+ "' ignored: IceSSL is not supported with the .NET Compact Framework");
+ ++end;
+ continue;
+ }
+#else
if(IceInternal.AssemblyUtil.runtime_ == IceInternal.AssemblyUtil.Runtime.Mono &&
s.StartsWith("ssl", StringComparison.Ordinal))
{
@@ -1235,6 +1420,7 @@ namespace Ice
++end;
continue;
}
+#endif
Ice.EndpointParseException e2 = new Ice.EndpointParseException();
e2.str = "invalid object adapter endpoint `" + s + "'";
throw e2;
@@ -1416,7 +1602,8 @@ namespace Ice
if(registerProcess && serverId.Length > 0)
{
- lock(this)
+ _m.Lock();
+ try
{
if(_processId == null)
{
@@ -1424,6 +1611,10 @@ namespace Ice
_processId = addWithUUID(servant).ice_getIdentity();
}
}
+ finally
+ {
+ _m.Unlock();
+ }
try
{
@@ -1566,5 +1757,7 @@ namespace Ice
private bool _destroyed;
private bool _noConfig;
private Identity _processId;
+
+ private readonly IceUtilInternal.Monitor _m = new IceUtilInternal.Monitor();
}
}
diff --git a/cs/src/Ice/Outgoing.cs b/cs/src/Ice/Outgoing.cs
index f3db8430841..a6f94e77340 100644
--- a/cs/src/Ice/Outgoing.cs
+++ b/cs/src/Ice/Outgoing.cs
@@ -73,16 +73,16 @@ namespace IceInternal
bool timedOut = false;
- lock(this)
+ _m.Lock();
+ try
{
-
//
// If the request is being sent in the background we first wait for the
// sent notification.
//
while(_state != StateFailed && !_sent)
{
- Monitor.Wait(this);
+ _m.Wait();
}
//
@@ -94,7 +94,7 @@ namespace IceInternal
{
if(timeout >= 0)
{
- Monitor.Wait(this, timeout);
+ _m.TimedWait(timeout);
if(_state == StateInProgress)
{
@@ -103,10 +103,14 @@ namespace IceInternal
}
else
{
- Monitor.Wait(this);
+ _m.Wait();
}
}
}
+ finally
+ {
+ _m.Unlock();
+ }
if(timedOut)
{
@@ -120,13 +124,18 @@ namespace IceInternal
// We must wait until the exception set above has
// propagated to this Outgoing object.
//
- lock(this)
+ _m.Lock();
+ try
{
while(_state == StateInProgress)
{
- Monitor.Wait(this);
+ _m.Wait();
}
}
+ finally
+ {
+ _m.Unlock();
+ }
}
if(_exception != null)
@@ -180,11 +189,12 @@ namespace IceInternal
//
// If the handler returns the connection, we must wait for the sent callback.
//
- lock(this)
+ _m.Lock();
+ try
{
while(_state != StateFailed && !_sent)
{
- Monitor.Wait(this);
+ _m.Wait();
}
if(_exception != null)
@@ -193,6 +203,10 @@ namespace IceInternal
throw _exception;
}
}
+ finally
+ {
+ _m.Unlock();
+ }
}
return true;
}
@@ -237,10 +251,15 @@ namespace IceInternal
{
if(notify)
{
- lock(this)
+ _m.Lock();
+ try
{
_sent = true;
- Monitor.Pulse(this);
+ _m.Notify();
+ }
+ finally
+ {
+ _m.Unlock();
}
}
else
@@ -255,7 +274,8 @@ namespace IceInternal
public void finished(BasicStream istr)
{
- lock(this)
+ _m.Lock();
+ try
{
Debug.Assert(_handler.getReference().getMode() == Reference.Mode.ModeTwoway); // Only for twoways.
@@ -384,19 +404,28 @@ namespace IceInternal
}
}
- Monitor.Pulse(this);
+ _m.Notify();
+ }
+ finally
+ {
+ _m.Unlock();
}
}
public void finished(Ice.LocalException ex, bool sent)
{
- lock(this)
+ _m.Lock();
+ try
{
Debug.Assert(_state <= StateInProgress);
_state = StateFailed;
_exception = ex;
_sent = sent;
- Monitor.Pulse(this);
+ _m.Notify();
+ }
+ finally
+ {
+ _m.Unlock();
}
}
@@ -519,6 +548,8 @@ namespace IceInternal
private const int StateFailed = 5;
private int _state;
+ private readonly IceUtilInternal.Monitor _m = new IceUtilInternal.Monitor();
+
public Outgoing next; // For use by Ice.ObjectDelM_
}
@@ -545,11 +576,12 @@ namespace IceInternal
if(_handler != null && !_handler.flushBatchRequests(this) ||
_connection != null && !_connection.flushBatchRequests(this))
{
- lock(this)
+ _m.Lock();
+ try
{
while(_exception == null && !_sent)
{
- Monitor.Wait(this);
+ _m.Wait();
}
if(_exception != null)
@@ -557,6 +589,10 @@ namespace IceInternal
throw _exception;
}
}
+ finally
+ {
+ _m.Unlock();
+ }
}
}
@@ -564,10 +600,15 @@ namespace IceInternal
{
if(notify)
{
- lock(this)
+ _m.Lock();
+ try
{
_sent = true;
- Monitor.Pulse(this);
+ _m.Notify();
+ }
+ finally
+ {
+ _m.Unlock();
}
}
else
@@ -578,10 +619,15 @@ namespace IceInternal
public void finished(Ice.LocalException ex, bool sent)
{
- lock(this)
+ _m.Lock();
+ try
{
_exception = ex;
- Monitor.Pulse(this);
+ _m.Notify();
+ }
+ finally
+ {
+ _m.Unlock();
}
}
@@ -595,6 +641,8 @@ namespace IceInternal
private BasicStream _os;
private bool _sent;
private Ice.LocalException _exception;
+
+ private readonly IceUtilInternal.Monitor _m = new IceUtilInternal.Monitor();
}
}
diff --git a/cs/src/Ice/OutgoingAsync.cs b/cs/src/Ice/OutgoingAsync.cs
index bc78961ac4f..3a2ee65b206 100644
--- a/cs/src/Ice/OutgoingAsync.cs
+++ b/cs/src/Ice/OutgoingAsync.cs
@@ -137,40 +137,60 @@ namespace IceInternal
public bool isCompleted_()
{
- lock(monitor_)
+ monitor_.Lock();
+ try
{
return (state_ & Done) != 0;
}
+ finally
+ {
+ monitor_.Unlock();
+ }
}
public void waitForCompleted()
{
- lock(monitor_)
+ monitor_.Lock();
+ try
{
while((state_ & Done) == 0)
{
- Monitor.Wait(monitor_);
+ monitor_.Wait();
}
}
+ finally
+ {
+ monitor_.Unlock();
+ }
}
public bool isSent()
{
- lock(monitor_)
+ monitor_.Lock();
+ try
{
return (state_ & Sent) != 0;
}
+ finally
+ {
+ monitor_.Unlock();
+ }
}
public void waitForSent()
{
- lock(monitor_)
+ monitor_.Lock();
+ try
{
while((state_ & (Sent | Done)) == 0)
{
- Monitor.Wait(monitor_);
+ monitor_.Wait();
}
}
+ finally
+ {
+ monitor_.Unlock();
+ }
}
public void throwLocalException()
@@ -225,7 +245,8 @@ namespace IceInternal
{
get
{
- lock(monitor_)
+ monitor_.Lock();
+ try
{
if(waitHandle_ == null)
{
@@ -237,12 +258,17 @@ namespace IceInternal
}
return waitHandle_;
}
+ finally
+ {
+ monitor_.Unlock();
+ }
}
}
public Ice.AsyncResult whenSent(Ice.AsyncCallback cb)
{
- lock(monitor_)
+ monitor_.Lock();
+ try
{
if(cb == null)
{
@@ -258,6 +284,10 @@ namespace IceInternal
return this;
}
}
+ finally
+ {
+ monitor_.Unlock();
+ }
if(sentSynchronously_)
{
@@ -289,7 +319,8 @@ namespace IceInternal
public Ice.AsyncResult whenSent(Ice.SentCallback cb)
{
- lock(monitor_)
+ monitor_.Lock();
+ try
{
if(cb == null)
{
@@ -308,6 +339,10 @@ namespace IceInternal
return this;
}
}
+ finally
+ {
+ monitor_.Unlock();
+ }
if(sentSynchronously_)
{
@@ -339,7 +374,8 @@ namespace IceInternal
public Ice.AsyncResult whenCompletedWithAsyncCallback(Ice.AsyncCallback cb)
{
- lock(monitor_)
+ monitor_.Lock();
+ try
{
setCompletedCallback(cb);
if((state_ & Done) == 0)
@@ -351,6 +387,10 @@ namespace IceInternal
return this;
}
}
+ finally
+ {
+ monitor_.Unlock();
+ }
instance_.clientThreadPool().dispatch(delegate()
{
@@ -368,7 +408,8 @@ namespace IceInternal
public Ice.AsyncResult whenCompleted(Ice.ExceptionCallback cb)
{
- lock(monitor_)
+ monitor_.Lock();
+ try
{
if(cb == null)
{
@@ -385,6 +426,10 @@ namespace IceInternal
return this;
}
}
+ finally
+ {
+ monitor_.Unlock();
+ }
instance_.clientThreadPool().dispatch(delegate()
{
@@ -423,7 +468,8 @@ namespace IceInternal
public bool wait__()
{
- lock(monitor_)
+ monitor_.Lock();
+ try
{
if((state_ & EndCalled) != 0)
{
@@ -432,7 +478,7 @@ namespace IceInternal
state_ |= EndCalled;
while((state_ & Done) == 0)
{
- Monitor.Wait(monitor_);
+ monitor_.Wait();
}
if(exception_ != null)
{
@@ -440,6 +486,10 @@ namespace IceInternal
}
return (state_ & OK) != 0;
}
+ finally
+ {
+ monitor_.Unlock();
+ }
}
public void throwUserException__()
@@ -611,17 +661,22 @@ namespace IceInternal
protected void exception__(Ice.Exception ex)
{
Ice.AsyncCallback cb;
- lock(monitor_)
+ monitor_.Lock();
+ try
{
state_ |= Done;
exception_ = ex;
- Monitor.PulseAll(monitor_);
+ monitor_.NotifyAll();
if(waitHandle_ != null)
{
waitHandle_.Set();
}
cb = completedCallback_;
}
+ finally
+ {
+ monitor_.Unlock();
+ }
if(cb != null)
{
@@ -666,7 +721,7 @@ namespace IceInternal
protected IceInternal.Instance instance_;
protected string operation_;
- protected object monitor_ = new object();
+ protected readonly IceUtilInternal.Monitor monitor_ = new IceUtilInternal.Monitor();
protected IceInternal.BasicStream is_;
protected IceInternal.BasicStream os_;
@@ -775,7 +830,8 @@ namespace IceInternal
public Ice.AsyncCallback sent__(Ice.ConnectionI connection)
{
- lock(monitor_)
+ monitor_.Lock();
+ try
{
bool alreadySent = (state_ & Sent) != 0;
state_ |= Sent;
@@ -803,9 +859,13 @@ namespace IceInternal
proxy_.reference__().getInstance().timer().schedule(_timerTask, connection.timeout());
}
}
- Monitor.PulseAll(monitor_);
+ monitor_.NotifyAll();
return alreadySent ? null : sentCallback_; // Don't call the sent call is already sent.
}
+ finally
+ {
+ monitor_.Unlock();
+ }
}
public new void sent__(Ice.AsyncCallback cb)
@@ -815,7 +875,8 @@ namespace IceInternal
public void finished__(Ice.LocalException exc, bool sent)
{
- lock(monitor_)
+ monitor_.Lock();
+ try
{
Debug.Assert((state_ & Done) == 0);
if(_timerTaskConnection != null)
@@ -826,6 +887,10 @@ namespace IceInternal
_timerTask = null;
}
}
+ finally
+ {
+ monitor_.Unlock();
+ }
//
// NOTE: at this point, synchronization isn't needed, no other threads should be
@@ -884,7 +949,8 @@ namespace IceInternal
Ice.AsyncCallback cb = null;
try
{
- lock(monitor_)
+ monitor_.Lock();
+ try
{
Debug.Assert(exception_ == null && (state_ & Done) == 0);
@@ -1018,7 +1084,11 @@ namespace IceInternal
state_ |= OK;
}
cb = completedCallback_;
- Monitor.PulseAll(monitor_);
+ monitor_.NotifyAll();
+ }
+ finally
+ {
+ monitor_.Unlock();
}
}
catch(Ice.LocalException ex)
@@ -1145,12 +1215,17 @@ namespace IceInternal
private void runTimerTask__()
{
Ice.ConnectionI connection = null;
- lock(monitor_)
+ monitor_.Lock();
+ try
{
connection = _timerTaskConnection;
_timerTaskConnection = null;
_timerTask = null;
}
+ finally
+ {
+ monitor_.Unlock();
+ }
if(connection != null)
{
@@ -1179,7 +1254,8 @@ namespace IceInternal
new public Ice.AsyncResult<T> whenCompleted(Ice.ExceptionCallback excb)
{
- lock(monitor_)
+ monitor_.Lock();
+ try
{
if(excb == null)
{
@@ -1196,6 +1272,10 @@ namespace IceInternal
return this;
}
}
+ finally
+ {
+ monitor_.Unlock();
+ }
instance_.clientThreadPool().dispatch(delegate()
{
@@ -1213,7 +1293,8 @@ namespace IceInternal
virtual public Ice.AsyncResult<T> whenCompleted(T cb, Ice.ExceptionCallback excb)
{
- lock(monitor_)
+ monitor_.Lock();
+ try
{
if(cb == null && excb == null)
{
@@ -1231,6 +1312,10 @@ namespace IceInternal
return this;
}
}
+ finally
+ {
+ monitor_.Unlock();
+ }
instance_.clientThreadPool().dispatch(delegate()
{
@@ -1321,17 +1406,22 @@ namespace IceInternal
public Ice.AsyncCallback sent__(Ice.ConnectionI connection)
{
- lock(monitor_)
+ monitor_.Lock();
+ try
{
Debug.Assert((state_ & (Done | OK | Sent)) == 0);
state_ |= (Done | OK | Sent);
- Monitor.PulseAll(monitor_);
+ monitor_.NotifyAll();
if(waitHandle_ != null)
{
waitHandle_.Set();
}
return sentCallback_;
}
+ finally
+ {
+ monitor_.Unlock();
+ }
}
public new void sent__(Ice.AsyncCallback cb)
@@ -1442,10 +1532,15 @@ namespace IceInternal
public void flushConnection(Ice.Connection con)
{
- lock(monitor_)
+ monitor_.Lock();
+ try
{
++_useCount;
}
+ finally
+ {
+ monitor_.Unlock();
+ }
Ice.AsyncResult r = con.begin_flushBatchRequests(completed, null);
r.whenSent((Ice.AsyncCallback)sent);
}
@@ -1481,7 +1576,8 @@ namespace IceInternal
bool done = false;
Ice.AsyncCallback sentCallback = null;
- lock(monitor_)
+ monitor_.Lock();
+ try
{
Debug.Assert(_useCount > 0);
--_useCount;
@@ -1500,9 +1596,13 @@ namespace IceInternal
done = true;
state_ |= Done | OK | Sent;
sentCallback = sentCallback_;
- Monitor.PulseAll(monitor_);
+ monitor_.NotifyAll();
}
}
+ finally
+ {
+ monitor_.Unlock();
+ }
if(done)
{
diff --git a/cs/src/Ice/PluginManagerI.cs b/cs/src/Ice/PluginManagerI.cs
index 16eca7f40f5..a03377d230a 100644
--- a/cs/src/Ice/PluginManagerI.cs
+++ b/cs/src/Ice/PluginManagerI.cs
@@ -337,7 +337,7 @@ namespace Ice
{
entryPoint = pluginSpec.Substring(0, pos);
char[] delims = { ' ', '\t', '\n' };
- args = pluginSpec.Substring(pos).Trim().Split(delims, pos);
+ args = pluginSpec.Substring(pos).Trim().Split(delims);
}
}
@@ -401,6 +401,21 @@ namespace Ice
}
catch(System.Exception ex)
{
+#if COMPACT
+ //
+ // IceSSL is not supported with the Compact Framework.
+ //
+ if(name == "IceSSL")
+ {
+ if(!_sslWarnOnce)
+ {
+ _communicator.getLogger().warning(
+ "IceSSL plug-in not loaded: IceSSL is not supported with the .NET Compact Framework");
+ _sslWarnOnce = true;
+ }
+ return;
+ }
+#else
//
// IceSSL is not yet supported with Mono. We avoid throwing an exception in that case,
// so the same configuration can be used with Mono or Visual C#.
@@ -415,6 +430,7 @@ namespace Ice
}
return;
}
+#endif
PluginInitializationException e = new PluginInitializationException();
e.reason = err + "unable to load assembly: '" + assemblyName + "': " + ex.ToString();
diff --git a/cs/src/Ice/PropertiesI.cs b/cs/src/Ice/PropertiesI.cs
index cedf3f5ef97..feaed731be4 100644
--- a/cs/src/Ice/PropertiesI.cs
+++ b/cs/src/Ice/PropertiesI.cs
@@ -625,7 +625,8 @@ namespace Ice
private void loadConfig()
{
string val = getProperty("Ice.Config");
-
+
+#if !COMPACT
if(val.Length == 0 || val.Equals("1"))
{
string s = System.Environment.GetEnvironmentVariable("ICE_CONFIG");
@@ -634,6 +635,7 @@ namespace Ice
val = s;
}
}
+#endif
if(val.Length > 0)
{
diff --git a/cs/src/Ice/PropertyNames.cs b/cs/src/Ice/PropertyNames.cs
index f00d251fb25..2a0c854e04f 100644
--- a/cs/src/Ice/PropertyNames.cs
+++ b/cs/src/Ice/PropertyNames.cs
@@ -8,7 +8,7 @@
// **********************************************************************
//
-// Generated by makeprops.py from file ./config/PropertyNames.xml, Mon Mar 7 23:28:12 2011
+// Generated by makeprops.py from file ..\config\PropertyNames.xml, Mon May 09 07:39:43 2011
// IMPORTANT: Do not edit this file -- any edits made here will be lost!
@@ -75,6 +75,7 @@ namespace IceInternal
new Property(@"^Ice\.IPv4$", false, null),
new Property(@"^Ice\.IPv6$", false, null),
new Property(@"^Ice\.EventLog\.Source$", false, null),
+ new Property(@"^Ice\.FactoryAssemblies$", false, null),
new Property(@"^Ice\.GC\.Interval$", false, null),
new Property(@"^Ice\.ImplicitContext$", false, null),
new Property(@"^Ice\.InitPlugins$", false, null),
diff --git a/cs/src/Ice/ProtocolPluginFacade.cs b/cs/src/Ice/ProtocolPluginFacade.cs
index 201f0190ddb..ac38bedea58 100644
--- a/cs/src/Ice/ProtocolPluginFacade.cs
+++ b/cs/src/Ice/ProtocolPluginFacade.cs
@@ -47,12 +47,16 @@ namespace IceInternal
// Get an EndpointFactory.
//
EndpointFactory getEndpointFactory(short type);
+
+ //
+ // Obtain the type for a name.
+ //
+ System.Type findType(string name);
}
public sealed class ProtocolPluginFacadeI : ProtocolPluginFacade
{
- public
- ProtocolPluginFacadeI(Ice.Communicator communicator)
+ public ProtocolPluginFacadeI(Ice.Communicator communicator)
{
_communicator = communicator;
_instance = IceInternal.Util.getInstance(communicator);
@@ -120,6 +124,14 @@ namespace IceInternal
return _instance.endpointFactoryManager().get(type);
}
+ //
+ // Obtain the type for a name.
+ //
+ public System.Type findType(string name)
+ {
+ return AssemblyUtil.findType(_instance, name);
+ }
+
private Instance _instance;
private Ice.Communicator _communicator;
}
diff --git a/cs/src/Ice/Proxy.cs b/cs/src/Ice/Proxy.cs
index 22b7f1fc6e4..16e58cf486e 100644
--- a/cs/src/Ice/Proxy.cs
+++ b/cs/src/Ice/Proxy.cs
@@ -1676,8 +1676,11 @@ namespace Ice
}
else
{
- ArrayList arr = ArrayList.Adapter(newEndpoints);
- IceInternal.EndpointI[] endpts = (IceInternal.EndpointI[])arr.ToArray(typeof(IceInternal.EndpointI));
+ IceInternal.EndpointI[] endpts = new IceInternal.EndpointI[newEndpoints.Length];
+ for(int i = 0; i < newEndpoints.Length; ++i)
+ {
+ endpts[i] = (IceInternal.EndpointI)newEndpoints[i];
+ }
return newInstance(_reference.changeEndpoints(endpts));
}
}
diff --git a/cs/src/Ice/SliceChecksums.cs b/cs/src/Ice/SliceChecksums.cs
index 178e3fc3d01..496c40d9762 100644
--- a/cs/src/Ice/SliceChecksums.cs
+++ b/cs/src/Ice/SliceChecksums.cs
@@ -19,6 +19,7 @@ namespace Ice
{
public static Dictionary<string, string> checksums = new Dictionary<string, string>();
+#if !COMPACT
static SliceChecksums()
{
Type[] types = IceInternal.AssemblyUtil.findTypesWithPrefix("IceInternal.SliceChecksums");
@@ -32,6 +33,7 @@ namespace Ice
}
}
}
+#endif
}
}
diff --git a/cs/src/Ice/StringUtil.cs b/cs/src/Ice/StringUtil.cs
index e5adff61d0a..5528410d19b 100644
--- a/cs/src/Ice/StringUtil.cs
+++ b/cs/src/Ice/StringUtil.cs
@@ -353,7 +353,7 @@ namespace IceUtilInternal
}
UTF8Encoding utf8 = new UTF8Encoding(false, true);
- return utf8.GetString(arr); // May raise ArgumentException.
+ return utf8.GetString(arr, 0, arr.Length); // May raise ArgumentException.
}
//
@@ -453,13 +453,14 @@ namespace IceUtilInternal
return 0; // Not quoted
}
- private class OrdinalStringComparerImpl : System.Collections.IComparer
+ private class OrdinalStringComparerImpl : System.Collections.Generic.IComparer<string>
{
- public int Compare(object l, object r)
+ public int Compare(string l, string r)
{
- return string.CompareOrdinal((string)l, (string)r);
+ return string.CompareOrdinal(l, r);
}
}
- public static System.Collections.IComparer OrdinalStringComparer = new OrdinalStringComparerImpl();
+ public static System.Collections.Generic.IComparer<string> OrdinalStringComparer =
+ new OrdinalStringComparerImpl();
}
}
diff --git a/cs/src/Ice/TcpAcceptor.cs b/cs/src/Ice/TcpAcceptor.cs
index 354d2ba458e..9a6befcd8db 100644
--- a/cs/src/Ice/TcpAcceptor.cs
+++ b/cs/src/Ice/TcpAcceptor.cs
@@ -90,7 +90,9 @@ namespace IceInternal
}
Network.setBlock(_acceptFd, false);
+#if !COMPACT
Network.setTcpBufSize(_acceptFd, instance_.initializationData().properties, _logger);
+#endif
if(_traceLevels.network >= 1)
{
@@ -126,7 +128,9 @@ namespace IceInternal
_addr = Network.getAddressForServer(host, port, instance_.protocolSupport());
_fd = Network.createSocket(false, _addr.AddressFamily);
Network.setBlock(_fd, false);
+#if !COMPACT
Network.setTcpBufSize(_fd, instance_.initializationData().properties, _logger);
+#endif
if(AssemblyUtil.platform_ != AssemblyUtil.Platform.Windows)
{
//
diff --git a/cs/src/Ice/TcpConnector.cs b/cs/src/Ice/TcpConnector.cs
index d13494a8c60..0c67d6dce9f 100644
--- a/cs/src/Ice/TcpConnector.cs
+++ b/cs/src/Ice/TcpConnector.cs
@@ -30,7 +30,9 @@ namespace IceInternal
{
Socket fd = Network.createSocket(false, _addr.AddressFamily);
Network.setBlock(fd, false);
+#if !COMPACT
Network.setTcpBufSize(fd, _instance.initializationData().properties, _logger);
+#endif
//
// Nonblocking connect is handled by the transceiver.
diff --git a/cs/src/Ice/TcpTransceiver.cs b/cs/src/Ice/TcpTransceiver.cs
index 737347fd02d..0859b06cf04 100644
--- a/cs/src/Ice/TcpTransceiver.cs
+++ b/cs/src/Ice/TcpTransceiver.cs
@@ -83,6 +83,14 @@ namespace IceInternal
public bool write(Buffer buf)
{
+#if COMPACT
+ //
+ // The Compact Framework does not support the use of synchronous socket
+ // operations on a non-blocking socket. Returning false here forces the
+ // caller to schedule an asynchronous operation.
+ //
+ return false;
+#else
int packetSize = buf.b.remaining();
if(AssemblyUtil.platform_ == AssemblyUtil.Platform.Windows)
{
@@ -155,10 +163,18 @@ namespace IceInternal
}
return true; // No more data to send.
+#endif
}
public bool read(Buffer buf)
{
+#if COMPACT
+ //
+ // The .NET Compact Framework does not support the use of synchronous socket
+ // operations on a non-blocking socket.
+ //
+ return false;
+#else
// COMPILERFIX: Workaround for Mac OS X broken poll(), see Mono bug #470120
if(AssemblyUtil.osx_)
{
@@ -242,6 +258,7 @@ namespace IceInternal
}
return true;
+#endif
}
public bool startRead(Buffer buf, AsyncCallback callback, object state)
diff --git a/cs/src/Ice/ThreadPool.cs b/cs/src/Ice/ThreadPool.cs
index 0f7bf4f9226..b2e5ae85fce 100644
--- a/cs/src/Ice/ThreadPool.cs
+++ b/cs/src/Ice/ThreadPool.cs
@@ -19,7 +19,7 @@ namespace IceInternal
internal struct ThreadPoolMessage
{
- public ThreadPoolMessage(object mutex)
+ public ThreadPoolMessage(IceUtilInternal.Monitor mutex)
{
_mutex = mutex;
_finish = false;
@@ -66,15 +66,20 @@ namespace IceInternal
// of the event handler. We need to lock the event handler here to call
// finishMessage.
//
- lock(_mutex)
+ _mutex.Lock();
+ try
{
current.finishMessage(false);
Debug.Assert(!current.completedSynchronously);
}
+ finally
+ {
+ _mutex.Unlock();
+ }
}
}
- private object _mutex;
+ private IceUtilInternal.Monitor _mutex;
private bool _finish;
private bool _finishWithIO;
}
@@ -241,11 +246,16 @@ namespace IceInternal
public void destroy()
{
- lock(this)
+ _m.Lock();
+ try
{
Debug.Assert(!_destroyed);
_destroyed = true;
- Monitor.PulseAll(this);
+ _m.NotifyAll();
+ }
+ finally
+ {
+ _m.Unlock();
}
}
@@ -261,7 +271,8 @@ namespace IceInternal
public void update(EventHandler handler, int remove, int add)
{
- lock(this)
+ _m.Lock();
+ try
{
Debug.Assert(!_destroyed);
handler._registered = handler._registered & ~remove;
@@ -283,6 +294,10 @@ namespace IceInternal
});
}
}
+ finally
+ {
+ _m.Unlock();
+ }
}
public void unregister(EventHandler handler, int op)
@@ -292,7 +307,8 @@ namespace IceInternal
public void finish(EventHandler handler)
{
- lock(this)
+ _m.Lock();
+ try
{
Debug.Assert(!_destroyed);
if(handler._pending == 0)
@@ -310,10 +326,17 @@ namespace IceInternal
handler._finish = true;
}
}
+ finally
+ {
+ _m.Unlock();
+ }
}
- public void
- dispatch(System.Action call)
+#if COMPACT
+ public void dispatch(Ice.VoidAction call)
+#else
+ public void dispatch(System.Action call)
+#endif
{
if(_dispatcher != null)
{
@@ -339,12 +362,13 @@ namespace IceInternal
public void
execute(ThreadPoolWorkItem workItem)
{
- lock(this)
+ _m.Lock();
+ try
{
Debug.Assert(!_destroyed);
if(_workItems.Count == 0)
{
- Monitor.Pulse(this);
+ _m.Notify();
}
_workItems.Enqueue(workItem);
@@ -383,16 +407,25 @@ namespace IceInternal
}
}
}
+ finally
+ {
+ _m.Unlock();
+ }
}
public void
executeNonBlocking(ThreadPoolWorkItem workItem)
{
- lock(this)
+ _m.Lock();
+ try
{
Debug.Assert(!_destroyed);
_instance.asyncIOThread().queue(workItem);
}
+ finally
+ {
+ _m.Unlock();
+ }
}
public void joinWithAllThreads()
@@ -425,7 +458,8 @@ namespace IceInternal
ThreadPoolWorkItem workItem = null;
while(true)
{
- lock(this)
+ _m.Lock();
+ try
{
if(workItem != null)
{
@@ -444,7 +478,7 @@ namespace IceInternal
if(_threadIdleTime > 0)
{
- if(!Monitor.Wait(this, _threadIdleTime * 1000) && _workItems.Count == 0) // If timeout
+ if(!_m.TimedWait(_threadIdleTime * 1000) && _workItems.Count == 0) // If timeout
{
if(_destroyed)
{
@@ -476,7 +510,7 @@ namespace IceInternal
else
{
Debug.Assert(_serverIdleTime > 0 && _inUse == 0 && _threads.Count == 1);
- if(!Monitor.Wait(this, _serverIdleTime * 1000) && _workItems.Count == 0)
+ if(!_m.TimedWait(_serverIdleTime * 1000) && _workItems.Count == 0)
{
if(!_destroyed)
{
@@ -497,7 +531,7 @@ namespace IceInternal
}
else
{
- Monitor.Wait(this);
+ _m.Wait();
}
}
@@ -514,6 +548,10 @@ namespace IceInternal
_instance.initializationData().logger.warning(s);
}
}
+ finally
+ {
+ _m.Unlock();
+ }
try
{
@@ -759,7 +797,6 @@ namespace IceInternal
private Thread _thread;
}
-
private readonly int _size; // Number of threads that are pre-created.
private readonly int _sizeMax; // Maximum number of threads.
private readonly int _sizeWarn; // If _inUse reaches _sizeWarn, a "low on threads" warning will be printed.
@@ -775,6 +812,8 @@ namespace IceInternal
private int _inUse; // Number of threads that are currently in use.
private Queue<ThreadPoolWorkItem> _workItems;
+
+ private readonly IceUtilInternal.Monitor _m = new IceUtilInternal.Monitor();
}
}
diff --git a/cs/src/Ice/Timer.cs b/cs/src/Ice/Timer.cs
index bc536fa95f0..c6a3780a675 100644
--- a/cs/src/Ice/Timer.cs
+++ b/cs/src/Ice/Timer.cs
@@ -29,7 +29,8 @@ namespace IceInternal
{
public void destroy()
{
- lock(this)
+ _m.Lock();
+ try
{
if(_instance == null)
{
@@ -37,18 +38,23 @@ namespace IceInternal
}
_instance = null;
- Monitor.Pulse(this);
+ _m.Notify();
_tokens.Clear();
_tasks.Clear();
}
+ finally
+ {
+ _m.Unlock();
+ }
_thread.Join();
}
public void schedule(TimerTask task, long delay)
{
- lock(this)
+ _m.Lock();
+ try
{
if(_instance == null)
{
@@ -69,14 +75,19 @@ namespace IceInternal
if(token.scheduledTime < _wakeUpTime)
{
- Monitor.Pulse(this);
+ _m.Notify();
}
}
+ finally
+ {
+ _m.Unlock();
+ }
}
public void scheduleRepeated(TimerTask task, long period)
{
- lock(this)
+ _m.Lock();
+ try
{
if(_instance == null)
{
@@ -97,14 +108,19 @@ namespace IceInternal
if(token.scheduledTime < _wakeUpTime)
{
- Monitor.Pulse(this);
+ _m.Notify();
}
}
+ finally
+ {
+ _m.Unlock();
+ }
}
public bool cancel(TimerTask task)
{
- lock(this)
+ _m.Lock();
+ try
{
if(_instance == null)
{
@@ -120,6 +136,10 @@ namespace IceInternal
_tokens.Remove(token);
return true;
}
+ finally
+ {
+ _m.Unlock();
+ }
}
//
@@ -160,7 +180,8 @@ namespace IceInternal
Token token = null;
while(true)
{
- lock(this)
+ _m.Lock();
+ try
{
if(_instance != null)
{
@@ -187,7 +208,7 @@ namespace IceInternal
if(_tokens.Count == 0)
{
_wakeUpTime = System.Int64.MaxValue;
- Monitor.Wait(this);
+ _m.Wait();
}
if(_instance == null)
@@ -219,7 +240,7 @@ namespace IceInternal
}
_wakeUpTime = first.scheduledTime;
- Monitor.Wait(this, (int)(first.scheduledTime - now));
+ _m.TimedWait((int)(first.scheduledTime - now));
}
if(_instance == null)
@@ -227,6 +248,10 @@ namespace IceInternal
break;
}
}
+ finally
+ {
+ _m.Unlock();
+ }
if(token != null)
{
@@ -236,7 +261,8 @@ namespace IceInternal
}
catch(System.Exception ex)
{
- lock(this)
+ _m.Lock();
+ try
{
if(_instance != null)
{
@@ -244,6 +270,10 @@ namespace IceInternal
_instance.initializationData().logger.error(s);
}
}
+ finally
+ {
+ _m.Unlock();
+ }
}
}
}
@@ -319,11 +349,17 @@ namespace IceInternal
public TimerTask task;
}
+#if COMPACT
+ private IDictionary<Token, object> _tokens = new SortedList<Token, object>();
+#else
private IDictionary<Token, object> _tokens = new SortedDictionary<Token, object>();
+#endif
private IDictionary<TimerTask, Token> _tasks = new Dictionary<TimerTask, Token>();
private Instance _instance;
private long _wakeUpTime = System.Int64.MaxValue;
private int _tokenId = 0;
private Thread _thread;
+
+ private readonly IceUtilInternal.Monitor _m = new IceUtilInternal.Monitor();
}
}
diff --git a/cs/src/Ice/UdpTransceiver.cs b/cs/src/Ice/UdpTransceiver.cs
index 0776c99653e..e9d46bb6495 100644
--- a/cs/src/Ice/UdpTransceiver.cs
+++ b/cs/src/Ice/UdpTransceiver.cs
@@ -77,6 +77,14 @@ namespace IceInternal
public bool write(Buffer buf)
{
+#if COMPACT
+ //
+ // The Compact Framework does not support the use of synchronous socket
+ // operations on a non-blocking socket. Returning false here forces the
+ // caller to schedule an asynchronous operation.
+ //
+ return false;
+#else
Debug.Assert(buf.b.position() == 0);
Debug.Assert(_fd != null && _state >= StateConnected);
@@ -145,10 +153,19 @@ namespace IceInternal
Debug.Assert(ret == buf.b.limit());
return true;
+#endif
}
public bool read(Buffer buf)
{
+#if COMPACT
+ //
+ // The Compact Framework does not support the use of synchronous socket
+ // operations on a non-blocking socket. Returning false here forces the
+ // caller to schedule an asynchronous operation.
+ //
+ return false;
+#else
Debug.Assert(buf.b.position() == 0);
Debug.Assert(_fd != null);
@@ -260,6 +277,7 @@ namespace IceInternal
buf.b.position(ret);
return true;
+#endif
}
public bool startRead(Buffer buf, AsyncCallback callback, object state)
diff --git a/cs/src/Ice/Util.cs b/cs/src/Ice/Util.cs
index 49799ced937..d265d93e73a 100644
--- a/cs/src/Ice/Util.cs
+++ b/cs/src/Ice/Util.cs
@@ -34,11 +34,22 @@ namespace Ice
void stop();
}
+#if COMPACT
+ /// <summary>
+ /// A delegate for an action taking no parameters.
+ /// </summary>
+ public delegate void VoidAction();
+#endif
+
/// <summary>
/// A delegate for the dispatcher. The dispatcher is called by the Ice
/// runtime to dispatch servant calls and AMI callbacks.
/// </summary>
+#if COMPACT
+ public delegate void Dispatcher(VoidAction call, Connection con);
+#else
public delegate void Dispatcher(System.Action call, Connection con);
+#endif
/// <summary>
/// A class that encpasulates data to initalize a communicator.
diff --git a/cs/src/Ice/ValueWriter.cs b/cs/src/Ice/ValueWriter.cs
index 56e2defb4d7..1238e2d06ce 100644
--- a/cs/src/Ice/ValueWriter.cs
+++ b/cs/src/Ice/ValueWriter.cs
@@ -57,9 +57,9 @@ namespace IceInternal
writeValue(elem, i.Current, objectTable, output);
}
}
- else if(val is DictionaryBase)
+ else if(val is IDictionary)
{
- foreach(DictionaryEntry entry in (Hashtable)val)
+ foreach(DictionaryEntry entry in (IDictionary)val)
{
string elem = name != null ? name + "." : "";
writeValue(elem + "key", entry.Key, objectTable, output);
diff --git a/cs/src/IceBox/Server.cs b/cs/src/IceBox/Server.cs
index 171af4f71d5..cd3fb780822 100644
--- a/cs/src/IceBox/Server.cs
+++ b/cs/src/IceBox/Server.cs
@@ -47,14 +47,14 @@ public class Server
}
}
- public static void Main(string[] args)
+ public static int Main(string[] args)
{
Ice.InitializationData initData = new Ice.InitializationData();
initData.properties = Ice.Util.createProperties();
initData.properties.setProperty("Ice.Admin.DelayCreation", "1");
App server = new App();
- System.Environment.Exit(server.main(args, initData));
+ return server.main(args, initData);
}
}
}
diff --git a/cs/src/IceBox/ServiceManagerI.cs b/cs/src/IceBox/ServiceManagerI.cs
index 3a97ed060ce..5f49e8cbbfc 100644
--- a/cs/src/IceBox/ServiceManagerI.cs
+++ b/cs/src/IceBox/ServiceManagerI.cs
@@ -94,7 +94,8 @@ class ServiceManagerI : ServiceManagerDisp_
startService(string name, Ice.Current current)
{
ServiceInfo info = new ServiceInfo();
- lock(this)
+ _m.Lock();
+ try
{
//
// Search would be more efficient if services were contained in
@@ -121,6 +122,10 @@ class ServiceManagerI : ServiceManagerDisp_
}
_pendingStatusChanges = true;
}
+ finally
+ {
+ _m.Unlock();
+ }
bool started = false;
try
@@ -134,7 +139,8 @@ class ServiceManagerI : ServiceManagerDisp_
_logger.warning("ServiceManager: exception in start for service " + info.name + "\n" + e.ToString());
}
- lock(this)
+ _m.Lock();
+ try
{
int i;
for(i = 0; i < _services.Count; ++i)
@@ -159,7 +165,11 @@ class ServiceManagerI : ServiceManagerDisp_
}
}
_pendingStatusChanges = false;
- Monitor.PulseAll(this);
+ _m.NotifyAll();
+ }
+ finally
+ {
+ _m.Unlock();
}
}
@@ -167,7 +177,8 @@ class ServiceManagerI : ServiceManagerDisp_
stopService(string name, Ice.Current current)
{
ServiceInfo info = new ServiceInfo();
- lock(this)
+ _m.Lock();
+ try
{
//
// Search would be more efficient if services were contained in
@@ -194,6 +205,10 @@ class ServiceManagerI : ServiceManagerDisp_
}
_pendingStatusChanges = true;
}
+ finally
+ {
+ _m.Unlock();
+ }
bool stopped = false;
try
@@ -207,7 +222,8 @@ class ServiceManagerI : ServiceManagerDisp_
e.ToString());
}
- lock(this)
+ _m.Lock();
+ try
{
int i;
for(i = 0; i < _services.Count; ++i)
@@ -232,7 +248,11 @@ class ServiceManagerI : ServiceManagerDisp_
}
}
_pendingStatusChanges = false;
- Monitor.PulseAll(this);
+ _m.NotifyAll();
+ }
+ finally
+ {
+ _m.Unlock();
}
}
@@ -245,7 +265,8 @@ class ServiceManagerI : ServiceManagerDisp_
// Null observers and duplicate registrations are ignored
//
- lock(this)
+ _m.Lock();
+ try
{
if(observer != null)
{
@@ -273,6 +294,10 @@ class ServiceManagerI : ServiceManagerDisp_
}
}
}
+ finally
+ {
+ _m.Unlock();
+ }
if(activeServices.Count > 0)
{
@@ -508,7 +533,8 @@ class ServiceManagerI : ServiceManagerDisp_
private void
startService(string service, string entryPoint, string[] args)
{
- lock(this)
+ _m.Lock();
+ try
{
//
// Instantiate the class.
@@ -764,19 +790,24 @@ class ServiceManagerI : ServiceManagerDisp_
throw e;
}
}
+ finally
+ {
+ _m.Unlock();
+ }
}
private void
stopAll()
{
- lock(this)
+ _m.Lock();
+ try
{
//
// First wait for any active startService/stopService calls to complete.
//
while(_pendingStatusChanges)
{
- Monitor.Wait(this);
+ _m.Wait();
}
//
@@ -859,6 +890,10 @@ class ServiceManagerI : ServiceManagerDisp_
_services.Clear();
servicesStopped(stoppedServices, _observers.Keys);
}
+ finally
+ {
+ _m.Unlock();
+ }
}
private void
@@ -902,13 +937,18 @@ class ServiceManagerI : ServiceManagerDisp_
private void
removeObserver(ServiceObserverPrx observer, Ice.Exception ex)
{
- lock(this)
+ _m.Lock();
+ try
{
if(_observers.Remove(observer))
{
observerRemoved(observer, ex);
}
}
+ finally
+ {
+ _m.Unlock();
+ }
}
private void
@@ -1068,6 +1108,7 @@ class ServiceManagerI : ServiceManagerDisp_
private bool _pendingStatusChanges = false;
private Dictionary<ServiceObserverPrx, bool> _observers = new Dictionary<ServiceObserverPrx, bool>();
private int _traceServiceObserver = 0;
+ private readonly IceUtilInternal.Monitor _m = new IceUtilInternal.Monitor();
}
}
diff --git a/cs/src/IceSSL/Instance.cs b/cs/src/IceSSL/Instance.cs
index 9e331e02400..cd6f04bbf34 100644
--- a/cs/src/IceSSL/Instance.cs
+++ b/cs/src/IceSSL/Instance.cs
@@ -105,7 +105,7 @@ namespace IceSSL
throw e;
}
- Type cls = IceInternal.AssemblyUtil.findType(certVerifierClass);
+ Type cls = _facade.findType(certVerifierClass);
if(cls == null)
{
Ice.PluginInitializationException e = new Ice.PluginInitializationException();
@@ -145,7 +145,7 @@ namespace IceSSL
throw e;
}
- Type cls = IceInternal.AssemblyUtil.findType(passwordCallbackClass);
+ Type cls = _facade.findType(passwordCallbackClass);
if(cls == null)
{
Ice.PluginInitializationException e = new Ice.PluginInitializationException();
diff --git a/cs/src/IceSSL/TransceiverI.cs b/cs/src/IceSSL/TransceiverI.cs
index 2f18b70afef..2f18b70afef 100755..100644
--- a/cs/src/IceSSL/TransceiverI.cs
+++ b/cs/src/IceSSL/TransceiverI.cs
diff --git a/cs/src/Makefile.mak b/cs/src/Makefile.mak
index 6a43f4c570c..b46fca78665 100644
--- a/cs/src/Makefile.mak
+++ b/cs/src/Makefile.mak
@@ -12,7 +12,10 @@ top_srcdir = ..
!include $(top_srcdir)\config\Make.rules.mak.cs
SUBDIRS = Ice IceStorm Glacier2 IcePatch2 IceGrid IceBox
+
+!if "$(COMPACT)" != "yes"
SUBDIRS = $(SUBDIRS) IceSSL
+!endif
$(EVERYTHING)::
@for %i in ( $(SUBDIRS) ) do \
diff --git a/cs/test/Glacier2/router/CallbackI.cs b/cs/test/Glacier2/router/CallbackI.cs
index eb6e6e56822..c931d74a62a 100644
--- a/cs/test/Glacier2/router/CallbackI.cs
+++ b/cs/test/Glacier2/router/CallbackI.cs
@@ -45,11 +45,16 @@ public sealed class CallbackReceiverI : CallbackReceiverDisp_
public override void
callback(Ice.Current current)
{
- lock(this)
+ _m.Lock();
+ try
{
Debug.Assert(!_callback);
_callback = true;
- System.Threading.Monitor.Pulse(this);
+ _m.Notify();
+ }
+ finally
+ {
+ _m.Unlock();
}
}
@@ -66,16 +71,22 @@ public sealed class CallbackReceiverI : CallbackReceiverDisp_
public void
callbackOK()
{
- lock(this)
+ _m.Lock();
+ try
{
while(!_callback)
{
- System.Threading.Monitor.Wait(this);
+ _m.Wait();
}
_callback = false;
}
+ finally
+ {
+ _m.Unlock();
+ }
}
private bool _callback;
+ private readonly IceUtilInternal.Monitor _m = new IceUtilInternal.Monitor();
}
diff --git a/cs/test/Glacier2/router/Client.cs b/cs/test/Glacier2/router/Client.cs
index 398430bfb43..823d637d540 100644
--- a/cs/test/Glacier2/router/Client.cs
+++ b/cs/test/Glacier2/router/Client.cs
@@ -34,7 +34,7 @@ public class Client
routerBase = communicator().stringToProxy("Glacier2/router:default -p 12347");
Console.Out.WriteLine("ok");
}
-
+
Glacier2.RouterPrx router;
{
@@ -68,7 +68,7 @@ public class Client
@base = communicator().stringToProxy("c1/callback:tcp -p 12010");
Console.Out.WriteLine("ok");
}
-
+
{
Console.Out.Write("trying to ping server before session creation... ");
Console.Out.Flush();
@@ -197,7 +197,7 @@ public class Client
Ice.Object callbackReceiver;
CallbackReceiverPrx twowayR;
CallbackReceiverPrx fakeTwowayR;
-
+
{
Console.Out.Write("creating and adding callback receiver object... ");
Console.Out.Flush();
@@ -214,7 +214,7 @@ public class Client
adapter.add(callbackReceiver, fakeCallbackReceiverIdent));
Console.Out.WriteLine("ok");
}
-
+
{
Console.Out.Write("testing oneway callback... ");
Console.Out.Flush();
@@ -283,7 +283,7 @@ public class Client
callbackReceiverImpl.callbackOK();
Console.Out.WriteLine("ok");
}
-
+
{
Console.Out.Write("testing whether disallowed category gets rejected... ");
Console.Out.Flush();
@@ -301,7 +301,7 @@ public class Client
Console.Out.WriteLine("ok");
}
}
-
+
{
Console.Out.Write("testing whether user-id as category is accepted... ");
Console.Out.Flush();
@@ -313,7 +313,7 @@ public class Client
callbackReceiverImpl.callbackOK();
Console.Out.WriteLine("ok");
}
-
+
{
Console.Out.Write("testing server shutdown... ");
Console.Out.Flush();
@@ -335,7 +335,7 @@ public class Client
}
*/
}
-
+
{
Console.Out.Write("destroying session... ");
Console.Out.Flush();
@@ -368,7 +368,7 @@ public class Client
test(false);
}
}
-
+
if(args.Length >= 1 && args[0].Equals("--shutdown"))
{
{
@@ -377,15 +377,15 @@ public class Client
communicator().setDefaultRouter(null);
Console.Out.WriteLine("ok");
}
-
+
Ice.ObjectPrx processBase;
-
+
{
Console.Out.Write("testing stringToProxy for admin object... ");
processBase = communicator().stringToProxy("Glacier2/admin -f Process:tcp -h 127.0.0.1 -p 12348");
Console.Out.WriteLine("ok");
}
-
+
/*
{
Console.Out.Write("uninstalling router with process object... ");
@@ -393,16 +393,16 @@ public class Client
Console.Out.WriteLine("ok");
}
*/
-
+
Ice.ProcessPrx process;
-
+
{
Console.Out.Write("testing checked cast for process object... ");
process = Ice.ProcessPrxHelper.checkedCast(processBase);
test(process != null);
Console.Out.WriteLine("ok");
}
-
+
Console.Out.Write("testing Glacier2 shutdown... ");
process.shutdown();
try
@@ -415,7 +415,7 @@ public class Client
Console.Out.WriteLine("ok");
}
}
-
+
return 0;
}
@@ -429,9 +429,11 @@ public class Client
}
}
- public static void Main(string[] args)
+ public static int Main(string[] args)
{
+#if !COMPACT
Debug.Listeners.Add(new ConsoleTraceListener());
+#endif
//
// We must disable connection warnings, because we attempt to
@@ -441,15 +443,18 @@ public class Client
//
Ice.InitializationData initData = new Ice.InitializationData();
initData.properties = Ice.Util.createProperties(ref args);
-
+
initData.properties.setProperty("Ice.Warn.Connections", "0");
- App app = new App();
- int status = app.main(args, initData);
+#if COMPACT
+ //
+ // When using Ice for .NET Compact Framework, we need to specify
+ // the assembly so that Ice can locate classes and exceptions.
+ //
+ initData.properties.setProperty("Ice.FactoryAssemblies", "client");
+#endif
- if(status != 0)
- {
- Environment.Exit(status);
- }
+ App app = new App();
+ return app.main(args, initData);
}
}
diff --git a/cs/test/Glacier2/router/Server.cs b/cs/test/Glacier2/router/Server.cs
index 4126266908d..6300661db6c 100644
--- a/cs/test/Glacier2/router/Server.cs
+++ b/cs/test/Glacier2/router/Server.cs
@@ -39,15 +39,24 @@ public class Server
}
}
- public static void Main(string[] args)
+ public static int Main(string[] args)
{
+#if !COMPACT
Debug.Listeners.Add(new ConsoleTraceListener());
+#endif
+
+ Ice.InitializationData initData = new Ice.InitializationData();
+ initData.properties = Ice.Util.createProperties(ref args);
+
+#if COMPACT
+ //
+ // When using Ice for .NET Compact Framework, we need to specify
+ // the assembly so that Ice can locate classes and exceptions.
+ //
+ initData.properties.setProperty("Ice.FactoryAssemblies", "server");
+#endif
App app = new App();
- int status = app.main(args);
- if(status != 0)
- {
- Environment.Exit(status);
- }
+ return app.main(args, initData);
}
}
diff --git a/cs/test/Glacier2/sessionHelper/Client.cs b/cs/test/Glacier2/sessionHelper/Client.cs
index 11b4f747846..35c15f2f280 100644
--- a/cs/test/Glacier2/sessionHelper/Client.cs
+++ b/cs/test/Glacier2/sessionHelper/Client.cs
@@ -54,10 +54,15 @@ public class Client
catch(Glacier2.PermissionDeniedException)
{
Console.Out.WriteLine("ok");
- lock(me)
+ me.lck.Lock();
+ try
{
wakeUp();
}
+ finally
+ {
+ me.lck.Unlock();
+ }
}
catch(System.Exception)
{
@@ -78,20 +83,30 @@ public class Client
connected(Glacier2.SessionHelper session)
{
Console.Out.WriteLine("ok");
- lock(me)
+ me.lck.Lock();
+ try
{
wakeUp();
}
+ finally
+ {
+ me.lck.Unlock();
+ }
}
public void
disconnected(Glacier2.SessionHelper session)
{
Console.Out.WriteLine("ok");
- lock(me)
+ me.lck.Lock();
+ try
{
wakeUp();
}
+ finally
+ {
+ me.lck.Unlock();
+ }
}
public void
@@ -132,10 +147,15 @@ public class Client
catch(Ice.ConnectionRefusedException)
{
Console.Out.WriteLine("ok");
- lock(me)
+ me.lck.Lock();
+ try
{
wakeUp();
}
+ finally
+ {
+ me.lck.Unlock();
+ }
}
catch(System.Exception)
{
@@ -155,7 +175,11 @@ public class Client
Ice.InitializationData initData = new Ice.InitializationData();
initData.properties = Ice.Util.createProperties(ref args);
initData.properties.setProperty("Ice.Default.Router", "Glacier2/router:default -p 12347");
+#if COMPACT
+ initData.dispatcher = delegate(Ice.VoidAction action, Ice.Connection connection)
+#else
initData.dispatcher = delegate(System.Action action, Ice.Connection connection)
+#endif
{
action();
};
@@ -165,7 +189,8 @@ public class Client
//
// Test to create a session with wrong userid/password
//
- lock(this)
+ lck.Lock();
+ try
{
Console.Out.Write("testing SessionHelper connect with wrong userid/password... ");
Console.Out.Flush();
@@ -177,19 +202,29 @@ public class Client
_session = _factory.connect("userid", "xxx");
while(true)
{
+#if COMPACT
+ lck.Wait();
+ break;
+#else
try
{
- System.Threading.Monitor.Wait(this);
+ lck.Wait();
break;
}
catch(ThreadInterruptedException)
{
}
+#endif
}
}
+ finally
+ {
+ lck.Unlock();
+ }
_factory = new Glacier2.SessionFactoryHelper(initData, new SessionCalback2());
- lock(this)
+ lck.Lock();
+ try
{
Console.Out.Write("testing SessionHelper connect... ");
Console.Out.Flush();
@@ -200,14 +235,19 @@ public class Client
_session = _factory.connect("userid", "abc123");
while(true)
{
+#if COMPACT
+ lck.Wait();
+ break;
+#else
try
{
- System.Threading.Monitor.Wait(this);
+ lck.Wait();
break;
}
catch(ThreadInterruptedException)
{
}
+#endif
}
Console.Out.Write("testing SessionHelper isConnected after connect... ");
@@ -263,14 +303,19 @@ public class Client
_session.destroy();
while(true)
{
+#if COMPACT
+ lck.Wait();
+ break;
+#else
try
{
- System.Threading.Monitor.Wait(this);
+ lck.Wait();
break;
}
catch(ThreadInterruptedException)
{
}
+#endif
}
Console.Out.Write("testing SessionHelper isConnected after destroy... ");
@@ -340,9 +385,14 @@ public class Client
Console.Out.WriteLine("ok");
}
}
+ finally
+ {
+ lck.Unlock();
+ }
_factory = new Glacier2.SessionFactoryHelper(initData, new SessionCalback3());
- lock(this)
+ lck.Lock();
+ try
{
Console.Out.Write("testing SessionHelper connect after router shutdown... ");
Console.Out.Flush();
@@ -354,14 +404,19 @@ public class Client
_session = _factory.connect("userid", "abc123");
while(true)
{
+#if COMPACT
+ lck.Wait();
+ break;
+#else
try
{
- System.Threading.Monitor.Wait(this);
+ lck.Wait();
break;
}
catch(ThreadInterruptedException)
{
}
+#endif
}
Console.Out.Write("testing SessionHelper isConnect after connect failure... ");
@@ -379,6 +434,10 @@ public class Client
_session.destroy();
Console.Out.WriteLine("ok");
}
+ finally
+ {
+ lck.Unlock();
+ }
return 0;
}
@@ -386,7 +445,7 @@ public class Client
public static void
wakeUp()
{
- System.Threading.Monitor.Pulse(me);
+ me.lck.Notify();
}
private static void
@@ -399,26 +458,22 @@ public class Client
}
public static App me;
+ public IceUtilInternal.Monitor lck = new IceUtilInternal.Monitor();
private Glacier2.SessionHelper _session;
private Glacier2.SessionFactoryHelper _factory;
}
- public static void Main(string[] args)
+ public static int Main(string[] args)
{
+#if !COMPACT
Debug.Listeners.Add(new ConsoleTraceListener());
+#endif
Ice.InitializationData initData = new Ice.InitializationData();
initData.properties = Ice.Util.createProperties(ref args);
initData.properties.setProperty("Ice.Warn.Connections", "0");
App app = new App();
- int status = app.main(args, initData);
-
- if(status != 0)
- {
- Environment.Exit(status);
- }
+ return app.main(args, initData);
}
-
-
}
diff --git a/cs/test/Glacier2/sessionHelper/Server.cs b/cs/test/Glacier2/sessionHelper/Server.cs
index aa5828fd179..51388242d5e 100644
--- a/cs/test/Glacier2/sessionHelper/Server.cs
+++ b/cs/test/Glacier2/sessionHelper/Server.cs
@@ -33,15 +33,13 @@ public class Server
}
}
- public static void Main(string[] args)
+ public static int Main(string[] args)
{
+#if !COMPACT
Debug.Listeners.Add(new ConsoleTraceListener());
+#endif
App app = new App();
- int status = app.main(args);
- if(status != 0)
- {
- Environment.Exit(status);
- }
+ return app.main(args);
}
}
diff --git a/cs/test/Ice/adapterDeactivation/Client.cs b/cs/test/Ice/adapterDeactivation/Client.cs
index b32b6a06e21..595f16d39c7 100644
--- a/cs/test/Ice/adapterDeactivation/Client.cs
+++ b/cs/test/Ice/adapterDeactivation/Client.cs
@@ -29,15 +29,13 @@ public class Client
}
}
- public static void Main(string[] args)
+ public static int Main(string[] args)
{
+#if !COMPACT
Debug.Listeners.Add(new ConsoleTraceListener());
+#endif
App app = new App();
- int result = app.main(args);
- if(result != 0)
- {
- System.Environment.Exit(result);
- }
+ return app.main(args);
}
}
diff --git a/cs/test/Ice/adapterDeactivation/Collocated.cs b/cs/test/Ice/adapterDeactivation/Collocated.cs
index f88ec334a02..c9fff454bb3 100644
--- a/cs/test/Ice/adapterDeactivation/Collocated.cs
+++ b/cs/test/Ice/adapterDeactivation/Collocated.cs
@@ -36,15 +36,13 @@ public class Collocated
}
}
- public static void Main(string[] args)
+ public static int Main(string[] args)
{
+#if !COMPACT
Debug.Listeners.Add(new ConsoleTraceListener());
+#endif
App app = new App();
- int result = app.main(args);
- if(result != 0)
- {
- System.Environment.Exit(result);
- }
+ return app.main(args);
}
}
diff --git a/cs/test/Ice/adapterDeactivation/Server.cs b/cs/test/Ice/adapterDeactivation/Server.cs
index b4de67c1d75..fdea1ea51f5 100644
--- a/cs/test/Ice/adapterDeactivation/Server.cs
+++ b/cs/test/Ice/adapterDeactivation/Server.cs
@@ -33,15 +33,13 @@ public class Server
}
}
- public static void Main(string[] args)
+ public static int Main(string[] args)
{
+#if !COMPACT
Debug.Listeners.Add(new ConsoleTraceListener());
+#endif
App app = new App();
- int result = app.main(args);
- if(result != 0)
- {
- System.Environment.Exit(result);
- }
+ return app.main(args);
}
}
diff --git a/cs/test/Ice/adapterDeactivation/TestI.cs b/cs/test/Ice/adapterDeactivation/TestI.cs
index 04d9204a5ac..50be142f97f 100644
--- a/cs/test/Ice/adapterDeactivation/TestI.cs
+++ b/cs/test/Ice/adapterDeactivation/TestI.cs
@@ -24,6 +24,6 @@ public sealed class TestI : TestIntfDisp_
public override void deactivate(Ice.Current current)
{
current.adapter.deactivate();
- System.Threading.Thread.Sleep(new System.TimeSpan(10 * 1000));
+ System.Threading.Thread.Sleep(10 * 1000);
}
}
diff --git a/cs/test/Ice/ami/AllTests.cs b/cs/test/Ice/ami/AllTests.cs
index 10be66e6cb1..55852362fd2 100644
--- a/cs/test/Ice/ami/AllTests.cs
+++ b/cs/test/Ice/ami/AllTests.cs
@@ -43,27 +43,38 @@ public class AllTests
public virtual void check()
{
- lock(this)
+ _m.Lock();
+ try
{
while(!_called)
{
- Monitor.Wait(this);
+ _m.Wait();
}
_called = false;
}
+ finally
+ {
+ _m.Unlock();
+ }
}
public virtual void called()
{
- lock(this)
+ _m.Lock();
+ try
{
Debug.Assert(!_called);
_called = true;
- Monitor.Pulse(this);
+ _m.Notify();
+ }
+ finally
+ {
+ _m.Unlock();
}
}
private bool _called;
+ private readonly IceUtilInternal.Monitor _m = new IceUtilInternal.Monitor();
}
private class AsyncCallback : CallbackBase
diff --git a/cs/test/Ice/ami/Client.cs b/cs/test/Ice/ami/Client.cs
index c2d71d081ec..3353fb9826c 100644
--- a/cs/test/Ice/ami/Client.cs
+++ b/cs/test/Ice/ami/Client.cs
@@ -24,19 +24,28 @@ public class Client
AllTests.allTests(communicator);
return 0;
}
-
- public static void Main(string[] args)
+
+ public static int Main(string[] args)
{
int status = 0;
Ice.Communicator communicator = null;
-
+
+#if !COMPACT
Debug.Listeners.Add(new ConsoleTraceListener());
+#endif
try
{
Ice.InitializationData initData = new Ice.InitializationData();
initData.properties = Ice.Util.createProperties(ref args);
initData.properties.setProperty("Ice.Warn.AMICallback", "0");
+#if COMPACT
+ //
+ // When using Ice for .NET Compact Framework, we need to specify
+ // the assembly so that Ice can locate classes and exceptions.
+ //
+ initData.properties.setProperty("Ice.FactoryAssemblies", "client");
+#endif
communicator = Ice.Util.initialize(ref args, initData);
status = run(args, communicator);
}
@@ -58,10 +67,7 @@ public class Client
status = 1;
}
}
-
- if(status != 0)
- {
- System.Environment.Exit(status);
- }
+
+ return status;
}
}
diff --git a/cs/test/Ice/ami/Server.cs b/cs/test/Ice/ami/Server.cs
index 7e2e8984244..2b16fd796d1 100644
--- a/cs/test/Ice/ami/Server.cs
+++ b/cs/test/Ice/ami/Server.cs
@@ -37,12 +37,14 @@ public class Server
return 0;
}
- public static void Main(string[] args)
+ public static int Main(string[] args)
{
int status = 0;
Ice.Communicator communicator = null;
-
+
+#if !COMPACT
Debug.Listeners.Add(new ConsoleTraceListener());
+#endif
try
{
@@ -57,7 +59,7 @@ public class Server
System.Console.Error.WriteLine(ex);
status = 1;
}
-
+
if(communicator != null)
{
try
@@ -70,10 +72,7 @@ public class Server
status = 1;
}
}
-
- if(status != 0)
- {
- System.Environment.Exit(status);
- }
+
+ return status;
}
}
diff --git a/cs/test/Ice/ami/TestI.cs b/cs/test/Ice/ami/TestI.cs
index f56adf6a99e..8c5d352acb1 100644
--- a/cs/test/Ice/ami/TestI.cs
+++ b/cs/test/Ice/ami/TestI.cs
@@ -41,35 +41,50 @@ public class TestI : TestIntfDisp_
override public void
opBatch(Ice.Current current)
{
- lock(this)
+ _m.Lock();
+ try
{
++_batchCount;
- Monitor.Pulse(this);
+ _m.Notify();
+ }
+ finally
+ {
+ _m.Unlock();
}
}
override public int
opBatchCount(Ice.Current current)
{
- lock(this)
+ _m.Lock();
+ try
{
return _batchCount;
}
+ finally
+ {
+ _m.Unlock();
+ }
}
override public bool
waitForBatch(int count, Ice.Current current)
{
- lock(this)
+ _m.Lock();
+ try
{
while(_batchCount < count)
{
- Monitor.Wait(this, 5000);
+ _m.TimedWait(5000);
}
bool result = count == _batchCount;
_batchCount = 0;
return result;
}
+ finally
+ {
+ _m.Unlock();
+ }
}
override public void
@@ -79,6 +94,7 @@ public class TestI : TestIntfDisp_
}
private int _batchCount;
+ private readonly IceUtilInternal.Monitor _m = new IceUtilInternal.Monitor();
}
public class TestControllerI : TestIntfControllerDisp_
@@ -102,4 +118,4 @@ public class TestControllerI : TestIntfControllerDisp_
}
private Ice.ObjectAdapter _adapter;
-};
+}
diff --git a/cs/test/Ice/application/Client.cs b/cs/test/Ice/application/Client.cs
index bd4f632e47f..4fb9f85d80b 100644
--- a/cs/test/Ice/application/Client.cs
+++ b/cs/test/Ice/application/Client.cs
@@ -59,15 +59,13 @@ public class Client
}
}
- public static void Main(string[] args)
+ public static int Main(string[] args)
{
+#if !COMPACT
Debug.Listeners.Add(new ConsoleTraceListener());
+#endif
App app = new App();
- int status = app.main(args);
- if(status != 0)
- {
- System.Environment.Exit(status);
- }
+ return app.main(args);
}
}
diff --git a/cs/test/Ice/background/AllTests.cs b/cs/test/Ice/background/AllTests.cs
index 4d9c927868c..efbd6f3e27b 100644
--- a/cs/test/Ice/background/AllTests.cs
+++ b/cs/test/Ice/background/AllTests.cs
@@ -15,113 +15,129 @@ using System.Threading;
public class AllTests
{
private static void test(bool b)
+ {
+ if(!b)
{
- if(!b)
- {
- throw new System.Exception();
- }
+ throw new System.Exception();
}
+ }
private class Callback
{
internal Callback()
- {
- _called = false;
- }
+ {
+ _called = false;
+ }
public virtual void check()
+ {
+ _m.Lock();
+ try
{
- lock(this)
+ while(!_called)
{
- while(!_called)
- {
- Monitor.Wait(this);
- }
-
- _called = false;
+ _m.Wait();
}
+
+ _called = false;
+ }
+ finally
+ {
+ _m.Unlock();
}
+ }
public virtual void called()
+ {
+ _m.Lock();
+ try
{
- lock(this)
- {
- Debug.Assert(!_called);
- _called = true;
- Monitor.Pulse(this);
- }
+ Debug.Assert(!_called);
+ _called = true;
+ _m.Notify();
+ }
+ finally
+ {
+ _m.Unlock();
}
+ }
public virtual bool isCalled()
+ {
+ _m.Lock();
+ try
{
- lock(this)
- {
- return _called;
- }
+ return _called;
+ }
+ finally
+ {
+ _m.Unlock();
}
+ }
private bool _called;
+ private readonly IceUtilInternal.Monitor _m = new IceUtilInternal.Monitor();
}
private class OpAMICallback
{
public void response()
- {
- _response.called();
- }
+ {
+ _response.called();
+ }
public void noResponse()
- {
- test(false);
- }
+ {
+ test(false);
+ }
public void exception(Ice.Exception ex)
- {
- _response.called();
- }
+ {
+ _response.called();
+ }
public void noException(Ice.Exception ex)
- {
- Console.Error.WriteLine(ex);
- test(false);
- }
+ {
+ Console.Error.WriteLine(ex);
+ test(false);
+ }
public void sent(bool ss)
- {
- _sent.called();
- }
+ {
+ _sent.called();
+ }
public bool checkException(bool wait)
+ {
+ if(wait)
{
- if(wait)
- {
- _response.check();
- return true;
- }
- else
- {
- return _response.isCalled();
- }
+ _response.check();
+ return true;
}
-
- public bool checkResponse(bool wait)
+ else
{
- if(wait)
- {
- _response.check();
- return true;
- }
- else
- {
- return _response.isCalled();
- }
+ return _response.isCalled();
}
+ }
- public void checkResponseAndSent()
+ public bool checkResponse(bool wait)
+ {
+ if(wait)
{
- _sent.check();
_response.check();
+ return true;
}
+ else
+ {
+ return _response.isCalled();
+ }
+ }
+
+ public void checkResponseAndSent()
+ {
+ _sent.check();
+ _response.check();
+ }
private Callback _response = new Callback();
private Callback _sent = new Callback();
@@ -130,58 +146,58 @@ public class AllTests
private class OpThread
{
internal OpThread(BackgroundPrx background)
- {
- _background = BackgroundPrxHelper.uncheckedCast(background.ice_oneway());
- Start();
- }
+ {
+ _background = BackgroundPrxHelper.uncheckedCast(background.ice_oneway());
+ Start();
+ }
public void Join()
- {
- _thread.Join();
- }
+ {
+ _thread.Join();
+ }
public void Start()
- {
- _thread = new Thread(new ThreadStart(Run));
- _thread.Start();
- }
+ {
+ _thread = new Thread(new ThreadStart(Run));
+ _thread.Start();
+ }
public void Run()
+ {
+ int count = 0;
+ while(true)
{
- int count = 0;
- while(true)
+ lock(this)
{
- lock(this)
+ if(_destroyed)
{
- if(_destroyed)
- {
- return;
- }
+ return;
}
+ }
- try
- {
- if(++count == 10) // Don't blast the connection with only oneway's
- {
- count = 0;
- _background.ice_twoway().ice_ping();
- }
- _background.begin_op();
- Thread.Sleep(1);
- }
- catch(Ice.LocalException)
+ try
+ {
+ if(++count == 10) // Don't blast the connection with only oneway's
{
+ count = 0;
+ _background.ice_twoway().ice_ping();
}
+ _background.begin_op();
+ Thread.Sleep(1);
+ }
+ catch(Ice.LocalException)
+ {
}
}
+ }
public void destroy()
+ {
+ lock(this)
{
- lock(this)
- {
- _destroyed = true;
- }
+ _destroyed = true;
}
+ }
private bool _destroyed = false;
private BackgroundPrx _background = null;
@@ -189,401 +205,401 @@ public class AllTests
}
public static Test.BackgroundPrx allTests(Ice.Communicator communicator)
- {
- string sref = "background:default -p 12010";
- Ice.ObjectPrx obj = communicator.stringToProxy(sref);
- test(obj != null);
+ {
+ string sref = "background:default -p 12010";
+ Ice.ObjectPrx obj = communicator.stringToProxy(sref);
+ test(obj != null);
- BackgroundPrx background = BackgroundPrxHelper.uncheckedCast(obj);
+ BackgroundPrx background = BackgroundPrxHelper.uncheckedCast(obj);
- sref = "backgroundController:tcp -p 12011";
- obj = communicator.stringToProxy(sref);
- test(obj != null);
+ sref = "backgroundController:tcp -p 12011";
+ obj = communicator.stringToProxy(sref);
+ test(obj != null);
- BackgroundControllerPrx backgroundController = BackgroundControllerPrxHelper.uncheckedCast(obj);
+ BackgroundControllerPrx backgroundController = BackgroundControllerPrxHelper.uncheckedCast(obj);
- Configuration configuration = Configuration.getInstance();
+ Configuration configuration = Configuration.getInstance();
- Console.Write("testing connect... ");
- Console.Out.Flush();
- {
- connectTests(configuration, background);
- }
- Console.Out.WriteLine("ok");
+ Console.Write("testing connect... ");
+ Console.Out.Flush();
+ {
+ connectTests(configuration, background);
+ }
+ Console.Out.WriteLine("ok");
- Console.Write("testing initialization... ");
- Console.Out.Flush();
- {
- initializeTests(configuration, background, backgroundController);
- }
- Console.Out.WriteLine("ok");
+ Console.Write("testing initialization... ");
+ Console.Out.Flush();
+ {
+ initializeTests(configuration, background, backgroundController);
+ }
+ Console.Out.WriteLine("ok");
- Console.Write("testing connection validation... ");
- Console.Out.Flush();
+ Console.Write("testing connection validation... ");
+ Console.Out.Flush();
+ {
+ validationTests(configuration, background, backgroundController);
+ }
+ Console.Out.WriteLine("ok");
+
+ Console.Write("testing read/write... ");
+ Console.Out.Flush();
+ {
+ readWriteTests(configuration, background, backgroundController);
+ }
+ Console.Out.WriteLine("ok");
+
+ Console.Write("testing locator... ");
+ Console.Out.Flush();
+ {
+ Ice.LocatorPrx locator;
+ obj = communicator.stringToProxy("locator:default -p 12010 -t 500");
+ locator = Ice.LocatorPrxHelper.uncheckedCast(obj);
+ obj = communicator.stringToProxy("background@Test").ice_locator(locator).ice_oneway();
+
+ backgroundController.pauseCall("findAdapterById");
+ try
{
- validationTests(configuration, background, backgroundController);
+ obj.ice_ping();
+ test(false);
}
- Console.Out.WriteLine("ok");
-
- Console.Write("testing read/write... ");
- Console.Out.Flush();
+ catch(Ice.TimeoutException)
{
- readWriteTests(configuration, background, backgroundController);
}
- Console.Out.WriteLine("ok");
+ backgroundController.resumeCall("findAdapterById");
+
+ obj = communicator.stringToProxy("locator:default -p 12010");
+ locator = Ice.LocatorPrxHelper.uncheckedCast(obj);
+ obj = obj.ice_locator(locator);
+ obj.ice_ping();
+
+ obj = communicator.stringToProxy("background@Test").ice_locator(locator);
+ BackgroundPrx bg = BackgroundPrxHelper.uncheckedCast(obj);
+
+ backgroundController.pauseCall("findAdapterById");
+ Ice.AsyncResult r1 = bg.begin_op();
+ Ice.AsyncResult r2 = bg.begin_op();
+ test(!r1.IsCompleted);
+ test(!r2.IsCompleted);
+ backgroundController.resumeCall("findAdapterById");
+ bg.end_op(r1);
+ bg.end_op(r2);
+ test(r1.IsCompleted);
+ test(r2.IsCompleted);
+ }
+ Console.Out.WriteLine("ok");
- Console.Write("testing locator... ");
- Console.Out.Flush();
- {
- Ice.LocatorPrx locator;
- obj = communicator.stringToProxy("locator:default -p 12010 -t 500");
- locator = Ice.LocatorPrxHelper.uncheckedCast(obj);
- obj = communicator.stringToProxy("background@Test").ice_locator(locator).ice_oneway();
+ Console.Write("testing router... ");
+ Console.Out.Flush();
+ {
+ Ice.RouterPrx router;
- backgroundController.pauseCall("findAdapterById");
- try
- {
- obj.ice_ping();
- test(false);
- }
- catch(Ice.TimeoutException)
- {
- }
- backgroundController.resumeCall("findAdapterById");
+ obj = communicator.stringToProxy("router:default -p 12010 -t 500");
+ router = Ice.RouterPrxHelper.uncheckedCast(obj);
+ obj = communicator.stringToProxy("background@Test").ice_router(router).ice_oneway();
- obj = communicator.stringToProxy("locator:default -p 12010");
- locator = Ice.LocatorPrxHelper.uncheckedCast(obj);
- obj = obj.ice_locator(locator);
+ backgroundController.pauseCall("getClientProxy");
+ try
+ {
obj.ice_ping();
-
- obj = communicator.stringToProxy("background@Test").ice_locator(locator);
- BackgroundPrx bg = BackgroundPrxHelper.uncheckedCast(obj);
-
- backgroundController.pauseCall("findAdapterById");
- Ice.AsyncResult r1 = bg.begin_op();
- Ice.AsyncResult r2 = bg.begin_op();
- test(!r1.IsCompleted);
- test(!r2.IsCompleted);
- backgroundController.resumeCall("findAdapterById");
- bg.end_op(r1);
- bg.end_op(r2);
- test(r1.IsCompleted);
- test(r2.IsCompleted);
+ test(false);
}
- Console.Out.WriteLine("ok");
-
- Console.Write("testing router... ");
- Console.Out.Flush();
+ catch(Ice.TimeoutException)
{
- Ice.RouterPrx router;
-
- obj = communicator.stringToProxy("router:default -p 12010 -t 500");
- router = Ice.RouterPrxHelper.uncheckedCast(obj);
- obj = communicator.stringToProxy("background@Test").ice_router(router).ice_oneway();
-
- backgroundController.pauseCall("getClientProxy");
- try
- {
- obj.ice_ping();
- test(false);
- }
- catch(Ice.TimeoutException)
- {
- }
- backgroundController.resumeCall("getClientProxy");
-
- obj = communicator.stringToProxy("router:default -p 12010");
- router = Ice.RouterPrxHelper.uncheckedCast(obj);
- obj = communicator.stringToProxy("background@Test").ice_router(router);
- BackgroundPrx bg = BackgroundPrxHelper.uncheckedCast(obj);
- test(bg.ice_getRouter() != null);
-
- backgroundController.pauseCall("getClientProxy");
- Ice.AsyncResult r1 = bg.begin_op();
- Ice.AsyncResult r2 = bg.begin_op();
- test(!r1.IsCompleted);
- test(!r2.IsCompleted);
- backgroundController.resumeCall("getClientProxy");
- bg.end_op(r1);
- bg.end_op(r2);
- test(r1.IsCompleted);
- test(r2.IsCompleted);
}
- Console.Out.WriteLine("ok");
-
- return background;
+ backgroundController.resumeCall("getClientProxy");
+
+ obj = communicator.stringToProxy("router:default -p 12010");
+ router = Ice.RouterPrxHelper.uncheckedCast(obj);
+ obj = communicator.stringToProxy("background@Test").ice_router(router);
+ BackgroundPrx bg = BackgroundPrxHelper.uncheckedCast(obj);
+ test(bg.ice_getRouter() != null);
+
+ backgroundController.pauseCall("getClientProxy");
+ Ice.AsyncResult r1 = bg.begin_op();
+ Ice.AsyncResult r2 = bg.begin_op();
+ test(!r1.IsCompleted);
+ test(!r2.IsCompleted);
+ backgroundController.resumeCall("getClientProxy");
+ bg.end_op(r1);
+ bg.end_op(r2);
+ test(r1.IsCompleted);
+ test(r2.IsCompleted);
}
+ Console.Out.WriteLine("ok");
+
+ return background;
+ }
private static void connectTests(Configuration configuration, Test.BackgroundPrx background)
+ {
+ try
{
- try
+ background.op();
+ }
+ catch(Ice.LocalException ex)
+ {
+ System.Console.Out.WriteLine(ex);
+ test(false);
+ }
+ background.ice_getConnection().close(false);
+
+ for(int i = 0; i < 4; ++i)
+ {
+ if(i == 0 || i == 2)
{
- background.op();
+ configuration.connectorsException(new Ice.DNSException());
}
- catch(Ice.LocalException ex)
+ else
{
- System.Console.Out.WriteLine(ex);
- test(false);
+ configuration.connectException(new Ice.SocketException());
}
- background.ice_getConnection().close(false);
+ BackgroundPrx prx = (i == 1 || i == 3) ? background : (BackgroundPrx)background.ice_oneway();
- for(int i = 0; i < 4; ++i)
+ try
{
- if(i == 0 || i == 2)
- {
- configuration.connectorsException(new Ice.DNSException());
- }
- else
- {
- configuration.connectException(new Ice.SocketException());
- }
- BackgroundPrx prx = (i == 1 || i == 3) ? background : (BackgroundPrx)background.ice_oneway();
-
- try
- {
- prx.op();
- test(false);
- }
- catch(Ice.Exception)
- {
- }
-
- Ice.AsyncResult r = prx.begin_op();
- test(!r.sentSynchronously());
- try
- {
- prx.end_op(r);
- test(false);
- }
- catch(Ice.Exception)
- {
- }
- test(r.IsCompleted);
-
- OpAMICallback cbEx = new OpAMICallback();
- r = prx.begin_op().whenCompleted(cbEx.exception);
- test(!r.sentSynchronously());
- cbEx.checkException(true);
- test(r.IsCompleted);
+ prx.op();
+ test(false);
+ }
+ catch(Ice.Exception)
+ {
+ }
- if(i == 0 || i == 2)
- {
- configuration.connectorsException(null);
- }
- else
- {
- configuration.connectException(null);
- }
+ Ice.AsyncResult r = prx.begin_op();
+ test(!r.sentSynchronously());
+ try
+ {
+ prx.end_op(r);
+ test(false);
}
+ catch(Ice.Exception)
+ {
+ }
+ test(r.IsCompleted);
- OpThread thread1 = new OpThread(background);
- OpThread thread2 = new OpThread(background);
+ OpAMICallback cbEx = new OpAMICallback();
+ r = prx.begin_op().whenCompleted(cbEx.exception);
+ test(!r.sentSynchronously());
+ cbEx.checkException(true);
+ test(r.IsCompleted);
- for(int i = 0; i < 5; i++)
+ if(i == 0 || i == 2)
+ {
+ configuration.connectorsException(null);
+ }
+ else
{
- try
- {
- background.ice_ping();
- }
- catch(Ice.LocalException)
- {
- test(false);
- }
-
- configuration.connectException(new Ice.SocketException());
- background.ice_getCachedConnection().close(true);
- Thread.Sleep(10);
configuration.connectException(null);
- try
- {
- background.ice_ping();
- }
- catch(Ice.LocalException)
- {
- }
}
-
- thread1.destroy();
- thread2.destroy();
-
- thread1.Join();
- thread2.Join();
}
- private static void initializeTests(Configuration configuration, Test.BackgroundPrx background,
- Test.BackgroundControllerPrx ctl)
+ OpThread thread1 = new OpThread(background);
+ OpThread thread2 = new OpThread(background);
+
+ for(int i = 0; i < 5; i++)
{
try
{
- background.op();
+ background.ice_ping();
}
catch(Ice.LocalException)
{
test(false);
}
- background.ice_getConnection().close(false);
- for(int i = 0; i < 4; ++i)
+ configuration.connectException(new Ice.SocketException());
+ background.ice_getCachedConnection().close(true);
+ Thread.Sleep(10);
+ configuration.connectException(null);
+ try
{
- if(i == 0 || i == 2)
- {
- configuration.initializeException(new Ice.SocketException());
- }
- else
- {
- continue;
- }
- BackgroundPrx prx = (i == 1 || i == 3) ? background : (BackgroundPrx)background.ice_oneway();
+ background.ice_ping();
+ }
+ catch(Ice.LocalException)
+ {
+ }
+ }
- try
- {
- prx.op();
- test(false);
- }
- catch(Ice.SocketException)
- {
- }
+ thread1.destroy();
+ thread2.destroy();
- Ice.AsyncResult r = prx.begin_op();
- test(!r.sentSynchronously());
- try
- {
- prx.end_op(r);
- test(false);
- }
- catch(Ice.Exception)
- {
- }
- test(r.IsCompleted);
+ thread1.Join();
+ thread2.Join();
+ }
- OpAMICallback cbEx = new OpAMICallback();
- r = prx.begin_op().whenCompleted(cbEx.exception);
- test(!r.sentSynchronously());
- cbEx.checkException(true);
- test(r.IsCompleted);
+ private static void initializeTests(Configuration configuration, Test.BackgroundPrx background,
+ Test.BackgroundControllerPrx ctl)
+ {
+ try
+ {
+ background.op();
+ }
+ catch(Ice.LocalException)
+ {
+ test(false);
+ }
+ background.ice_getConnection().close(false);
- if(i == 0 || i == 2)
- {
- configuration.initializeException(null);
- }
+ for(int i = 0; i < 4; ++i)
+ {
+ if(i == 0 || i == 2)
+ {
+ configuration.initializeException(new Ice.SocketException());
}
-
- //
- // Now run the same tests with the server side.
- //
+ else
+ {
+ continue;
+ }
+ BackgroundPrx prx = (i == 1 || i == 3) ? background : (BackgroundPrx)background.ice_oneway();
try
{
- ctl.initializeException(true);
- background.op();
+ prx.op();
test(false);
}
- catch(Ice.ConnectionLostException)
+ catch(Ice.SocketException)
+ {
+ }
+
+ Ice.AsyncResult r = prx.begin_op();
+ test(!r.sentSynchronously());
+ try
{
- ctl.initializeException(false);
+ prx.end_op(r);
+ test(false);
}
- catch(Ice.SecurityException)
+ catch(Ice.Exception)
{
- ctl.initializeException(false);
}
+ test(r.IsCompleted);
- OpThread thread1 = new OpThread(background);
- OpThread thread2 = new OpThread(background);
+ OpAMICallback cbEx = new OpAMICallback();
+ r = prx.begin_op().whenCompleted(cbEx.exception);
+ test(!r.sentSynchronously());
+ cbEx.checkException(true);
+ test(r.IsCompleted);
- for(int i = 0; i < 5; i++)
+ if(i == 0 || i == 2)
{
- try
- {
- background.ice_ping();
- }
- catch(Ice.LocalException)
- {
- test(false);
- }
-
- configuration.initializeException(new Ice.SocketException());
- background.ice_getCachedConnection().close(true);
- Thread.Sleep(10);
configuration.initializeException(null);
- try
- {
- background.ice_ping();
- }
- catch(Ice.LocalException)
- {
- }
- try
- {
- background.ice_ping();
- }
- catch(Ice.LocalException)
- {
- test(false);
- }
+ }
+ }
- background.ice_getCachedConnection().close(true);
- background.ice_ping();
+ //
+ // Now run the same tests with the server side.
+ //
- ctl.initializeException(true);
- background.ice_getCachedConnection().close(true);
- Thread.Sleep(10);
- ctl.initializeException(false);
- try
- {
- background.ice_ping();
- }
- catch(Ice.LocalException)
- {
- }
- try
- {
- background.ice_ping();
- }
- catch(Ice.LocalException)
- {
- test(false);
- }
+ try
+ {
+ ctl.initializeException(true);
+ background.op();
+ test(false);
+ }
+ catch(Ice.ConnectionLostException)
+ {
+ ctl.initializeException(false);
+ }
+ catch(Ice.SecurityException)
+ {
+ ctl.initializeException(false);
+ }
- try
- {
- background.ice_getCachedConnection().close(true);
- background.op();
- }
- catch(Ice.LocalException)
- {
- test(false);
- }
+ OpThread thread1 = new OpThread(background);
+ OpThread thread2 = new OpThread(background);
+
+ for(int i = 0; i < 5; i++)
+ {
+ try
+ {
+ background.ice_ping();
+ }
+ catch(Ice.LocalException)
+ {
+ test(false);
}
- thread1.destroy();
- thread2.destroy();
+ configuration.initializeException(new Ice.SocketException());
+ background.ice_getCachedConnection().close(true);
+ Thread.Sleep(10);
+ configuration.initializeException(null);
+ try
+ {
+ background.ice_ping();
+ }
+ catch(Ice.LocalException)
+ {
+ }
+ try
+ {
+ background.ice_ping();
+ }
+ catch(Ice.LocalException)
+ {
+ test(false);
+ }
- thread1.Join();
- thread2.Join();
- }
+ background.ice_getCachedConnection().close(true);
+ background.ice_ping();
- private static void validationTests(Configuration configuration, Test.BackgroundPrx background,
- Test.BackgroundControllerPrx ctl)
- {
+ ctl.initializeException(true);
+ background.ice_getCachedConnection().close(true);
+ Thread.Sleep(10);
+ ctl.initializeException(false);
try
{
- background.op();
+ background.ice_ping();
+ }
+ catch(Ice.LocalException)
+ {
+ }
+ try
+ {
+ background.ice_ping();
}
catch(Ice.LocalException)
{
test(false);
}
- background.ice_getConnection().close(false);
try
{
- // Get the read() of connection validation to throw right away.
- configuration.readException(new Ice.SocketException());
+ background.ice_getCachedConnection().close(true);
background.op();
- test(false);
}
- catch(Ice.SocketException)
+ catch(Ice.LocalException)
{
+ test(false);
+ }
+ }
+
+ thread1.destroy();
+ thread2.destroy();
+
+ thread1.Join();
+ thread2.Join();
+ }
+
+ private static void validationTests(Configuration configuration, Test.BackgroundPrx background,
+ Test.BackgroundControllerPrx ctl)
+ {
+ try
+ {
+ background.op();
+ }
+ catch(Ice.LocalException)
+ {
+ test(false);
+ }
+ background.ice_getConnection().close(false);
+
+ try
+ {
+ // Get the read() of connection validation to throw right away.
+ configuration.readException(new Ice.SocketException());
+ background.op();
+ test(false);
+ }
+ catch(Ice.SocketException)
+ {
configuration.readException(null);
}
diff --git a/cs/test/Ice/background/BackgroundControllerI.cs b/cs/test/Ice/background/BackgroundControllerI.cs
index 1de26f8b949..dd1965e4d63 100644
--- a/cs/test/Ice/background/BackgroundControllerI.cs
+++ b/cs/test/Ice/background/BackgroundControllerI.cs
@@ -15,31 +15,46 @@ internal class BackgroundControllerI : BackgroundControllerDisp_
{
public override void pauseCall(string opName, Ice.Current current)
{
- lock(this)
+ _m.Lock();
+ try
{
_pausedCalls.Add(opName);
}
+ finally
+ {
+ _m.Unlock();
+ }
}
public override void resumeCall(string opName, Ice.Current current)
{
- lock(this)
+ _m.Lock();
+ try
{
_pausedCalls.Remove(opName);
- Monitor.PulseAll(this);
+ _m.NotifyAll();
+ }
+ finally
+ {
+ _m.Unlock();
}
}
internal void checkCallPause(Ice.Current current)
{
- lock(this)
+ _m.Lock();
+ try
{
while(_pausedCalls.Contains(current.operation))
{
- Monitor.Wait(this);
+ _m.Wait();
break;
}
}
+ finally
+ {
+ _m.Unlock();
+ }
}
public override void holdAdapter(Ice.Current current)
@@ -84,6 +99,11 @@ internal class BackgroundControllerI : BackgroundControllerDisp_
}
private Ice.ObjectAdapter _adapter;
+#if COMPACT
+ private IceInternal.HashSet<string> _pausedCalls = new IceInternal.HashSet<string>();
+#else
private HashSet<string> _pausedCalls = new HashSet<string>();
+#endif
private Configuration _configuration;
+ private readonly IceUtilInternal.Monitor _m = new IceUtilInternal.Monitor();
}
diff --git a/cs/test/Ice/background/Client.cs b/cs/test/Ice/background/Client.cs
index b8f18c49edf..40c637c8c5c 100644
--- a/cs/test/Ice/background/Client.cs
+++ b/cs/test/Ice/background/Client.cs
@@ -26,12 +26,14 @@ public class Client
return 0;
}
- public static void Main(string[] args)
+ public static int Main(string[] args)
{
int status = 0;
Ice.Communicator communicator = null;
+#if !COMPACT
Debug.Listeners.Add(new ConsoleTraceListener());
+#endif
try
{
@@ -80,9 +82,6 @@ public class Client
}
}
- if(status != 0)
- {
- System.Environment.Exit(status);
- }
+ return status;
}
}
diff --git a/cs/test/Ice/background/Server.cs b/cs/test/Ice/background/Server.cs
index a95f4047a82..0bbf9ba9438 100644
--- a/cs/test/Ice/background/Server.cs
+++ b/cs/test/Ice/background/Server.cs
@@ -115,12 +115,14 @@ public class Server
return 0;
}
- public static void Main(string[] args)
+ public static int Main(string[] args)
{
int status = 0;
Ice.Communicator communicator = null;
+#if !COMPACT
Debug.Listeners.Add(new ConsoleTraceListener());
+#endif
try
{
@@ -164,9 +166,6 @@ public class Server
}
}
- if(status != 0)
- {
- System.Environment.Exit(status);
- }
+ return status;
}
}
diff --git a/cs/test/Ice/binding/AllTests.cs b/cs/test/Ice/binding/AllTests.cs
index 6d9e504a649..ff8554c4ead 100644
--- a/cs/test/Ice/binding/AllTests.cs
+++ b/cs/test/Ice/binding/AllTests.cs
@@ -24,36 +24,47 @@ public class AllTests
}
}
- private class GetAdapterNameCB
+ private class GetAdapterNameCB
{
public void response(string name)
{
- lock(this)
+ _m.Lock();
+ try
{
_name = name;
- Monitor.Pulse(this);
+ _m.Notify();
+ }
+ finally
+ {
+ _m.Unlock();
}
}
-
+
public void exception(Ice.Exception ex)
{
test(false);
}
-
+
public string getResult()
{
- lock(this)
+ _m.Lock();
+ try
{
while(_name == null)
{
- Monitor.Wait(this);
+ _m.Wait();
}
return _name;
- }
+ }
+ finally
+ {
+ _m.Unlock();
+ }
}
-
+
private string _name = null;
- };
+ private readonly IceUtilInternal.Monitor _m = new IceUtilInternal.Monitor();
+ }
private static string getAdapterNameWithAMI(TestIntfPrx test)
{
@@ -76,7 +87,7 @@ public class AllTests
}
}
}
-
+
private static TestIntfPrx createTestIntfPrx(ArrayList adapters)
{
ArrayList endpoints = new ArrayList();
@@ -85,7 +96,10 @@ public class AllTests
while(p.MoveNext())
{
obj = ((RemoteObjectAdapterPrx)p.Current).getTestIntf();
- endpoints.AddRange(ArrayList.Adapter(obj.ice_getEndpoints()));
+ foreach(Ice.Endpoint e in obj.ice_getEndpoints())
+ {
+ endpoints.Add(e);
+ }
}
return TestIntfPrxHelper.uncheckedCast(
obj.ice_endpoints((Ice.Endpoint[])endpoints.ToArray(typeof(Ice.Endpoint))));
@@ -126,9 +140,9 @@ public class AllTests
test1.ice_ping();
test2.ice_ping();
-
+
com.deactivateObjectAdapter(adapter);
-
+
TestIntfPrx test3 = TestIntfPrxHelper.uncheckedCast(test1);
test(test3.ice_getConnection() == test1.ice_getConnection());
test(test3.ice_getConnection() == test2.ice_getConnection());
@@ -156,7 +170,7 @@ public class AllTests
// Ensure that when a connection is opened it's reused for new
// proxies and that all endpoints are eventually tried.
//
- HashSet<string> names = new HashSet<string>();
+ List<string> names = new List<string>();
names.Add("Adapter11");
names.Add("Adapter12");
names.Add("Adapter13");
@@ -176,7 +190,7 @@ public class AllTests
names.Remove(test1.getAdapterName());
test1.ice_getConnection().close(false);
}
-
+
//
// Ensure that the proxy correctly caches the connection (we
// always send the request over the same connection.)
@@ -186,7 +200,7 @@ public class AllTests
{
adpt.getTestIntf().ice_ping();
}
-
+
TestIntfPrx t = createTestIntfPrx(adapters);
string name = t.getAdapterName();
int nRetry = 10;
@@ -198,7 +212,7 @@ public class AllTests
{
adpt.getTestIntf().ice_getConnection().close(false);
}
- }
+ }
//
// Deactivate an adapter and ensure that we can still
@@ -216,7 +230,7 @@ public class AllTests
TestIntfPrx test2 = createTestIntfPrx(adpts);
shuffle(ref adpts);
TestIntfPrx test3 = createTestIntfPrx(adpts);
-
+
test(test1.ice_getConnection() == test2.ice_getConnection());
test(test2.ice_getConnection() == test3.ice_getConnection());
@@ -228,7 +242,7 @@ public class AllTests
// Deactivate an adapter and ensure that we can still
// establish the connection to the remaining adapter.
//
- com.deactivateObjectAdapter((RemoteObjectAdapterPrx)adapters[2]);
+ com.deactivateObjectAdapter((RemoteObjectAdapterPrx)adapters[2]);
TestIntfPrx obj = createTestIntfPrx(adapters);
test(obj.getAdapterName().Equals("Adapter12"));
@@ -293,7 +307,7 @@ public class AllTests
}
proxies[i] = createTestIntfPrx(new ArrayList(adpts));
}
-
+
for(i = 0; i < proxies.Length; i++)
{
proxies[i].begin_getAdapterName();
@@ -308,7 +322,7 @@ public class AllTests
{
}
}
-
+
ArrayList connections = new ArrayList();
for(i = 0; i < proxies.Length; i++)
{
@@ -349,7 +363,7 @@ public class AllTests
// Ensure that when a connection is opened it's reused for new
// proxies and that all endpoints are eventually tried.
//
- HashSet<string> names = new HashSet<string>();
+ List<string> names = new List<string>();
names.Add("AdapterAMI11");
names.Add("AdapterAMI12");
names.Add("AdapterAMI13");
@@ -369,7 +383,7 @@ public class AllTests
names.Remove(getAdapterNameWithAMI(test1));
test1.ice_getConnection().close(false);
}
-
+
//
// Ensure that the proxy correctly caches the connection (we
// always send the request over the same connection.)
@@ -379,7 +393,7 @@ public class AllTests
{
adpt.getTestIntf().ice_ping();
}
-
+
TestIntfPrx t = createTestIntfPrx(adapters);
string name = getAdapterNameWithAMI(t);
int nRetry = 10;
@@ -391,7 +405,7 @@ public class AllTests
{
adpt.getTestIntf().ice_getConnection().close(false);
}
- }
+ }
//
// Deactivate an adapter and ensure that we can still
@@ -409,7 +423,7 @@ public class AllTests
TestIntfPrx test2 = createTestIntfPrx(adpts);
shuffle(ref adpts);
TestIntfPrx test3 = createTestIntfPrx(adpts);
-
+
test(test1.ice_getConnection() == test2.ice_getConnection());
test(test2.ice_getConnection() == test3.ice_getConnection());
@@ -421,7 +435,7 @@ public class AllTests
// Deactivate an adapter and ensure that we can still
// establish the connection to the remaining adapter.
//
- com.deactivateObjectAdapter((RemoteObjectAdapterPrx)adapters[2]);
+ com.deactivateObjectAdapter((RemoteObjectAdapterPrx)adapters[2]);
TestIntfPrx obj = createTestIntfPrx(adapters);
test(getAdapterNameWithAMI(obj).Equals("AdapterAMI12"));
@@ -440,7 +454,7 @@ public class AllTests
TestIntfPrx obj = createTestIntfPrx(adapters);
test(obj.ice_getEndpointSelection() == Ice.EndpointSelectionType.Random);
- HashSet<string> names = new HashSet<string>();
+ List<string> names = new List<string>();
names.Add("Adapter21");
names.Add("Adapter22");
names.Add("Adapter23");
@@ -493,7 +507,7 @@ public class AllTests
for(i = 0; i < nRetry && obj.getAdapterName().Equals("Adapter33"); i++);
test(i == nRetry);
com.deactivateObjectAdapter((RemoteObjectAdapterPrx)adapters[2]);
-
+
try
{
obj.getAdapterName();
@@ -509,7 +523,7 @@ public class AllTests
//
// Now, re-activate the adapters with the same endpoints in the opposite
// order.
- //
+ //
adapters.Add(com.createObjectAdapter("Adapter36", endpoints[2].ToString()));
for(i = 0; i < nRetry && obj.getAdapterName().Equals("Adapter36"); i++);
test(i == nRetry);
@@ -538,9 +552,9 @@ public class AllTests
test(test1.ice_getConnection() == test2.ice_getConnection());
test1.ice_ping();
-
+
com.deactivateObjectAdapter(adapter);
-
+
TestIntfPrx test3 = TestIntfPrxHelper.uncheckedCast(test1);
try
{
@@ -564,7 +578,7 @@ public class AllTests
TestIntfPrx obj = TestIntfPrxHelper.uncheckedCast(createTestIntfPrx(adapters).ice_connectionCached(false));
test(!obj.ice_isConnectionCached());
- HashSet<string> names = new HashSet<string>();
+ List<string> names = new List<string>();
names.Add("Adapter51");
names.Add("Adapter52");
names.Add("Adapter53");
@@ -586,7 +600,7 @@ public class AllTests
test(obj.getAdapterName().Equals("Adapter52"));
-
+
deactivate(com, adapters);
}
Console.Out.WriteLine("ok");
@@ -602,7 +616,7 @@ public class AllTests
TestIntfPrx obj = TestIntfPrxHelper.uncheckedCast(createTestIntfPrx(adapters).ice_connectionCached(false));
test(!obj.ice_isConnectionCached());
- HashSet<string> names = new HashSet<string>();
+ List<string> names = new List<string>();
names.Add("AdapterAMI51");
names.Add("AdapterAMI52");
names.Add("AdapterAMI53");
@@ -624,7 +638,7 @@ public class AllTests
test(getAdapterNameWithAMI(obj).Equals("AdapterAMI52"));
-
+
deactivate(com, adapters);
}
Console.Out.WriteLine("ok");
@@ -658,7 +672,7 @@ public class AllTests
for(i = 0; i < nRetry && obj.getAdapterName().Equals("Adapter63"); i++);
test(i == nRetry);
com.deactivateObjectAdapter((RemoteObjectAdapterPrx)adapters[2]);
-
+
try
{
obj.getAdapterName();
@@ -674,7 +688,7 @@ public class AllTests
//
// Now, re-activate the adapters with the same endpoints in the opposite
// order.
- //
+ //
adapters.Add(com.createObjectAdapter("Adapter66", endpoints[2].ToString()));
for(i = 0; i < nRetry && obj.getAdapterName().Equals("Adapter66"); i++);
test(i == nRetry);
@@ -718,7 +732,7 @@ public class AllTests
for(i = 0; i < nRetry && getAdapterNameWithAMI(obj).Equals("AdapterAMI63"); i++);
test(i == nRetry);
com.deactivateObjectAdapter((RemoteObjectAdapterPrx)adapters[2]);
-
+
try
{
obj.getAdapterName();
@@ -734,7 +748,7 @@ public class AllTests
//
// Now, re-activate the adapters with the same endpoints in the opposite
// order.
- //
+ //
adapters.Add(com.createObjectAdapter("AdapterAMI66", endpoints[2].ToString()));
for(i = 0; i < nRetry && getAdapterNameWithAMI(obj).Equals("AdapterAMI66"); i++);
test(i == nRetry);
@@ -758,7 +772,7 @@ public class AllTests
TestIntfPrx obj = createTestIntfPrx(adapters);
test(obj.getAdapterName().Equals("Adapter71"));
-
+
TestIntfPrx testUDP = TestIntfPrxHelper.uncheckedCast(obj.ice_datagram());
test(obj.ice_getConnection() != testUDP.ice_getConnection());
try
@@ -779,7 +793,7 @@ public class AllTests
ArrayList adapters = new ArrayList();
adapters.Add(com.createObjectAdapter("Adapter81", "ssl"));
adapters.Add(com.createObjectAdapter("Adapter82", "tcp"));
-
+
TestIntfPrx obj = createTestIntfPrx(adapters);
int i;
for(i = 0; i < 5; i++)
@@ -787,7 +801,7 @@ public class AllTests
test(obj.getAdapterName().Equals("Adapter82"));
obj.ice_getConnection().close(false);
}
-
+
TestIntfPrx testSecure = TestIntfPrxHelper.uncheckedCast(obj.ice_secure(true));
test(testSecure.ice_isSecure());
testSecure = TestIntfPrxHelper.uncheckedCast(obj.ice_secure(false));
@@ -797,7 +811,7 @@ public class AllTests
test(obj.ice_getConnection() != testSecure.ice_getConnection());
com.deactivateObjectAdapter((RemoteObjectAdapterPrx)adapters[1]);
-
+
for(i = 0; i < 5; i++)
{
test(obj.getAdapterName().Equals("Adapter81"));
@@ -827,7 +841,7 @@ public class AllTests
Console.Out.WriteLine("ok");
}
- com.shutdown();
+ com.shutdown();
}
private static System.Random rand_ = new System.Random(unchecked((int)System.DateTime.Now.Ticks));
diff --git a/cs/test/Ice/binding/Client.cs b/cs/test/Ice/binding/Client.cs
index 157607235a1..98fe9543c06 100644
--- a/cs/test/Ice/binding/Client.cs
+++ b/cs/test/Ice/binding/Client.cs
@@ -24,13 +24,15 @@ public class Client
AllTests.allTests(communicator);
return 0;
}
-
- public static void Main(string[] args)
+
+ public static int Main(string[] args)
{
int status = 0;
Ice.Communicator communicator = null;
-
+
+#if !COMPACT
Debug.Listeners.Add(new ConsoleTraceListener());
+#endif
try
{
@@ -42,7 +44,7 @@ public class Client
System.Console.Error.WriteLine(ex);
status = 1;
}
-
+
if(communicator != null)
{
try
@@ -55,10 +57,7 @@ public class Client
status = 1;
}
}
-
- if(status != 0)
- {
- System.Environment.Exit(status);
- }
+
+ return status;
}
}
diff --git a/cs/test/Ice/binding/Server.cs b/cs/test/Ice/binding/Server.cs
index 0ac5d9a3922..951f5defdd9 100644
--- a/cs/test/Ice/binding/Server.cs
+++ b/cs/test/Ice/binding/Server.cs
@@ -30,13 +30,15 @@ public class Server
communicator.waitForShutdown();
return 0;
}
-
- public static void Main(string[] args)
+
+ public static int Main(string[] args)
{
int status = 0;
Ice.Communicator communicator = null;
-
+
+#if !COMPACT
Debug.Listeners.Add(new ConsoleTraceListener());
+#endif
try
{
@@ -51,7 +53,7 @@ public class Server
System.Console.Error.WriteLine(ex);
status = 1;
}
-
+
if(communicator != null)
{
try
@@ -64,10 +66,7 @@ public class Server
status = 1;
}
}
-
- if(status != 0)
- {
- System.Environment.Exit(status);
- }
+
+ return status;
}
}
diff --git a/cs/test/Ice/checksum/Client.cs b/cs/test/Ice/checksum/Client.cs
index 287ed593d44..06132c1ee4a 100644
--- a/cs/test/Ice/checksum/Client.cs
+++ b/cs/test/Ice/checksum/Client.cs
@@ -19,12 +19,14 @@ public class Client
return 0;
}
- public static void Main(string[] args)
+ public static int Main(string[] args)
{
int status = 0;
Ice.Communicator communicator = null;
-
+
+#if !COMPACT
Debug.Listeners.Add(new ConsoleTraceListener());
+#endif
try
{
@@ -36,7 +38,7 @@ public class Client
Console.Error.WriteLine(ex);
status = 1;
}
-
+
if(communicator != null)
{
try
@@ -49,10 +51,7 @@ public class Client
status = 1;
}
}
-
- if(status != 0)
- {
- System.Environment.Exit(status);
- }
+
+ return status;
}
}
diff --git a/cs/test/Ice/checksum/Makefile.mak b/cs/test/Ice/checksum/Makefile.mak
index f0d944f8732..5d93398b9b3 100644
--- a/cs/test/Ice/checksum/Makefile.mak
+++ b/cs/test/Ice/checksum/Makefile.mak
@@ -27,7 +27,7 @@ GDIR = generated
MCSFLAGS = $(MCSFLAGS) -target:exe
-SLICE2CSFLAGS = $(SLICE2CSFLAGS) -I. -I"$(slicedir)"
+SLICE2CSFLAGS = $(SLICE2CSFLAGS) --checksum -I. -I"$(slicedir)"
client.exe: $(C_SRCS) $(GEN_SRCS)
$(MCS) $(MCSFLAGS) -out:$@ -r:"$(refdir)\Ice.dll" $(C_SRCS) $(GEN_SRCS)
diff --git a/cs/test/Ice/checksum/server/Server.cs b/cs/test/Ice/checksum/server/Server.cs
index 2dbb931e090..1e4b4d28b1b 100644
--- a/cs/test/Ice/checksum/server/Server.cs
+++ b/cs/test/Ice/checksum/server/Server.cs
@@ -23,12 +23,14 @@ public class Server
return 0;
}
- public static void Main(string[] args)
+ public static int Main(string[] args)
{
int status = 0;
Ice.Communicator communicator = null;
+#if !COMPACT
Debug.Listeners.Add(new ConsoleTraceListener());
+#endif
try
{
@@ -54,9 +56,6 @@ public class Server
}
}
- if(status != 0)
- {
- System.Environment.Exit(status);
- }
+ return status;
}
}
diff --git a/cs/test/Ice/defaultServant/Client.cs b/cs/test/Ice/defaultServant/Client.cs
index 8eda2a4ddd4..d71e088168b 100644
--- a/cs/test/Ice/defaultServant/Client.cs
+++ b/cs/test/Ice/defaultServant/Client.cs
@@ -26,12 +26,14 @@ public class Client
return 0;
}
- public static void Main(string[] args)
+ public static int Main(string[] args)
{
int status = 0;
Ice.Communicator communicator = null;
+#if !COMPACT
Debug.Listeners.Add(new ConsoleTraceListener());
+#endif
try
{
@@ -57,10 +59,6 @@ public class Client
}
}
- if(status != 0)
- {
- System.Environment.Exit(status);
- }
+ return status;
}
}
-
diff --git a/cs/test/Ice/defaultValue/Client.cs b/cs/test/Ice/defaultValue/Client.cs
index 3d9cd7176f5..332e7a50b02 100644
--- a/cs/test/Ice/defaultValue/Client.cs
+++ b/cs/test/Ice/defaultValue/Client.cs
@@ -26,11 +26,13 @@ public class Client
return 0;
}
- public static void Main(string[] args)
+ public static int Main(string[] args)
{
int status = 0;
+#if !COMPACT
Debug.Listeners.Add(new ConsoleTraceListener());
+#endif
try
{
@@ -42,10 +44,7 @@ public class Client
status = 1;
}
- if(status != 0)
- {
- System.Environment.Exit(status);
- }
+ return status;
}
}
diff --git a/cs/test/Ice/dictMapping/Client.cs b/cs/test/Ice/dictMapping/Client.cs
index 08b2bbf2e5a..0e92b97239d 100644
--- a/cs/test/Ice/dictMapping/Client.cs
+++ b/cs/test/Ice/dictMapping/Client.cs
@@ -30,12 +30,14 @@ public class Client
return 0;
}
- public static void Main(string[] args)
+ public static int Main(string[] args)
{
int status = 0;
Ice.Communicator communicator = null;
+#if !COMPACT
Debug.Listeners.Add(new ConsoleTraceListener());
+#endif
try
{
@@ -61,9 +63,6 @@ public class Client
}
}
- if(status != 0)
- {
- System.Environment.Exit(status);
- }
+ return status;
}
}
diff --git a/cs/test/Ice/dictMapping/Collocated.cs b/cs/test/Ice/dictMapping/Collocated.cs
index 9f2d7fc0ad2..71174974fca 100644
--- a/cs/test/Ice/dictMapping/Collocated.cs
+++ b/cs/test/Ice/dictMapping/Collocated.cs
@@ -31,12 +31,14 @@ public class Collocated
return 0;
}
- public static void Main(String[] args)
+ public static int Main(String[] args)
{
int status = 0;
Ice.Communicator communicator = null;
+#if !COMPACT
Debug.Listeners.Add(new ConsoleTraceListener());
+#endif
try
{
@@ -62,9 +64,6 @@ public class Collocated
}
}
- if(status != 0)
- {
- System.Environment.Exit(status);
- }
+ return status;
}
}
diff --git a/cs/test/Ice/dictMapping/Server.cs b/cs/test/Ice/dictMapping/Server.cs
index de4f8a45a0c..13b1b09325d 100644
--- a/cs/test/Ice/dictMapping/Server.cs
+++ b/cs/test/Ice/dictMapping/Server.cs
@@ -30,12 +30,14 @@ public class Server
return 0;
}
- public static void Main(string[] args)
+ public static int Main(string[] args)
{
int status = 0;
Ice.Communicator communicator = null;
+#if !COMPACT
Debug.Listeners.Add(new ConsoleTraceListener());
+#endif
try
{
@@ -61,9 +63,6 @@ public class Server
}
}
- if(status != 0)
- {
- System.Environment.Exit(status);
- }
+ return status;
}
}
diff --git a/cs/test/Ice/dictMapping/TwowaysAMI.cs b/cs/test/Ice/dictMapping/TwowaysAMI.cs
index be11a563f64..fd305c92d5a 100644
--- a/cs/test/Ice/dictMapping/TwowaysAMI.cs
+++ b/cs/test/Ice/dictMapping/TwowaysAMI.cs
@@ -32,28 +32,39 @@ public class TwowaysAMI
public virtual void check()
{
- lock(this)
+ _m.Lock();
+ try
{
while(!_called)
{
- Monitor.Wait(this);
+ _m.Wait();
}
_called = false;
}
+ finally
+ {
+ _m.Unlock();
+ }
}
public virtual void called()
{
- lock(this)
+ _m.Lock();
+ try
{
Debug.Assert(!_called);
_called = true;
- Monitor.Pulse(this);
+ _m.Notify();
+ }
+ finally
+ {
+ _m.Unlock();
}
}
private bool _called;
+ private readonly IceUtilInternal.Monitor _m = new IceUtilInternal.Monitor();
}
private class AMI_MyClass_opNVI : Test.AMI_MyClass_opNV
diff --git a/cs/test/Ice/dictMapping/TwowaysNewAMI.cs b/cs/test/Ice/dictMapping/TwowaysNewAMI.cs
index 1b4885f3898..883810889f5 100644
--- a/cs/test/Ice/dictMapping/TwowaysNewAMI.cs
+++ b/cs/test/Ice/dictMapping/TwowaysNewAMI.cs
@@ -32,28 +32,39 @@ public class TwowaysNewAMI
public virtual void check()
{
- lock(this)
+ _m.Lock();
+ try
{
while(!_called)
{
- Monitor.Wait(this);
+ _m.Wait();
}
_called = false;
}
+ finally
+ {
+ _m.Unlock();
+ }
}
public virtual void called()
{
- lock(this)
+ _m.Lock();
+ try
{
Debug.Assert(!_called);
_called = true;
- Monitor.Pulse(this);
+ _m.Notify();
+ }
+ finally
+ {
+ _m.Unlock();
}
}
private bool _called;
+ private readonly IceUtilInternal.Monitor _m = new IceUtilInternal.Monitor();
}
private class Callback
diff --git a/cs/test/Ice/dispatcher/AllTests.cs b/cs/test/Ice/dispatcher/AllTests.cs
index 607725b4413..21936ea6e20 100644
--- a/cs/test/Ice/dispatcher/AllTests.cs
+++ b/cs/test/Ice/dispatcher/AllTests.cs
@@ -33,14 +33,19 @@ public class AllTests
public void check()
{
- lock(this)
+ _m.Lock();
+ try
{
while(!_called)
{
- Monitor.Wait(this);
+ _m.Wait();
}
_called = false;
}
+ finally
+ {
+ _m.Unlock();
+ }
}
public void response()
@@ -73,15 +78,21 @@ public class AllTests
protected void called()
{
- lock(this)
+ _m.Lock();
+ try
{
Debug.Assert(!_called);
_called = true;
- Monitor.Pulse(this);
+ _m.Notify();
+ }
+ finally
+ {
+ _m.Unlock();
}
}
private bool _called;
+ private readonly IceUtilInternal.Monitor _m = new IceUtilInternal.Monitor();
}
public static void allTests(Ice.Communicator communicator)
diff --git a/cs/test/Ice/dispatcher/Client.cs b/cs/test/Ice/dispatcher/Client.cs
index 326d3ddab57..e5e88473143 100644
--- a/cs/test/Ice/dispatcher/Client.cs
+++ b/cs/test/Ice/dispatcher/Client.cs
@@ -24,13 +24,15 @@ public class Client
AllTests.allTests(communicator);
return 0;
}
-
- public static void Main(string[] args)
+
+ public static int Main(string[] args)
{
int status = 0;
Ice.Communicator communicator = null;
-
+
+#if !COMPACT
Debug.Listeners.Add(new ConsoleTraceListener());
+#endif
try
{
@@ -46,7 +48,7 @@ public class Client
System.Console.Error.WriteLine(ex);
status = 1;
}
-
+
if(communicator != null)
{
try
@@ -59,10 +61,9 @@ public class Client
status = 1;
}
}
+
Dispatcher.terminate();
- if(status != 0)
- {
- System.Environment.Exit(status);
- }
+
+ return status;
}
}
diff --git a/cs/test/Ice/dispatcher/Dispatcher.cs b/cs/test/Ice/dispatcher/Dispatcher.cs
index d3d8da9863b..7dce0f663e5 100644
--- a/cs/test/Ice/dispatcher/Dispatcher.cs
+++ b/cs/test/Ice/dispatcher/Dispatcher.cs
@@ -31,19 +31,23 @@ public class Dispatcher
_thread.Start();
}
- public void
- run()
+ public void run()
{
while(true)
{
+#if COMPACT
+ Ice.VoidAction call = null;
+#else
System.Action call = null;
- lock(this)
+#endif
+ _m.Lock();
+ try
{
if(!_terminated && _calls.Count == 0)
{
- Monitor.Wait(this);
+ _m.Wait();
}
-
+
if(_calls.Count > 0)
{
call = _calls.Dequeue();
@@ -54,7 +58,11 @@ public class Dispatcher
return;
}
}
-
+ finally
+ {
+ _m.Unlock();
+ }
+
if(call != null)
{
try
@@ -69,41 +77,57 @@ public class Dispatcher
}
}
}
-
- public void
- dispatch(System.Action call, Ice.Connection con)
+
+#if COMPACT
+ public void dispatch(Ice.VoidAction call, Ice.Connection con)
+#else
+ public void dispatch(System.Action call, Ice.Connection con)
+#endif
{
- lock(this)
+ _m.Lock();
+ try
{
_calls.Enqueue(call);
if(_calls.Count == 1)
{
- Monitor.Pulse(this);
+ _m.Notify();
}
}
+ finally
+ {
+ _m.Unlock();
+ }
}
- static public void
- terminate()
+ static public void terminate()
{
- lock(_instance)
+ _m.Lock();
+ try
{
_instance._terminated = true;
- Monitor.Pulse(_instance);
+ _m.Notify();
+ }
+ finally
+ {
+ _m.Unlock();
}
_instance._thread.Join();
}
-
- static public bool
- isDispatcherThread()
+
+ static public bool isDispatcherThread()
{
return Thread.CurrentThread == _instance._thread;
}
- static Dispatcher _instance;
+ static Dispatcher _instance;
+#if COMPACT
+ private Queue<Ice.VoidAction> _calls = new Queue<Ice.VoidAction>();
+#else
private Queue<System.Action> _calls = new Queue<System.Action>();
+#endif
Thread _thread;
bool _terminated = false;
-};
+ private static readonly IceUtilInternal.Monitor _m = new IceUtilInternal.Monitor();
+}
diff --git a/cs/test/Ice/dispatcher/Server.cs b/cs/test/Ice/dispatcher/Server.cs
index 2c12b02462a..cdc29d40d04 100644
--- a/cs/test/Ice/dispatcher/Server.cs
+++ b/cs/test/Ice/dispatcher/Server.cs
@@ -36,13 +36,15 @@ public class Server
communicator.waitForShutdown();
return 0;
}
-
- public static void Main(string[] args)
+
+ public static int Main(string[] args)
{
int status = 0;
Ice.Communicator communicator = null;
-
+
+#if !COMPACT
Debug.Listeners.Add(new ConsoleTraceListener());
+#endif
try
{
@@ -58,7 +60,7 @@ public class Server
System.Console.Error.WriteLine(ex);
status = 1;
}
-
+
if(communicator != null)
{
try
@@ -71,10 +73,9 @@ public class Server
status = 1;
}
}
- Dispatcher.terminate();
- if(status != 0)
- {
- System.Environment.Exit(status);
- }
+
+ Dispatcher.terminate();
+
+ return status;
}
}
diff --git a/cs/test/Ice/exceptions/AllTests.cs b/cs/test/Ice/exceptions/AllTests.cs
index 2c8ae2b6941..fc231dcdcd8 100644
--- a/cs/test/Ice/exceptions/AllTests.cs
+++ b/cs/test/Ice/exceptions/AllTests.cs
@@ -31,28 +31,39 @@ public class AllTests
public virtual void check()
{
- lock(this)
+ _m.Lock();
+ try
{
while(!_called)
{
- Monitor.Wait(this);
+ _m.Wait();
}
_called = false;
}
+ finally
+ {
+ _m.Unlock();
+ }
}
public virtual void called()
{
- lock(this)
+ _m.Lock();
+ try
{
Debug.Assert(!_called);
_called = true;
- Monitor.Pulse(this);
+ _m.Notify();
+ }
+ finally
+ {
+ _m.Unlock();
}
}
private bool _called;
+ private readonly IceUtilInternal.Monitor _m = new IceUtilInternal.Monitor();
}
private class AMI_Thrower_throwAasAI : AMI_Thrower_throwAasA
diff --git a/cs/test/Ice/exceptions/Client.cs b/cs/test/Ice/exceptions/Client.cs
index d066abd41ba..20892e78e38 100644
--- a/cs/test/Ice/exceptions/Client.cs
+++ b/cs/test/Ice/exceptions/Client.cs
@@ -20,25 +20,34 @@ using System.Reflection;
public class Client
{
- private static int
- run(string[] args, Ice.Communicator communicator)
+ private static int run(string[] args, Ice.Communicator communicator)
{
ThrowerPrx thrower = AllTests.allTests(communicator, false);
thrower.shutdown();
return 0;
}
- public static void
- Main(string[] args)
+ public static int Main(string[] args)
{
int status = 0;
Ice.Communicator communicator = null;
-
+
+#if !COMPACT
Debug.Listeners.Add(new ConsoleTraceListener());
+#endif
try
{
- communicator = Ice.Util.initialize(ref args);
+ Ice.InitializationData data = new Ice.InitializationData();
+#if COMPACT
+ //
+ // When using Ice for .NET Compact Framework, we need to specify
+ // the assembly so that Ice can locate classes and exceptions.
+ //
+ data.properties = Ice.Util.createProperties();
+ data.properties.setProperty("Ice.FactoryAssemblies", "client");
+#endif
+ communicator = Ice.Util.initialize(ref args, data);
status = run(args, communicator);
}
catch(System.Exception ex)
@@ -46,7 +55,7 @@ public class Client
System.Console.WriteLine(ex);
status = 1;
}
-
+
if(communicator != null)
{
try
@@ -59,10 +68,7 @@ public class Client
status = 1;
}
}
-
- if(status != 0)
- {
- System.Environment.Exit(status);
- }
+
+ return status;
}
}
diff --git a/cs/test/Ice/exceptions/Collocated.cs b/cs/test/Ice/exceptions/Collocated.cs
index 9def6644679..1aa7d45c341 100644
--- a/cs/test/Ice/exceptions/Collocated.cs
+++ b/cs/test/Ice/exceptions/Collocated.cs
@@ -19,8 +19,7 @@ using System.Reflection;
public class Collocated
{
- private static int
- run(string[] args, Ice.Communicator communicator)
+ private static int run(string[] args, Ice.Communicator communicator)
{
communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010");
Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
@@ -30,13 +29,14 @@ public class Collocated
return 0;
}
- public static void
- Main(string[] args)
+ public static int Main(string[] args)
{
int status = 0;
Ice.Communicator communicator = null;
-
+
+#if !COMPACT
Debug.Listeners.Add(new ConsoleTraceListener());
+#endif
try
{
@@ -48,7 +48,7 @@ public class Collocated
System.Console.WriteLine(ex);
status = 1;
}
-
+
if(communicator != null)
{
try
@@ -61,10 +61,7 @@ public class Collocated
status = 1;
}
}
-
- if(status != 0)
- {
- System.Environment.Exit(status);
- }
+
+ return status;
}
}
diff --git a/cs/test/Ice/exceptions/Server.cs b/cs/test/Ice/exceptions/Server.cs
index 002cace8ecd..622d4737890 100644
--- a/cs/test/Ice/exceptions/Server.cs
+++ b/cs/test/Ice/exceptions/Server.cs
@@ -56,13 +56,15 @@ public class Server
communicator.waitForShutdown();
return 0;
}
-
- public static void Main(string[] args)
+
+ public static int Main(string[] args)
{
int status = 0;
Ice.Communicator communicator = null;
-
+
+#if !COMPACT
Debug.Listeners.Add(new ConsoleTraceListener());
+#endif
try
{
@@ -80,7 +82,7 @@ public class Server
System.Console.WriteLine(ex);
status = 1;
}
-
+
if(communicator != null)
{
try
@@ -93,10 +95,7 @@ public class Server
status = 1;
}
}
-
- if(status != 0)
- {
- System.Environment.Exit(status);
- }
+
+ return status;
}
}
diff --git a/cs/test/Ice/facets/Client.cs b/cs/test/Ice/facets/Client.cs
index b1598805198..a5543f9ccaa 100644
--- a/cs/test/Ice/facets/Client.cs
+++ b/cs/test/Ice/facets/Client.cs
@@ -26,13 +26,15 @@ public class Client
g.shutdown();
return 0;
}
-
- public static void Main(string[] args)
+
+ public static int Main(string[] args)
{
int status = 0;
Ice.Communicator communicator = null;
-
+
+#if !COMPACT
Debug.Listeners.Add(new ConsoleTraceListener());
+#endif
try
{
@@ -44,7 +46,7 @@ public class Client
System.Console.WriteLine(ex);
status = 1;
}
-
+
if(communicator != null)
{
try
@@ -57,10 +59,7 @@ public class Client
status = 1;
}
}
-
- if(status != 0)
- {
- System.Environment.Exit(status);
- }
+
+ return status;
}
}
diff --git a/cs/test/Ice/facets/Collocated.cs b/cs/test/Ice/facets/Collocated.cs
index 3458934906e..d5dab17ff78 100644
--- a/cs/test/Ice/facets/Collocated.cs
+++ b/cs/test/Ice/facets/Collocated.cs
@@ -30,18 +30,20 @@ public class Collocated
adapter.addFacet(f, communicator.stringToIdentity("d"), "facetEF");
Ice.Object h = new HI(communicator);
adapter.addFacet(h, communicator.stringToIdentity("d"), "facetGH");
-
+
AllTests.allTests(communicator);
return 0;
}
-
- public static void Main(string[] args)
+
+ public static int Main(string[] args)
{
int status = 0;
Ice.Communicator communicator = null;
-
+
+#if !COMPACT
Debug.Listeners.Add(new ConsoleTraceListener());
+#endif
try
{
@@ -53,7 +55,7 @@ public class Collocated
System.Console.WriteLine(ex);
status = 1;
}
-
+
if(communicator != null)
{
try
@@ -66,10 +68,7 @@ public class Collocated
status = 1;
}
}
-
- if(status != 0)
- {
- System.Environment.Exit(status);
- }
+
+ return status;
}
}
diff --git a/cs/test/Ice/facets/Server.cs b/cs/test/Ice/facets/Server.cs
index 8ff4f3efa65..5b64e0968ab 100644
--- a/cs/test/Ice/facets/Server.cs
+++ b/cs/test/Ice/facets/Server.cs
@@ -30,19 +30,21 @@ public class Server
adapter.addFacet(f, communicator.stringToIdentity("d"), "facetEF");
Ice.Object h = new HI(communicator);
adapter.addFacet(h, communicator.stringToIdentity("d"), "facetGH");
-
+
adapter.activate();
communicator.waitForShutdown();
-
+
return 0;
}
-
- public static void Main(string[] args)
+
+ public static int Main(string[] args)
{
int status = 0;
Ice.Communicator communicator = null;
-
+
+#if !COMPACT
Debug.Listeners.Add(new ConsoleTraceListener());
+#endif
try
{
@@ -54,7 +56,7 @@ public class Server
System.Console.WriteLine(ex);
status = 1;
}
-
+
if(communicator != null)
{
try
@@ -67,10 +69,7 @@ public class Server
status = 1;
}
}
-
- if(status != 0)
- {
- System.Environment.Exit(status);
- }
+
+ return status;
}
}
diff --git a/cs/test/Ice/faultTolerance/AllTests.cs b/cs/test/Ice/faultTolerance/AllTests.cs
index 993a4e76c28..18a507b9288 100644
--- a/cs/test/Ice/faultTolerance/AllTests.cs
+++ b/cs/test/Ice/faultTolerance/AllTests.cs
@@ -31,28 +31,39 @@ public class AllTests
public void check()
{
- lock(this)
+ _m.Lock();
+ try
{
while(!_called)
{
- Monitor.Wait(this);
+ _m.Wait();
}
_called = false;
}
+ finally
+ {
+ _m.Unlock();
+ }
}
public void called()
{
- lock(this)
+ _m.Lock();
+ try
{
Debug.Assert(!_called);
_called = true;
- Monitor.Pulse(this);
+ _m.Notify();
+ }
+ finally
+ {
+ _m.Unlock();
}
}
private bool _called;
+ private readonly IceUtilInternal.Monitor _m = new IceUtilInternal.Monitor();
}
private class Callback
diff --git a/cs/test/Ice/faultTolerance/Client.cs b/cs/test/Ice/faultTolerance/Client.cs
index 81fe15ab069..8babb032613 100644
--- a/cs/test/Ice/faultTolerance/Client.cs
+++ b/cs/test/Ice/faultTolerance/Client.cs
@@ -23,7 +23,7 @@ public class Client
{
System.Console.Error.WriteLine("Usage: client port...");
}
-
+
private static int run(string[] args, Ice.Communicator communicator)
{
System.Collections.ArrayList ports = new System.Collections.ArrayList(args.Length);
@@ -41,24 +41,26 @@ public class Client
}
ports.Add(port);
}
-
+
if(ports.Count == 0)
{
System.Console.Error.WriteLine("Client: no ports specified");
usage();
return 1;
}
-
+
AllTests.allTests(communicator, ports);
return 0;
}
-
- public static void Main(string[] args)
+
+ public static int Main(string[] args)
{
int status = 0;
Ice.Communicator communicator = null;
-
+
+#if !COMPACT
Debug.Listeners.Add(new ConsoleTraceListener());
+#endif
try
{
@@ -77,7 +79,7 @@ public class Client
System.Console.Error.WriteLine(ex);
status = 1;
}
-
+
if(communicator != null)
{
try
@@ -90,10 +92,7 @@ public class Client
status = 1;
}
}
-
- if(status != 0)
- {
- System.Environment.Exit(status);
- }
+
+ return status;
}
}
diff --git a/cs/test/Ice/faultTolerance/Server.cs b/cs/test/Ice/faultTolerance/Server.cs
index ff56aafa630..fe48a4bef63 100644
--- a/cs/test/Ice/faultTolerance/Server.cs
+++ b/cs/test/Ice/faultTolerance/Server.cs
@@ -23,7 +23,7 @@ public class Server
{
System.Console.Error.WriteLine("Usage: Server port");
}
-
+
private static int run(string[] args, Ice.Communicator communicator)
{
int port = 0;
@@ -35,14 +35,14 @@ public class Server
usage();
return 1;
}
-
+
if(port != 0)
{
System.Console.Error.WriteLine("Server: only one port can be specified");
usage();
return 1;
}
-
+
try
{
port = System.Int32.Parse(args[i]);
@@ -54,14 +54,14 @@ public class Server
return 1;
}
}
-
+
if(port <= 0)
{
System.Console.Error.WriteLine("Server: no port specified");
usage();
return 1;
}
-
+
communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p " + port + ":udp");
Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
Ice.Object obj = new TestI();
@@ -70,13 +70,15 @@ public class Server
communicator.waitForShutdown();
return 0;
}
-
- public static void Main(string[] args)
+
+ public static int Main(string[] args)
{
int status = 0;
Ice.Communicator communicator = null;
-
+
+#if !COMPACT
Debug.Listeners.Add(new ConsoleTraceListener());
+#endif
try
{
@@ -97,7 +99,7 @@ public class Server
System.Console.Error.WriteLine(ex);
status = 1;
}
-
+
if(communicator != null)
{
try
@@ -110,10 +112,7 @@ public class Server
status = 1;
}
}
-
- if(status != 0)
- {
- System.Environment.Exit(status);
- }
+
+ return status;
}
}
diff --git a/cs/test/Ice/hold/AllTests.cs b/cs/test/Ice/hold/AllTests.cs
index aaa813cf974..553f5b6bf9a 100644
--- a/cs/test/Ice/hold/AllTests.cs
+++ b/cs/test/Ice/hold/AllTests.cs
@@ -46,9 +46,9 @@ public class AllTests
}
private bool _value;
- };
+ }
- private class SetCB
+ private class SetCB
{
public
SetCB(Condition condition, int expected)
@@ -74,29 +74,40 @@ public class AllTests
public void
sent(bool sync)
{
- lock(this)
+ _m.Lock();
+ try
{
_sent = true;
- System.Threading.Monitor.Pulse(this);
+ _m.Notify();
+ }
+ finally
+ {
+ _m.Unlock();
}
}
public void
waitForSent()
{
- lock(this)
+ _m.Lock();
+ try
{
while(!_sent)
{
- System.Threading.Monitor.Wait(this);
+ _m.Wait();
}
}
+ finally
+ {
+ _m.Unlock();
+ }
}
private bool _sent = false;
private Condition _condition;
private int _expected;
- };
+ private readonly IceUtilInternal.Monitor _m = new IceUtilInternal.Monitor();
+ }
public static void allTests(Ice.Communicator communicator)
{
diff --git a/cs/test/Ice/hold/Client.cs b/cs/test/Ice/hold/Client.cs
index ff74428b279..09c36bc393a 100644
--- a/cs/test/Ice/hold/Client.cs
+++ b/cs/test/Ice/hold/Client.cs
@@ -26,12 +26,14 @@ public class Client
return 0;
}
- public static void Main(string[] args)
+ public static int Main(string[] args)
{
int status = 0;
Ice.Communicator communicator = null;
-
+
+#if !COMPACT
Debug.Listeners.Add(new ConsoleTraceListener());
+#endif
try
{
@@ -43,7 +45,7 @@ public class Client
System.Console.Error.WriteLine(ex);
status = 1;
}
-
+
if(communicator != null)
{
try
@@ -56,10 +58,7 @@ public class Client
status = 1;
}
}
-
- if(status != 0)
- {
- System.Environment.Exit(status);
- }
+
+ return status;
}
}
diff --git a/cs/test/Ice/hold/HoldI.cs b/cs/test/Ice/hold/HoldI.cs
index 9c008c8d7b6..56f3689934f 100644
--- a/cs/test/Ice/hold/HoldI.cs
+++ b/cs/test/Ice/hold/HoldI.cs
@@ -39,10 +39,7 @@ public sealed class HoldI : HoldDisp_
}
else
{
- System.Timers.Timer timer = new System.Timers.Timer(milliSeconds);
- timer.AutoReset = false;
- timer.Elapsed += new System.Timers.ElapsedEventHandler(
- delegate(object source, System.Timers.ElapsedEventArgs e)
+ new DelayedTask(milliSeconds, delegate()
{
try
{
@@ -52,7 +49,6 @@ public sealed class HoldI : HoldDisp_
{
}
});
- timer.Enabled = true;
}
}
@@ -63,10 +59,7 @@ public sealed class HoldI : HoldDisp_
{
if(++_waitForHold == 1)
{
- System.Timers.Timer timer = new System.Timers.Timer(1);
- timer.AutoReset = false;
- timer.Elapsed += new System.Timers.ElapsedEventHandler(
- delegate(object source, System.Timers.ElapsedEventArgs e)
+ new DelayedTask(1, delegate()
{
while(true)
{
@@ -85,17 +78,16 @@ public sealed class HoldI : HoldDisp_
catch(Ice.ObjectAdapterDeactivatedException)
{
//
- // This shouldn't occur. The test ensures all the waitForHold timers are
+ // This shouldn't occur. The test ensures all the waitForHold timers are
// finished before shutting down the communicator.
//
test(false);
}
}
});
- timer.Enabled = true;
}
}
- }
+ }
public override int
set(int value, int delay, Ice.Current current)
@@ -127,6 +119,32 @@ public sealed class HoldI : HoldDisp_
_adapter.getCommunicator().shutdown();
}
+ //
+ // The .NET Compact Framework doesn't support the System.Timers.Timer class,
+ // but a simple thread does what we need in this test.
+ //
+ private delegate void Task();
+
+ private class DelayedTask
+ {
+ internal DelayedTask(int timeout, Task task)
+ {
+ _timeout = timeout;
+ _task = task;
+ System.Threading.Thread t = new System.Threading.Thread(new System.Threading.ThreadStart(run));
+ t.Start();
+ }
+
+ private void run()
+ {
+ System.Threading.Thread.Sleep(_timeout);
+ _task();
+ }
+
+ private int _timeout;
+ private Task _task;
+ }
+
private Ice.ObjectAdapter _adapter;
private int _last = 0;
private int _waitForHold = 0;
diff --git a/cs/test/Ice/hold/Server.cs b/cs/test/Ice/hold/Server.cs
index 22b129bcee8..addd0d579fb 100644
--- a/cs/test/Ice/hold/Server.cs
+++ b/cs/test/Ice/hold/Server.cs
@@ -45,12 +45,14 @@ public class Server
return 0;
}
- public static void Main(string[] args)
+ public static int Main(string[] args)
{
int status = 0;
Ice.Communicator communicator = null;
+#if !COMPACT
Debug.Listeners.Add(new ConsoleTraceListener());
+#endif
try
{
@@ -76,9 +78,6 @@ public class Server
}
}
- if(status != 0)
- {
- System.Environment.Exit(status);
- }
+ return status;
}
}
diff --git a/cs/test/Ice/info/AllTests.cs b/cs/test/Ice/info/AllTests.cs
index c75a863266b..5693ae8a80d 100644
--- a/cs/test/Ice/info/AllTests.cs
+++ b/cs/test/Ice/info/AllTests.cs
@@ -43,7 +43,7 @@ public class AllTests
test(ipEndpoint.compress);
test(!ipEndpoint.datagram());
-#if __MonoCS__
+#if __MonoCS__ || COMPACT
test(ipEndpoint.type() == Ice.TCPEndpointType.value && !ipEndpoint.secure());
test(ipEndpoint.type() == Ice.TCPEndpointType.value && ipEndpoint is Ice.TCPEndpointInfo);
#else
@@ -84,7 +84,7 @@ public class AllTests
test(IceUtilInternal.Arrays.Equals(endpoints, publishedEndpoints));
Ice.IPEndpointInfo ipEndpoint = (Ice.IPEndpointInfo)endpoints[0].getInfo();
-#if __MonoCS__
+#if __MonoCS__ || COMPACT
test(ipEndpoint.type() == Ice.TCPEndpointType.value);
#else
test(ipEndpoint.type() == Ice.TCPEndpointType.value || ipEndpoint.type() == IceSSL.EndpointType.value);
diff --git a/cs/test/Ice/info/Client.cs b/cs/test/Ice/info/Client.cs
index 157607235a1..98fe9543c06 100644
--- a/cs/test/Ice/info/Client.cs
+++ b/cs/test/Ice/info/Client.cs
@@ -24,13 +24,15 @@ public class Client
AllTests.allTests(communicator);
return 0;
}
-
- public static void Main(string[] args)
+
+ public static int Main(string[] args)
{
int status = 0;
Ice.Communicator communicator = null;
-
+
+#if !COMPACT
Debug.Listeners.Add(new ConsoleTraceListener());
+#endif
try
{
@@ -42,7 +44,7 @@ public class Client
System.Console.Error.WriteLine(ex);
status = 1;
}
-
+
if(communicator != null)
{
try
@@ -55,10 +57,7 @@ public class Client
status = 1;
}
}
-
- if(status != 0)
- {
- System.Environment.Exit(status);
- }
+
+ return status;
}
}
diff --git a/cs/test/Ice/info/Makefile.mak b/cs/test/Ice/info/Makefile.mak
index 7bf92753559..9b0dfb222d3 100644
--- a/cs/test/Ice/info/Makefile.mak
+++ b/cs/test/Ice/info/Makefile.mak
@@ -27,7 +27,11 @@ MCSFLAGS = $(MCSFLAGS) -target:exe
SLICE2CSFLAGS = $(SLICE2CSFLAGS) -I. -I"$(slicedir)"
client.exe: $(C_SRCS) $(GEN_SRCS)
+!if "$(COMPACT)" == "yes"
+ $(MCS) $(MCSFLAGS) -out:$@ -r:"$(refdir)\Ice.dll" $(C_SRCS) $(GEN_SRCS)
+!else
$(MCS) $(MCSFLAGS) -out:$@ -r:"$(refdir)\Ice.dll" -r:"$(refdir)\IceSSL.dll" $(C_SRCS) $(GEN_SRCS)
+!endif
server.exe: $(S_SRCS) $(GEN_SRCS)
$(MCS) $(MCSFLAGS) -out:$@ -r:"$(refdir)\Ice.dll" $(S_SRCS) $(GEN_SRCS)
diff --git a/cs/test/Ice/info/Server.cs b/cs/test/Ice/info/Server.cs
index c19f54e062f..bc1d7ea5726 100644
--- a/cs/test/Ice/info/Server.cs
+++ b/cs/test/Ice/info/Server.cs
@@ -30,12 +30,14 @@ public class Server
return 0;
}
- public static void Main(string[] args)
+ public static int Main(string[] args)
{
int status = 0;
Ice.Communicator communicator = null;
+#if !COMPACT
Debug.Listeners.Add(new ConsoleTraceListener());
+#endif
try
{
@@ -63,9 +65,6 @@ public class Server
}
}
- if(status != 0)
- {
- System.Environment.Exit(status);
- }
+ return status;
}
}
diff --git a/cs/test/Ice/inheritance/Client.cs b/cs/test/Ice/inheritance/Client.cs
index f99cdbacad6..21b5efd34e6 100644
--- a/cs/test/Ice/inheritance/Client.cs
+++ b/cs/test/Ice/inheritance/Client.cs
@@ -26,17 +26,28 @@ public class Client
initial.shutdown();
return 0;
}
-
- public static void Main(string[] args)
+
+ public static int Main(string[] args)
{
int status = 0;
Ice.Communicator communicator = null;
-
+
+#if !COMPACT
Debug.Listeners.Add(new ConsoleTraceListener());
+#endif
try
{
- communicator = Ice.Util.initialize(ref args);
+ Ice.InitializationData data = new Ice.InitializationData();
+#if COMPACT
+ //
+ // When using Ice for .NET Compact Framework, we need to specify
+ // the assembly so that Ice can locate classes and exceptions.
+ //
+ data.properties = Ice.Util.createProperties();
+ data.properties.setProperty("Ice.FactoryAssemblies", "client");
+#endif
+ communicator = Ice.Util.initialize(ref args, data);
status = run(args, communicator);
}
catch(System.Exception ex)
@@ -44,7 +55,7 @@ public class Client
System.Console.Error.WriteLine(ex);
status = 1;
}
-
+
if(communicator != null)
{
try
@@ -57,10 +68,7 @@ public class Client
status = 1;
}
}
-
- if(status != 0)
- {
- System.Environment.Exit(status);
- }
+
+ return status;
}
}
diff --git a/cs/test/Ice/inheritance/Collocated.cs b/cs/test/Ice/inheritance/Collocated.cs
index 2091418d752..3774b5e5e71 100644
--- a/cs/test/Ice/inheritance/Collocated.cs
+++ b/cs/test/Ice/inheritance/Collocated.cs
@@ -19,8 +19,7 @@ using System.Reflection;
public class Collocated
{
- private static int
- run(string[] args, Ice.Communicator communicator)
+ private static int run(string[] args, Ice.Communicator communicator)
{
communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010");
Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
@@ -30,13 +29,14 @@ public class Collocated
return 0;
}
- public static void
- Main(string[] args)
+ public static int Main(string[] args)
{
int status = 0;
Ice.Communicator communicator = null;
-
+
+#if !COMPACT
Debug.Listeners.Add(new ConsoleTraceListener());
+#endif
try
{
@@ -48,7 +48,7 @@ public class Collocated
System.Console.WriteLine(ex);
status = 1;
}
-
+
if(communicator != null)
{
try
@@ -61,10 +61,7 @@ public class Collocated
status = 1;
}
}
-
- if(status != 0)
- {
- System.Environment.Exit(status);
- }
+
+ return status;
}
}
diff --git a/cs/test/Ice/inheritance/Server.cs b/cs/test/Ice/inheritance/Server.cs
index 92307f931ad..0cfa23377a1 100644
--- a/cs/test/Ice/inheritance/Server.cs
+++ b/cs/test/Ice/inheritance/Server.cs
@@ -29,13 +29,15 @@ public class Server
communicator.waitForShutdown();
return 0;
}
-
- public static void Main(string[] args)
+
+ public static int Main(string[] args)
{
int status = 0;
Ice.Communicator communicator = null;
-
+
+#if !COMPACT
Debug.Listeners.Add(new ConsoleTraceListener());
+#endif
try
{
@@ -47,7 +49,7 @@ public class Server
System.Console.Error.WriteLine(ex);
status = 1;
}
-
+
if(communicator != null)
{
try
@@ -60,10 +62,7 @@ public class Server
status = 1;
}
}
-
- if(status != 0)
- {
- System.Environment.Exit(status);
- }
+
+ return status;
}
}
diff --git a/cs/test/Ice/interceptor/Client.cs b/cs/test/Ice/interceptor/Client.cs
index 8daa008c979..fcf180b3c5b 100644
--- a/cs/test/Ice/interceptor/Client.cs
+++ b/cs/test/Ice/interceptor/Client.cs
@@ -112,7 +112,7 @@ public class Client
}
return 0;
}
-
+
private int runAmd(Test.MyObjectPrx prx, AMDInterceptorI interceptor)
{
Console.Out.Write("testing simple interceptor... ");
@@ -186,7 +186,7 @@ public class Client
public override int run(string[] args)
{
//
- // Create OA and servants
+ // Create OA and servants
//
communicator().getProperties().setProperty("MyOA.AdapterId", "myOA");
@@ -195,11 +195,11 @@ public class Client
Ice.Object servant = new MyObjectI();
InterceptorI interceptor = new InterceptorI(servant);
-
+
Test.MyObjectPrx prx = Test.MyObjectPrxHelper.uncheckedCast(oa.addWithUUID(interceptor));
-
+
oa.activate();
-
+
Console.WriteLine("Collocation optimization on");
int rs = run(prx, interceptor);
if(rs == 0)
@@ -223,18 +223,22 @@ public class Client
}
}
- public static void Main(string[] args)
+ public static int Main(string[] args)
{
+#if !COMPACT
Debug.Listeners.Add(new ConsoleTraceListener());
+#endif
App app = new App();
- int status = app.main(args);
- if(status != 0)
- {
- System.Environment.Exit(status);
- }
+ Ice.InitializationData data = new Ice.InitializationData();
+#if COMPACT
+ //
+ // When using Ice for .NET Compact Framework, we need to specify
+ // the assembly so that Ice can locate classes and exceptions.
+ //
+ data.properties = Ice.Util.createProperties();
+ data.properties.setProperty("Ice.FactoryAssemblies", "client");
+#endif
+ return app.main(args, data);
}
}
-
-
-
diff --git a/cs/test/Ice/invoke/AllTests.cs b/cs/test/Ice/invoke/AllTests.cs
index 0a633e6dff1..e119c0a9e46 100644
--- a/cs/test/Ice/invoke/AllTests.cs
+++ b/cs/test/Ice/invoke/AllTests.cs
@@ -40,28 +40,39 @@ public class AllTests
public virtual void check()
{
- lock(this)
+ _m.Lock();
+ try
{
while(!_called)
{
- Monitor.Wait(this);
+ _m.Wait();
}
_called = false;
}
+ finally
+ {
+ _m.Unlock();
+ }
}
public virtual void called()
{
- lock(this)
+ _m.Lock();
+ try
{
Debug.Assert(!_called);
_called = true;
- Monitor.Pulse(this);
+ _m.Notify();
+ }
+ finally
+ {
+ _m.Unlock();
}
}
private bool _called;
+ private readonly IceUtilInternal.Monitor _m = new IceUtilInternal.Monitor();
}
private class Callback
diff --git a/cs/test/Ice/invoke/Client.cs b/cs/test/Ice/invoke/Client.cs
index 97d5f710cce..4fc62024fe9 100644
--- a/cs/test/Ice/invoke/Client.cs
+++ b/cs/test/Ice/invoke/Client.cs
@@ -25,18 +25,27 @@ public class Client
myClass.shutdown();
return 0;
}
-
- public static void Main(string[] args)
+
+ public static int Main(string[] args)
{
int status = 0;
Ice.Communicator communicator = null;
-
+
+#if !COMPACT
Debug.Listeners.Add(new ConsoleTraceListener());
+#endif
try
{
Ice.InitializationData initData = new Ice.InitializationData();
initData.properties = Ice.Util.createProperties(ref args);
+#if COMPACT
+ //
+ // When using Ice for .NET Compact Framework, we need to specify
+ // the assembly so that Ice can locate classes and exceptions.
+ //
+ initData.properties.setProperty("Ice.FactoryAssemblies", "client");
+#endif
communicator = Ice.Util.initialize(ref args, initData);
status = run(args, communicator);
}
@@ -45,7 +54,7 @@ public class Client
Console.Error.WriteLine(ex);
status = 1;
}
-
+
if(communicator != null)
{
try
@@ -58,10 +67,7 @@ public class Client
status = 1;
}
}
-
- if(status != 0)
- {
- System.Environment.Exit(status);
- }
+
+ return status;
}
}
diff --git a/cs/test/Ice/invoke/Server.cs b/cs/test/Ice/invoke/Server.cs
index e592382456a..d132e0d66c6 100644
--- a/cs/test/Ice/invoke/Server.cs
+++ b/cs/test/Ice/invoke/Server.cs
@@ -73,12 +73,14 @@ public class Server
return 0;
}
- public static void Main(string[] args)
+ public static int Main(string[] args)
{
int status = 0;
Ice.Communicator communicator = null;
+#if !COMPACT
Debug.Listeners.Add(new ConsoleTraceListener());
+#endif
try
{
@@ -106,10 +108,7 @@ public class Server
}
}
- if(status != 0)
- {
- System.Environment.Exit(status);
- }
+ return status;
}
}
diff --git a/cs/test/Ice/location/AllTests.cs b/cs/test/Ice/location/AllTests.cs
index be65d40b9e4..77cf2cfba6d 100644
--- a/cs/test/Ice/location/AllTests.cs
+++ b/cs/test/Ice/location/AllTests.cs
@@ -233,7 +233,7 @@ public class AllTests
test(++count == locator.getRequestCount());
communicator.stringToProxy("test@TestAdapter").ice_locatorCacheTimeout(1).ice_ping(); // 1s timeout.
test(count == locator.getRequestCount());
- System.Threading.Thread.Sleep(new System.TimeSpan(10 * 1200 * 1000)); // 1200ms
+ System.Threading.Thread.Sleep(1200); // 1200ms
communicator.stringToProxy("test@TestAdapter").ice_locatorCacheTimeout(1).ice_ping(); // 1s timeout.
test(++count == locator.getRequestCount());
@@ -242,7 +242,7 @@ public class AllTests
test(count == locator.getRequestCount());
communicator.stringToProxy("test").ice_locatorCacheTimeout(1).ice_ping(); // 1s timeout
test(count == locator.getRequestCount());
- System.Threading.Thread.Sleep(new System.TimeSpan(10 * 1200 * 1000)); // 1200ms
+ System.Threading.Thread.Sleep(1200); // 1200ms
communicator.stringToProxy("test").ice_locatorCacheTimeout(1).ice_ping(); // 1s timeout
count += 2;
test(count == locator.getRequestCount());
@@ -490,7 +490,7 @@ public class AllTests
ic.stringToProxy("test@TestAdapter5").ice_locatorCacheTimeout(10).ice_ping(); // 10s timeout.
ic.stringToProxy("test3").ice_locatorCacheTimeout(10).ice_ping(); // 10s timeout.
test(count == locator.getRequestCount());
- System.Threading.Thread.Sleep(new System.TimeSpan(10 * 1200 * 1000));
+ System.Threading.Thread.Sleep(1200);
// The following request should trigger the background
// updates but still use the cached endpoints and
@@ -503,7 +503,7 @@ public class AllTests
while(true)
{
ic.stringToProxy("test@TestAdapter5").ice_locatorCacheTimeout(1).ice_ping(); // 1s timeout.
- System.Threading.Thread.Sleep(new System.TimeSpan(10 * 10 * 1000));
+ System.Threading.Thread.Sleep(10);
}
}
catch(Ice.LocalException)
@@ -515,7 +515,7 @@ public class AllTests
while(true)
{
ic.stringToProxy("test3").ice_locatorCacheTimeout(1).ice_ping(); // 1s timeout.
- System.Threading.Thread.Sleep(new System.TimeSpan(10 * 10 * 1000));
+ System.Threading.Thread.Sleep(10);
}
}
catch(Ice.LocalException)
diff --git a/cs/test/Ice/location/Client.cs b/cs/test/Ice/location/Client.cs
index 4c893ac68f6..c101e184d72 100644
--- a/cs/test/Ice/location/Client.cs
+++ b/cs/test/Ice/location/Client.cs
@@ -24,13 +24,15 @@ public class Client
AllTests.allTests(communicator);
return 0;
}
-
- public static void Main(string[] args)
+
+ public static int Main(string[] args)
{
int status = 0;
Ice.Communicator communicator = null;
-
+
+#if !COMPACT
Debug.Listeners.Add(new ConsoleTraceListener());
+#endif
try
{
@@ -45,7 +47,7 @@ public class Client
System.Console.Error.WriteLine(ex);
status = 1;
}
-
+
if(communicator != null)
{
try
@@ -58,10 +60,7 @@ public class Client
status = 1;
}
}
-
- if(status != 0)
- {
- System.Environment.Exit(status);
- }
+
+ return status;
}
}
diff --git a/cs/test/Ice/location/Server.cs b/cs/test/Ice/location/Server.cs
index 0270a655ccb..1423f0c1e4a 100644
--- a/cs/test/Ice/location/Server.cs
+++ b/cs/test/Ice/location/Server.cs
@@ -30,9 +30,9 @@ public class Server
Ice.Properties properties = communicator.getProperties();
properties.setProperty("Ice.ThreadPool.Server.Size", "2");
properties.setProperty("ServerManagerAdapter.Endpoints", "default -p 12010:udp");
-
+
Ice.ObjectAdapter adapter = communicator.createObjectAdapter("ServerManagerAdapter");
-
+
//
// We also register a sample server locator which implements the
// locator interface, this locator is used by the clients and the
@@ -44,22 +44,24 @@ public class Server
registry.addObject(adapter.createProxy(communicator.stringToIdentity("ServerManager")));
Ice.LocatorRegistryPrx registryPrx = Ice.LocatorRegistryPrxHelper.uncheckedCast(
adapter.add(registry, communicator.stringToIdentity("registry")));
-
+
ServerLocator locator = new ServerLocator(registry, registryPrx);
adapter.add(locator, communicator.stringToIdentity("locator"));
-
+
adapter.activate();
communicator.waitForShutdown();
-
+
return 0;
}
-
- public static void Main(string[] args)
+
+ public static int Main(string[] args)
{
int status = 0;
Ice.Communicator communicator = null;
-
+
+#if !COMPACT
Debug.Listeners.Add(new ConsoleTraceListener());
+#endif
try
{
@@ -73,7 +75,7 @@ public class Server
System.Console.Error.WriteLine(ex);
status = 1;
}
-
+
if(communicator != null)
{
try
@@ -86,10 +88,7 @@ public class Server
status = 1;
}
}
-
- if(status != 0)
- {
- System.Environment.Exit(status);
- }
+
+ return status;
}
}
diff --git a/cs/test/Ice/objects/Client.cs b/cs/test/Ice/objects/Client.cs
index f7ad9749be0..0f3f51144c9 100644
--- a/cs/test/Ice/objects/Client.cs
+++ b/cs/test/Ice/objects/Client.cs
@@ -83,17 +83,28 @@ public class Client
initial.shutdown();
return 0;
}
-
- public static void Main(string[] args)
+
+ public static int Main(string[] args)
{
int status = 0;
Ice.Communicator communicator = null;
+#if !COMPACT
Debug.Listeners.Add(new ConsoleTraceListener());
+#endif
try
{
- communicator = Ice.Util.initialize(ref args);
+ Ice.InitializationData data = new Ice.InitializationData();
+#if COMPACT
+ //
+ // When using Ice for .NET Compact Framework, we need to specify
+ // the assembly so that Ice can locate classes and exceptions.
+ //
+ data.properties = Ice.Util.createProperties();
+ data.properties.setProperty("Ice.FactoryAssemblies", "client");
+#endif
+ communicator = Ice.Util.initialize(ref args, data);
status = run(args, communicator);
}
catch(System.Exception ex)
@@ -101,7 +112,7 @@ public class Client
System.Console.Error.WriteLine(ex);
status = 1;
}
-
+
if(communicator != null)
{
try
@@ -114,10 +125,7 @@ public class Client
status = 1;
}
}
-
- if(status != 0)
- {
- System.Environment.Exit(status);
- }
+
+ return status;
}
}
diff --git a/cs/test/Ice/objects/Collocated.cs b/cs/test/Ice/objects/Collocated.cs
index 82e7b6cb87f..f2518fed1f6 100644
--- a/cs/test/Ice/objects/Collocated.cs
+++ b/cs/test/Ice/objects/Collocated.cs
@@ -20,8 +20,7 @@ using System.Reflection;
public class Client
{
- private static int
- run(string[] args, Ice.Communicator communicator)
+ private static int run(string[] args, Ice.Communicator communicator)
{
communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010");
Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
@@ -33,13 +32,14 @@ public class Client
return 0;
}
- public static void
- Main(string[] args)
+ public static int Main(string[] args)
{
int status = 0;
Ice.Communicator communicator = null;
-
+
+#if !COMPACT
Debug.Listeners.Add(new ConsoleTraceListener());
+#endif
try
{
@@ -51,7 +51,7 @@ public class Client
System.Console.WriteLine(ex);
status = 1;
}
-
+
if(communicator != null)
{
try
@@ -64,10 +64,7 @@ public class Client
status = 1;
}
}
-
- if(status != 0)
- {
- System.Environment.Exit(status);
- }
+
+ return status;
}
}
diff --git a/cs/test/Ice/objects/Server.cs b/cs/test/Ice/objects/Server.cs
index 798044205dc..51500b51894 100644
--- a/cs/test/Ice/objects/Server.cs
+++ b/cs/test/Ice/objects/Server.cs
@@ -63,13 +63,15 @@ public class Server
communicator.waitForShutdown();
return 0;
}
-
- public static void Main(string[] args)
+
+ public static int Main(string[] args)
{
int status = 0;
Ice.Communicator communicator = null;
-
+
+#if !COMPACT
Debug.Listeners.Add(new ConsoleTraceListener());
+#endif
try
{
@@ -81,7 +83,7 @@ public class Server
System.Console.Error.WriteLine(ex);
status = 1;
}
-
+
if(communicator != null)
{
try
@@ -94,10 +96,7 @@ public class Server
status = 1;
}
}
-
- if(status != 0)
- {
- System.Environment.Exit(status);
- }
+
+ return status;
}
}
diff --git a/cs/test/Ice/operations/Client.cs b/cs/test/Ice/operations/Client.cs
index ffdb5620e51..1e48e5a3f38 100644
--- a/cs/test/Ice/operations/Client.cs
+++ b/cs/test/Ice/operations/Client.cs
@@ -22,7 +22,7 @@ public class Client
private static int run(String[] args, Ice.Communicator communicator)
{
Test.MyClassPrx myClass = AllTests.allTests(communicator, false);
-
+
Console.Out.Write("testing server shutdown... ");
Console.Out.Flush();
myClass.shutdown();
@@ -35,16 +35,18 @@ public class Client
{
Console.Out.WriteLine("ok");
}
-
+
return 0;
}
-
- public static void Main(string[] args)
+
+ public static int Main(string[] args)
{
int status = 0;
Ice.Communicator communicator = null;
-
+
+#if !COMPACT
Debug.Listeners.Add(new ConsoleTraceListener());
+#endif
try
{
@@ -72,7 +74,7 @@ public class Client
Console.Error.WriteLine(ex);
status = 1;
}
-
+
if(communicator != null)
{
try
@@ -85,10 +87,7 @@ public class Client
status = 1;
}
}
-
- if(status != 0)
- {
- System.Environment.Exit(status);
- }
+
+ return status;
}
}
diff --git a/cs/test/Ice/operations/Collocated.cs b/cs/test/Ice/operations/Collocated.cs
index 5d619ca98ab..3108c265cd1 100644
--- a/cs/test/Ice/operations/Collocated.cs
+++ b/cs/test/Ice/operations/Collocated.cs
@@ -30,13 +30,15 @@ public class Collocated
return 0;
}
-
- public static void Main(String[] args)
+
+ public static int Main(String[] args)
{
int status = 0;
Ice.Communicator communicator = null;
-
+
+#if !COMPACT
Debug.Listeners.Add(new ConsoleTraceListener());
+#endif
try
{
@@ -44,7 +46,7 @@ public class Collocated
initData.properties = Ice.Util.createProperties(ref args);
initData.properties.setProperty("Ice.ThreadPool.Client.Size", "2"); // For nested AMI.
initData.properties.setProperty("Ice.ThreadPool.Client.SizeWarn", "0");
-
+
communicator = Ice.Util.initialize(ref args, initData);
status = run(args, communicator);
}
@@ -53,7 +55,7 @@ public class Collocated
Console.Error.WriteLine(ex);
status = 1;
}
-
+
if(communicator != null)
{
try
@@ -66,10 +68,7 @@ public class Collocated
status = 1;
}
}
-
- if(status != 0)
- {
- System.Environment.Exit(status);
- }
+
+ return status;
}
}
diff --git a/cs/test/Ice/operations/OnewaysAMI.cs b/cs/test/Ice/operations/OnewaysAMI.cs
index a3dc617a07a..313f4d50633 100644
--- a/cs/test/Ice/operations/OnewaysAMI.cs
+++ b/cs/test/Ice/operations/OnewaysAMI.cs
@@ -30,28 +30,39 @@ class OnewaysAMI
public void check()
{
- lock(this)
+ _m.Lock();
+ try
{
while(!_called)
{
- Monitor.Wait(this);
+ _m.Wait();
}
_called = false;
}
+ finally
+ {
+ _m.Unlock();
+ }
}
public void called()
{
- lock(this)
+ _m.Lock();
+ try
{
Debug.Assert(!_called);
_called = true;
- Monitor.Pulse(this);
+ _m.Notify();
+ }
+ finally
+ {
+ _m.Unlock();
}
}
private bool _called;
+ private readonly IceUtilInternal.Monitor _m = new IceUtilInternal.Monitor();
}
private class AMI_MyClass_opVoidI : Test.AMI_MyClass_opVoid
diff --git a/cs/test/Ice/operations/OnewaysNewAMI.cs b/cs/test/Ice/operations/OnewaysNewAMI.cs
index ca6c35bf4b3..87a2a45a533 100644
--- a/cs/test/Ice/operations/OnewaysNewAMI.cs
+++ b/cs/test/Ice/operations/OnewaysNewAMI.cs
@@ -31,27 +31,38 @@ public class OnewaysNewAMI
public virtual void check()
{
- lock(this)
+ _m.Lock();
+ try
{
while(!_called)
{
- Monitor.Wait(this);
+ _m.Wait();
}
_called = false;
}
+ finally
+ {
+ _m.Unlock();
+ }
}
public virtual void called()
{
- lock(this)
+ _m.Lock();
+ try
{
Debug.Assert(!_called);
_called = true;
- Monitor.Pulse(this);
+ _m.Notify();
+ }
+ finally
+ {
+ _m.Unlock();
}
}
private bool _called;
+ private readonly IceUtilInternal.Monitor _m = new IceUtilInternal.Monitor();
}
private class Callback : CallbackBase
diff --git a/cs/test/Ice/operations/Server.cs b/cs/test/Ice/operations/Server.cs
index 455b02f9e7a..ca05050cd7e 100644
--- a/cs/test/Ice/operations/Server.cs
+++ b/cs/test/Ice/operations/Server.cs
@@ -25,7 +25,7 @@ public class Server
// We don't want connection warnings because of the timeout test.
//
communicator.getProperties().setProperty("Ice.Warn.Connections", "0");
-
+
communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010:udp");
Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
adapter.add(new MyDerivedClassI(), communicator.stringToIdentity("test"));
@@ -34,13 +34,15 @@ public class Server
communicator.waitForShutdown();
return 0;
}
-
- public static void Main(string[] args)
+
+ public static int Main(string[] args)
{
int status = 0;
Ice.Communicator communicator = null;
-
+
+#if !COMPACT
Debug.Listeners.Add(new ConsoleTraceListener());
+#endif
try
{
@@ -60,7 +62,7 @@ public class Server
Console.Error.WriteLine(ex);
status = 1;
}
-
+
if(communicator != null)
{
try
@@ -73,10 +75,7 @@ public class Server
status = 1;
}
}
-
- if(status != 0)
- {
- System.Environment.Exit(status);
- }
+
+ return status;
}
}
diff --git a/cs/test/Ice/operations/TwowaysAMI.cs b/cs/test/Ice/operations/TwowaysAMI.cs
index ddd46cfcf83..722ed1cabaa 100644
--- a/cs/test/Ice/operations/TwowaysAMI.cs
+++ b/cs/test/Ice/operations/TwowaysAMI.cs
@@ -31,28 +31,39 @@ public class TwowaysAMI
public virtual void check()
{
- lock(this)
+ _m.Lock();
+ try
{
while(!_called)
{
- Monitor.Wait(this);
+ _m.Wait();
}
_called = false;
}
+ finally
+ {
+ _m.Unlock();
+ }
}
public virtual void called()
{
- lock(this)
+ _m.Lock();
+ try
{
Debug.Assert(!_called);
_called = true;
- Monitor.Pulse(this);
+ _m.Notify();
+ }
+ finally
+ {
+ _m.Unlock();
}
}
private bool _called;
+ private readonly IceUtilInternal.Monitor _m = new IceUtilInternal.Monitor();
}
private class AMI_MyClass_opVoidI : Test.AMI_MyClass_opVoid
diff --git a/cs/test/Ice/operations/TwowaysNewAMI.cs b/cs/test/Ice/operations/TwowaysNewAMI.cs
index 4df7ab75ca5..02c97d04726 100644
--- a/cs/test/Ice/operations/TwowaysNewAMI.cs
+++ b/cs/test/Ice/operations/TwowaysNewAMI.cs
@@ -31,27 +31,38 @@ public class TwowaysNewAMI
public virtual void check()
{
- lock(this)
+ _m.Lock();
+ try
{
while(!_called)
{
- Monitor.Wait(this);
+ _m.Wait();
}
_called = false;
}
+ finally
+ {
+ _m.Unlock();
+ }
}
public virtual void called()
{
- lock(this)
+ _m.Lock();
+ try
{
Debug.Assert(!_called);
_called = true;
- Monitor.Pulse(this);
+ _m.Notify();
+ }
+ finally
+ {
+ _m.Unlock();
}
}
private bool _called;
+ private readonly IceUtilInternal.Monitor _m = new IceUtilInternal.Monitor();
}
private class Callback : CallbackBase
diff --git a/cs/test/Ice/properties/Client.cs b/cs/test/Ice/properties/Client.cs
index d5bbcd7eaf1..461590269da 100644
--- a/cs/test/Ice/properties/Client.cs
+++ b/cs/test/Ice/properties/Client.cs
@@ -42,7 +42,7 @@ public class Client
}
}
- public static void Main(string[] args)
+ public static int Main(string[] args)
{
int status = 0;
try
@@ -69,9 +69,6 @@ public class Client
status = 1;
}
- if(status != 0)
- {
- System.Environment.Exit(status);
- }
+ return status;
}
}
diff --git a/cs/test/Ice/proxy/Client.cs b/cs/test/Ice/proxy/Client.cs
index 6d7800c9193..f98a39bc164 100644
--- a/cs/test/Ice/proxy/Client.cs
+++ b/cs/test/Ice/proxy/Client.cs
@@ -22,18 +22,20 @@ public class Client
private static int run(String[] args, Ice.Communicator communicator)
{
Test.MyClassPrx myClass = AllTests.allTests(communicator);
-
+
myClass.shutdown();
-
+
return 0;
}
-
- public static void Main(string[] args)
+
+ public static int Main(string[] args)
{
int status = 0;
Ice.Communicator communicator = null;
-
+
+#if !COMPACT
Debug.Listeners.Add(new ConsoleTraceListener());
+#endif
try
{
@@ -48,7 +50,7 @@ public class Client
Console.Error.WriteLine(ex);
status = 1;
}
-
+
if(communicator != null)
{
try
@@ -61,10 +63,7 @@ public class Client
status = 1;
}
}
-
- if(status != 0)
- {
- System.Environment.Exit(status);
- }
+
+ return status;
}
}
diff --git a/cs/test/Ice/proxy/Collocated.cs b/cs/test/Ice/proxy/Collocated.cs
index 426a8566eb0..001e8d87589 100644
--- a/cs/test/Ice/proxy/Collocated.cs
+++ b/cs/test/Ice/proxy/Collocated.cs
@@ -30,13 +30,15 @@ public class Collocated
return 0;
}
-
- public static void Main(String[] args)
+
+ public static int Main(String[] args)
{
int status = 0;
Ice.Communicator communicator = null;
-
+
+#if !COMPACT
Debug.Listeners.Add(new ConsoleTraceListener());
+#endif
try
{
@@ -44,7 +46,7 @@ public class Collocated
initData.properties = Ice.Util.createProperties(ref args);
initData.properties.setProperty("Ice.ThreadPool.Client.Size", "2"); // For nested AMI.
initData.properties.setProperty("Ice.ThreadPool.Client.SizeWarn", "0");
-
+
communicator = Ice.Util.initialize(ref args, initData);
status = run(args, communicator);
}
@@ -53,7 +55,7 @@ public class Collocated
Console.Error.WriteLine(ex);
status = 1;
}
-
+
if(communicator != null)
{
try
@@ -66,10 +68,7 @@ public class Collocated
status = 1;
}
}
-
- if(status != 0)
- {
- System.Environment.Exit(status);
- }
+
+ return status;
}
}
diff --git a/cs/test/Ice/proxy/Server.cs b/cs/test/Ice/proxy/Server.cs
index 3e1edab545a..30bd4cf45da 100644
--- a/cs/test/Ice/proxy/Server.cs
+++ b/cs/test/Ice/proxy/Server.cs
@@ -25,7 +25,7 @@ public class Server
// We don't want connection warnings because of the timeout test.
//
communicator.getProperties().setProperty("Ice.Warn.Connections", "0");
-
+
communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010:udp");
Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
adapter.add(new MyDerivedClassI(), communicator.stringToIdentity("test"));
@@ -34,13 +34,15 @@ public class Server
communicator.waitForShutdown();
return 0;
}
-
- public static void Main(string[] args)
+
+ public static int Main(string[] args)
{
int status = 0;
Ice.Communicator communicator = null;
-
+
+#if !COMPACT
Debug.Listeners.Add(new ConsoleTraceListener());
+#endif
try
{
@@ -54,7 +56,7 @@ public class Server
Console.Error.WriteLine(ex);
status = 1;
}
-
+
if(communicator != null)
{
try
@@ -67,10 +69,7 @@ public class Server
status = 1;
}
}
-
- if(status != 0)
- {
- System.Environment.Exit(status);
- }
+
+ return status;
}
}
diff --git a/cs/test/Ice/retry/AllTests.cs b/cs/test/Ice/retry/AllTests.cs
index 733915b3853..411231523c2 100644
--- a/cs/test/Ice/retry/AllTests.cs
+++ b/cs/test/Ice/retry/AllTests.cs
@@ -30,28 +30,39 @@ public class AllTests
public void check()
{
- lock(this)
+ _m.Lock();
+ try
{
while(!_called)
{
- Monitor.Wait(this);
+ _m.Wait();
}
_called = false;
}
+ finally
+ {
+ _m.Unlock();
+ }
}
public void called()
{
- lock(this)
+ _m.Lock();
+ try
{
Debug.Assert(!_called);
_called = true;
- Monitor.Pulse(this);
+ _m.Notify();
+ }
+ finally
+ {
+ _m.Unlock();
}
}
private bool _called;
+ private readonly IceUtilInternal.Monitor _m = new IceUtilInternal.Monitor();
}
private class AMIRegular
diff --git a/cs/test/Ice/retry/Client.cs b/cs/test/Ice/retry/Client.cs
index c873d5aee36..a1bb7f15f08 100644
--- a/cs/test/Ice/retry/Client.cs
+++ b/cs/test/Ice/retry/Client.cs
@@ -26,12 +26,14 @@ public class Client
return 0;
}
- public static void Main(string[] args)
+ public static int Main(string[] args)
{
int status = 0;
Ice.Communicator communicator = null;
+#if !COMPACT
Debug.Listeners.Add(new ConsoleTraceListener());
+#endif
try
{
@@ -47,7 +49,7 @@ public class Client
// This test kills connections, so we don't want warnings.
//
initData.properties.setProperty("Ice.Warn.Connections", "0");
-
+
communicator = Ice.Util.initialize(ref args, initData);
status = run(args, communicator);
}
@@ -70,9 +72,6 @@ public class Client
}
}
- if(status != 0)
- {
- System.Environment.Exit(status);
- }
+ return status;
}
}
diff --git a/cs/test/Ice/retry/Server.cs b/cs/test/Ice/retry/Server.cs
index 59569e7aa6f..79f8c49b63f 100644
--- a/cs/test/Ice/retry/Server.cs
+++ b/cs/test/Ice/retry/Server.cs
@@ -30,12 +30,14 @@ public class Server
return 0;
}
- public static void Main(string[] args)
+ public static int Main(string[] args)
{
int status = 0;
Ice.Communicator communicator = null;
+#if !COMPACT
Debug.Listeners.Add(new ConsoleTraceListener());
+#endif
try
{
@@ -61,9 +63,6 @@ public class Server
}
}
- if(status != 0)
- {
- System.Environment.Exit(status);
- }
+ return status;
}
}
diff --git a/cs/test/Ice/seqMapping/Client.cs b/cs/test/Ice/seqMapping/Client.cs
index 08b2bbf2e5a..3b1f08a645e 100644
--- a/cs/test/Ice/seqMapping/Client.cs
+++ b/cs/test/Ice/seqMapping/Client.cs
@@ -30,16 +30,27 @@ public class Client
return 0;
}
- public static void Main(string[] args)
+ public static int Main(string[] args)
{
int status = 0;
Ice.Communicator communicator = null;
+#if !COMPACT
Debug.Listeners.Add(new ConsoleTraceListener());
+#endif
try
{
- communicator = Ice.Util.initialize(ref args);
+ Ice.InitializationData data = new Ice.InitializationData();
+#if COMPACT
+ //
+ // When using Ice for .NET Compact Framework, we need to specify
+ // the assembly so that Ice can locate classes and exceptions.
+ //
+ data.properties = Ice.Util.createProperties();
+ data.properties.setProperty("Ice.FactoryAssemblies", "client");
+#endif
+ communicator = Ice.Util.initialize(ref args, data);
status = run(args, communicator);
}
catch(System.Exception ex)
@@ -61,9 +72,6 @@ public class Client
}
}
- if(status != 0)
- {
- System.Environment.Exit(status);
- }
+ return status;
}
}
diff --git a/cs/test/Ice/seqMapping/Collocated.cs b/cs/test/Ice/seqMapping/Collocated.cs
index 9f2d7fc0ad2..71174974fca 100644
--- a/cs/test/Ice/seqMapping/Collocated.cs
+++ b/cs/test/Ice/seqMapping/Collocated.cs
@@ -31,12 +31,14 @@ public class Collocated
return 0;
}
- public static void Main(String[] args)
+ public static int Main(String[] args)
{
int status = 0;
Ice.Communicator communicator = null;
+#if !COMPACT
Debug.Listeners.Add(new ConsoleTraceListener());
+#endif
try
{
@@ -62,9 +64,6 @@ public class Collocated
}
}
- if(status != 0)
- {
- System.Environment.Exit(status);
- }
+ return status;
}
}
diff --git a/cs/test/Ice/seqMapping/Makefile b/cs/test/Ice/seqMapping/Makefile
index 35fc07f24c0..000a3ead550 100644
--- a/cs/test/Ice/seqMapping/Makefile
+++ b/cs/test/Ice/seqMapping/Makefile
@@ -14,7 +14,7 @@ TARGETS = client.exe server.exe collocated.exe serveramd.exe
C_SRCS = AllTests.cs Client.cs Twoways.cs TwowaysAMI.cs TwowaysNewAMI.cs Custom.cs
S_SRCS = MyClassI.cs Server.cs Custom.cs
COL_SRCS = AllTests.cs Collocated.cs MyClassI.cs Twoways.cs TwowaysAMI.cs TwowaysNewAMI.cs Custom.cs
-SAMD_SRCS = MyClassAMDI.cs Server.cs Custom.cs
+SAMD_SRCS = MyClassAMDI.cs ServerAMD.cs Custom.cs
SLICE_SRCS = $(SDIR)/Test.ice
SLICE_AMD_SRCS = $(SDIR)/TestAMD.ice
diff --git a/cs/test/Ice/seqMapping/Makefile.mak b/cs/test/Ice/seqMapping/Makefile.mak
index 55502cbfab2..fa640fc6902 100644
--- a/cs/test/Ice/seqMapping/Makefile.mak
+++ b/cs/test/Ice/seqMapping/Makefile.mak
@@ -14,7 +14,7 @@ TARGETS = client.exe server.exe collocated.exe serveramd.exe Serializable.dll
C_SRCS = AllTests.cs Client.cs Twoways.cs TwowaysAMI.cs TwowaysNewAMI.cs Custom.cs
S_SRCS = MyClassI.cs Server.cs Custom.cs
COL_SRCS = AllTests.cs Collocated.cs MyClassI.cs Twoways.cs TwowaysAMI.cs TwowaysNewAMI.cs Custom.cs
-SAMD_SRCS = MyClassAMDI.cs Server.cs Custom.cs
+SAMD_SRCS = MyClassAMDI.cs ServerAMD.cs Custom.cs
GEN_SRCS = $(GDIR)\Test.cs
GEN_AMD_SRCS = $(GDIR)\TestAMD.cs
diff --git a/cs/test/Ice/seqMapping/Serializable.cs b/cs/test/Ice/seqMapping/Serializable.cs
index 02951747319..02951747319 100755..100644
--- a/cs/test/Ice/seqMapping/Serializable.cs
+++ b/cs/test/Ice/seqMapping/Serializable.cs
diff --git a/cs/test/Ice/seqMapping/Server.cs b/cs/test/Ice/seqMapping/Server.cs
index 36965ca2925..cad9e7eb1b9 100644
--- a/cs/test/Ice/seqMapping/Server.cs
+++ b/cs/test/Ice/seqMapping/Server.cs
@@ -30,16 +30,27 @@ public class Server
return 0;
}
- public static void Main(string[] args)
+ public static int Main(string[] args)
{
int status = 0;
Ice.Communicator communicator = null;
+#if !COMPACT
Debug.Listeners.Add(new ConsoleTraceListener());
+#endif
try
{
- communicator = Ice.Util.initialize(ref args);
+ Ice.InitializationData data = new Ice.InitializationData();
+#if COMPACT
+ //
+ // When using Ice for .NET Compact Framework, we need to specify
+ // the assembly so that Ice can locate classes and exceptions.
+ //
+ data.properties = Ice.Util.createProperties();
+ data.properties.setProperty("Ice.FactoryAssemblies", "server");
+#endif
+ communicator = Ice.Util.initialize(ref args, data);
status = run(args, communicator);
}
catch(System.Exception ex)
@@ -61,9 +72,6 @@ public class Server
}
}
- if(status != 0)
- {
- System.Environment.Exit(status);
- }
+ return status;
}
}
diff --git a/cs/test/Ice/seqMapping/ServerAMD.cs b/cs/test/Ice/seqMapping/ServerAMD.cs
new file mode 100644
index 00000000000..6239ec19807
--- /dev/null
+++ b/cs/test/Ice/seqMapping/ServerAMD.cs
@@ -0,0 +1,77 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2010 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.
+//
+// **********************************************************************
+
+using System;
+using System.Diagnostics;
+using System.Reflection;
+
+[assembly: CLSCompliant(true)]
+
+[assembly: AssemblyTitle("IceTest")]
+[assembly: AssemblyDescription("Ice test")]
+[assembly: AssemblyCompany("ZeroC, Inc.")]
+
+public class Server
+{
+ private static int run(string[] args, Ice.Communicator communicator)
+ {
+ communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010");
+ Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
+ adapter.add(new MyClassI(), communicator.stringToIdentity("test"));
+ adapter.activate();
+
+ communicator.waitForShutdown();
+ return 0;
+ }
+
+ public static int Main(string[] args)
+ {
+ int status = 0;
+ Ice.Communicator communicator = null;
+
+#if !COMPACT
+ Debug.Listeners.Add(new ConsoleTraceListener());
+#endif
+
+ try
+ {
+ Ice.InitializationData data = new Ice.InitializationData();
+#if COMPACT
+ //
+ // When using Ice for .NET Compact Framework, we need to specify
+ // the assembly so that Ice can locate classes and exceptions.
+ //
+ data.properties = Ice.Util.createProperties();
+ data.properties.setProperty("Ice.FactoryAssemblies", "serveramd");
+#endif
+ communicator = Ice.Util.initialize(ref args, data);
+ status = run(args, communicator);
+ }
+ catch(System.Exception ex)
+ {
+ Console.Error.WriteLine(ex);
+ status = 1;
+ }
+
+ if(communicator != null)
+ {
+ try
+ {
+ communicator.destroy();
+ }
+ catch(Ice.LocalException ex)
+ {
+ Console.Error.WriteLine(ex);
+ status = 1;
+ }
+ }
+
+ return status;
+ }
+}
diff --git a/cs/test/Ice/seqMapping/Twoways.cs b/cs/test/Ice/seqMapping/Twoways.cs
index cc7cf2db7df..ff0d83cdddb 100644
--- a/cs/test/Ice/seqMapping/Twoways.cs
+++ b/cs/test/Ice/seqMapping/Twoways.cs
@@ -1413,6 +1413,7 @@ class Twoways
}
}
+#if !COMPACT
{
Serialize.Small i = null;
Serialize.Small o;
@@ -1520,5 +1521,6 @@ class Twoways
// OK, talking to non-C# server.
}
}
+#endif
}
}
diff --git a/cs/test/Ice/seqMapping/TwowaysAMI.cs b/cs/test/Ice/seqMapping/TwowaysAMI.cs
index 17321f19750..186fbb411a9 100644
--- a/cs/test/Ice/seqMapping/TwowaysAMI.cs
+++ b/cs/test/Ice/seqMapping/TwowaysAMI.cs
@@ -32,28 +32,39 @@ public class TwowaysAMI
public virtual void check()
{
- lock(this)
+ _m.Lock();
+ try
{
while(!_called)
{
- Monitor.Wait(this);
+ _m.Wait();
}
_called = false;
}
+ finally
+ {
+ _m.Unlock();
+ }
}
public virtual void called()
{
- lock(this)
+ _m.Lock();
+ try
{
Debug.Assert(!_called);
_called = true;
- Monitor.Pulse(this);
+ _m.Notify();
+ }
+ finally
+ {
+ _m.Unlock();
}
}
private bool _called;
+ private readonly IceUtilInternal.Monitor _m = new IceUtilInternal.Monitor();
}
private class AMI_MyClass_opAByteSI : Test.AMI_MyClass_opAByteS
@@ -2536,6 +2547,7 @@ public class TwowaysAMI
private Callback callback = new Callback();
}
+#if !COMPACT
private class AMI_MyClass_opSerialSmallCSharpNull : Test.AMI_MyClass_opSerialSmallCSharp
{
public AMI_MyClass_opSerialSmallCSharpNull()
@@ -2667,7 +2679,7 @@ public class TwowaysAMI
private Callback callback = new Callback();
}
-
+#endif
static int _length = 100;
@@ -3703,6 +3715,7 @@ public class TwowaysAMI
cb.check();
}
+#if !COMPACT
{
Serialize.Small i = null;
@@ -3749,5 +3762,6 @@ public class TwowaysAMI
p.opSerialStructCSharp_async(cb, i);
cb.check();
}
+#endif
}
}
diff --git a/cs/test/Ice/seqMapping/TwowaysNewAMI.cs b/cs/test/Ice/seqMapping/TwowaysNewAMI.cs
index 1278d15fa74..74aac59c9e8 100644
--- a/cs/test/Ice/seqMapping/TwowaysNewAMI.cs
+++ b/cs/test/Ice/seqMapping/TwowaysNewAMI.cs
@@ -32,28 +32,39 @@ public class TwowaysNewAMI
public virtual void check()
{
- lock(this)
+ _m.Lock();
+ try
{
while(!_called)
{
- Monitor.Wait(this);
+ _m.Wait();
}
_called = false;
}
+ finally
+ {
+ _m.Unlock();
+ }
}
public virtual void called()
{
- lock(this)
+ _m.Lock();
+ try
{
Debug.Assert(!_called);
_called = true;
- Monitor.Pulse(this);
+ _m.Notify();
+ }
+ finally
+ {
+ _m.Unlock();
}
}
private bool _called;
+ private readonly IceUtilInternal.Monitor _m = new IceUtilInternal.Monitor();
}
private class Callback
@@ -1010,6 +1021,7 @@ public class TwowaysNewAMI
callback.called();
}
+#if !COMPACT
public void opSerialSmallCSharpNullI(Ice.AsyncResult result)
{
try
@@ -1105,6 +1117,7 @@ public class TwowaysNewAMI
// OK, talking to non-C# server.
}
}
+#endif
public virtual void check()
{
@@ -2149,6 +2162,7 @@ public class TwowaysNewAMI
cb.check();
}
+#if !COMPACT
{
Serialize.Small i = null;
@@ -2195,5 +2209,6 @@ public class TwowaysNewAMI
p.begin_opSerialStructCSharp(i, null, cb.opSerialStructCSharpI, i);
cb.check();
}
+#endif
}
}
diff --git a/cs/test/Ice/servantLocator/Client.cs b/cs/test/Ice/servantLocator/Client.cs
index 4ac9be46594..456acad0967 100644
--- a/cs/test/Ice/servantLocator/Client.cs
+++ b/cs/test/Ice/servantLocator/Client.cs
@@ -29,16 +29,24 @@ public class Client
return 0;
}
}
-
- public static void Main(string[] args)
+
+ public static int Main(string[] args)
{
+#if !COMPACT
Debug.Listeners.Add(new ConsoleTraceListener());
+#endif
+
+ Ice.InitializationData data = new Ice.InitializationData();
+#if COMPACT
+ //
+ // When using Ice for .NET Compact Framework, we need to specify
+ // the assembly so that Ice can locate classes and exceptions.
+ //
+ data.properties = Ice.Util.createProperties();
+ data.properties.setProperty("Ice.FactoryAssemblies", "client");
+#endif
App app = new App();
- int result = app.main(args);
- if(result != 0)
- {
- System.Environment.Exit(result);
- }
+ return app.main(args, data);
}
}
diff --git a/cs/test/Ice/servantLocator/Collocated.cs b/cs/test/Ice/servantLocator/Collocated.cs
index 97bd5608b3b..82f0eb1deaf 100644
--- a/cs/test/Ice/servantLocator/Collocated.cs
+++ b/cs/test/Ice/servantLocator/Collocated.cs
@@ -38,16 +38,14 @@ public class Collocated
return 0;
}
}
-
- public static void Main(string[] args)
+
+ public static int Main(string[] args)
{
+#if !COMPACT
Debug.Listeners.Add(new ConsoleTraceListener());
+#endif
App app = new App();
- int result = app.main(args);
- if(result != 0)
- {
- System.Environment.Exit(result);
- }
+ return app.main(args);
}
}
diff --git a/cs/test/Ice/servantLocator/Server.cs b/cs/test/Ice/servantLocator/Server.cs
index 321b1e8c33a..820ef02ca54 100644
--- a/cs/test/Ice/servantLocator/Server.cs
+++ b/cs/test/Ice/servantLocator/Server.cs
@@ -36,16 +36,14 @@ public class Server
return 0;
}
}
-
- public static void Main(string[] args)
+
+ public static int Main(string[] args)
{
+#if !COMPACT
Debug.Listeners.Add(new ConsoleTraceListener());
+#endif
App app = new App();
- int result = app.main(args);
- if(result != 0)
- {
- System.Environment.Exit(result);
- }
+ return app.main(args);
}
}
diff --git a/cs/test/Ice/slicing/exceptions/AllTests.cs b/cs/test/Ice/slicing/exceptions/AllTests.cs
index 6b42dc03139..c81b0fbf584 100644
--- a/cs/test/Ice/slicing/exceptions/AllTests.cs
+++ b/cs/test/Ice/slicing/exceptions/AllTests.cs
@@ -21,47 +21,58 @@ public class AllTests
throw new System.Exception();
}
}
-
+
private class Callback
{
internal Callback()
{
_called = false;
}
-
+
public virtual void check()
{
- lock(this)
+ _m.Lock();
+ try
{
while(!_called)
{
- Monitor.Wait(this);
+ _m.Wait();
}
-
+
_called = false;
}
+ finally
+ {
+ _m.Unlock();
+ }
}
-
+
public virtual void called()
{
- lock(this)
+ _m.Lock();
+ try
{
Debug.Assert(!_called);
_called = true;
- Monitor.Pulse(this);
+ _m.Notify();
+ }
+ finally
+ {
+ _m.Unlock();
}
}
-
+
private bool _called;
+ private readonly IceUtilInternal.Monitor _m = new IceUtilInternal.Monitor();
}
-
+
private class AsyncCallback
{
public void response()
{
AllTests.test(false);
}
-
+
public void exception_baseAsBase(Ice.Exception exc)
{
try
@@ -79,7 +90,7 @@ public class AllTests
}
callback.called();
}
-
+
public void exception_unknownDerivedAsBase(Ice.Exception exc)
{
try
@@ -97,7 +108,7 @@ public class AllTests
}
callback.called();
}
-
+
public void exception_knownDerivedAsBase(Ice.Exception exc)
{
try
@@ -116,7 +127,7 @@ public class AllTests
}
callback.called();
}
-
+
public void exception_knownDerivedAsKnownDerived(Ice.Exception exc)
{
try
@@ -135,7 +146,7 @@ public class AllTests
}
callback.called();
}
-
+
public void exception_unknownIntermediateAsBase(Ice.Exception exc)
{
try
@@ -153,7 +164,7 @@ public class AllTests
}
callback.called();
}
-
+
public void exception_knownIntermediateAsBase(Ice.Exception exc)
{
try
@@ -172,7 +183,7 @@ public class AllTests
}
callback.called();
}
-
+
public void exception_knownMostDerivedAsBase(Ice.Exception exc)
{
try
@@ -192,7 +203,7 @@ public class AllTests
}
callback.called();
}
-
+
public void exception_knownIntermediateAsKnownIntermediate(Ice.Exception exc)
{
try
@@ -211,7 +222,7 @@ public class AllTests
}
callback.called();
}
-
+
public void exception_knownMostDerivedAsKnownIntermediate(Ice.Exception exc)
{
try
@@ -231,7 +242,7 @@ public class AllTests
}
callback.called();
}
-
+
public void exception_knownMostDerivedAsKnownMostDerived(Ice.Exception exc)
{
try
@@ -251,7 +262,7 @@ public class AllTests
}
callback.called();
}
-
+
public void exception_unknownMostDerived1AsBase(Ice.Exception exc)
{
try
@@ -270,7 +281,7 @@ public class AllTests
}
callback.called();
}
-
+
public void exception_unknownMostDerived1AsKnownIntermediate(Ice.Exception exc)
{
try
@@ -289,7 +300,7 @@ public class AllTests
}
callback.called();
}
-
+
public void exception_unknownMostDerived2AsBase(Ice.Exception exc)
{
try
@@ -307,15 +318,15 @@ public class AllTests
}
callback.called();
}
-
+
public virtual void check()
{
callback.check();
}
-
+
private Callback callback = new Callback();
}
-
+
public static TestIntfPrx allTests(Ice.Communicator communicator, bool collocated)
{
Console.Out.Write("testing stringToProxy... ");
@@ -324,14 +335,14 @@ public class AllTests
Ice.ObjectPrx @base = communicator.stringToProxy(@ref);
test(@base != null);
Console.Out.WriteLine("ok");
-
+
Console.Out.Write("testing checked cast... ");
Console.Out.Flush();
TestIntfPrx testPrx = TestIntfPrxHelper.checkedCast(@base);
test(testPrx != null);
test(testPrx.Equals(@base));
Console.Out.WriteLine("ok");
-
+
Console.Out.Write("base... ");
Console.Out.Flush();
{
@@ -351,7 +362,7 @@ public class AllTests
}
}
Console.Out.WriteLine("ok");
-
+
Console.Out.Write("base (AMI)... ");
Console.Out.Flush();
{
@@ -360,7 +371,7 @@ public class AllTests
cb.check();
}
Console.Out.WriteLine("ok");
-
+
Console.Out.Write("slicing of unknown derived... ");
Console.Out.Flush();
{
@@ -380,7 +391,7 @@ public class AllTests
}
}
Console.Out.WriteLine("ok");
-
+
Console.Out.Write("slicing of unknown derived (AMI)... ");
Console.Out.Flush();
{
@@ -389,7 +400,7 @@ public class AllTests
cb.check();
}
Console.Out.WriteLine("ok");
-
+
Console.Out.Write("non-slicing of known derived as base... ");
Console.Out.Flush();
{
@@ -410,7 +421,7 @@ public class AllTests
}
}
Console.Out.WriteLine("ok");
-
+
Console.Out.Write("non-slicing of known derived as base (AMI)... ");
Console.Out.Flush();
{
@@ -419,7 +430,7 @@ public class AllTests
cb.check();
}
Console.Out.WriteLine("ok");
-
+
Console.Out.Write("non-slicing of known derived as derived... ");
Console.Out.Flush();
{
@@ -440,7 +451,7 @@ public class AllTests
}
}
Console.Out.WriteLine("ok");
-
+
Console.Out.Write("non-slicing of known derived as derived (AMI)... ");
Console.Out.Flush();
{
@@ -450,7 +461,7 @@ public class AllTests
cb.check();
}
Console.Out.WriteLine("ok");
-
+
Console.Out.Write("slicing of unknown intermediate as base... ");
Console.Out.Flush();
{
@@ -470,7 +481,7 @@ public class AllTests
}
}
Console.Out.WriteLine("ok");
-
+
Console.Out.Write("slicing of unknown intermediate as base (AMI)... ");
Console.Out.Flush();
{
@@ -480,7 +491,7 @@ public class AllTests
cb.check();
}
Console.Out.WriteLine("ok");
-
+
Console.Out.Write("slicing of known intermediate as base... ");
Console.Out.Flush();
{
@@ -501,7 +512,7 @@ public class AllTests
}
}
Console.Out.WriteLine("ok");
-
+
Console.Out.Write("slicing of known intermediate as base (AMI)... ");
Console.Out.Flush();
{
@@ -511,7 +522,7 @@ public class AllTests
cb.check();
}
Console.Out.WriteLine("ok");
-
+
Console.Out.Write("slicing of known most derived as base... ");
Console.Out.Flush();
{
@@ -533,7 +544,7 @@ public class AllTests
}
}
Console.Out.WriteLine("ok");
-
+
Console.Out.Write("slicing of known most derived as base (AMI)... ");
Console.Out.Flush();
{
@@ -543,7 +554,7 @@ public class AllTests
cb.check();
}
Console.Out.WriteLine("ok");
-
+
Console.Out.Write("non-slicing of known intermediate as intermediate... ");
Console.Out.Flush();
{
@@ -564,7 +575,7 @@ public class AllTests
}
}
Console.Out.WriteLine("ok");
-
+
Console.Out.Write("non-slicing of known intermediate as intermediate (AMI)... ");
Console.Out.Flush();
{
@@ -574,7 +585,7 @@ public class AllTests
cb.check();
}
Console.Out.WriteLine("ok");
-
+
Console.Out.Write("non-slicing of known most derived as intermediate... ");
Console.Out.Flush();
{
@@ -596,7 +607,7 @@ public class AllTests
}
}
Console.Out.WriteLine("ok");
-
+
Console.Out.Write("non-slicing of known most derived as intermediate (AMI)... ");
Console.Out.Flush();
{
@@ -606,7 +617,7 @@ public class AllTests
cb.check();
}
Console.Out.WriteLine("ok");
-
+
Console.Out.Write("non-slicing of known most derived as most derived... ");
Console.Out.Flush();
{
@@ -628,7 +639,7 @@ public class AllTests
}
}
Console.Out.WriteLine("ok");
-
+
Console.Out.Write("non-slicing of known most derived as most derived (AMI)... ");
Console.Out.Flush();
{
@@ -638,7 +649,7 @@ public class AllTests
cb.check();
}
Console.Out.WriteLine("ok");
-
+
Console.Out.Write("slicing of unknown most derived, known intermediate as base... ");
Console.Out.Flush();
{
@@ -659,7 +670,7 @@ public class AllTests
}
}
Console.Out.WriteLine("ok");
-
+
Console.Out.Write("slicing of unknown most derived, known intermediate as base (AMI)... ");
Console.Out.Flush();
{
@@ -669,7 +680,7 @@ public class AllTests
cb.check();
}
Console.Out.WriteLine("ok");
-
+
Console.Out.Write("slicing of unknown most derived, known intermediate as intermediate... ");
Console.Out.Flush();
{
@@ -690,7 +701,7 @@ public class AllTests
}
}
Console.Out.WriteLine("ok");
-
+
Console.Out.Write("slicing of unknown most derived, known intermediate as intermediate (AMI)... ");
Console.Out.Flush();
{
@@ -700,7 +711,7 @@ public class AllTests
cb.check();
}
Console.Out.WriteLine("ok");
-
+
Console.Out.Write("slicing of unknown most derived, unknown intermediate thrown as base... ");
Console.Out.Flush();
{
@@ -720,7 +731,7 @@ public class AllTests
}
}
Console.Out.WriteLine("ok");
-
+
Console.Out.Write("slicing of unknown most derived, unknown intermediate thrown as base (AMI)... ");
Console.Out.Flush();
{
@@ -730,7 +741,7 @@ public class AllTests
cb.check();
}
Console.Out.WriteLine("ok");
-
+
return testPrx;
}
}
diff --git a/cs/test/Ice/slicing/exceptions/Client.cs b/cs/test/Ice/slicing/exceptions/Client.cs
index ab726d719f9..7a1339b73aa 100644
--- a/cs/test/Ice/slicing/exceptions/Client.cs
+++ b/cs/test/Ice/slicing/exceptions/Client.cs
@@ -18,17 +18,28 @@ public class Client
test.shutdown();
return 0;
}
-
- public static void Main(string[] args)
+
+ public static int Main(string[] args)
{
int status = 0;
Ice.Communicator communicator = null;
-
+
+#if !COMPACT
Debug.Listeners.Add(new ConsoleTraceListener());
+#endif
try
{
- communicator = Ice.Util.initialize(ref args);
+ Ice.InitializationData data = new Ice.InitializationData();
+#if COMPACT
+ //
+ // When using Ice for .NET Compact Framework, we need to specify
+ // the assembly so that Ice can locate classes and exceptions.
+ //
+ data.properties = Ice.Util.createProperties();
+ data.properties.setProperty("Ice.FactoryAssemblies", "client");
+#endif
+ communicator = Ice.Util.initialize(ref args, data);
status = run(args, communicator);
}
catch(System.Exception ex)
@@ -36,7 +47,7 @@ public class Client
System.Console.Error.WriteLine(ex);
status = 1;
}
-
+
if(communicator != null)
{
try
@@ -49,10 +60,7 @@ public class Client
status = 1;
}
}
-
- if(status != 0)
- {
- System.Environment.Exit(status);
- }
+
+ return status;
}
}
diff --git a/cs/test/Ice/slicing/exceptions/Server.cs b/cs/test/Ice/slicing/exceptions/Server.cs
index 7b653c21a2b..2009c290f09 100644
--- a/cs/test/Ice/slicing/exceptions/Server.cs
+++ b/cs/test/Ice/slicing/exceptions/Server.cs
@@ -23,13 +23,15 @@ public class Server
communicator.waitForShutdown();
return 0;
}
-
- public static void Main(string[] args)
+
+ public static int Main(string[] args)
{
int status = 0;
Ice.Communicator communicator = null;
-
+
+#if !COMPACT
Debug.Listeners.Add(new ConsoleTraceListener());
+#endif
try
{
@@ -41,7 +43,7 @@ public class Server
System.Console.Error.WriteLine(ex);
status = 1;
}
-
+
if(communicator != null)
{
try
@@ -54,10 +56,7 @@ public class Server
status = 1;
}
}
-
- if(status != 0)
- {
- System.Environment.Exit(status);
- }
+
+ return status;
}
}
diff --git a/cs/test/Ice/slicing/objects/AllTests.cs b/cs/test/Ice/slicing/objects/AllTests.cs
index b152e7ca59a..cbe486a8877 100644
--- a/cs/test/Ice/slicing/objects/AllTests.cs
+++ b/cs/test/Ice/slicing/objects/AllTests.cs
@@ -22,40 +22,51 @@ public class AllTests
throw new System.Exception();
}
}
-
+
private class Callback
{
internal Callback()
{
_called = false;
}
-
+
public virtual void check()
{
- lock(this)
+ _m.Lock();
+ try
{
while(!_called)
{
- Monitor.Wait(this);
+ _m.Wait();
}
-
+
_called = false;
}
+ finally
+ {
+ _m.Unlock();
+ }
}
-
+
public virtual void called()
{
- lock(this)
+ _m.Lock();
+ try
{
Debug.Assert(!_called);
_called = true;
- Monitor.Pulse(this);
+ _m.Notify();
+ }
+ finally
+ {
+ _m.Unlock();
}
}
-
+
private bool _called;
+ private readonly IceUtilInternal.Monitor _m = new IceUtilInternal.Monitor();
}
-
+
private class AsyncCallback
{
public void response_SBaseAsObject(Ice.Object o)
@@ -67,13 +78,13 @@ public class AllTests
AllTests.test(sb.sb.Equals("SBase.sb"));
callback.called();
}
-
+
public void response_SBaseAsSBase(SBase sb)
{
AllTests.test(sb.sb.Equals("SBase.sb"));
callback.called();
}
-
+
public void response_SBSKnownDerivedAsSBase(SBase sb)
{
AllTests.test(sb.sb.Equals("SBSKnownDerived.sb"));
@@ -82,30 +93,30 @@ public class AllTests
AllTests.test(sbskd.sbskd.Equals("SBSKnownDerived.sbskd"));
callback.called();
}
-
+
public void response_SBSKnownDerivedAsSBSKnownDerived(SBSKnownDerived sbskd)
{
AllTests.test(sbskd.sbskd.Equals("SBSKnownDerived.sbskd"));
callback.called();
}
-
+
public void response_SBSUnknownDerivedAsSBase(SBase sb)
{
AllTests.test(sb.sb.Equals("SBSUnknownDerived.sb"));
callback.called();
}
-
+
public void response_SUnknownAsObject(Ice.Object o)
{
AllTests.test(false);
}
-
+
public void exception_SUnknownAsObject(Ice.Exception exc)
{
AllTests.test(exc.GetType().FullName.Equals("Ice.NoObjectFactoryException"));
callback.called();
}
-
+
public void response_oneElementCycle(B b)
{
AllTests.test(b != null);
@@ -114,13 +125,13 @@ public class AllTests
AllTests.test(b.pb == b);
callback.called();
}
-
+
public void response_twoElementCycle(B b1)
{
AllTests.test(b1 != null);
AllTests.test(b1.ice_id().Equals("::Test::B"));
AllTests.test(b1.sb.Equals("B1.sb"));
-
+
B b2 = b1.pb;
AllTests.test(b2 != null);
AllTests.test(b2.ice_id().Equals("::Test::B"));
@@ -128,7 +139,7 @@ public class AllTests
AllTests.test(b2.pb == b1);
callback.called();
}
-
+
public void response_D1AsB(B b1)
{
AllTests.test(b1 != null);
@@ -142,7 +153,7 @@ public class AllTests
AllTests.test(d1.pd1 != null);
AllTests.test(d1.pd1 != b1);
AllTests.test(b1.pb == d1.pd1);
-
+
B b2 = b1.pb;
AllTests.test(b2 != null);
AllTests.test(b2.pb == b1);
@@ -150,7 +161,7 @@ public class AllTests
AllTests.test(b2.ice_id().Equals("::Test::B"));
callback.called();
}
-
+
public void response_D1AsD1(D1 d1)
{
AllTests.test(d1 != null);
@@ -158,7 +169,7 @@ public class AllTests
AllTests.test(d1.sb.Equals("D1.sb"));
AllTests.test(d1.pb != null);
AllTests.test(d1.pb != d1);
-
+
B b2 = d1.pb;
AllTests.test(b2 != null);
AllTests.test(b2.ice_id().Equals("::Test::B"));
@@ -166,7 +177,7 @@ public class AllTests
AllTests.test(b2.pb == d1);
callback.called();
}
-
+
public void response_D2AsB(B b2)
{
AllTests.test(b2 != null);
@@ -174,7 +185,7 @@ public class AllTests
AllTests.test(b2.sb.Equals("D2.sb"));
AllTests.test(b2.pb != null);
AllTests.test(b2.pb != b2);
-
+
B b1 = b2.pb;
AllTests.test(b1 != null);
AllTests.test(b1.ice_id().Equals("::Test::D1"));
@@ -186,7 +197,7 @@ public class AllTests
AllTests.test(d1.pd1 == b2);
callback.called();
}
-
+
public void response_paramTest1(B b1, B b2)
{
AllTests.test(b1 != null);
@@ -197,14 +208,14 @@ public class AllTests
AllTests.test(d1 != null);
AllTests.test(d1.sd1.Equals("D1.sd1"));
AllTests.test(d1.pd1 == b2);
-
+
AllTests.test(b2 != null);
AllTests.test(b2.ice_id().Equals("::Test::B")); // No factory, must be sliced
AllTests.test(b2.sb.Equals("D2.sb"));
AllTests.test(b2.pb == b1);
callback.called();
}
-
+
public void response_paramTest2(B b2, B b1)
{
AllTests.test(b1 != null);
@@ -215,78 +226,78 @@ public class AllTests
AllTests.test(d1 != null);
AllTests.test(d1.sd1.Equals("D1.sd1"));
AllTests.test(d1.pd1 == b2);
-
+
AllTests.test(b2 != null);
AllTests.test(b2.ice_id().Equals("::Test::B")); // No factory, must be sliced
AllTests.test(b2.sb.Equals("D2.sb"));
AllTests.test(b2.pb == b1);
callback.called();
}
-
+
public void response_returnTest1(B r, B p1, B p2)
{
AllTests.test(r == p1);
callback.called();
}
-
+
public void response_returnTest2(B r, B p1, B p2)
{
AllTests.test(r == p1);
callback.called();
}
-
+
public void response_returnTest3(B b)
{
rb = b;
callback.called();
}
-
+
public void response_paramTest3(B ret, B p1, B p2)
{
AllTests.test(p1 != null);
AllTests.test(p1.sb.Equals("D2.sb (p1 1)"));
AllTests.test(p1.pb == null);
AllTests.test(p1.ice_id().Equals("::Test::B"));
-
+
AllTests.test(p2 != null);
AllTests.test(p2.sb.Equals("D2.sb (p2 1)"));
AllTests.test(p2.pb == null);
AllTests.test(p2.ice_id().Equals("::Test::B"));
-
+
AllTests.test(ret != null);
AllTests.test(ret.sb.Equals("D1.sb (p2 2)"));
AllTests.test(ret.pb == null);
AllTests.test(ret.ice_id().Equals("::Test::D1"));
callback.called();
}
-
+
public void response_paramTest4(B ret, B b)
{
AllTests.test(b != null);
AllTests.test(b.sb.Equals("D4.sb (1)"));
AllTests.test(b.pb == null);
AllTests.test(b.ice_id().Equals("::Test::B"));
-
+
AllTests.test(ret != null);
AllTests.test(ret.sb.Equals("B.sb (2)"));
AllTests.test(ret.pb == null);
AllTests.test(ret.ice_id().Equals("::Test::B"));
callback.called();
}
-
+
public void response_sequenceTest(SS ss)
{
rss = ss;
callback.called();
}
-
+
public void response_dictionaryTest(Dictionary<int, B> r, Dictionary<int, B> bout)
{
this.rbdict = (Dictionary<int, B>)r;
this.obdict = (Dictionary<int, B>)bout;
callback.called();
}
-
+
public void exception_throwBaseAsBase(Ice.Exception exc)
{
try
@@ -303,7 +314,7 @@ public class AllTests
}
callback.called();
}
-
+
public void exception_throwDerivedAsBase(Ice.Exception exc)
{
try
@@ -326,7 +337,7 @@ public class AllTests
}
callback.called();
}
-
+
public void exception_throwDerivedAsDerived(Ice.Exception exc)
{
try
@@ -349,7 +360,7 @@ public class AllTests
}
callback.called();
}
-
+
public void exception_throwUnknownDerivedAsBase(Ice.Exception exc)
{
try
@@ -366,23 +377,23 @@ public class AllTests
}
callback.called();
}
-
+
public void response_useForward(Forward f)
{
AllTests.test(f != null);
callback.called();
}
-
+
public void response()
{
AllTests.test(false);
}
-
+
public void exception(Ice.Exception exc)
{
AllTests.test(false);
}
-
+
public virtual void check()
{
callback.check();
@@ -392,10 +403,10 @@ public class AllTests
public SS rss;
public Dictionary<int, B> rbdict;
public Dictionary<int, B> obdict;
-
+
private Callback callback = new Callback();
}
-
+
public static TestIntfPrx allTests(Ice.Communicator communicator, bool collocated)
{
Console.Out.Write("testing stringToProxy... ");
@@ -404,14 +415,14 @@ public class AllTests
Ice.ObjectPrx basePrx = communicator.stringToProxy(r);
test(basePrx != null);
Console.Out.WriteLine("ok");
-
+
Console.Out.Write("testing checked cast... ");
Console.Out.Flush();
TestIntfPrx testPrx = TestIntfPrxHelper.checkedCast(basePrx);
test(testPrx != null);
test(testPrx.Equals(basePrx));
Console.Out.WriteLine("ok");
-
+
Console.Out.Write("base as Object... ");
Console.Out.Flush();
{
@@ -432,7 +443,7 @@ public class AllTests
test(sb.sb.Equals("SBase.sb"));
}
Console.Out.WriteLine("ok");
-
+
Console.Out.Write("base as Object (AMI)... ");
Console.Out.Flush();
{
@@ -441,7 +452,7 @@ public class AllTests
cb.check();
}
Console.Out.WriteLine("ok");
-
+
Console.Out.Write("base as base... ");
Console.Out.Flush();
{
@@ -457,7 +468,7 @@ public class AllTests
}
}
Console.Out.WriteLine("ok");
-
+
Console.Out.Write("base as base (AMI)... ");
Console.Out.Flush();
{
@@ -466,7 +477,7 @@ public class AllTests
cb.check();
}
Console.Out.WriteLine("ok");
-
+
Console.Out.Write("base with known derived as base... ");
Console.Out.Flush();
{
@@ -486,7 +497,7 @@ public class AllTests
test(sbskd.sbskd.Equals("SBSKnownDerived.sbskd"));
}
Console.Out.WriteLine("ok");
-
+
Console.Out.Write("base with known derived as base (AMI)... ");
Console.Out.Flush();
{
@@ -495,7 +506,7 @@ public class AllTests
cb.check();
}
Console.Out.WriteLine("ok");
-
+
Console.Out.Write("base with known derived as known derived... ");
Console.Out.Flush();
{
@@ -511,7 +522,7 @@ public class AllTests
}
}
Console.Out.WriteLine("ok");
-
+
Console.Out.Write("base with known derived as known derived (AMI)... ");
Console.Out.Flush();
{
@@ -521,7 +532,7 @@ public class AllTests
cb.check();
}
Console.Out.WriteLine("ok");
-
+
Console.Out.Write("base with unknown derived as base... ");
Console.Out.Flush();
{
@@ -537,7 +548,7 @@ public class AllTests
}
}
Console.Out.WriteLine("ok");
-
+
Console.Out.Write("base with unknown derived as base (AMI)... ");
Console.Out.Flush();
{
@@ -547,7 +558,7 @@ public class AllTests
cb.check();
}
Console.Out.WriteLine("ok");
-
+
Console.Out.Write("unknown with Object as Object... ");
Console.Out.Flush();
{
@@ -565,7 +576,7 @@ public class AllTests
}
}
Console.Out.WriteLine("ok");
-
+
Console.Out.Write("unknown with Object as Object (AMI)... ");
Console.Out.Flush();
{
@@ -582,7 +593,7 @@ public class AllTests
}
}
Console.Out.WriteLine("ok");
-
+
Console.Out.Write("one-element cycle... ");
Console.Out.Flush();
{
@@ -600,7 +611,7 @@ public class AllTests
}
}
Console.Out.WriteLine("ok");
-
+
Console.Out.Write("one-element cycle (AMI)... ");
Console.Out.Flush();
{
@@ -610,7 +621,7 @@ public class AllTests
cb.check();
}
Console.Out.WriteLine("ok");
-
+
Console.Out.Write("two-element cycle... ");
Console.Out.Flush();
{
@@ -620,7 +631,7 @@ public class AllTests
test(b1 != null);
test(b1.ice_id().Equals("::Test::B"));
test(b1.sb.Equals("B1.sb"));
-
+
B b2 = b1.pb;
test(b2 != null);
test(b2.ice_id().Equals("::Test::B"));
@@ -633,7 +644,7 @@ public class AllTests
}
}
Console.Out.WriteLine("ok");
-
+
Console.Out.Write("two-element cycle (AMI)... ");
Console.Out.Flush();
{
@@ -643,7 +654,7 @@ public class AllTests
cb.check();
}
Console.Out.WriteLine("ok");
-
+
Console.Out.Write("known derived pointer slicing as base... ");
Console.Out.Flush();
{
@@ -662,7 +673,7 @@ public class AllTests
test(d1.pd1 != null);
test(d1.pd1 != b1);
test(b1.pb == d1.pd1);
-
+
B b2 = b1.pb;
test(b2 != null);
test(b2.pb == b1);
@@ -675,7 +686,7 @@ public class AllTests
}
}
Console.Out.WriteLine("ok");
-
+
Console.Out.Write("known derived pointer slicing as base (AMI)... ");
Console.Out.Flush();
{
@@ -684,7 +695,7 @@ public class AllTests
cb.check();
}
Console.Out.WriteLine("ok");
-
+
Console.Out.Write("known derived pointer slicing as derived... ");
Console.Out.Flush();
{
@@ -697,7 +708,7 @@ public class AllTests
test(d1.sb.Equals("D1.sb"));
test(d1.pb != null);
test(d1.pb != d1);
-
+
B b2 = d1.pb;
test(b2 != null);
test(b2.ice_id().Equals("::Test::B"));
@@ -710,7 +721,7 @@ public class AllTests
}
}
Console.Out.WriteLine("ok");
-
+
Console.Out.Write("known derived pointer slicing as derived (AMI)... ");
Console.Out.Flush();
{
@@ -719,7 +730,7 @@ public class AllTests
cb.check();
}
Console.Out.WriteLine("ok");
-
+
Console.Out.Write("unknown derived pointer slicing as base... ");
Console.Out.Flush();
{
@@ -732,7 +743,7 @@ public class AllTests
test(b2.sb.Equals("D2.sb"));
test(b2.pb != null);
test(b2.pb != b2);
-
+
B b1 = b2.pb;
test(b1 != null);
test(b1.ice_id().Equals("::Test::D1"));
@@ -749,7 +760,7 @@ public class AllTests
}
}
Console.Out.WriteLine("ok");
-
+
Console.Out.Write("unknown derived pointer slicing as base (AMI)... ");
Console.Out.Flush();
{
@@ -758,7 +769,7 @@ public class AllTests
cb.check();
}
Console.Out.WriteLine("ok");
-
+
Console.Out.Write("param ptr slicing with known first... ");
Console.Out.Flush();
{
@@ -767,7 +778,7 @@ public class AllTests
B b1;
B b2;
testPrx.paramTest1(out b1, out b2);
-
+
test(b1 != null);
test(b1.ice_id().Equals("::Test::D1"));
test(b1.sb.Equals("D1.sb"));
@@ -776,7 +787,7 @@ public class AllTests
test(d1 != null);
test(d1.sd1.Equals("D1.sd1"));
test(d1.pd1 == b2);
-
+
test(b2 != null);
test(b2.ice_id().Equals("::Test::B")); // No factory, must be sliced
test(b2.sb.Equals("D2.sb"));
@@ -788,7 +799,7 @@ public class AllTests
}
}
Console.Out.WriteLine("ok");
-
+
Console.Out.Write("param ptr slicing with known first (AMI)... ");
Console.Out.Flush();
{
@@ -797,7 +808,7 @@ public class AllTests
cb.check();
}
Console.Out.WriteLine("ok");
-
+
Console.Out.Write("param ptr slicing with unknown first... ");
Console.Out.Flush();
{
@@ -806,7 +817,7 @@ public class AllTests
B b2;
B b1;
testPrx.paramTest2(out b2, out b1);
-
+
test(b1 != null);
test(b1.ice_id().Equals("::Test::D1"));
test(b1.sb.Equals("D1.sb"));
@@ -815,7 +826,7 @@ public class AllTests
test(d1 != null);
test(d1.sd1.Equals("D1.sd1"));
test(d1.pd1 == b2);
-
+
test(b2 != null);
test(b2.ice_id().Equals("::Test::B")); // No factory, must be sliced
test(b2.sb.Equals("D2.sb"));
@@ -827,7 +838,7 @@ public class AllTests
}
}
Console.Out.WriteLine("ok");
-
+
Console.Out.Write("param ptr slicing with unknown first (AMI)... ");
Console.Out.Flush();
{
@@ -836,7 +847,7 @@ public class AllTests
cb.check();
}
Console.Out.WriteLine("ok");
-
+
Console.Out.Write("return value identity with known first... ");
Console.Out.Flush();
{
@@ -853,7 +864,7 @@ public class AllTests
}
}
Console.Out.WriteLine("ok");
-
+
Console.Out.Write("return value identity with known first (AMI)... ");
Console.Out.Flush();
{
@@ -862,7 +873,7 @@ public class AllTests
cb.check();
}
Console.Out.WriteLine("ok");
-
+
Console.Out.Write("return value identity with unknown first... ");
Console.Out.Flush();
{
@@ -879,7 +890,7 @@ public class AllTests
}
}
Console.Out.WriteLine("ok");
-
+
Console.Out.Write("return value identity with unknown first (AMI)... ");
Console.Out.Flush();
{
@@ -888,7 +899,7 @@ public class AllTests
cb.check();
}
Console.Out.WriteLine("ok");
-
+
Console.Out.Write("return value identity for input params known first... ");
Console.Out.Flush();
{
@@ -904,9 +915,9 @@ public class AllTests
d3.pd3 = d1;
d1.pb = d3;
d1.pd1 = d3;
-
+
B b1 = testPrx.returnTest3(d1, d3);
-
+
test(b1 != null);
test(b1.sb.Equals("D1.sb"));
test(b1.ice_id().Equals("::Test::D1"));
@@ -914,7 +925,7 @@ public class AllTests
test(p1 != null);
test(p1.sd1.Equals("D1.sd1"));
test(p1.pd1 == b1.pb);
-
+
B b2 = b1.pb;
test(b2 != null);
test(b2.sb.Equals("D3.sb"));
@@ -929,7 +940,7 @@ public class AllTests
catch(InvalidCastException)
{
}
-
+
test(b1 != d1);
test(b1 != d3);
test(b2 != d1);
@@ -941,7 +952,7 @@ public class AllTests
}
}
Console.Out.WriteLine("ok");
-
+
Console.Out.Write("return value identity for input params known first (AMI)... ");
Console.Out.Flush();
{
@@ -955,12 +966,12 @@ public class AllTests
d3.pd3 = d1;
d1.pb = d3;
d1.pd1 = d3;
-
+
AsyncCallback cb = new AsyncCallback();
testPrx.begin_returnTest3(d1, d3).whenCompleted(cb.response_returnTest3, cb.exception);
cb.check();
B b1 = cb.rb;
-
+
test(b1 != null);
test(b1.sb.Equals("D1.sb"));
test(b1.ice_id().Equals("::Test::D1"));
@@ -968,7 +979,7 @@ public class AllTests
test(p1 != null);
test(p1.sd1.Equals("D1.sd1"));
test(p1.pd1 == b1.pb);
-
+
B b2 = b1.pb;
test(b2 != null);
test(b2.sb.Equals("D3.sb"));
@@ -983,14 +994,14 @@ public class AllTests
catch(InvalidCastException)
{
}
-
+
test(b1 != d1);
test(b1 != d3);
test(b2 != d1);
test(b2 != d3);
}
Console.Out.WriteLine("ok");
-
+
Console.Out.Write("return value identity for input params unknown first... ");
Console.Out.Flush();
{
@@ -1006,13 +1017,13 @@ public class AllTests
d3.pd3 = d1;
d1.pb = d3;
d1.pd1 = d3;
-
+
B b1 = testPrx.returnTest3(d3, d1);
-
+
test(b1 != null);
test(b1.sb.Equals("D3.sb"));
test(b1.ice_id().Equals("::Test::B")); // Sliced by server
-
+
try
{
D3 p1 = (D3) b1;
@@ -1022,7 +1033,7 @@ public class AllTests
catch(InvalidCastException)
{
}
-
+
B b2 = b1.pb;
test(b2 != null);
test(b2.sb.Equals("D1.sb"));
@@ -1032,7 +1043,7 @@ public class AllTests
test(p3 != null);
test(p3.sd1.Equals("D1.sd1"));
test(p3.pd1 == b1);
-
+
test(b1 != d1);
test(b1 != d3);
test(b2 != d1);
@@ -1044,7 +1055,7 @@ public class AllTests
}
}
Console.Out.WriteLine("ok");
-
+
Console.Out.Write("return value identity for input params unknown first (AMI)... ");
Console.Out.Flush();
{
@@ -1058,16 +1069,16 @@ public class AllTests
d3.pd3 = d1;
d1.pb = d3;
d1.pd1 = d3;
-
+
AsyncCallback cb = new AsyncCallback();
testPrx.begin_returnTest3(d3, d1).whenCompleted(cb.response_returnTest3, cb.exception);
cb.check();
B b1 = cb.rb;
-
+
test(b1 != null);
test(b1.sb.Equals("D3.sb"));
test(b1.ice_id().Equals("::Test::B")); // Sliced by server
-
+
try
{
D3 p1 = (D3) b1;
@@ -1077,7 +1088,7 @@ public class AllTests
catch(InvalidCastException)
{
}
-
+
B b2 = b1.pb;
test(b2 != null);
test(b2.sb.Equals("D1.sb"));
@@ -1087,14 +1098,14 @@ public class AllTests
test(p3 != null);
test(p3.sd1.Equals("D1.sd1"));
test(p3.pd1 == b1);
-
+
test(b1 != d1);
test(b1 != d3);
test(b2 != d1);
test(b2 != d3);
}
Console.Out.WriteLine("ok");
-
+
Console.Out.Write("remainder unmarshaling (3 instances)... ");
Console.Out.Flush();
{
@@ -1103,17 +1114,17 @@ public class AllTests
B p1;
B p2;
B ret = testPrx.paramTest3(out p1, out p2);
-
+
test(p1 != null);
test(p1.sb.Equals("D2.sb (p1 1)"));
test(p1.pb == null);
test(p1.ice_id().Equals("::Test::B"));
-
+
test(p2 != null);
test(p2.sb.Equals("D2.sb (p2 1)"));
test(p2.pb == null);
test(p2.ice_id().Equals("::Test::B"));
-
+
test(ret != null);
test(ret.sb.Equals("D1.sb (p2 2)"));
test(ret.pb == null);
@@ -1125,7 +1136,7 @@ public class AllTests
}
}
Console.Out.WriteLine("ok");
-
+
Console.Out.Write("remainder unmarshaling (3 instances) (AMI)... ");
Console.Out.Flush();
{
@@ -1134,7 +1145,7 @@ public class AllTests
cb.check();
}
Console.Out.WriteLine("ok");
-
+
Console.Out.Write("remainder unmarshaling (4 instances)... ");
Console.Out.Flush();
{
@@ -1142,12 +1153,12 @@ public class AllTests
{
B b;
B ret = testPrx.paramTest4(out b);
-
+
test(b != null);
test(b.sb.Equals("D4.sb (1)"));
test(b.pb == null);
test(b.ice_id().Equals("::Test::B"));
-
+
test(ret != null);
test(ret.sb.Equals("B.sb (2)"));
test(ret.pb == null);
@@ -1159,7 +1170,7 @@ public class AllTests
}
}
Console.Out.WriteLine("ok");
-
+
Console.Out.Write("remainder unmarshaling (4 instances) (AMI)... ");
Console.Out.Flush();
{
@@ -1168,7 +1179,7 @@ public class AllTests
cb.check();
}
Console.Out.WriteLine("ok");
-
+
Console.Out.Write("param ptr slicing, instance marshaled in unknown derived as base... ");
Console.Out.Flush();
{
@@ -1177,19 +1188,19 @@ public class AllTests
B b1 = new B();
b1.sb = "B.sb(1)";
b1.pb = b1;
-
+
D3 d3 = new D3();
d3.sb = "D3.sb";
d3.pb = d3;
d3.sd3 = "D3.sd3";
d3.pd3 = b1;
-
+
B b2 = new B();
b2.sb = "B.sb(2)";
b2.pb = b1;
-
+
B ret = testPrx.returnTest3(d3, b2);
-
+
test(ret != null);
test(ret.ice_id().Equals("::Test::B"));
test(ret.sb.Equals("D3.sb"));
@@ -1201,36 +1212,36 @@ public class AllTests
}
}
Console.Out.WriteLine("ok");
-
+
Console.Out.Write("param ptr slicing, instance marshaled in unknown derived as base (AMI)... ");
Console.Out.Flush();
{
B b1 = new B();
b1.sb = "B.sb(1)";
b1.pb = b1;
-
+
D3 d3 = new D3();
d3.sb = "D3.sb";
d3.pb = d3;
d3.sd3 = "D3.sd3";
d3.pd3 = b1;
-
+
B b2 = new B();
b2.sb = "B.sb(2)";
b2.pb = b1;
-
+
AsyncCallback cb = new AsyncCallback();
testPrx.begin_returnTest3(d3, b2).whenCompleted(cb.response_returnTest3, cb.exception);
cb.check();
B rv = cb.rb;
-
+
test(rv != null);
test(rv.ice_id().Equals("::Test::B"));
test(rv.sb.Equals("D3.sb"));
test(rv.pb == rv);
}
Console.Out.WriteLine("ok");
-
+
Console.Out.Write("param ptr slicing, instance marshaled in unknown derived as derived... ");
Console.Out.Flush();
{
@@ -1240,19 +1251,19 @@ public class AllTests
d11.sb = "D1.sb(1)";
d11.pb = d11;
d11.sd1 = "D1.sd1(1)";
-
+
D3 d3 = new D3();
d3.sb = "D3.sb";
d3.pb = d3;
d3.sd3 = "D3.sd3";
d3.pd3 = d11;
-
+
D1 d12 = new D1();
d12.sb = "D1.sb(2)";
d12.pb = d12;
d12.sd1 = "D1.sd1(2)";
d12.pd1 = d11;
-
+
B ret = testPrx.returnTest3(d3, d12);
test(ret != null);
test(ret.ice_id().Equals("::Test::B"));
@@ -1265,7 +1276,7 @@ public class AllTests
}
}
Console.Out.WriteLine("ok");
-
+
Console.Out.Write("param ptr slicing, instance marshaled in unknown derived as derived (AMI)... ");
Console.Out.Flush();
{
@@ -1273,31 +1284,31 @@ public class AllTests
d11.sb = "D1.sb(1)";
d11.pb = d11;
d11.sd1 = "D1.sd1(1)";
-
+
D3 d3 = new D3();
d3.sb = "D3.sb";
d3.pb = d3;
d3.sd3 = "D3.sd3";
d3.pd3 = d11;
-
+
D1 d12 = new D1();
d12.sb = "D1.sb(2)";
d12.pb = d12;
d12.sd1 = "D1.sd1(2)";
d12.pd1 = d11;
-
+
AsyncCallback cb = new AsyncCallback();
testPrx.begin_returnTest3(d3, d12).whenCompleted(cb.response_returnTest3, cb.exception);
cb.check();
B rv = cb.rb;
-
+
test(rv != null);
test(rv.ice_id().Equals("::Test::B"));
test(rv.sb.Equals("D3.sb"));
test(rv.pb == rv);
}
Console.Out.WriteLine("ok");
-
+
Console.Out.Write("sequence slicing... ");
Console.Out.Flush();
{
@@ -1308,75 +1319,75 @@ public class AllTests
B ss1b = new B();
ss1b.sb = "B.sb";
ss1b.pb = ss1b;
-
+
D1 ss1d1 = new D1();
ss1d1.sb = "D1.sb";
ss1d1.sd1 = "D1.sd1";
ss1d1.pb = ss1b;
-
+
D3 ss1d3 = new D3();
ss1d3.sb = "D3.sb";
ss1d3.sd3 = "D3.sd3";
ss1d3.pb = ss1b;
-
+
B ss2b = new B();
ss2b.sb = "B.sb";
ss2b.pb = ss1b;
-
+
D1 ss2d1 = new D1();
ss2d1.sb = "D1.sb";
ss2d1.sd1 = "D1.sd1";
ss2d1.pb = ss2b;
-
+
D3 ss2d3 = new D3();
ss2d3.sb = "D3.sb";
ss2d3.sd3 = "D3.sd3";
ss2d3.pb = ss2b;
-
+
ss1d1.pd1 = ss2b;
ss1d3.pd3 = ss2d1;
-
+
ss2d1.pd1 = ss1d3;
ss2d3.pd3 = ss1d1;
-
+
SS1 ss1 = new SS1();
ss1.s = new BSeq(3);
ss1.s.Add(ss1b);
ss1.s.Add(ss1d1);
ss1.s.Add(ss1d3);
-
+
SS2 ss2 = new SS2();
ss2.s = new BSeq(3);
ss2.s.Add(ss2b);
ss2.s.Add(ss2d1);
ss2.s.Add(ss2d3);
-
+
ss = testPrx.sequenceTest(ss1, ss2);
}
-
+
test(ss.c1 != null);
B ss1b2 = ss.c1.s[0];
B ss1d2 = ss.c1.s[1];
test(ss.c2 != null);
B ss1d4 = ss.c1.s[2];
-
+
test(ss.c2 != null);
B ss2b2 = ss.c2.s[0];
B ss2d2 = ss.c2.s[1];
B ss2d4 = ss.c2.s[2];
-
+
test(ss1b2.pb == ss1b2);
test(ss1d2.pb == ss1b2);
test(ss1d4.pb == ss1b2);
-
+
test(ss2b2.pb == ss1b2);
test(ss2d2.pb == ss2b2);
test(ss2d4.pb == ss2b2);
-
+
test(ss1b2.ice_id().Equals("::Test::B"));
test(ss1d2.ice_id().Equals("::Test::D1"));
test(ss1d4.ice_id().Equals("::Test::B"));
-
+
test(ss2b2.ice_id().Equals("::Test::B"));
test(ss2d2.ice_id().Equals("::Test::D1"));
test(ss2d4.ice_id().Equals("::Test::B"));
@@ -1387,7 +1398,7 @@ public class AllTests
}
}
Console.Out.WriteLine("ok");
-
+
Console.Out.Write("sequence slicing (AMI)... ");
Console.Out.Flush();
{
@@ -1396,49 +1407,49 @@ public class AllTests
B ss1b = new B();
ss1b.sb = "B.sb";
ss1b.pb = ss1b;
-
+
D1 ss1d1 = new D1();
ss1d1.sb = "D1.sb";
ss1d1.sd1 = "D1.sd1";
ss1d1.pb = ss1b;
-
+
D3 ss1d3 = new D3();
ss1d3.sb = "D3.sb";
ss1d3.sd3 = "D3.sd3";
ss1d3.pb = ss1b;
-
+
B ss2b = new B();
ss2b.sb = "B.sb";
ss2b.pb = ss1b;
-
+
D1 ss2d1 = new D1();
ss2d1.sb = "D1.sb";
ss2d1.sd1 = "D1.sd1";
ss2d1.pb = ss2b;
-
+
D3 ss2d3 = new D3();
ss2d3.sb = "D3.sb";
ss2d3.sd3 = "D3.sd3";
ss2d3.pb = ss2b;
-
+
ss1d1.pd1 = ss2b;
ss1d3.pd3 = ss2d1;
-
+
ss2d1.pd1 = ss1d3;
ss2d3.pd3 = ss1d1;
-
+
SS1 ss1 = new SS1();
ss1.s = new BSeq();
ss1.s.Add(ss1b);
ss1.s.Add(ss1d1);
ss1.s.Add(ss1d3);
-
+
SS2 ss2 = new SS2();
ss2.s = new BSeq();
ss2.s.Add(ss2b);
ss2.s.Add(ss2d1);
ss2.s.Add(ss2d3);
-
+
AsyncCallback cb = new AsyncCallback();
testPrx.begin_sequenceTest(ss1, ss2).whenCompleted(cb.response_sequenceTest, cb.exception);
cb.check();
@@ -1449,30 +1460,30 @@ public class AllTests
B ss1d5 = ss.c1.s[1];
test(ss.c2 != null);
B ss1d6 = ss.c1.s[2];
-
+
test(ss.c2 != null);
B ss2b3 = ss.c2.s[0];
B ss2d5 = ss.c2.s[1];
B ss2d6 = ss.c2.s[2];
-
+
test(ss1b3.pb == ss1b3);
test(ss1d6.pb == ss1b3);
test(ss1d6.pb == ss1b3);
-
+
test(ss2b3.pb == ss1b3);
test(ss2d6.pb == ss2b3);
test(ss2d6.pb == ss2b3);
-
+
test(ss1b3.ice_id().Equals("::Test::B"));
test(ss1d5.ice_id().Equals("::Test::D1"));
test(ss1d6.ice_id().Equals("::Test::B"));
-
+
test(ss2b3.ice_id().Equals("::Test::B"));
test(ss2d5.ice_id().Equals("::Test::D1"));
test(ss2d6.ice_id().Equals("::Test::B"));
}
Console.Out.WriteLine("ok");
-
+
Console.Out.Write("dictionary slicing... ");
Console.Out.Flush();
{
@@ -1491,9 +1502,9 @@ public class AllTests
d1.sd1 = s;
bin[i] = d1;
}
-
+
ret = testPrx.dictionaryTest(bin, out bout);
-
+
test(bout.Count == 10);
for(i = 0; i < 10; ++i)
{
@@ -1506,7 +1517,7 @@ public class AllTests
test(b.pb.sb.Equals(s));
test(b.pb.pb == b.pb);
}
-
+
test(ret.Count == 10);
for(i = 0; i < 10; ++i)
{
@@ -1527,7 +1538,7 @@ public class AllTests
}
}
Console.Out.WriteLine("ok");
-
+
Console.Out.Write("dictionary slicing (AMI)... ");
Console.Out.Flush();
{
@@ -1544,13 +1555,13 @@ public class AllTests
d1.sd1 = s;
bin[i] = d1;
}
-
+
AsyncCallback cb = new AsyncCallback();
testPrx.begin_dictionaryTest(bin).whenCompleted(cb.response_dictionaryTest, cb.exception);
cb.check();
bout = cb.obdict;
rv = cb.rbdict;
-
+
test(bout.Count == 10);
for(i = 0; i < 10; ++i)
{
@@ -1563,7 +1574,7 @@ public class AllTests
test(b.pb.sb.Equals(s));
test(b.pb.pb == b.pb);
}
-
+
test(rv.Count == 10);
for(i = 0; i < 10; ++i)
{
@@ -1579,7 +1590,7 @@ public class AllTests
}
}
Console.Out.WriteLine("ok");
-
+
Console.Out.Write("base exception thrown as base exception... ");
Console.Out.Flush();
{
@@ -1602,7 +1613,7 @@ public class AllTests
}
}
Console.Out.WriteLine("ok");
-
+
Console.Out.Write("base exception thrown as base exception (AMI)... ");
Console.Out.Flush();
{
@@ -1611,7 +1622,7 @@ public class AllTests
cb.check();
}
Console.Out.WriteLine("ok");
-
+
Console.Out.Write("derived exception thrown as base exception... ");
Console.Out.Flush();
{
@@ -1640,7 +1651,7 @@ public class AllTests
}
}
Console.Out.WriteLine("ok");
-
+
Console.Out.Write("derived exception thrown as base exception (AMI)... ");
Console.Out.Flush();
{
@@ -1649,7 +1660,7 @@ public class AllTests
cb.check();
}
Console.Out.WriteLine("ok");
-
+
Console.Out.Write("derived exception thrown as derived exception... ");
Console.Out.Flush();
{
@@ -1678,7 +1689,7 @@ public class AllTests
}
}
Console.Out.WriteLine("ok");
-
+
Console.Out.Write("derived exception thrown as derived exception (AMI)... ");
Console.Out.Flush();
{
@@ -1687,7 +1698,7 @@ public class AllTests
cb.check();
}
Console.Out.WriteLine("ok");
-
+
Console.Out.Write("unknown derived exception thrown as base exception... ");
Console.Out.Flush();
{
@@ -1710,7 +1721,7 @@ public class AllTests
}
}
Console.Out.WriteLine("ok");
-
+
Console.Out.Write("unknown derived exception thrown as base exception (AMI)... ");
Console.Out.Flush();
{
@@ -1720,7 +1731,7 @@ public class AllTests
cb.check();
}
Console.Out.WriteLine("ok");
-
+
Console.Out.Write("forward-declared class... ");
Console.Out.Flush();
{
@@ -1736,7 +1747,7 @@ public class AllTests
}
}
Console.Out.WriteLine("ok");
-
+
Console.Out.Write("forward-declared class (AMI)... ");
Console.Out.Flush();
{
@@ -1745,7 +1756,7 @@ public class AllTests
cb.check();
}
Console.Out.WriteLine("ok");
-
+
return testPrx;
}
}
diff --git a/cs/test/Ice/slicing/objects/Client.cs b/cs/test/Ice/slicing/objects/Client.cs
index e56a4baaced..7a1339b73aa 100644
--- a/cs/test/Ice/slicing/objects/Client.cs
+++ b/cs/test/Ice/slicing/objects/Client.cs
@@ -18,17 +18,28 @@ public class Client
test.shutdown();
return 0;
}
-
- public static void Main(string[] args)
+
+ public static int Main(string[] args)
{
int status = 0;
Ice.Communicator communicator = null;
-
+
+#if !COMPACT
Debug.Listeners.Add(new ConsoleTraceListener());
+#endif
try
{
- communicator = Ice.Util.initialize(ref args);
+ Ice.InitializationData data = new Ice.InitializationData();
+#if COMPACT
+ //
+ // When using Ice for .NET Compact Framework, we need to specify
+ // the assembly so that Ice can locate classes and exceptions.
+ //
+ data.properties = Ice.Util.createProperties();
+ data.properties.setProperty("Ice.FactoryAssemblies", "client");
+#endif
+ communicator = Ice.Util.initialize(ref args, data);
status = run(args, communicator);
}
catch(System.Exception ex)
@@ -36,7 +47,7 @@ public class Client
System.Console.Error.WriteLine(ex);
status = 1;
}
-
+
if(communicator != null)
{
try
@@ -49,10 +60,7 @@ public class Client
status = 1;
}
}
-
- if(status != 0)
- {
- System.Environment.Exit(status);
- }
+
+ return status;
}
}
diff --git a/cs/test/Ice/slicing/objects/Makefile b/cs/test/Ice/slicing/objects/Makefile
index f5a1341a099..0ef1d0368e9 100644
--- a/cs/test/Ice/slicing/objects/Makefile
+++ b/cs/test/Ice/slicing/objects/Makefile
@@ -13,7 +13,7 @@ TARGETS = client.exe server.exe serveramd.exe
C_SRCS = AllTests.cs Client.cs
S_SRCS = Server.cs TestI.cs
-SAMD_SRCS = Server.cs TestAMDI.cs
+SAMD_SRCS = ServerAMD.cs TestAMDI.cs
SLICE_SRCS = $(SDIR)/Test.ice $(SDIR)/Forward.ice
SLICE_C_SRCS = $(SDIR)/ClientPrivate.ice
diff --git a/cs/test/Ice/slicing/objects/Makefile.mak b/cs/test/Ice/slicing/objects/Makefile.mak
index 0ec400f95b6..83e623736fc 100644
--- a/cs/test/Ice/slicing/objects/Makefile.mak
+++ b/cs/test/Ice/slicing/objects/Makefile.mak
@@ -13,7 +13,7 @@ TARGETS = client.exe server.exe serveramd.exe
C_SRCS = AllTests.cs Client.cs
S_SRCS = Server.cs TestI.cs
-SAMD_SRCS = Server.cs TestAMDI.cs
+SAMD_SRCS = ServerAMD.cs TestAMDI.cs
GEN_SRCS = $(GDIR)\Test.cs \
$(GDIR)\Forward.cs
diff --git a/cs/test/Ice/slicing/objects/Server.cs b/cs/test/Ice/slicing/objects/Server.cs
index a74f0b2188d..76afab697f2 100644
--- a/cs/test/Ice/slicing/objects/Server.cs
+++ b/cs/test/Ice/slicing/objects/Server.cs
@@ -23,17 +23,28 @@ public class Server
communicator.waitForShutdown();
return 0;
}
-
- public static void Main(string[] args)
+
+ public static int Main(string[] args)
{
int status = 0;
Ice.Communicator communicator = null;
-
+
+#if !COMPACT
Debug.Listeners.Add(new ConsoleTraceListener());
+#endif
try
{
- communicator = Ice.Util.initialize(ref args);
+ Ice.InitializationData data = new Ice.InitializationData();
+#if COMPACT
+ //
+ // When using Ice for .NET Compact Framework, we need to specify
+ // the assembly so that Ice can locate classes and exceptions.
+ //
+ data.properties = Ice.Util.createProperties();
+ data.properties.setProperty("Ice.FactoryAssemblies", "server");
+#endif
+ communicator = Ice.Util.initialize(ref args, data);
status = run(args, communicator);
}
catch(System.Exception ex)
@@ -41,7 +52,7 @@ public class Server
System.Console.Error.WriteLine(ex);
status = 1;
}
-
+
if(communicator != null)
{
try
@@ -54,10 +65,7 @@ public class Server
status = 1;
}
}
-
- if(status != 0)
- {
- System.Environment.Exit(status);
- }
+
+ return status;
}
}
diff --git a/cs/test/Ice/slicing/objects/ServerAMD.cs b/cs/test/Ice/slicing/objects/ServerAMD.cs
new file mode 100644
index 00000000000..2404d5b3445
--- /dev/null
+++ b/cs/test/Ice/slicing/objects/ServerAMD.cs
@@ -0,0 +1,71 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2010 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.
+//
+// **********************************************************************
+
+using System.Diagnostics;
+
+public class Server
+{
+ private static int run(string[] args, Ice.Communicator communicator)
+ {
+ Ice.Properties properties = communicator.getProperties();
+ properties.setProperty("Ice.Warn.Dispatch", "0");
+ properties.setProperty("TestAdapter.Endpoints", "default -p 12010 -t 2000");
+ Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
+ Ice.Object obj = new TestI();
+ adapter.add(obj, communicator.stringToIdentity("Test"));
+ adapter.activate();
+ communicator.waitForShutdown();
+ return 0;
+ }
+
+ public static int Main(string[] args)
+ {
+ int status = 0;
+ Ice.Communicator communicator = null;
+
+#if !COMPACT
+ Debug.Listeners.Add(new ConsoleTraceListener());
+#endif
+
+ try
+ {
+ Ice.InitializationData data = new Ice.InitializationData();
+#if COMPACT
+ //
+ // When using Ice for .NET Compact Framework, we need to specify
+ // the assembly so that Ice can locate classes and exceptions.
+ //
+ data.properties = Ice.Util.createProperties();
+ data.properties.setProperty("Ice.FactoryAssemblies", "serveramd");
+#endif
+ communicator = Ice.Util.initialize(ref args, data);
+ status = run(args, communicator);
+ }
+ catch(System.Exception ex)
+ {
+ System.Console.Error.WriteLine(ex);
+ status = 1;
+ }
+
+ if(communicator != null)
+ {
+ try
+ {
+ communicator.destroy();
+ }
+ catch(Ice.LocalException ex)
+ {
+ System.Console.Error.WriteLine(ex);
+ status = 1;
+ }
+ }
+
+ return status;
+ }
+}
diff --git a/cs/test/Ice/stream/Client.cs b/cs/test/Ice/stream/Client.cs
index 9771b38281a..f431ad1a66a 100644
--- a/cs/test/Ice/stream/Client.cs
+++ b/cs/test/Ice/stream/Client.cs
@@ -404,6 +404,7 @@ public class Client
@in.destroy();
}
+#if !COMPACT
{
Serialize.Small small = new Serialize.Small();
small.i = 99;
@@ -416,6 +417,7 @@ public class Client
@out.destroy();
@in.destroy();
}
+#endif
{
short[] arr =
@@ -1393,14 +1395,18 @@ public class Client
}
{
+#if COMPACT
+ SortedList<string, string> dict = new SortedList<string, string>();
+#else
SortedDictionary<string, string> dict = new SortedDictionary<string, string>();
+#endif
dict.Add("key1", "value1");
dict.Add("key2", "value2");
@out = Ice.Util.createOutputStream(communicator);
Test.SortedStringStringDHelper.write(@out, dict);
byte[] data = @out.finished();
@in = Ice.Util.createInputStream(communicator, data);
- SortedDictionary<string, string> dict2 = Test.SortedStringStringDHelper.read(@in);
+ IDictionary<string, string> dict2 = Test.SortedStringStringDHelper.read(@in);
test(Ice.CollectionComparer.Equals(dict2, dict));
}
@@ -1421,16 +1427,27 @@ public class Client
return 0;
}
- public static void Main(string[] args)
+ public static int Main(string[] args)
{
int status = 0;
Ice.Communicator communicator = null;
+#if !COMPACT
Debug.Listeners.Add(new ConsoleTraceListener());
+#endif
try
{
- communicator = Ice.Util.initialize(ref args);
+ Ice.InitializationData data = new Ice.InitializationData();
+#if COMPACT
+ //
+ // When using Ice for .NET Compact Framework, we need to specify
+ // the assembly so that Ice can locate classes and exceptions.
+ //
+ data.properties = Ice.Util.createProperties();
+ data.properties.setProperty("Ice.FactoryAssemblies", "client");
+#endif
+ communicator = Ice.Util.initialize(ref args, data);
status = run(args, communicator);
}
catch(System.Exception ex)
@@ -1452,9 +1469,6 @@ public class Client
}
}
- if(status != 0)
- {
- System.Environment.Exit(status);
- }
+ return status;
}
}
diff --git a/cs/test/Ice/stream/Makefile.mak b/cs/test/Ice/stream/Makefile.mak
index a556597d8e4..e96c9128cba 100644
--- a/cs/test/Ice/stream/Makefile.mak
+++ b/cs/test/Ice/stream/Makefile.mak
@@ -25,6 +25,10 @@ MCSFLAGS = $(MCSFLAGS) -target:exe
SLICE2CSFLAGS = $(SLICE2CSFLAGS) --stream -I. -I$(slicedir)
+!if "$(COMPACT)" == "yes"
+SLICE2CSFLAGS = $(SLICE2CSFLAGS) -DCOMPACT
+!endif
+
client.exe: $(C_SRCS) $(GEN_SRCS) Serializable.dll
$(MCS) $(MCSFLAGS) -out:$@ -r:"$(refdir)\Ice.dll" -r:Serializable.dll $(C_SRCS) $(GEN_SRCS)
diff --git a/cs/test/Ice/stream/Serializable.cs b/cs/test/Ice/stream/Serializable.cs
index 9d7c76069e3..9d7c76069e3 100755..100644
--- a/cs/test/Ice/stream/Serializable.cs
+++ b/cs/test/Ice/stream/Serializable.cs
diff --git a/cs/test/Ice/stream/Test.ice b/cs/test/Ice/stream/Test.ice
index ab4ed2a8ddd..42270ac667f 100644
--- a/cs/test/Ice/stream/Test.ice
+++ b/cs/test/Ice/stream/Test.ice
@@ -114,8 +114,13 @@ sequence<Ice::StringSeq> StringSList;
["clr:generic:Stack"]
sequence<Ice::StringSeq> StringSStack;
+#if COMPACT
+["clr:generic:SortedList"]
+dictionary<string, string> SortedStringStringD;
+#else
["clr:generic:SortedDictionary"]
dictionary<string, string> SortedStringStringD;
+#endif
["clr:collection"]
dictionary<string, int> StringIntDCollection;
@@ -137,7 +142,9 @@ class MyClass
MyEnumS seq9;
MyClassS seq10;
StringMyClassD d;
+#ifndef COMPACT
SerialSmall ss;
+#endif
};
interface MyInterface
diff --git a/cs/test/Ice/threadPoolPriority/Client.cs b/cs/test/Ice/threadPoolPriority/Client.cs
index 1cb6e86c9e5..9c8dc857609 100644
--- a/cs/test/Ice/threadPoolPriority/Client.cs
+++ b/cs/test/Ice/threadPoolPriority/Client.cs
@@ -50,12 +50,14 @@ public class Client
return 0;
}
- public static void Main(string[] args)
+ public static int Main(string[] args)
{
int status = 0;
Ice.Communicator communicator = null;
+#if !COMPACT
Debug.Listeners.Add(new ConsoleTraceListener());
+#endif
try
{
@@ -81,10 +83,7 @@ public class Client
}
}
- if(status != 0)
- {
- System.Environment.Exit(status);
- }
+ return status;
}
}
diff --git a/cs/test/Ice/threadPoolPriority/Server.cs b/cs/test/Ice/threadPoolPriority/Server.cs
index afb2976b328..95d9490d45b 100644
--- a/cs/test/Ice/threadPoolPriority/Server.cs
+++ b/cs/test/Ice/threadPoolPriority/Server.cs
@@ -35,22 +35,24 @@ public class Server
communicator.waitForShutdown();
return 0;
}
-
- public static void Main(string[] args)
+
+ public static int Main(string[] args)
{
int status = 0;
Ice.Communicator communicator = null;
-
+
+#if !COMPACT
Debug.Listeners.Add(new ConsoleTraceListener());
+#endif
try
{
Ice.InitializationData initData = new Ice.InitializationData();
initData.properties = Ice.Util.createProperties(ref args);
//
- // Its possible to have batch oneway requests dispatched
+ // It's possible to have batch oneway requests dispatched
// after the adapter is deactivated due to thread
- // scheduling so we supress this warning.
+ // scheduling so we suppress this warning.
//
initData.properties.setProperty("Ice.Warn.Dispatch", "0");
communicator = Ice.Util.initialize(ref args, initData);
@@ -61,7 +63,7 @@ public class Server
Console.Error.WriteLine(ex);
status = 1;
}
-
+
if(communicator != null)
{
try
@@ -74,10 +76,7 @@ public class Server
status = 1;
}
}
-
- if(status != 0)
- {
- System.Environment.Exit(status);
- }
+
+ return status;
}
}
diff --git a/cs/test/Ice/timeout/AllTests.cs b/cs/test/Ice/timeout/AllTests.cs
index d07e5906bf2..28e1f6b28f2 100644
--- a/cs/test/Ice/timeout/AllTests.cs
+++ b/cs/test/Ice/timeout/AllTests.cs
@@ -28,30 +28,41 @@ public class AllTests
_called = false;
}
- public void check()
+ public virtual void check()
{
- lock(this)
+ _m.Lock();
+ try
{
while(!_called)
{
- Monitor.Wait(this);
+ _m.Wait();
}
_called = false;
}
+ finally
+ {
+ _m.Unlock();
+ }
}
- public void called()
+ public virtual void called()
{
- lock(this)
+ _m.Lock();
+ try
{
Debug.Assert(!_called);
_called = true;
- Monitor.Pulse(this);
+ _m.Notify();
+ }
+ finally
+ {
+ _m.Unlock();
}
}
private bool _called;
+ private readonly IceUtilInternal.Monitor _m = new IceUtilInternal.Monitor();
}
private class Callback
diff --git a/cs/test/Ice/timeout/Client.cs b/cs/test/Ice/timeout/Client.cs
index c9437dfdb5e..1b6c256ce81 100644
--- a/cs/test/Ice/timeout/Client.cs
+++ b/cs/test/Ice/timeout/Client.cs
@@ -26,12 +26,14 @@ public class Client
return 0;
}
- public static void Main(string[] args)
+ public static int Main(string[] args)
{
int status = 0;
Ice.Communicator communicator = null;
+#if !COMPACT
Debug.Listeners.Add(new ConsoleTraceListener());
+#endif
try
{
@@ -70,9 +72,6 @@ public class Client
}
}
- if(status != 0)
- {
- System.Environment.Exit(status);
- }
+ return status;
}
}
diff --git a/cs/test/Ice/timeout/Server.cs b/cs/test/Ice/timeout/Server.cs
index acbeb653397..0ed3907dbaa 100644
--- a/cs/test/Ice/timeout/Server.cs
+++ b/cs/test/Ice/timeout/Server.cs
@@ -30,12 +30,14 @@ public class Server
return 0;
}
- public static void Main(string[] args)
+ public static int Main(string[] args)
{
int status = 0;
Ice.Communicator communicator = null;
+#if !COMPACT
Debug.Listeners.Add(new ConsoleTraceListener());
+#endif
try
{
@@ -69,9 +71,6 @@ public class Server
}
}
- if(status != 0)
- {
- System.Environment.Exit(status);
- }
+ return status;
}
}
diff --git a/cs/test/Ice/udp/AllTests.cs b/cs/test/Ice/udp/AllTests.cs
index 08aa658fa23..b30f2e58390 100644
--- a/cs/test/Ice/udp/AllTests.cs
+++ b/cs/test/Ice/udp/AllTests.cs
@@ -25,24 +25,35 @@ public class AllTests
{
public override void reply(Ice.Current current)
{
- lock(this)
+ _m.Lock();
+ try
{
++_replies;
- Monitor.Pulse(this);
+ _m.Notify();
+ }
+ finally
+ {
+ _m.Unlock();
}
}
public void reset()
{
- lock(this)
+ _m.Lock();
+ try
{
_replies = 0;
}
+ finally
+ {
+ _m.Unlock();
+ }
}
public bool waitReply(int expectedReplies, long timeout)
{
- lock(this)
+ _m.Lock();
+ try
{
long end = IceInternal.Time.currentMonotonicTimeMillis() + timeout;
while(_replies < expectedReplies)
@@ -50,7 +61,7 @@ public class AllTests
int delay = (int)(end - IceInternal.Time.currentMonotonicTimeMillis());
if(delay > 0)
{
- Monitor.Wait(this, delay);
+ _m.TimedWait(delay);
}
else
{
@@ -59,9 +70,14 @@ public class AllTests
}
return _replies == expectedReplies;
}
+ finally
+ {
+ _m.Unlock();
+ }
}
private int _replies = 0;
+ private readonly IceUtilInternal.Monitor _m = new IceUtilInternal.Monitor();
}
public static void allTests(Ice.Communicator communicator)
@@ -69,7 +85,7 @@ public class AllTests
communicator.getProperties().setProperty("ReplyAdapter.Endpoints", "udp -p 12030");
Ice.ObjectAdapter adapter = communicator.createObjectAdapter("ReplyAdapter");
PingReplyI replyI = new PingReplyI();
- Test.PingReplyPrx reply =
+ Test.PingReplyPrx reply =
(Test.PingReplyPrx)Test.PingReplyPrxHelper.uncheckedCast(adapter.addWithUUID(replyI)).ice_datagram();
adapter.activate();
@@ -91,9 +107,9 @@ public class AllTests
{
break; // Success
}
-
+
// If the 3 datagrams were not received within the 2 seconds, we try again to
- // receive 3 new datagrams using a new object. We give up after 5 retries.
+ // receive 3 new datagrams using a new object. We give up after 5 retries.
replyI = new PingReplyI();
reply =(Test.PingReplyPrx)Test.PingReplyPrxHelper.uncheckedCast(adapter.addWithUUID(replyI)).ice_datagram();
}
@@ -202,7 +218,7 @@ public class AllTests
// platform (it works for OS X Leopard but not Snow Leopard, doesn't work on SLES,
// Windows...). For Windows, see UdpTransceiver constructor for the details. So
// we don't run this test.
- //
+ //
// Console.Out.Write("testing udp bi-dir connection... ");
// nRetry = 5;
// while(nRetry-- > 0)
diff --git a/cs/test/Ice/udp/Client.cs b/cs/test/Ice/udp/Client.cs
index 7ae9ad5e7c7..e10d9a04f12 100644
--- a/cs/test/Ice/udp/Client.cs
+++ b/cs/test/Ice/udp/Client.cs
@@ -25,7 +25,7 @@ public class Client
AllTests.allTests(communicator);
int num;
- try
+ try
{
num = args.Length == 1 ? System.Int32.Parse(args[0]) : 0;
}
@@ -40,18 +40,20 @@ public class Client
return 0;
}
- public static void Main(string[] args)
+ public static int Main(string[] args)
{
int status = 0;
Ice.Communicator communicator = null;
+#if !COMPACT
Debug.Listeners.Add(new ConsoleTraceListener());
+#endif
try
{
Ice.InitializationData initData = new Ice.InitializationData();
initData.properties = Ice.Util.createProperties(ref args);
-
+
initData.properties.setProperty("Ice.Warn.Connections", "0");
initData.properties.setProperty("Ice.UDP.SndSize", "16384");
@@ -77,9 +79,6 @@ public class Client
}
}
- if(status != 0)
- {
- System.Environment.Exit(status);
- }
+ return status;
}
}
diff --git a/cs/test/Ice/udp/Server.cs b/cs/test/Ice/udp/Server.cs
index 40f96843d5c..214126fcab1 100644
--- a/cs/test/Ice/udp/Server.cs
+++ b/cs/test/Ice/udp/Server.cs
@@ -62,18 +62,20 @@ public class Server
return 0;
}
- public static void Main(string[] args)
+ public static int Main(string[] args)
{
int status = 0;
Ice.Communicator communicator = null;
+#if !COMPACT
Debug.Listeners.Add(new ConsoleTraceListener());
+#endif
try
{
Ice.InitializationData initData = new Ice.InitializationData();
initData.properties = Ice.Util.createProperties(ref args);
-
+
initData.properties.setProperty("Ice.Warn.Connections", "0");
initData.properties.setProperty("Ice.UDP.RcvSize", "16384");
@@ -99,9 +101,6 @@ public class Server
}
}
- if(status != 0)
- {
- System.Environment.Exit(status);
- }
+ return status;
}
}
diff --git a/cs/test/IceBox/configuration/Client.cs b/cs/test/IceBox/configuration/Client.cs
index 86c96af9175..8698e9b51e3 100644
--- a/cs/test/IceBox/configuration/Client.cs
+++ b/cs/test/IceBox/configuration/Client.cs
@@ -20,8 +20,7 @@ using System.Reflection;
public class Client
{
- private static int
- run(string[] args, Ice.Communicator communicator)
+ private static int run(string[] args, Ice.Communicator communicator)
{
AllTests.allTests(communicator);
@@ -33,12 +32,14 @@ public class Client
return 0;
}
- public static void Main(string[] args)
+ public static int Main(string[] args)
{
int status = 0;
Ice.Communicator communicator = null;
+#if !COMPACT
Debug.Listeners.Add(new ConsoleTraceListener());
+#endif
try
{
@@ -64,9 +65,6 @@ public class Client
}
}
- if(status != 0)
- {
- System.Environment.Exit(status);
- }
+ return status;
}
}
diff --git a/cs/test/IceGrid/simple/AllTests.cs b/cs/test/IceGrid/simple/AllTests.cs
index b6326979b41..a24c0e78bc5 100644
--- a/cs/test/IceGrid/simple/AllTests.cs
+++ b/cs/test/IceGrid/simple/AllTests.cs
@@ -24,11 +24,12 @@ public class AllTests
public void run()
{
- lock(this)
+ _m.Lock();
+ try
{
while(!_terminated)
{
- System.Threading.Monitor.Wait(this, _timeout);
+ _m.TimedWait(_timeout);
if(_terminated)
{
break;
@@ -43,20 +44,30 @@ public class AllTests
}
}
}
+ finally
+ {
+ _m.Unlock();
+ }
}
public void terminate()
{
- lock(this)
+ _m.Lock();
+ try
{
_terminated = true;
- System.Threading.Monitor.Pulse(this);
+ _m.Notify();
+ }
+ finally
+ {
+ _m.Unlock();
}
}
private IceGrid.AdminSessionPrx _session;
private int _timeout;
private bool _terminated;
+ private readonly IceUtilInternal.Monitor _m = new IceUtilInternal.Monitor();
}
private static void
diff --git a/cs/test/IceGrid/simple/Client.cs b/cs/test/IceGrid/simple/Client.cs
index 12ed04fb30d..f7b7655de54 100644
--- a/cs/test/IceGrid/simple/Client.cs
+++ b/cs/test/IceGrid/simple/Client.cs
@@ -20,8 +20,7 @@ using System.Reflection;
public class Client
{
- private static int
- run(string[] args, Ice.Communicator communicator)
+ private static int run(string[] args, Ice.Communicator communicator)
{
bool withDeploy = false;
for(int i = 0; i < args.Length; i++)
@@ -45,12 +44,14 @@ public class Client
return 0;
}
- public static void Main(string[] args)
+ public static int Main(string[] args)
{
int status = 0;
Ice.Communicator communicator = null;
+#if !COMPACT
Debug.Listeners.Add(new ConsoleTraceListener());
+#endif
try
{
@@ -76,9 +77,6 @@ public class Client
}
}
- if(status != 0)
- {
- System.Environment.Exit(status);
- }
+ return status;
}
}
diff --git a/cs/test/IceGrid/simple/Server.cs b/cs/test/IceGrid/simple/Server.cs
index 9927058d2aa..3437b3f5bb9 100644
--- a/cs/test/IceGrid/simple/Server.cs
+++ b/cs/test/IceGrid/simple/Server.cs
@@ -39,15 +39,13 @@ public class Server
}
}
- public static void Main(string[] args)
+ public static int Main(string[] args)
{
+#if !COMPACT
Debug.Listeners.Add(new ConsoleTraceListener());
+#endif
App server = new App();
- int status = server.main(args);
- if(status != 0)
- {
- System.Environment.Exit(status);
- }
+ return server.main(args);
}
}
diff --git a/cs/test/IceSSL/configuration/AllTests.cs b/cs/test/IceSSL/configuration/AllTests.cs
index 6a588c7576f..6a588c7576f 100755..100644
--- a/cs/test/IceSSL/configuration/AllTests.cs
+++ b/cs/test/IceSSL/configuration/AllTests.cs
diff --git a/cs/test/IceSSL/configuration/Client.cs b/cs/test/IceSSL/configuration/Client.cs
index ba6584998d6..c8fb8760cdd 100644
--- a/cs/test/IceSSL/configuration/Client.cs
+++ b/cs/test/IceSSL/configuration/Client.cs
@@ -34,7 +34,7 @@ public class Client
return 0;
}
- public static void Main(string[] args)
+ public static int Main(string[] args)
{
int status = 0;
Ice.Communicator communicator = null;
@@ -65,9 +65,6 @@ public class Client
}
}
- if(status != 0)
- {
- System.Environment.Exit(status);
- }
+ return status;
}
}
diff --git a/cs/test/IceSSL/configuration/Server.cs b/cs/test/IceSSL/configuration/Server.cs
index 7db52b6a11f..e438d244f72 100644
--- a/cs/test/IceSSL/configuration/Server.cs
+++ b/cs/test/IceSSL/configuration/Server.cs
@@ -31,7 +31,7 @@ public class Server
return 0;
}
- public static void Main(string[] args)
+ public static int Main(string[] args)
{
int status = 0;
Ice.Communicator communicator = null;
@@ -62,9 +62,6 @@ public class Server
}
}
- if(status != 0)
- {
- System.Environment.Exit(status);
- }
+ return status;
}
}
diff --git a/cs/test/IceUtil/inputUtil/Client.cs b/cs/test/IceUtil/inputUtil/Client.cs
index 3d8bd1f72a5..07eba98d636 100644
--- a/cs/test/IceUtil/inputUtil/Client.cs
+++ b/cs/test/IceUtil/inputUtil/Client.cs
@@ -22,7 +22,9 @@ public class Client
public static void Main(string[] argvs)
{
+#if !COMPACT
Debug.Listeners.Add(new ConsoleTraceListener());
+#endif
System.Console.Out.Write("testing string to command line arguments... ");
System.Console.Out.Flush();
diff --git a/cs/test/Makefile.mak b/cs/test/Makefile.mak
index 8156e2a755a..f52c1a9ba0d 100644
--- a/cs/test/Makefile.mak
+++ b/cs/test/Makefile.mak
@@ -11,7 +11,11 @@ top_srcdir = ..
!include $(top_srcdir)\config\Make.rules.mak.cs
-SUBDIRS = Slice IceUtil Ice IceBox Glacier2 IceGrid IceSSL
+SUBDIRS = Slice IceUtil Ice IceBox Glacier2 IceGrid
+!if "$(COMPACT)" == ""
+SUBDIRS = $(SUBDIRS) IceSSL
+!endif
+
$(EVERYTHING)::
@for %i in ( $(SUBDIRS) ) do \
diff --git a/cs/test/Slice/keyword/Client.cs b/cs/test/Slice/keyword/Client.cs
index 7d8b9cc6ee7..8f68ccad403 100644
--- a/cs/test/Slice/keyword/Client.cs
+++ b/cs/test/Slice/keyword/Client.cs
@@ -182,12 +182,14 @@ public class Client
return 0;
}
- public static void Main(string[] args)
+ public static int Main(string[] args)
{
int status = 0;
Ice.Communicator communicator = null;
+#if !COMPACT
Debug.Listeners.Add(new ConsoleTraceListener());
+#endif
try
{
@@ -215,9 +217,6 @@ public class Client
}
}
- if(status != 0)
- {
- System.Environment.Exit(status);
- }
+ return status;
}
}
diff --git a/cs/test/Slice/structure/Client.cs b/cs/test/Slice/structure/Client.cs
index 128f49cf3bb..de79d8e2cab 100644
--- a/cs/test/Slice/structure/Client.cs
+++ b/cs/test/Slice/structure/Client.cs
@@ -275,12 +275,14 @@ public class Client
return 0;
}
- public static void Main(string[] args)
+ public static int Main(string[] args)
{
int status = 0;
Ice.Communicator communicator = null;
+#if !COMPACT
Debug.Listeners.Add(new ConsoleTraceListener());
+#endif
try
{
@@ -308,9 +310,6 @@ public class Client
}
}
- if(status != 0)
- {
- System.Environment.Exit(status);
- }
+ return status;
}
}
diff --git a/java/src/IceInternal/PropertyNames.java b/java/src/IceInternal/PropertyNames.java
index 19daf8dd288..82e6258394f 100644
--- a/java/src/IceInternal/PropertyNames.java
+++ b/java/src/IceInternal/PropertyNames.java
@@ -8,7 +8,7 @@
// **********************************************************************
//
-// Generated by makeprops.py from file ./config/PropertyNames.xml, Mon Mar 7 23:28:12 2011
+// Generated by makeprops.py from file ..\config\PropertyNames.xml, Mon May 09 07:39:43 2011
// IMPORTANT: Do not edit this file -- any edits made here will be lost!
@@ -75,6 +75,7 @@ public final class PropertyNames
new Property("Ice\\.IPv4", false, null),
new Property("Ice\\.IPv6", false, null),
new Property("Ice\\.EventLog\\.Source", false, null),
+ new Property("Ice\\.FactoryAssemblies", false, null),
new Property("Ice\\.GC\\.Interval", false, null),
new Property("Ice\\.ImplicitContext", false, null),
new Property("Ice\\.InitPlugins", false, null),
diff --git a/scripts/TestUtil.py b/scripts/TestUtil.py
index 202e33d4cca..3737f60b251 100755
--- a/scripts/TestUtil.py
+++ b/scripts/TestUtil.py
@@ -34,6 +34,7 @@ sqlPort = None
sqlUser = None
sqlPassword = None
serviceDir = None
+compact = False
def isCygwin():
# The substring on sys.platform is required because some cygwin
@@ -312,6 +313,7 @@ def run(tests, root = False):
--sql-user=<user> Set SQL user name.
--sql-passwd=<passwd> Set SQL password.
--service-dir=<dir> Where to locate services for builds without service support.
+ --compact Ice for .NET uses the Compact Framework.
"""
sys.exit(2)
@@ -321,7 +323,7 @@ def run(tests, root = False):
"debug", "protocol=", "compress", "valgrind", "host=", "serialize", "continue",
"ipv6", "no-ipv6", "ice-home=", "cross=", "x64", "script", "env", "sql-type=",
"sql-db=", "sql-host=", "sql-port=", "sql-user=", "sql-passwd=", "service-dir=",
- "appverifier"])
+ "appverifier", "compact"])
except getopt.GetoptError:
usage()
@@ -335,6 +337,7 @@ def run(tests, root = False):
arg = ""
script = False
noipv6 = False
+ compact = "--compact" in opts
filters = []
for o, a in opts:
@@ -368,13 +371,17 @@ def run(tests, root = False):
elif o == "--protocol":
if a not in ( "ssl", "tcp"):
usage()
- if mono and getDefaultMapping() == "cs" and a == "ssl":
- print "SSL is not supported with mono"
- sys.exit(1)
+ if getDefaultMapping() == "cs" and a == "ssl":
+ if mono:
+ print "SSL is not supported with mono"
+ sys.exit(1)
+ if compact:
+ print "SSL is not supported with the Compact Framework"
+ sys.exit(1)
if o in ( "--cross", "--protocol", "--host", "--debug", "--compress", "--valgrind", "--serialize", "--ipv6", \
"--ice-home", "--x64", "--env", "--sql-type", "--sql-db", "--sql-host", "--sql-port", "--sql-user", \
- "--sql-passwd", "--service-dir", "--appverifier"):
+ "--sql-passwd", "--service-dir", "--appverifier", "--compact"):
arg += " " + o
if len(a) > 0:
arg += " " + a
@@ -432,7 +439,7 @@ def run(tests, root = False):
expanded.append([ ( "%s/test/%s" % (lang, test), a, []) for test in crossTests if not (test == "Ice/background" and (lang == "cs" or c == "cs"))])
# Add ssl & compress for the operations test.
- if mono and c == "cs": # Don't add the ssl tests for mono.
+ if (compact or mono) and c == "cs": # Don't add the ssl tests.
continue
a = "--cross=%s --protocol=ssl --compress" % c
expanded.append([("%s/test/Ice/operations" % lang, a, [])])
@@ -747,6 +754,7 @@ class DriverConfig:
global sqlUser
global sqlPassword
global serviceDir
+ global compact
self.lang = getDefaultMapping()
self.protocol = protocol
self.compress = compress
@@ -765,6 +773,7 @@ class DriverConfig:
self.sqlUser = sqlUser
self.sqlPassword = sqlPassword
self.serviceDir = serviceDir
+ self.compact = compact
def argsToDict(argumentString, results):
"""Converts an argument string to dictionary"""
@@ -1078,7 +1087,6 @@ def appVerifierAfterTestEnd(targets, cwd=os.getcwd()):
verifier = spawn(cmd, cwd=cwd)
verifier.expect(matchAppVerifierSuccess(), -1)
-
def getMirrorDir(base, mapping):
"""Get the mirror directory for the current test in the given mapping."""
lang = getDefaultMapping()
@@ -1387,6 +1395,7 @@ def processCmdLine():
--sql-user=<user> Set SQL user name.
--sql-passwd=<passwd> Set SQL password.
--service-dir=<dir> Where to locate services for builds without service support.
+ --compact Ice for .NET uses the Compact Framework.
"""
sys.exit(2)
@@ -1394,7 +1403,7 @@ def processCmdLine():
opts, args = getopt.getopt(
sys.argv[1:], "", ["debug", "trace=", "protocol=", "compress", "valgrind", "host=", "serialize", "ipv6", \
"ice-home=", "x64", "cross=", "env", "sql-type=", "sql-db=", "sql-host=", "sql-port=", \
- "sql-user=", "sql-passwd=", "service-dir=", "appverifier"])
+ "sql-user=", "sql-passwd=", "service-dir=", "appverifier", "compact"])
except getopt.GetoptError:
usage()
@@ -1489,6 +1498,9 @@ def processCmdLine():
elif o == "--service-dir":
global serviceDir
serviceDir = a
+ elif o == "--compact":
+ global compact
+ compact = True
if len(args) > 0:
usage()
@@ -1559,6 +1571,14 @@ def runTests(start, expanded, num = 0, script = False):
print "%s*** test not supported with compression%s" % (prefix, suffix)
continue
+ if args.find("compact") != -1 and "nocompact" in config:
+ print "%s*** test not supported with Compact Framework%s" % (prefix, suffix)
+ continue
+
+ if args.find("compact") == -1 and "compact" in config:
+ print "%s*** test requires Compact Framework%s" % (prefix, suffix)
+ continue
+
if isVista() and "novista" in config:
print "%s*** test not supported under Vista%s" % (prefix, suffix)
continue