summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Spruiell <mes@zeroc.com>2008-06-03 19:32:20 -0700
committerMark Spruiell <mes@zeroc.com>2008-06-03 19:32:20 -0700
commit3d649bed4328992f41f567136025f58a019a5159 (patch)
tree470be901fbbfe5c6cd4269884412b0d36b48dc92
parentlocal interface fixes for slice2javae (diff)
downloadice-3d649bed4328992f41f567136025f58a019a5159.tar.bz2
ice-3d649bed4328992f41f567136025f58a019a5159.tar.xz
ice-3d649bed4328992f41f567136025f58a019a5159.zip
Various Ice-E fixes:
- Bug fix in slice2javae for local interfaces/classes - Added Ice.LocalObjectHolder - Reviewed Java/C++ demos and aligned with Ice - Source code clean up (removed tabs, etc.)
-rw-r--r--cppe/demo/IceE/MFC/client/HelloClient.cpp40
-rw-r--r--cppe/demo/IceE/MFC/client/HelloClientDlg.cpp4
-rw-r--r--cppe/demo/IceE/MFC/client/stdafx.h8
-rw-r--r--cppe/demo/IceE/MFC/server/HelloServer.cpp40
-rw-r--r--cppe/demo/IceE/MFC/server/LogI.cpp4
-rw-r--r--cppe/demo/IceE/MFC/server/stdafx.h8
-rw-r--r--cppe/demo/IceE/bidir/CallbackI.cpp74
-rw-r--r--cppe/demo/IceE/bidir/CallbackI.h19
-rw-r--r--cppe/demo/IceE/bidir/Client.cpp17
-rw-r--r--cppe/demo/IceE/bidir/Server.cpp8
-rw-r--r--cppe/demo/IceE/bidir/config7
-rw-r--r--cppe/demo/IceE/bidir/config.client28
-rw-r--r--cppe/demo/IceE/bidir/config.server29
-rw-r--r--cppe/demo/IceE/callback/CallbackSenderI.cpp8
-rw-r--r--cppe/demo/IceE/callback/Client.cpp111
-rw-r--r--cppe/demo/IceE/callback/Server.cpp5
-rw-r--r--cppe/demo/IceE/callback/config7
-rw-r--r--cppe/demo/IceE/callback/config.client35
-rw-r--r--cppe/demo/IceE/callback/config.server29
-rw-r--r--cppe/demo/IceE/chat/ChatClient.cpp4
-rw-r--r--cppe/demo/IceE/chat/ChatClientDlg.cpp300
-rw-r--r--cppe/demo/IceE/chat/ChatConfigDlg.cpp2
-rw-r--r--cppe/demo/IceE/chat/Client.cpp124
-rw-r--r--cppe/demo/IceE/chat/LogI.cpp4
-rw-r--r--cppe/demo/IceE/chat/README4
-rw-r--r--cppe/demo/IceE/chat/Router.ice4
-rw-r--r--cppe/demo/IceE/chat/Session.ice2
-rw-r--r--cppe/demo/IceE/chat/config28
-rw-r--r--cppe/demo/IceE/chat/stdafx.h8
-rw-r--r--cppe/demo/IceE/hello/Client.cpp220
-rw-r--r--cppe/demo/IceE/hello/Server.cpp34
-rw-r--r--cppe/demo/IceE/hello/config.client (renamed from javae/demo/IceE/jdk/hello/config)11
-rw-r--r--cppe/demo/IceE/hello/config.server (renamed from cppe/demo/IceE/minimal/config)10
-rw-r--r--cppe/demo/IceE/latency/Client.cpp42
-rw-r--r--cppe/demo/IceE/latency/Server.cpp39
-rw-r--r--cppe/demo/IceE/latency/WinCEClient.cpp256
-rw-r--r--cppe/demo/IceE/latency/WinCEServer.cpp187
-rw-r--r--cppe/demo/IceE/latency/config7
-rw-r--r--cppe/demo/IceE/latency/config.client5
-rw-r--r--cppe/demo/IceE/latency/config.server10
-rw-r--r--cppe/demo/IceE/minimal/Client.cpp117
-rw-r--r--cppe/demo/IceE/minimal/Server.cpp60
-rw-r--r--cppe/demo/IceE/minimal/WinCEClient.cpp88
-rw-r--r--cppe/demo/IceE/minimal/WinCEServer.cpp205
-rw-r--r--cppe/demo/IceE/throughput/Client.cpp685
-rw-r--r--cppe/demo/IceE/throughput/Server.cpp42
-rw-r--r--cppe/demo/IceE/throughput/Throughput.ice4
-rw-r--r--cppe/demo/IceE/throughput/ThroughputI.cpp68
-rw-r--r--cppe/demo/IceE/throughput/ThroughputI.h5
-rw-r--r--cppe/demo/IceE/throughput/WinCEClient.cpp410
-rw-r--r--cppe/demo/IceE/throughput/WinCEServer.cpp184
-rw-r--r--cppe/demo/IceE/throughput/config7
-rw-r--r--cppe/demo/IceE/throughput/config.client5
-rw-r--r--cppe/demo/IceE/throughput/config.server11
-rw-r--r--cppe/demo/IceE/workqueue/WorkQueue.cpp90
-rw-r--r--cppe/include/IceE/AbstractMutex.h18
-rw-r--r--cppe/include/IceE/BasicStream.h518
-rw-r--r--cppe/include/IceE/Buffer.h270
-rw-r--r--cppe/include/IceE/Cond.h40
-rw-r--r--cppe/include/IceE/Connection.h28
-rw-r--r--cppe/include/IceE/DisableWarnings.h4
-rw-r--r--cppe/include/IceE/FactoryTable.h2
-rw-r--r--cppe/include/IceE/Functional.h32
-rw-r--r--cppe/include/IceE/Handle.h380
-rw-r--r--cppe/include/IceE/Initialize.h4
-rw-r--r--cppe/include/IceE/Lock.h58
-rw-r--r--cppe/include/IceE/Monitor.h94
-rw-r--r--cppe/include/IceE/Mutex.h42
-rw-r--r--cppe/include/IceE/Object.h8
-rw-r--r--cppe/include/IceE/ObjectAdapter.h6
-rw-r--r--cppe/include/IceE/Outgoing.h10
-rw-r--r--cppe/include/IceE/Proxy.h100
-rw-r--r--cppe/include/IceE/ProxyHandle.h184
-rw-r--r--cppe/include/IceE/RecMutex.h6
-rw-r--r--cppe/include/IceE/ScopedArray.h24
-rw-r--r--cppe/include/IceE/Shared.h112
-rw-r--r--cppe/include/IceE/StaticMutex.h14
-rw-r--r--cppe/include/IceE/StringConverter.h4
-rw-r--r--cppe/include/IceE/Thread.h4
-rw-r--r--cppe/include/IceE/Time.h88
-rw-r--r--cppe/include/IceE/Unicode.h14
-rw-r--r--cppe/slice/IceE/Locator.ice8
-rw-r--r--cppe/src/IceE/BasicStream.cpp606
-rw-r--r--cppe/src/IceE/Buffer.cpp76
-rw-r--r--cppe/src/IceE/Communicator.cpp20
-rw-r--r--cppe/src/IceE/Cond.cpp96
-rw-r--r--cppe/src/IceE/Connection.cpp1888
-rw-r--r--cppe/src/IceE/ConvertUTF.cpp458
-rw-r--r--cppe/src/IceE/ConvertUTF.h34
-rw-r--r--cppe/src/IceE/Current.cpp46
-rw-r--r--cppe/src/IceE/DefaultsAndOverrides.cpp8
-rw-r--r--cppe/src/IceE/ExceptionBase.cpp10
-rw-r--r--cppe/src/IceE/FactoryTableDef.cpp60
-rw-r--r--cppe/src/IceE/Incoming.cpp628
-rw-r--r--cppe/src/IceE/IncomingConnectionFactory.cpp452
-rw-r--r--cppe/src/IceE/IncomingConnectionFactory.h16
-rw-r--r--cppe/src/IceE/Initialize.cpp66
-rw-r--r--cppe/src/IceE/Instance.cpp494
-rw-r--r--cppe/src/IceE/Instance.h6
-rw-r--r--cppe/src/IceE/LocalException.cpp34
-rw-r--r--cppe/src/IceE/LocatorInfo.cpp318
-rw-r--r--cppe/src/IceE/LoggerI.cpp6
-rw-r--r--cppe/src/IceE/LoggerUtil.cpp8
-rw-r--r--cppe/src/IceE/Network.cpp692
-rw-r--r--cppe/src/IceE/Object.cpp60
-rw-r--r--cppe/src/IceE/ObjectAdapter.cpp438
-rw-r--r--cppe/src/IceE/ObjectAdapterFactory.cpp118
-rw-r--r--cppe/src/IceE/ObjectAdapterFactory.h4
-rw-r--r--cppe/src/IceE/Outgoing.cpp500
-rw-r--r--cppe/src/IceE/OutgoingConnectionFactory.cpp588
-rw-r--r--cppe/src/IceE/Properties.cpp50
-rw-r--r--cppe/src/IceE/Protocol.cpp2
-rw-r--r--cppe/src/IceE/Proxy.cpp448
-rw-r--r--cppe/src/IceE/ProxyFactory.cpp108
-rw-r--r--cppe/src/IceE/RecMutex.cpp116
-rw-r--r--cppe/src/IceE/Reference.cpp466
-rw-r--r--cppe/src/IceE/Reference.h36
-rw-r--r--cppe/src/IceE/ReferenceFactory.cpp498
-rw-r--r--cppe/src/IceE/ReferenceFactory.h10
-rw-r--r--cppe/src/IceE/RouterInfo.cpp90
-rw-r--r--cppe/src/IceE/ServantManager.cpp124
-rw-r--r--cppe/src/IceE/StaticMutex.cpp12
-rw-r--r--cppe/src/IceE/StringConverter.cpp66
-rw-r--r--cppe/src/IceE/StringUtil.cpp382
-rw-r--r--cppe/src/IceE/Thread.cpp136
-rw-r--r--cppe/src/IceE/ThreadException.cpp50
-rw-r--r--cppe/src/IceE/TraceUtil.cpp334
-rw-r--r--cppe/src/IceE/Transceiver.h4
-rw-r--r--cppe/src/IceE/UUID.cpp156
-rw-r--r--cppe/src/IceE/Unicode.cpp116
-rw-r--r--cppe/src/IceE/UnknownEndpoint.cpp16
-rw-r--r--cppe/src/TcpTransport/Acceptor.cpp38
-rw-r--r--cppe/src/TcpTransport/Connector.cpp8
-rw-r--r--cppe/src/TcpTransport/EndpointFactory.cpp2
-rw-r--r--cppe/src/TcpTransport/TcpEndpoint.cpp294
-rw-r--r--cppe/src/TcpTransport/Transceiver.cpp730
-rw-r--r--cppe/test/Common/TestCommon.cpp376
-rw-r--r--cppe/test/IceE/adapterDeactivation/AllTests.cpp8
-rw-r--r--cppe/test/IceE/adapterDeactivation/Client.cpp6
-rw-r--r--cppe/test/IceE/adapterDeactivation/Collocated.cpp4
-rw-r--r--cppe/test/IceE/adapterDeactivation/Server.cpp2
-rw-r--r--cppe/test/IceE/adapterDeactivation/TestI.cpp2
-rw-r--r--cppe/test/IceE/custom/AllTests.cpp646
-rw-r--r--cppe/test/IceE/custom/Client.cpp8
-rw-r--r--cppe/test/IceE/custom/Collocated.cpp18
-rw-r--r--cppe/test/IceE/custom/MyByteSeq.cpp6
-rw-r--r--cppe/test/IceE/custom/Server.cpp22
-rw-r--r--cppe/test/IceE/custom/StringConverterI.cpp4
-rw-r--r--cppe/test/IceE/custom/StringConverterI.h4
-rw-r--r--cppe/test/IceE/custom/Test.ice10
-rw-r--r--cppe/test/IceE/custom/TestI.cpp84
-rw-r--r--cppe/test/IceE/custom/TestI.h84
-rw-r--r--cppe/test/IceE/custom/WstringI.cpp20
-rw-r--r--cppe/test/IceE/custom/WstringI.h20
-rw-r--r--cppe/test/IceE/exceptions/AllTests.cpp382
-rw-r--r--cppe/test/IceE/exceptions/Client.cpp2
-rw-r--r--cppe/test/IceE/exceptions/Collocated.cpp6
-rw-r--r--cppe/test/IceE/exceptions/Server.cpp6
-rw-r--r--cppe/test/IceE/exceptions/Test.ice2
-rw-r--r--cppe/test/IceE/exceptions/TestI.cpp12
-rw-r--r--cppe/test/IceE/facets/AllTests.cpp12
-rw-r--r--cppe/test/IceE/facets/Client.cpp2
-rw-r--r--cppe/test/IceE/facets/Collocated.cpp6
-rw-r--r--cppe/test/IceE/facets/Server.cpp8
-rw-r--r--cppe/test/IceE/faultTolerance/AllTests.cpp152
-rw-r--r--cppe/test/IceE/faultTolerance/Client.cpp42
-rw-r--r--cppe/test/IceE/faultTolerance/Server.cpp34
-rw-r--r--cppe/test/IceE/inheritance/AllTests.cpp2
-rw-r--r--cppe/test/IceE/inheritance/Client.cpp2
-rw-r--r--cppe/test/IceE/inheritance/Collocated.cpp4
-rw-r--r--cppe/test/IceE/inheritance/Server.cpp8
-rw-r--r--cppe/test/IceE/inheritance/TestI.h2
-rw-r--r--cppe/test/IceE/location/AllTests.cpp98
-rw-r--r--cppe/test/IceE/location/Client.cpp28
-rw-r--r--cppe/test/IceE/location/Server.cpp52
-rw-r--r--cppe/test/IceE/location/ServerLocator.cpp8
-rw-r--r--cppe/test/IceE/location/ServerLocator.h2
-rw-r--r--cppe/test/IceE/location/TestI.cpp18
-rw-r--r--cppe/test/IceE/location/TestI.h2
-rw-r--r--cppe/test/IceE/operations/AllTests.cpp6
-rw-r--r--cppe/test/IceE/operations/BatchOneways.cpp36
-rw-r--r--cppe/test/IceE/operations/Client.cpp50
-rw-r--r--cppe/test/IceE/operations/Collocated.cpp40
-rw-r--r--cppe/test/IceE/operations/Server.cpp16
-rw-r--r--cppe/test/IceE/operations/Test.ice44
-rw-r--r--cppe/test/IceE/operations/TestI.cpp168
-rw-r--r--cppe/test/IceE/operations/TestI.h152
-rw-r--r--cppe/test/IceE/operations/Twoways.cpp1106
-rw-r--r--cppe/test/IceE/proxy/Client.cpp16
-rw-r--r--cppe/test/IceE/proxy/Collocated.cpp18
-rw-r--r--cppe/test/IceE/proxy/Server.cpp6
-rw-r--r--cppe/test/IceE/retry/AllTests.cpp6
-rw-r--r--cppe/test/IceE/retry/Client.cpp26
-rw-r--r--cppe/test/IceE/retry/Server.cpp14
-rw-r--r--cppe/test/IceE/retry/TestI.cpp2
-rw-r--r--cppe/test/IceE/slicing/AllTests.cpp418
-rw-r--r--cppe/test/IceE/slicing/Client.cpp2
-rw-r--r--cppe/test/IceE/slicing/Server.cpp4
-rw-r--r--cppe/test/IceE/thread/AliveTest.cpp36
-rw-r--r--cppe/test/IceE/thread/Client.cpp28
-rw-r--r--cppe/test/IceE/thread/CreateTest.cpp32
-rw-r--r--cppe/test/IceE/thread/MonitorMutexTest.cpp94
-rw-r--r--cppe/test/IceE/thread/MonitorRecMutexTest.cpp94
-rw-r--r--cppe/test/IceE/thread/MutexTest.cpp170
-rw-r--r--cppe/test/IceE/thread/RecMutexTest.cpp68
-rw-r--r--cppe/test/IceE/thread/StartTest.cpp64
-rw-r--r--cppe/test/IceE/thread/StaticMutexTest.cpp152
-rw-r--r--cppe/test/IceE/thread/TestBase.cpp4
-rw-r--r--cppe/test/IceE/uuid/Client.cpp252
-rw-r--r--javae/ant/JADTask.java54
-rw-r--r--javae/ant/Javac11.java96
-rw-r--r--javae/ant/Slice2JavaETask.java90
-rw-r--r--javae/ant/SliceTask.java230
-rw-r--r--javae/demo/IceE/jdk/bidir/CallbackSenderI.java102
-rw-r--r--javae/demo/IceE/jdk/bidir/Client.java20
-rw-r--r--javae/demo/IceE/jdk/bidir/Server.java38
-rw-r--r--javae/demo/IceE/jdk/bidir/config7
-rw-r--r--javae/demo/IceE/jdk/bidir/config.client28
-rw-r--r--javae/demo/IceE/jdk/bidir/config.server29
-rw-r--r--javae/demo/IceE/jdk/callback/CallbackSenderI.java32
-rw-r--r--javae/demo/IceE/jdk/callback/Client.java10
-rw-r--r--javae/demo/IceE/jdk/callback/Server.java4
-rw-r--r--javae/demo/IceE/jdk/callback/config7
-rw-r--r--javae/demo/IceE/jdk/callback/config.client35
-rw-r--r--javae/demo/IceE/jdk/callback/config.server29
-rw-r--r--javae/demo/IceE/jdk/chat/ChatCallbackI.java2
-rw-r--r--javae/demo/IceE/jdk/chat/Client.java208
-rw-r--r--javae/demo/IceE/jdk/chat/README6
-rw-r--r--javae/demo/IceE/jdk/chat/Router.ice4
-rw-r--r--javae/demo/IceE/jdk/chat/Session.ice2
-rw-r--r--javae/demo/IceE/jdk/chat/SessionPingThread.java62
-rw-r--r--javae/demo/IceE/jdk/chat/config9
-rw-r--r--javae/demo/IceE/jdk/hello/Client.java8
-rw-r--r--javae/demo/IceE/jdk/hello/Server.java4
-rw-r--r--javae/demo/IceE/jdk/hello/config.client28
-rw-r--r--javae/demo/IceE/jdk/hello/config.server (renamed from cppe/demo/IceE/hello/config)12
-rw-r--r--javae/demo/IceE/jdk/latency/Client.java6
-rw-r--r--javae/demo/IceE/jdk/latency/Server.java4
-rw-r--r--javae/demo/IceE/jdk/latency/config7
-rw-r--r--javae/demo/IceE/jdk/latency/config.client5
-rw-r--r--javae/demo/IceE/jdk/latency/config.server10
-rw-r--r--javae/demo/IceE/jdk/throughput/Client.java670
-rw-r--r--javae/demo/IceE/jdk/throughput/Server.java4
-rw-r--r--javae/demo/IceE/jdk/throughput/Throughput.ice4
-rw-r--r--javae/demo/IceE/jdk/throughput/ThroughputI.java108
-rw-r--r--javae/demo/IceE/jdk/throughput/config7
-rw-r--r--javae/demo/IceE/jdk/throughput/config.client5
-rw-r--r--javae/demo/IceE/jdk/throughput/config.server11
-rw-r--r--javae/demo/IceE/midp/chat/ChatCallbackI.java4
-rw-r--r--javae/demo/IceE/midp/chat/ChatForm.java220
-rw-r--r--javae/demo/IceE/midp/chat/ChatMIDlet.java56
-rw-r--r--javae/demo/IceE/midp/chat/Console.java502
-rw-r--r--javae/demo/IceE/midp/chat/LoginForm.java190
-rw-r--r--javae/demo/IceE/midp/hello/ClientMIDlet.java182
-rw-r--r--javae/demo/IceE/midp/hello/ServerMIDlet.java172
-rw-r--r--javae/jdk/Ice/LoggerI.java34
-rw-r--r--javae/jdk/Ice/Properties.java178
-rw-r--r--javae/jdk/IceInternal/Acceptor.java162
-rw-r--r--javae/jdk/IceInternal/Connector.java292
-rw-r--r--javae/jdk/IceInternal/InetSocketAddress.java54
-rw-r--r--javae/jdk/IceInternal/Network.java126
-rw-r--r--javae/jdk/IceInternal/TcpEndpoint.java148
-rw-r--r--javae/jdk/IceInternal/Transceiver.java324
-rw-r--r--javae/midp/Ice/LoggerI.java66
-rw-r--r--javae/midp/Ice/Properties.java216
-rw-r--r--javae/midp/IceInternal/Acceptor.java216
-rw-r--r--javae/midp/IceInternal/Connector.java306
-rw-r--r--javae/midp/IceInternal/InetSocketAddress.java34
-rw-r--r--javae/midp/IceInternal/Network.java274
-rw-r--r--javae/midp/IceInternal/TcpEndpoint.java116
-rw-r--r--javae/midp/IceInternal/Transceiver.java732
-rw-r--r--javae/slice/IceE/Locator.ice8
-rw-r--r--javae/src/Ice/Communicator.java32
-rw-r--r--javae/src/Ice/Connection.java2704
-rw-r--r--javae/src/Ice/Current.java112
-rw-r--r--javae/src/Ice/DispatchStatus.java14
-rw-r--r--javae/src/Ice/InitializationData.java8
-rw-r--r--javae/src/Ice/LocalException.java28
-rw-r--r--javae/src/Ice/LocalObjectHolder.java26
-rw-r--r--javae/src/Ice/ObjectAdapter.java934
-rw-r--r--javae/src/Ice/ObjectImpl.java98
-rw-r--r--javae/src/Ice/ObjectPrxHelper.java104
-rw-r--r--javae/src/Ice/ObjectPrxHelperBase.java246
-rw-r--r--javae/src/Ice/OperationMode.java38
-rw-r--r--javae/src/Ice/UserException.java2
-rw-r--r--javae/src/Ice/Util.java154
-rw-r--r--javae/src/IceInternal/BasicStream.java918
-rw-r--r--javae/src/IceInternal/ByteBuffer.java1002
-rw-r--r--javae/src/IceInternal/DefaultsAndOverrides.java76
-rw-r--r--javae/src/IceInternal/DirectReference.java192
-rw-r--r--javae/src/IceInternal/EndpointFactory.java6
-rw-r--r--javae/src/IceInternal/FixedReference.java88
-rw-r--r--javae/src/IceInternal/Incoming.java504
-rw-r--r--javae/src/IceInternal/IncomingConnectionFactory.java750
-rw-r--r--javae/src/IceInternal/IndirectReference.java292
-rw-r--r--javae/src/IceInternal/Instance.java264
-rw-r--r--javae/src/IceInternal/IntMap.java26
-rw-r--r--javae/src/IceInternal/LocalExceptionWrapper.java4
-rw-r--r--javae/src/IceInternal/LocatorInfo.java418
-rw-r--r--javae/src/IceInternal/LocatorManager.java40
-rw-r--r--javae/src/IceInternal/LocatorTable.java16
-rw-r--r--javae/src/IceInternal/ObjectAdapterFactory.java228
-rw-r--r--javae/src/IceInternal/Outgoing.java486
-rw-r--r--javae/src/IceInternal/OutgoingConnectionFactory.java854
-rw-r--r--javae/src/IceInternal/Protocol.java26
-rw-r--r--javae/src/IceInternal/ProxyFactory.java68
-rw-r--r--javae/src/IceInternal/Reference.java486
-rw-r--r--javae/src/IceInternal/ReferenceFactory.java334
-rw-r--r--javae/src/IceInternal/RoutableReference.java62
-rw-r--r--javae/src/IceInternal/RouterInfo.java32
-rw-r--r--javae/src/IceInternal/RouterManager.java24
-rw-r--r--javae/src/IceInternal/ServantManager.java154
-rw-r--r--javae/src/IceInternal/TraceLevels.java10
-rw-r--r--javae/src/IceInternal/TraceUtil.java438
-rw-r--r--javae/src/IceUtil/Arrays.java552
-rw-r--r--javae/src/IceUtil/AssertionError.java2
-rw-r--r--javae/src/IceUtil/CloneException.java4
-rw-r--r--javae/src/IceUtil/Debug.java26
-rw-r--r--javae/src/IceUtil/Hashtable.java44
-rw-r--r--javae/src/IceUtil/StringUtil.java534
-rw-r--r--javae/src/IceUtil/UUID.java106
-rw-r--r--javae/test/IceE/adapterDeactivation/AllTests.java2
-rw-r--r--javae/test/IceE/adapterDeactivation/Client.java2
-rw-r--r--javae/test/IceE/adapterDeactivation/Collocated.java10
-rw-r--r--javae/test/IceE/adapterDeactivation/Server.java24
-rw-r--r--javae/test/IceE/common/ClientBase.java24
-rw-r--r--javae/test/IceE/common/CollocatedBase.java24
-rw-r--r--javae/test/IceE/common/ServerBase.java24
-rw-r--r--javae/test/IceE/common/StreamListAdapter.java116
-rw-r--r--javae/test/IceE/common/TestApplication.java48
-rw-r--r--javae/test/IceE/exceptions/AllTests.java426
-rw-r--r--javae/test/IceE/exceptions/Client.java2
-rw-r--r--javae/test/IceE/exceptions/Collocated.java16
-rw-r--r--javae/test/IceE/exceptions/DummyLogger.java2
-rw-r--r--javae/test/IceE/exceptions/Server.java32
-rw-r--r--javae/test/IceE/facets/AllTests.java84
-rw-r--r--javae/test/IceE/facets/Client.java2
-rw-r--r--javae/test/IceE/facets/Collocated.java8
-rw-r--r--javae/test/IceE/facets/Server.java24
-rw-r--r--javae/test/IceE/faultTolerance/AllTests.java184
-rw-r--r--javae/test/IceE/faultTolerance/Client.java74
-rw-r--r--javae/test/IceE/faultTolerance/Server.java20
-rw-r--r--javae/test/IceE/faultTolerance/TestI.java6
-rw-r--r--javae/test/IceE/inheritance/AllTests.java2
-rw-r--r--javae/test/IceE/inheritance/Client.java2
-rw-r--r--javae/test/IceE/inheritance/Collocated.java4
-rw-r--r--javae/test/IceE/inheritance/Server.java20
-rw-r--r--javae/test/IceE/location/AllTests.java454
-rw-r--r--javae/test/IceE/location/Client.java20
-rw-r--r--javae/test/IceE/location/Server.java84
-rw-r--r--javae/test/IceE/location/ServerLocator.java14
-rw-r--r--javae/test/IceE/location/ServerLocatorRegistry.java30
-rw-r--r--javae/test/IceE/location/ServerManagerI.java86
-rw-r--r--javae/test/IceE/location/TestI.java32
-rw-r--r--javae/test/IceE/operations/AllTests.java36
-rw-r--r--javae/test/IceE/operations/BatchOneways.java68
-rw-r--r--javae/test/IceE/operations/Client.java27
-rw-r--r--javae/test/IceE/operations/Collocated.java8
-rw-r--r--javae/test/IceE/operations/MyDerivedClassI.java148
-rw-r--r--javae/test/IceE/operations/Server.java20
-rw-r--r--javae/test/IceE/operations/Test.ice44
-rw-r--r--javae/test/IceE/operations/Twoways.java280
-rw-r--r--javae/test/IceE/package/AllTests.java2
-rw-r--r--javae/test/IceE/package/Client.java2
-rw-r--r--javae/test/IceE/package/Server.java20
-rw-r--r--javae/test/IceE/proxy/AllTests.java2
-rw-r--r--javae/test/IceE/proxy/Collocated.java2
-rw-r--r--javae/test/IceE/proxy/Server.java18
-rw-r--r--javae/test/IceE/retry/AllTests.java42
-rw-r--r--javae/test/IceE/retry/Client.java30
-rw-r--r--javae/test/IceE/retry/RetryI.java6
-rw-r--r--javae/test/IceE/retry/Server.java20
-rw-r--r--javae/test/IceE/slicing/csrc/AllTests.java584
-rw-r--r--javae/test/IceE/slicing/csrc/Client.java2
-rw-r--r--javae/test/IceE/slicing/ssrc/Server.java10
-rw-r--r--javae/test/IceE/slicing/ssrc/TestI.java112
-rw-r--r--javae/test/IceE/translator/Metadata.ice4
377 files changed, 23595 insertions, 23166 deletions
diff --git a/cppe/demo/IceE/MFC/client/HelloClient.cpp b/cppe/demo/IceE/MFC/client/HelloClient.cpp
index 03f55a05a5d..fbb96b11150 100644
--- a/cppe/demo/IceE/MFC/client/HelloClient.cpp
+++ b/cppe/demo/IceE/MFC/client/HelloClient.cpp
@@ -46,30 +46,30 @@ CHelloClientApp::InitInstance()
try
{
int argc = 0;
- Ice::InitializationData initData;
- initData.properties = Ice::createProperties();
- //
- // Set a default value for Hello.Proxy so that the demo will
- // run without a configuration file.
- //
- initData.properties->setProperty("Hello.Proxy", "hello:tcp -p 10000");
+ Ice::InitializationData initData;
+ initData.properties = Ice::createProperties();
+ //
+ // Set a default value for Hello.Proxy so that the demo will
+ // run without a configuration file.
+ //
+ initData.properties->setProperty("Hello.Proxy", "hello:tcp -p 10000");
- //
- // Now, load the configuration file if present. Under WinCE we
- // use "config.txt" since it can be edited with pocket word.
- //
+ //
+ // Now, load the configuration file if present. Under WinCE we
+ // use "config.txt" since it can be edited with pocket word.
+ //
#ifdef _WIN32_WCE
- string config = "config.txt";
+ string config = "config.txt";
#else
- string config = "config";
+ string config = "config";
#endif
- try
- {
- initData.properties->load(config);
- }
- catch(const Ice::FileException&)
- {
- }
+ try
+ {
+ initData.properties->load(config);
+ }
+ catch(const Ice::FileException&)
+ {
+ }
communicator = Ice::initialize(argc, 0, initData);
}
diff --git a/cppe/demo/IceE/MFC/client/HelloClientDlg.cpp b/cppe/demo/IceE/MFC/client/HelloClientDlg.cpp
index 5ccb10cd449..f0fb65c754a 100644
--- a/cppe/demo/IceE/MFC/client/HelloClientDlg.cpp
+++ b/cppe/demo/IceE/MFC/client/HelloClientDlg.cpp
@@ -59,7 +59,6 @@ CHelloClientDlg::OnInitDialog()
//
_mode->SetCurSel(_currentMode);
-
//
// Disable flush button if built without batch support.
//
@@ -67,7 +66,6 @@ CHelloClientDlg::OnInitDialog()
(CButton*)GetDlgItem(IDC_FLUSH)->EnableWindow(FALSE);
#endif
-
//
// Create the proxy.
//
@@ -214,7 +212,7 @@ CHelloClientDlg::updateProxy()
#else
AfxMessageBox(CString("Batch mode is currently not enabled."),
MB_OK|MB_ICONEXCLAMATION);
- return;
+ return;
#endif
default:
assert(false);
diff --git a/cppe/demo/IceE/MFC/client/stdafx.h b/cppe/demo/IceE/MFC/client/stdafx.h
index f3bc1290dc9..a4761e36b74 100644
--- a/cppe/demo/IceE/MFC/client/stdafx.h
+++ b/cppe/demo/IceE/MFC/client/stdafx.h
@@ -49,22 +49,22 @@
#endif // _WIN32_WCE
#ifndef VC_EXTRALEAN
-#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
+#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
#endif
#include <afxwin.h> // MFC core and standard components
#include <afxext.h> // MFC extensions
#if defined(_WIN32_WCE) && (_WIN32_WCE >= 211) && (_AFXDLL)
-#include <afxdtctl.h> // MFC support for Internet Explorer 4 Common Controls
+#include <afxdtctl.h> // MFC support for Internet Explorer 4 Common Controls
#endif
#ifndef _AFX_NO_AFXCMN_SUPPORT
-#include <afxcmn.h> // MFC support for Windows Common Controls
+#include <afxcmn.h> // MFC support for Windows Common Controls
#endif // _AFX_NO_AFXCMN_SUPPORT
-#include <afxsock.h> // MFC socket extensions
+#include <afxsock.h> // MFC socket extensions
//{{AFX_INSERT_LOCATION}}
// Microsoft eMbedded Visual C++ will insert additional declarations immediately before the previous line.
diff --git a/cppe/demo/IceE/MFC/server/HelloServer.cpp b/cppe/demo/IceE/MFC/server/HelloServer.cpp
index 98194c1e96a..bd5f3391a3c 100644
--- a/cppe/demo/IceE/MFC/server/HelloServer.cpp
+++ b/cppe/demo/IceE/MFC/server/HelloServer.cpp
@@ -50,34 +50,34 @@ BOOL CHelloServerApp::InitInstance()
try
{
int argc = 0;
- Ice::InitializationData initData;
+ Ice::InitializationData initData;
initData.properties = Ice::createProperties();
- //
- // Set a default value for Hello.Endpoints so that the demo
- // will run without a configuration file.
- //
- initData.properties->setProperty("Hello.Endpoints", "tcp -p 10000");
+ //
+ // Set a default value for Hello.Endpoints so that the demo
+ // will run without a configuration file.
+ //
+ initData.properties->setProperty("Hello.Endpoints", "tcp -p 10000");
- //
- // Now, load the configuration file if present. Under WinCE we
- // use "config.txt" since it can be edited with pocket word.
- //
+ //
+ // Now, load the configuration file if present. Under WinCE we
+ // use "config.txt" since it can be edited with pocket word.
+ //
#ifdef _WIN32_WCE
- string config = "config.txt";
+ string config = "config.txt";
#else
- string config = "config";
+ string config = "config";
#endif
- try
- {
- initData.properties->load(config);
- }
- catch(const Ice::FileException&)
- {
- }
+ try
+ {
+ initData.properties->load(config);
+ }
+ catch(const Ice::FileException&)
+ {
+ }
log = new LogI;
- initData.logger = log;
+ initData.logger = log;
communicator = Ice::initialize(argc, 0, initData);
adapter = communicator->createObjectAdapter("Hello");
diff --git a/cppe/demo/IceE/MFC/server/LogI.cpp b/cppe/demo/IceE/MFC/server/LogI.cpp
index dbed3ad13c9..7577334bb12 100644
--- a/cppe/demo/IceE/MFC/server/LogI.cpp
+++ b/cppe/demo/IceE/MFC/server/LogI.cpp
@@ -65,7 +65,7 @@ LogI::message(const string& msg)
string line = msg + "\r\n";
if(_hwnd)
{
- post(line);
+ post(line);
}
else
{
@@ -79,7 +79,7 @@ LogI::setHandle(HWND hwnd)
_hwnd = hwnd;
if(_hwnd != 0 && !_buffer.empty())
{
- post(_buffer);
+ post(_buffer);
_buffer.clear();
}
}
diff --git a/cppe/demo/IceE/MFC/server/stdafx.h b/cppe/demo/IceE/MFC/server/stdafx.h
index ab60a56baa8..0affd98b539 100644
--- a/cppe/demo/IceE/MFC/server/stdafx.h
+++ b/cppe/demo/IceE/MFC/server/stdafx.h
@@ -50,22 +50,22 @@
#endif // _WIN32_WCE
#ifndef VC_EXTRALEAN
-#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
+#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
#endif
#include <afxwin.h> // MFC core and standard components
#include <afxext.h> // MFC extensions
#if defined(_WIN32_WCE) && (_WIN32_WCE >= 211) && (_AFXDLL)
-#include <afxdtctl.h> // MFC support for Internet Explorer 4 Common Controls
+#include <afxdtctl.h> // MFC support for Internet Explorer 4 Common Controls
#endif
#ifndef _AFX_NO_AFXCMN_SUPPORT
-#include <afxcmn.h> // MFC support for Windows Common Controls
+#include <afxcmn.h> // MFC support for Windows Common Controls
#endif // _AFX_NO_AFXCMN_SUPPORT
-#include <afxsock.h> // MFC socket extensions
+#include <afxsock.h> // MFC socket extensions
//{{AFX_INSERT_LOCATION}}
// Microsoft eMbedded Visual C++ will insert additional declarations immediately before the previous line.
diff --git a/cppe/demo/IceE/bidir/CallbackI.cpp b/cppe/demo/IceE/bidir/CallbackI.cpp
index defd118bec3..ec486167729 100644
--- a/cppe/demo/IceE/bidir/CallbackI.cpp
+++ b/cppe/demo/IceE/bidir/CallbackI.cpp
@@ -15,7 +15,6 @@ using namespace Demo;
CallbackSenderI::CallbackSenderI(const Ice::CommunicatorPtr& communicator) :
_communicator(communicator),
_destroy(false),
- _num(0),
_callbackSenderThread(new CallbackSenderThread(this))
{
}
@@ -26,15 +25,15 @@ CallbackSenderI::destroy()
IceUtil::ThreadPtr callbackSenderThread;
{
- Lock lock(*this);
-
- printf("destroying callback sender\n");
- _destroy = true;
-
- notify();
+ Lock lock(*this);
+
+ printf("destroying callback sender\n");
+ _destroy = true;
+
+ notify();
- callbackSenderThread = _callbackSenderThread;
- _callbackSenderThread = 0; // Resolve cyclic dependency.
+ callbackSenderThread = _callbackSenderThread;
+ _callbackSenderThread = 0; // Resolve cyclic dependency.
}
callbackSenderThread->getThreadControl().join();
@@ -60,32 +59,39 @@ CallbackSenderI::start()
void
CallbackSenderI::run()
{
- Lock lock(*this);
-
- while(!_destroy)
+ int num = 0;
+ while(true)
{
- timedWait(IceUtil::Time::seconds(2));
+ std::set<Demo::CallbackReceiverPrx> clients;
+ {
+ Lock lock(*this);
+ timedWait(IceUtil::Time::seconds(2));
+
+ if(_destroy)
+ {
+ break;
+ }
+
+ clients = _clients;
+ }
- if(!_destroy && !_clients.empty())
- {
- ++_num;
-
- set<CallbackReceiverPrx>::iterator p = _clients.begin();
- while(p != _clients.end())
- {
- try
- {
- (*p)->callback(_num);
- ++p;
- }
- catch(const Ice::Exception& ex)
- {
- fprintf(stderr, "removing client `%s':\n%s\n",
- _communicator->identityToString((*p)->ice_getIdentity()).c_str(),
- ex.toString().c_str());
- _clients.erase(p++);
- }
- }
- }
+ if(!clients.empty())
+ {
+ ++num;
+ for(set<CallbackReceiverPrx>::iterator p = clients.begin(); p != clients.end(); ++p)
+ {
+ try
+ {
+ (*p)->callback(num);
+ }
+ catch(const Ice::Exception& ex)
+ {
+ fprintf(stderr, "removing client `%s':\n%s\n",
+ _communicator->identityToString((*p)->ice_getIdentity()).c_str(),
+ ex.toString().c_str());
+ _clients.erase(*p);
+ }
+ }
+ }
}
}
diff --git a/cppe/demo/IceE/bidir/CallbackI.h b/cppe/demo/IceE/bidir/CallbackI.h
index 922410f76c1..6fd80632369 100644
--- a/cppe/demo/IceE/bidir/CallbackI.h
+++ b/cppe/demo/IceE/bidir/CallbackI.h
@@ -34,7 +34,6 @@ private:
Ice::CommunicatorPtr _communicator;
bool _destroy;
- Ice::Int _num;
std::set<Demo::CallbackReceiverPrx> _clients;
//
@@ -47,19 +46,19 @@ private:
{
public:
- CallbackSenderThread(const CallbackSenderIPtr& callbackSender) :
- _callbackSender(callbackSender)
- {
- }
+ CallbackSenderThread(const CallbackSenderIPtr& callbackSender) :
+ _callbackSender(callbackSender)
+ {
+ }
- virtual void run()
- {
- _callbackSender->run();
- }
+ virtual void run()
+ {
+ _callbackSender->run();
+ }
private:
- CallbackSenderIPtr _callbackSender;
+ CallbackSenderIPtr _callbackSender;
};
IceUtil::ThreadPtr _callbackSenderThread;
diff --git a/cppe/demo/IceE/bidir/Client.cpp b/cppe/demo/IceE/bidir/Client.cpp
index dc982affc9f..4d5084bca5f 100644
--- a/cppe/demo/IceE/bidir/Client.cpp
+++ b/cppe/demo/IceE/bidir/Client.cpp
@@ -20,7 +20,7 @@ public:
virtual void
callback(Ice::Int num, const Ice::Current&)
{
- printf("received callback #%d\n", num);
+ printf("received callback #%d\n", num);
}
};
@@ -34,26 +34,27 @@ run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator)
}
Ice::PropertiesPtr properties = communicator->getProperties();
- const char* proxyProperty = "Callback.Client.CallbackServer";
+ const char* proxyProperty = "CallbackSender.Proxy";
string proxy = properties->getProperty(proxyProperty);
if(proxy.empty())
{
- fprintf(stderr, "%s: property `%s' not set\n", argv[0], proxyProperty);
- return EXIT_FAILURE;
+ fprintf(stderr, "%s: property `%s' not set\n", argv[0], proxyProperty);
+ return EXIT_FAILURE;
}
CallbackSenderPrx server = CallbackSenderPrx::checkedCast(communicator->stringToProxy(proxy));
if(!server)
{
- fprintf(stderr, "%s: invalid proxy\n", argv[0]);
- return EXIT_FAILURE;
+ fprintf(stderr, "%s: invalid proxy\n", argv[0]);
+ return EXIT_FAILURE;
}
Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("Callback.Client");
Ice::Identity ident;
ident.name = IceUtil::generateUUID();
ident.category = "";
- adapter->add(new CallbackReceiverI, ident);
+ CallbackReceiverPtr cr = new CallbackReceiverI;
+ adapter->add(cr, ident);
adapter->activate();
server->ice_getConnection()->setAdapter(adapter);
server->addClient(ident);
@@ -72,7 +73,7 @@ main(int argc, char* argv[])
{
Ice::InitializationData initData;
initData.properties = Ice::createProperties();
- initData.properties->load("config");
+ initData.properties->load("config.client");
communicator = Ice::initialize(argc, argv, initData);
status = run(argc, argv, communicator);
}
diff --git a/cppe/demo/IceE/bidir/Server.cpp b/cppe/demo/IceE/bidir/Server.cpp
index 949fb23d2df..08b07d343de 100644
--- a/cppe/demo/IceE/bidir/Server.cpp
+++ b/cppe/demo/IceE/bidir/Server.cpp
@@ -29,12 +29,12 @@ run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator)
sender->start();
try
{
- communicator->waitForShutdown();
+ communicator->waitForShutdown();
}
catch(...)
{
- sender->destroy();
- throw;
+ sender->destroy();
+ throw;
}
sender->destroy();
@@ -51,7 +51,7 @@ main(int argc, char* argv[])
{
Ice::InitializationData initData;
initData.properties = Ice::createProperties();
- initData.properties->load("config");
+ initData.properties->load("config.server");
communicator = Ice::initialize(argc, argv, initData);
status = run(argc, argv, communicator);
}
diff --git a/cppe/demo/IceE/bidir/config b/cppe/demo/IceE/bidir/config
deleted file mode 100644
index d194f5d3765..00000000000
--- a/cppe/demo/IceE/bidir/config
+++ /dev/null
@@ -1,7 +0,0 @@
-Callback.Client.CallbackServer=sender:tcp -p 10000
-Callback.Client.Endpoints=
-Callback.Server.Endpoints=tcp -p 10000
-
-#Ice.Trace.Network=1
-#Ice.Trace.Protocol=1
-Ice.Warn.Connections=1
diff --git a/cppe/demo/IceE/bidir/config.client b/cppe/demo/IceE/bidir/config.client
new file mode 100644
index 00000000000..fa7a6ae7fb4
--- /dev/null
+++ b/cppe/demo/IceE/bidir/config.client
@@ -0,0 +1,28 @@
+#
+# The client reads this property to create the reference to the
+# "CallbackSender" object in the server.
+#
+CallbackSender.Proxy=sender:tcp -p 10000
+
+#
+# Warn about connection exceptions
+#
+Ice.Warn.Connections=1
+
+#
+# Network Tracing
+#
+# 0 = no network tracing
+# 1 = trace connection establishment and closure
+# 2 = like 1, but more detailed
+# 3 = like 2, but also trace data transfer
+#
+#Ice.Trace.Network=1
+
+#
+# Protocol Tracing
+#
+# 0 = no protocol tracing
+# 1 = trace protocol messages
+#
+#Ice.Trace.Protocol=1
diff --git a/cppe/demo/IceE/bidir/config.server b/cppe/demo/IceE/bidir/config.server
new file mode 100644
index 00000000000..e7e23e47480
--- /dev/null
+++ b/cppe/demo/IceE/bidir/config.server
@@ -0,0 +1,29 @@
+#
+# The server creates one single object adapter with the name
+# "Callback.Server". The following line sets the endpoints for this
+# adapter.
+#
+Callback.Server.Endpoints=tcp -p 10000
+
+#
+# Warn about connection exceptions
+#
+Ice.Warn.Connections=1
+
+#
+# Network Tracing
+#
+# 0 = no network tracing
+# 1 = trace connection establishment and closure
+# 2 = like 1, but more detailed
+# 3 = like 2, but also trace data transfer
+#
+#Ice.Trace.Network=1
+
+#
+# Protocol Tracing
+#
+# 0 = no protocol tracing
+# 1 = trace protocol messages
+#
+#Ice.Trace.Protocol=1
diff --git a/cppe/demo/IceE/callback/CallbackSenderI.cpp b/cppe/demo/IceE/callback/CallbackSenderI.cpp
index cf492a4bb11..e3008b7f8d5 100644
--- a/cppe/demo/IceE/callback/CallbackSenderI.cpp
+++ b/cppe/demo/IceE/callback/CallbackSenderI.cpp
@@ -19,11 +19,11 @@ CallbackSenderI::initiateCallback(const CallbackReceiverPrx& proxy, const Ice::C
printf("initiating callback\n");
try
{
- proxy->callback(current.ctx);
+ proxy->callback(current.ctx);
}
catch(const Ice::Exception& ex)
{
- fprintf(stderr, "%s\n", ex.toString().c_str());
+ fprintf(stderr, "%s\n", ex.toString().c_str());
}
}
@@ -33,10 +33,10 @@ CallbackSenderI::shutdown(const Ice::Current& c)
printf("shutting down...\n");
try
{
- c.adapter->getCommunicator()->shutdown();
+ c.adapter->getCommunicator()->shutdown();
}
catch(const Ice::Exception& ex)
{
- fprintf(stderr, "%s\n", ex.toString().c_str());
+ fprintf(stderr, "%s\n", ex.toString().c_str());
}
}
diff --git a/cppe/demo/IceE/callback/Client.cpp b/cppe/demo/IceE/callback/Client.cpp
index da018dfec4a..dc3c2f9ab68 100644
--- a/cppe/demo/IceE/callback/Client.cpp
+++ b/cppe/demo/IceE/callback/Client.cpp
@@ -19,7 +19,7 @@ public:
virtual void callback(const Ice::Current&)
{
- printf("received callback\n");
+ printf("received callback\n");
}
};
@@ -47,30 +47,31 @@ run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator)
}
Ice::PropertiesPtr properties = communicator->getProperties();
- const char* proxyProperty = "Callback.Client.CallbackServer";
+ const char* proxyProperty = "CallbackSender.Proxy";
string proxy = properties->getProperty(proxyProperty);
if(proxy.empty())
{
- fprintf(stderr, "%s: property `%s' not set\n", argv[0], proxyProperty);
- return EXIT_FAILURE;
+ fprintf(stderr, "%s: property `%s' not set\n", argv[0], proxyProperty);
+ return EXIT_FAILURE;
}
Ice::ObjectPrx base = communicator->stringToProxy(proxy);
CallbackSenderPrx twoway = CallbackSenderPrx::checkedCast(base->ice_twoway()->ice_timeout(-1));
if(!twoway)
{
- fprintf(stderr, "%s: invalid proxy\n", argv[0]);
- return EXIT_FAILURE;
+ fprintf(stderr, "%s: invalid proxy\n", argv[0]);
+ return EXIT_FAILURE;
}
CallbackSenderPrx oneway = CallbackSenderPrx::uncheckedCast(twoway->ice_oneway());
CallbackSenderPrx batchOneway = CallbackSenderPrx::uncheckedCast(twoway->ice_batchOneway());
Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("Callback.Client");
- adapter->add(new CallbackReceiverI, communicator->stringToIdentity("callbackReceiver"));
+ CallbackReceiverPtr cr = new CallbackReceiverI;
+ adapter->add(cr, communicator->stringToIdentity("callbackReceiver"));
adapter->activate();
CallbackReceiverPrx twowayR = CallbackReceiverPrx::uncheckedCast(
- adapter->createProxy(communicator->stringToIdentity("callbackReceiver")));
+ adapter->createProxy(communicator->stringToIdentity("callbackReceiver")));
CallbackReceiverPrx onewayR = CallbackReceiverPrx::uncheckedCast(twowayR->ice_oneway());
menu();
@@ -78,52 +79,52 @@ run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator)
char c = EOF;
do
{
- try
- {
- printf("==> ");
- do
- {
- c = getchar();
- }
- while(c != EOF && c == '\n');
- if(c == 't')
- {
- twoway->initiateCallback(twowayR);
- }
- else if(c == 'o')
- {
- oneway->initiateCallback(onewayR);
- }
- else if(c == 'O')
- {
- batchOneway->initiateCallback(onewayR);
- }
- else if(c == 'f')
- {
- communicator->flushBatchRequests();
- }
- else if(c == 's')
- {
- twoway->shutdown();
- }
- else if(c == 'x')
- {
- // Nothing to do
- }
- else if(c == '?')
- {
- menu();
- }
- else
- {
- printf("unknown command `%c'\n", c);
- menu();
- }
- }
- catch(const Ice::Exception& ex)
- {
- fprintf(stderr, "%s\n", ex.toString().c_str());
- }
+ try
+ {
+ printf("==> ");
+ do
+ {
+ c = getchar();
+ }
+ while(c != EOF && c == '\n');
+ if(c == 't')
+ {
+ twoway->initiateCallback(twowayR);
+ }
+ else if(c == 'o')
+ {
+ oneway->initiateCallback(onewayR);
+ }
+ else if(c == 'O')
+ {
+ batchOneway->initiateCallback(onewayR);
+ }
+ else if(c == 'f')
+ {
+ communicator->flushBatchRequests();
+ }
+ else if(c == 's')
+ {
+ twoway->shutdown();
+ }
+ else if(c == 'x')
+ {
+ // Nothing to do
+ }
+ else if(c == '?')
+ {
+ menu();
+ }
+ else
+ {
+ printf("unknown command `%c'\n", c);
+ menu();
+ }
+ }
+ catch(const Ice::Exception& ex)
+ {
+ fprintf(stderr, "%s\n", ex.toString().c_str());
+ }
}
while(c != EOF && c != 'x');
@@ -140,7 +141,7 @@ main(int argc, char* argv[])
{
Ice::InitializationData initData;
initData.properties = Ice::createProperties();
- initData.properties->load("config");
+ initData.properties->load("config.client");
communicator = Ice::initialize(argc, argv, initData);
status = run(argc, argv, communicator);
}
diff --git a/cppe/demo/IceE/callback/Server.cpp b/cppe/demo/IceE/callback/Server.cpp
index 2950777c207..01997a21f21 100644
--- a/cppe/demo/IceE/callback/Server.cpp
+++ b/cppe/demo/IceE/callback/Server.cpp
@@ -23,7 +23,8 @@ run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator)
}
Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("Callback.Server");
- adapter->add(new CallbackSenderI, communicator->stringToIdentity("callback"));
+ CallbackSenderPtr cbs = new CallbackSenderI;
+ adapter->add(cbs, communicator->stringToIdentity("callback"));
adapter->activate();
communicator->waitForShutdown();
return EXIT_SUCCESS;
@@ -39,7 +40,7 @@ main(int argc, char* argv[])
{
Ice::InitializationData initData;
initData.properties = Ice::createProperties();
- initData.properties->load("config");
+ initData.properties->load("config.server");
communicator = Ice::initialize(argc, argv, initData);
status = run(argc, argv, communicator);
}
diff --git a/cppe/demo/IceE/callback/config b/cppe/demo/IceE/callback/config
deleted file mode 100644
index 3b224be4236..00000000000
--- a/cppe/demo/IceE/callback/config
+++ /dev/null
@@ -1,7 +0,0 @@
-Callback.Client.CallbackServer=callback:tcp -p 10000
-Callback.Client.Endpoints=tcp
-Callback.Server.Endpoints=tcp -p 10000
-
-#Ice.Trace.Network=1
-#Ice.Trace.Protocol=1
-Ice.Warn.Connections=1
diff --git a/cppe/demo/IceE/callback/config.client b/cppe/demo/IceE/callback/config.client
new file mode 100644
index 00000000000..012ddfb43b7
--- /dev/null
+++ b/cppe/demo/IceE/callback/config.client
@@ -0,0 +1,35 @@
+#
+# The client reads this property to create the reference to the
+# "CallbackSender" object in the server.
+#
+CallbackSender.Proxy=callback:tcp -p 10000
+
+#
+# The client creates one single object adapter with the name
+# "Callback.Client". The following line sets the endpoints for this
+# adapter.
+#
+Callback.Client.Endpoints=tcp
+
+#
+# Warn about connection exceptions.
+#
+Ice.Warn.Connections=1
+
+#
+# Network Tracing
+#
+# 0 = no network tracing
+# 1 = trace connection establishment and closure
+# 2 = like 1, but more detailed
+# 3 = like 2, but also trace data transfer
+#
+#Ice.Trace.Network=1
+
+#
+# Protocol Tracing
+#
+# 0 = no protocol tracing
+# 1 = trace protocol messages
+#
+#Ice.Trace.Protocol=1
diff --git a/cppe/demo/IceE/callback/config.server b/cppe/demo/IceE/callback/config.server
new file mode 100644
index 00000000000..d9c7154678a
--- /dev/null
+++ b/cppe/demo/IceE/callback/config.server
@@ -0,0 +1,29 @@
+#
+# The server creates one single object adapter with the name
+# "Callback.Server". The following line sets the endpoints for this
+# adapter.
+#
+Callback.Server.Endpoints=tcp -p 10000
+
+#
+# Warn about connection exceptions
+#
+Ice.Warn.Connections=1
+
+#
+# Network Tracing
+#
+# 0 = no network tracing
+# 1 = trace connection establishment and closure
+# 2 = like 1, but more detailed
+# 3 = like 2, but also trace data transfer
+#
+#Ice.Trace.Network=1
+
+#
+# Protocol Tracing
+#
+# 0 = no protocol tracing
+# 1 = trace protocol messages
+#
+#Ice.Trace.Protocol=1
diff --git a/cppe/demo/IceE/chat/ChatClient.cpp b/cppe/demo/IceE/chat/ChatClient.cpp
index f8acfe634cd..0f4be3f31d3 100644
--- a/cppe/demo/IceE/chat/ChatClient.cpp
+++ b/cppe/demo/IceE/chat/ChatClient.cpp
@@ -52,9 +52,9 @@ BOOL CChatClientApp::InitInstance()
LogIPtr log;
try
{
- Ice::InitializationData initData;
+ Ice::InitializationData initData;
log = new LogI;
- initData.logger = log;
+ initData.logger = log;
int argc = 0;
communicator = Ice::initialize(argc, 0, initData);
diff --git a/cppe/demo/IceE/chat/ChatClientDlg.cpp b/cppe/demo/IceE/chat/ChatClientDlg.cpp
index 216a77ba4d9..6bb3f13d32c 100644
--- a/cppe/demo/IceE/chat/ChatClientDlg.cpp
+++ b/cppe/demo/IceE/chat/ChatClientDlg.cpp
@@ -35,17 +35,15 @@ public:
virtual void
message(const string& data, const Ice::Current&)
{
- _log->message(data);
+ _log->message(data);
}
private:
const LogIPtr _log;
-
};
-CChatClientDlg::CChatClientDlg(const Ice::CommunicatorPtr& communicator, const LogIPtr& log,
- CWnd* pParent /*=NULL*/) :
+CChatClientDlg::CChatClientDlg(const Ice::CommunicatorPtr& communicator, const LogIPtr& log, CWnd* pParent /*=NULL*/) :
CDialog(CChatClientDlg::IDD, pParent),
_communicator(communicator),
_chat(0),
@@ -53,7 +51,7 @@ CChatClientDlg::CChatClientDlg(const Ice::CommunicatorPtr& communicator, const L
//_user(""), // For ease of testing these can be filled in.
//_password(""),
//_host(""),
- _port("10005")
+ _port("4063")
{
_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}
@@ -66,9 +64,9 @@ CChatClientDlg::~CChatClientDlg()
//
if(_ping)
{
- _ping->destroy();
- _ping->getThreadControl().join();
- _ping = 0;
+ _ping->destroy();
+ _ping->getThreadControl().join();
+ _ping = 0;
}
}
@@ -108,9 +106,9 @@ CChatClientDlg::setDialogState()
if(_chat == 0)
{
- //
- // Logged out: Disable all except Login.
- //
+ //
+ // Logged out: Disable all except Login.
+ //
_edit->EnableWindow(FALSE);
_display->EnableWindow(FALSE);
sendWnd->EnableWindow(FALSE);
@@ -120,23 +118,23 @@ CChatClientDlg::setDialogState()
configWnd->SetWindowText("Login");
#endif
- //
- // Set the focus to the login button
- //
- loginWnd->SetFocus();
-
- //
- // Set the default button.
- //
- sendWnd->SendMessage(BM_SETSTYLE, (WPARAM)BS_PUSHBUTTON, (LPARAM)TRUE);
- SendMessage(DM_SETDEFID, (WPARAM)IDC_CONFIG, 0);
- configWnd->SendMessage(BM_SETSTYLE, (WPARAM)BS_DEFPUSHBUTTON, (LPARAM)TRUE);
+ //
+ // Set the focus to the login button
+ //
+ loginWnd->SetFocus();
+
+ //
+ // Set the default button.
+ //
+ sendWnd->SendMessage(BM_SETSTYLE, (WPARAM)BS_PUSHBUTTON, (LPARAM)TRUE);
+ SendMessage(DM_SETDEFID, (WPARAM)IDC_CONFIG, 0);
+ configWnd->SendMessage(BM_SETSTYLE, (WPARAM)BS_DEFPUSHBUTTON, (LPARAM)TRUE);
}
else
{
//
- // Logged in: Enable all and change Login to Logout
- //
+ // Logged in: Enable all and change Login to Logout
+ //
_edit->EnableWindow(TRUE);
_display->EnableWindow(TRUE);
sendWnd->EnableWindow(TRUE);
@@ -147,12 +145,12 @@ CChatClientDlg::setDialogState()
#endif
_edit->SetFocus();
- //
- // Set the default button.
- //
- configWnd->SendMessage(BM_SETSTYLE, (WPARAM)BS_PUSHBUTTON, (LPARAM)TRUE);
- SendMessage(DM_SETDEFID, (WPARAM)IDC_SEND, 0);
- sendWnd->SendMessage(BM_SETSTYLE, (WPARAM)BS_DEFPUSHBUTTON, (LPARAM)TRUE);
+ //
+ // Set the default button.
+ //
+ configWnd->SendMessage(BM_SETSTYLE, (WPARAM)BS_PUSHBUTTON, (LPARAM)TRUE);
+ SendMessage(DM_SETDEFID, (WPARAM)IDC_SEND, 0);
+ sendWnd->SendMessage(BM_SETSTYLE, (WPARAM)BS_DEFPUSHBUTTON, (LPARAM)TRUE);
}
}
@@ -195,24 +193,24 @@ CChatClientDlg::OnCancel()
{
if(_chat)
{
- //
- // Clear the router.
- //
- assert(_router);
- try
- {
- _router->destroySession();
- }
+ //
+ // Clear the router.
+ //
+ assert(_router);
+ try
+ {
+ _router->destroySession();
+ }
catch(const Ice::ConnectionLostException&)
{
//
// Expected: the router closed the connection.
//
}
- catch(const Ice::Exception& ex)
- {
- AfxMessageBox(CString(ex.toString().c_str()), MB_OK|MB_ICONEXCLAMATION);
- }
+ catch(const Ice::Exception& ex)
+ {
+ AfxMessageBox(CString(ex.toString().c_str()), MB_OK|MB_ICONEXCLAMATION);
+ }
}
_log->setHandle(0);
@@ -283,15 +281,15 @@ CChatClientDlg::OnSend()
text.TrimRight();
if(text.IsEmpty())
{
- return;
+ return;
}
try
{
#ifdef _WIN32_WCE
- char buffer[256];
- wcstombs(buffer, text, 256);
- _chat->say(buffer);
+ char buffer[256];
+ wcstombs(buffer, text, 256);
+ _chat->say(buffer);
#else
_chat->say(string(text));
#endif
@@ -300,10 +298,10 @@ CChatClientDlg::OnSend()
{
AfxMessageBox(CString(e.toString().c_str()), MB_OK|MB_ICONEXCLAMATION);
- _ping->destroy();
- _ping->getThreadControl().join();
+ _ping->destroy();
+ _ping->getThreadControl().join();
- EndDialog(0);
+ EndDialog(0);
}
//
@@ -319,129 +317,127 @@ CChatClientDlg::OnLogin()
if(_chat == 0)
{
//
- // Login: Create and display login dialog.
- //
+ // Login: Create and display login dialog.
+ //
CChatConfigDlg dlg(_user, _password, _host, _port);
if(dlg.DoModal() == IDOK)
- {
- _user = dlg.getUser();
- _password = dlg.getPassword();
- _host = dlg.getHost();
- _port = dlg.getPort();
-
- string user;
- string password;
- string host;
- string port;
+ {
+ _user = dlg.getUser();
+ _password = dlg.getPassword();
+ _host = dlg.getHost();
+ _port = dlg.getPort();
+
+ string user;
+ string password;
+ string host;
+ string port;
#ifdef _WIN32_WCE
- char buffer[64];
- wcstombs(buffer, _user, 64);
- user = buffer;
+ char buffer[64];
+ wcstombs(buffer, _user, 64);
+ user = buffer;
- wcstombs(buffer, _password, 64);
- password = buffer;
+ wcstombs(buffer, _password, 64);
+ password = buffer;
- wcstombs(buffer, _host, 64);
- host = buffer;
+ wcstombs(buffer, _host, 64);
+ host = buffer;
- wcstombs(buffer, _port, 64);
- port = buffer;
+ wcstombs(buffer, _port, 64);
+ port = buffer;
#else
- user = _user;
- password = _password;
- host = _host;
- port = _port;
+ user = _user;
+ password = _password;
+ host = _host;
+ port = _port;
#endif
- try
- {
- string routerStr =
- Ice::printfToString("DemoGlacier2/router:tcp -p %s -h %s", port.c_str(), host.c_str());
- _router = Glacier2::RouterPrx::checkedCast(_communicator->stringToProxy(routerStr));
- assert(_router);
-
- //
- // Now setup the new router.
- //
- _chat = ChatSessionPrx::uncheckedCast(_router->createSession(user, password)->ice_router(_router));
-
-
- //
- // Create the OA.
- //
- _adapter = _communicator->createObjectAdapterWithRouter("Chat.Client", _router);
- _adapter->activate();
-
- //
- // Create the callback object. This must have the
- // category as defined by the Glacier2 session.
- //
- string category = _router->getServerProxy()->ice_getIdentity().category;
- Ice::Identity callbackReceiverIdent;
- callbackReceiverIdent.name = "callbackReceiver";
- callbackReceiverIdent.category = category;
- _callback = ChatCallbackPrx::uncheckedCast(
- _adapter->add(new ChatCallbackI(_log), callbackReceiverIdent));
-
- _chat->setCallback(_callback);
-
- //
- // Create a ping thread to keep the session alive.
- //
- _ping = new SessionPingThread(_chat, (long)_router->getSessionTimeout() / 2);
- _ping->start();
- }
- catch(const Glacier2::CannotCreateSessionException& ex)
- {
- AfxMessageBox(CString(ex.reason.c_str()), MB_OK|MB_ICONEXCLAMATION);
- }
- catch(const Ice::Exception& ex)
- {
- AfxMessageBox(CString(ex.toString().c_str()), MB_OK|MB_ICONEXCLAMATION);
- _chat = 0;
- }
- }
+ try
+ {
+ string routerStr =
+ Ice::printfToString("DemoGlacier2/router:tcp -p %s -h %s", port.c_str(), host.c_str());
+ _router = Glacier2::RouterPrx::checkedCast(_communicator->stringToProxy(routerStr));
+ assert(_router);
+
+ //
+ // Now setup the new router.
+ //
+ _chat = ChatSessionPrx::uncheckedCast(_router->createSession(user, password)->ice_router(_router));
+
+ //
+ // Create the OA.
+ //
+ _adapter = _communicator->createObjectAdapterWithRouter("Chat.Client", _router);
+ _adapter->activate();
+
+ //
+ // Create the callback object. This must have the
+ // category as defined by the Glacier2 session.
+ //
+ Ice::Identity callbackReceiverIdent;
+ callbackReceiverIdent.name = "callbackReceiver";
+ callbackReceiverIdent.category = _router->getCallbackForClient();
+ ChatCallbackPtr cb = new ChatCallbackI(_log);
+ _callback = ChatCallbackPrx::uncheckedCast(_adapter->add(cb, callbackReceiverIdent));
+
+ _chat->setCallback(_callback);
+
+ //
+ // Create a ping thread to keep the session alive.
+ //
+ _ping = new SessionPingThread(_chat, (long)_router->getSessionTimeout() / 2);
+ _ping->start();
+ }
+ catch(const Glacier2::CannotCreateSessionException& ex)
+ {
+ AfxMessageBox(CString(ex.reason.c_str()), MB_OK|MB_ICONEXCLAMATION);
+ }
+ catch(const Ice::Exception& ex)
+ {
+ AfxMessageBox(CString(ex.toString().c_str()), MB_OK|MB_ICONEXCLAMATION);
+ _chat = 0;
+ }
+ }
}
else
{
//
- // Logout: Destroy session and stop ping thread.
- //
- assert(_callback);
- _adapter->remove(_callback->ice_getIdentity());
- _callback = 0;
-
- assert(_chat);
- _chat = 0;
-
- //
- // Destroy the ping thread.
- //
- _ping->destroy();
- _ping->getThreadControl().join();
- _ping = 0;
-
- //
- // Clear the router.
- //
- assert(_router);
- try
- {
- _router->destroySession();
- }
+ // Logout: Destroy session and stop ping thread.
+ //
+ assert(_callback);
+ _adapter->remove(_callback->ice_getIdentity());
+ _callback = 0;
+
+ assert(_chat);
+ _chat = 0;
+
+ //
+ // Destroy the ping thread.
+ //
+ _ping->destroy();
+ _ping->getThreadControl().join();
+ _ping = 0;
+
+ //
+ // Clear the router.
+ //
+ assert(_router);
+ try
+ {
+ _router->destroySession();
+ }
catch(const Ice::ConnectionLostException&)
{
//
// Expected: the router closed the connection.
//
}
- catch(const Ice::Exception& ex)
- {
- AfxMessageBox(CString(ex.toString().c_str()), MB_OK|MB_ICONEXCLAMATION);
- }
+ catch(const Ice::Exception& ex)
+ {
+ AfxMessageBox(CString(ex.toString().c_str()), MB_OK|MB_ICONEXCLAMATION);
+ }
- _adapter->destroy();
- _router = 0;
+ _adapter->destroy();
+ _router = 0;
}
//
diff --git a/cppe/demo/IceE/chat/ChatConfigDlg.cpp b/cppe/demo/IceE/chat/ChatConfigDlg.cpp
index 5ff7993880a..3849f12bc6c 100644
--- a/cppe/demo/IceE/chat/ChatConfigDlg.cpp
+++ b/cppe/demo/IceE/chat/ChatConfigDlg.cpp
@@ -19,7 +19,7 @@
using namespace std;
CChatConfigDlg::CChatConfigDlg(const CString& user, const CString& password,
- const CString& host, const CString& port, CWnd* pParent /*=NULL*/) :
+ const CString& host, const CString& port, CWnd* pParent /*=NULL*/) :
CDialog(CChatConfigDlg::IDD, pParent),
_user(user),
_password(password),
diff --git a/cppe/demo/IceE/chat/Client.cpp b/cppe/demo/IceE/chat/Client.cpp
index 78b09f415bd..7559dd37ae4 100644
--- a/cppe/demo/IceE/chat/Client.cpp
+++ b/cppe/demo/IceE/chat/Client.cpp
@@ -24,7 +24,7 @@ public:
virtual void
message(const string& data, const Ice::Current&)
{
- printf("%s\n", data.c_str());
+ printf("%s\n", data.c_str());
}
};
@@ -46,6 +46,23 @@ trim(const string& s)
return s;
}
+void
+cleanup(const Glacier2::RouterPrx& router, const SessionPingThreadPtr& ping)
+{
+ try
+ {
+ router->destroySession();
+ }
+ catch(const Ice::ConnectionLostException&)
+ {
+ //
+ // Expected: the router closed the connection.
+ //
+ }
+ ping->destroy();
+ ping->getThreadControl().join();
+}
+
int
run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator)
{
@@ -63,12 +80,10 @@ run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator)
}
Glacier2::RouterPrx router = Glacier2::RouterPrx::checkedCast(defaultRouter);
+ if(!router)
{
- if(!router)
- {
- fprintf(stderr, "%s: configured router is not a Glacier2 router\n", argv[0]);
- return EXIT_FAILURE;
- }
+ fprintf(stderr, "%s: configured router is not a Glacier2 router\n", argv[0]);
+ return EXIT_FAILURE;
}
char buffer[1024];
@@ -76,40 +91,39 @@ run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator)
ChatSessionPrx session;
while(true)
{
- printf("This demo accepts any user-id / password combination.\n");
+ printf("This demo accepts any user-id / password combination.\n");
printf("user id: ");
- fgets(buffer, 1024, stdin);
- string id(buffer);
+ fgets(buffer, 1024, stdin);
+ string id(buffer);
id = trim(id);
printf("password: ");
- fgets(buffer, 1024, stdin);
- string pw(buffer);
+ fgets(buffer, 1024, stdin);
+ string pw(buffer);
pw = trim(pw);
try
{
- session = ChatSessionPrx::uncheckedCast(router->createSession(id, pw));
- break;
+ session = ChatSessionPrx::uncheckedCast(router->createSession(id, pw));
+ break;
}
catch(const Glacier2::PermissionDeniedException& ex)
{
- fprintf(stderr, "permission denied:\n%s", ex.toString().c_str());
+ fprintf(stderr, "permission denied:\n%s", ex.toString().c_str());
}
}
SessionPingThreadPtr ping = new SessionPingThread(session, (long)router->getSessionTimeout() / 2);
ping->start();
- string category = router->getServerProxy()->ice_getIdentity().category;
Ice::Identity callbackReceiverIdent;
callbackReceiverIdent.name = "callbackReceiver";
- callbackReceiverIdent.category = category;
+ callbackReceiverIdent.category = router->getCategoryForClient();
- Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("Chat.Client");
- ChatCallbackPrx callback = ChatCallbackPrx::uncheckedCast(
- adapter->add(new ChatCallbackI, callbackReceiverIdent));
+ Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapterWithRouter("Chat.Client", defaultRouter);
+ ChatCallbackPtr cb = new ChatCallbackI;
+ ChatCallbackPrx callback = ChatCallbackPrx::uncheckedCast(adapter->add(cb, callbackReceiverIdent));
adapter->activate();
session->setCallback(callback);
@@ -120,54 +134,42 @@ run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator)
{
do
{
- printf("==> ");
- char* ret = fgets(buffer, 1024, stdin);
- if(ret == NULL)
- {
- break;
- }
-
- string s(buffer);
- s = trim(s);
- if(!s.empty())
- {
- if(s[0] == '/')
- {
- if(s == "/quit")
- {
- break;
- }
- menu();
- }
- else
- {
- session->say(s);
- }
- }
- }
- while(true);
-
- try
- {
- router->destroySession();
- }
- catch(const Ice::ConnectionLostException&)
- {
- //
- // Expected: the router closed the connection.
- //
- }
+ printf("==> ");
+ char* ret = fgets(buffer, 1024, stdin);
+ if(ret == NULL)
+ {
+ break;
+ }
+
+ string s(buffer);
+ s = trim(s);
+ if(!s.empty())
+ {
+ if(s[0] == '/')
+ {
+ if(s == "/quit")
+ {
+ break;
+ }
+ menu();
+ }
+ else
+ {
+ session->say(s);
+ }
+ }
+ }
+ while(true);
+
+ cleanup(router, ping);
}
catch(const Ice::Exception& ex)
{
fprintf(stderr, "%s\n", ex.toString().c_str());
- ping->destroy();
- ping->getThreadControl().join();
+ cleanup(router, ping);
+
return EXIT_FAILURE;
}
-
- ping->destroy();
- ping->getThreadControl().join();
return EXIT_SUCCESS;
}
diff --git a/cppe/demo/IceE/chat/LogI.cpp b/cppe/demo/IceE/chat/LogI.cpp
index dbed3ad13c9..7577334bb12 100644
--- a/cppe/demo/IceE/chat/LogI.cpp
+++ b/cppe/demo/IceE/chat/LogI.cpp
@@ -65,7 +65,7 @@ LogI::message(const string& msg)
string line = msg + "\r\n";
if(_hwnd)
{
- post(line);
+ post(line);
}
else
{
@@ -79,7 +79,7 @@ LogI::setHandle(HWND hwnd)
_hwnd = hwnd;
if(_hwnd != 0 && !_buffer.empty())
{
- post(_buffer);
+ post(_buffer);
_buffer.clear();
}
}
diff --git a/cppe/demo/IceE/chat/README b/cppe/demo/IceE/chat/README
index 9204b31ccc2..fd026868442 100644
--- a/cppe/demo/IceE/chat/README
+++ b/cppe/demo/IceE/chat/README
@@ -16,11 +16,11 @@ public interface instead of the loopback interface.
For most configurations the property can be changed from:
-Glacier2.Client.Endpoints=ssl -p 10005 -h 127.0.0.1
+Glacier2.Client.Endpoints=ssl -p 4064 -h 127.0.0.1
to:
-Glacier2.Client.Endpoints=tcp -p 10005
+Glacier2.Client.Endpoints=tcp -p 4063
Next, start the Glacier2 router:
diff --git a/cppe/demo/IceE/chat/Router.ice b/cppe/demo/IceE/chat/Router.ice
index 5f22e1081bf..a8d117da000 100644
--- a/cppe/demo/IceE/chat/Router.ice
+++ b/cppe/demo/IceE/chat/Router.ice
@@ -107,7 +107,7 @@ interface Router extends Ice::Router
*
**/
Session* createSession(string userId, string password)
- throws PermissionDeniedException, CannotCreateSessionException;
+ throws PermissionDeniedException, CannotCreateSessionException;
/**
*
@@ -118,7 +118,7 @@ interface Router extends Ice::Router
*
**/
void destroySession()
- throws SessionNotExistException;
+ throws SessionNotExistException;
/**
*
diff --git a/cppe/demo/IceE/chat/Session.ice b/cppe/demo/IceE/chat/Session.ice
index f2fb6861fc3..f1f9c39b54d 100644
--- a/cppe/demo/IceE/chat/Session.ice
+++ b/cppe/demo/IceE/chat/Session.ice
@@ -224,7 +224,7 @@ interface SessionManager
*
**/
Session* create(string userId, SessionControl* control)
- throws CannotCreateSessionException;
+ throws CannotCreateSessionException;
};
};
diff --git a/cppe/demo/IceE/chat/config b/cppe/demo/IceE/chat/config
index 83d3000811e..e6dec3e0505 100644
--- a/cppe/demo/IceE/chat/config
+++ b/cppe/demo/IceE/chat/config
@@ -2,14 +2,7 @@
# The proxy to the Glacier2 router for all outgoing connections. This
# must match the value of Glacier2.Client.Endpoints in config.glacier2.
#
-Ice.Default.Router=DemoGlacier2/router:tcp -p 10005 -h 127.0.0.1
-
-#
-# The proxy for the Glacier2 router, installed in the client's
-# object adapter named Chat.Client. This router proxy must
-# match the value of Glacier2.Client.Endpoints.
-#
-Chat.Client.Router=DemoGlacier2/router:tcp -p 10005 -h 127.0.0.1
+Ice.Default.Router=DemoGlacier2/router:tcp -p 4063 -h 127.0.0.1
#
# We don't need any endpoints for the client if we use a
@@ -25,9 +18,24 @@ Chat.Client.Endpoints=
Ice.RetryIntervals=-1
#
-# Other settings.
+# Warn about connection exceptions
#
+#Ice.Warn.Connections=1
+#
+# Network Tracing
+#
+# 0 = no network tracing
+# 1 = trace connection establishment and closure
+# 2 = like 1, but more detailed
+# 3 = like 2, but also trace data transfer
+#
#Ice.Trace.Network=1
+
+#
+# Protocol Tracing
+#
+# 0 = no protocol tracing
+# 1 = trace protocol messages
+#
#Ice.Trace.Protocol=1
-#Ice.Warn.Connections=1
diff --git a/cppe/demo/IceE/chat/stdafx.h b/cppe/demo/IceE/chat/stdafx.h
index 64165af5a41..7316cf46505 100644
--- a/cppe/demo/IceE/chat/stdafx.h
+++ b/cppe/demo/IceE/chat/stdafx.h
@@ -51,21 +51,21 @@
#endif // _WIN32_WCE
#ifndef VC_EXTRALEAN
-#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
+#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
#endif
#include <afxwin.h> // MFC core and standard components
#include <afxext.h> // MFC extensions
#if defined(_WIN32_WCE) && (_WIN32_WCE >= 211) && (_AFXDLL)
-#include <afxdtctl.h> // MFC support for Internet Explorer 4 Common Controls
+#include <afxdtctl.h> // MFC support for Internet Explorer 4 Common Controls
#endif
#ifndef _AFX_NO_AFXCMN_SUPPORT
-#include <afxcmn.h> // MFC support for Windows Common Controls
+#include <afxcmn.h> // MFC support for Windows Common Controls
#endif // _AFX_NO_AFXCMN_SUPPORT
-#include <afxsock.h> // MFC socket extensions
+#include <afxsock.h> // MFC socket extensions
//{{AFX_INSERT_LOCATION}}
// Microsoft eMbedded Visual C++ will insert additional declarations immediately before the previous line.
diff --git a/cppe/demo/IceE/hello/Client.cpp b/cppe/demo/IceE/hello/Client.cpp
index f2174d5e25b..f739944e5e2 100644
--- a/cppe/demo/IceE/hello/Client.cpp
+++ b/cppe/demo/IceE/hello/Client.cpp
@@ -44,16 +44,16 @@ run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator)
string proxy = properties->getProperty(proxyProperty);
if(proxy.empty())
{
- fprintf(stderr, "%s: property `%s' not set\n", argv[0], proxyProperty);
- return EXIT_FAILURE;
+ fprintf(stderr, "%s: property `%s' not set\n", argv[0], proxyProperty);
+ return EXIT_FAILURE;
}
Ice::ObjectPrx base = communicator->stringToProxy(proxy);
HelloPrx twoway = HelloPrx::checkedCast(base->ice_twoway()->ice_timeout(-1));
if(!twoway)
{
- fprintf(stderr, "%s: invalid proxy\n", argv[0]);
- return EXIT_FAILURE;
+ fprintf(stderr, "%s: invalid proxy\n", argv[0]);
+ return EXIT_FAILURE;
}
HelloPrx oneway = HelloPrx::uncheckedCast(twoway->ice_oneway());
#ifdef ICEE_HAS_BATCH
@@ -68,99 +68,99 @@ run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator)
char c = EOF;
do
{
- try
- {
- printf("==> ");
- do
- {
- c = getchar();
- }
- while(c != EOF && c == '\n');
- if(c == 't')
- {
- twoway->sayHello(delay);
- }
- else if(c == 'o')
- {
- oneway->sayHello(delay);
- }
+ try
+ {
+ printf("==> ");
+ do
+ {
+ c = getchar();
+ }
+ while(c != EOF && c == '\n');
+ if(c == 't')
+ {
+ twoway->sayHello(delay);
+ }
+ else if(c == 'o')
+ {
+ oneway->sayHello(delay);
+ }
#ifdef ICEE_HAS_BATCH
- else if(c == 'O')
- {
- batchOneway->sayHello(delay);
- }
- else if(c == 'f')
- {
- communicator->flushBatchRequests();
- }
+ else if(c == 'O')
+ {
+ batchOneway->sayHello(delay);
+ }
+ else if(c == 'f')
+ {
+ communicator->flushBatchRequests();
+ }
#endif
- else if(c == 'T')
- {
- if(timeout == -1)
- {
- timeout = 2000;
- }
- else
- {
- timeout = -1;
- }
-
- twoway = HelloPrx::uncheckedCast(twoway->ice_timeout(timeout));
- oneway = HelloPrx::uncheckedCast(oneway->ice_timeout(timeout));
+ else if(c == 'T')
+ {
+ if(timeout == -1)
+ {
+ timeout = 2000;
+ }
+ else
+ {
+ timeout = -1;
+ }
+
+ twoway = HelloPrx::uncheckedCast(twoway->ice_timeout(timeout));
+ oneway = HelloPrx::uncheckedCast(oneway->ice_timeout(timeout));
#ifdef ICEE_HAS_BATCH
- batchOneway = HelloPrx::uncheckedCast(batchOneway->ice_timeout(timeout));
-#endif
- if(timeout == -1)
- {
- printf("timeout is now switched off\n");
- }
- else
- {
- printf("timeout is now set to 2000ms\n");
- }
- }
- else if(c == 'P')
- {
- if(delay == 0)
- {
- delay = 2500;
- }
- else
- {
- delay = 0;
- }
-
- if(delay == 0)
- {
- printf("server delay is now deactivated\n");
- }
- else
- {
- printf("server delay is now set to 2500ms\n");
- }
- }
- else if(c == 's')
- {
- twoway->shutdown();
- }
- else if(c == 'x')
- {
- // Nothing to do
- }
- else if(c == '?')
- {
- menu();
- }
- else
- {
- printf("unknown command `%c'\n", c);
- menu();
- }
- }
- catch(const Ice::Exception& ex)
- {
- fprintf(stderr, "%s\n", ex.toString().c_str());
- }
+ batchOneway = HelloPrx::uncheckedCast(batchOneway->ice_timeout(timeout));
+#endif
+ if(timeout == -1)
+ {
+ printf("timeout is now switched off\n");
+ }
+ else
+ {
+ printf("timeout is now set to 2000ms\n");
+ }
+ }
+ else if(c == 'P')
+ {
+ if(delay == 0)
+ {
+ delay = 2500;
+ }
+ else
+ {
+ delay = 0;
+ }
+
+ if(delay == 0)
+ {
+ printf("server delay is now deactivated\n");
+ }
+ else
+ {
+ printf("server delay is now set to 2500ms\n");
+ }
+ }
+ else if(c == 's')
+ {
+ twoway->shutdown();
+ }
+ else if(c == 'x')
+ {
+ // Nothing to do
+ }
+ else if(c == '?')
+ {
+ menu();
+ }
+ else
+ {
+ printf("unknown command `%c'\n", c);
+ menu();
+ }
+ }
+ catch(const Ice::Exception& ex)
+ {
+ fprintf(stderr, "%s\n", ex.toString().c_str());
+ }
}
while(c != EOF && c != 'x');
@@ -175,29 +175,29 @@ main(int argc, char* argv[])
try
{
- Ice::InitializationData initData;
- initData.properties = Ice::createProperties();
- initData.properties->load("config");
- communicator = Ice::initialize(argc, argv, initData);
- status = run(argc, argv, communicator);
+ Ice::InitializationData initData;
+ initData.properties = Ice::createProperties();
+ initData.properties->load("config.client");
+ communicator = Ice::initialize(argc, argv, initData);
+ status = run(argc, argv, communicator);
}
catch(const Ice::Exception& ex)
{
- fprintf(stderr, "%s\n", ex.toString().c_str());
- status = EXIT_FAILURE;
+ fprintf(stderr, "%s\n", ex.toString().c_str());
+ status = EXIT_FAILURE;
}
if(communicator)
{
- try
- {
- communicator->destroy();
- }
- catch(const Ice::Exception& ex)
- {
- fprintf(stderr, "%s\n", ex.toString().c_str());
- status = EXIT_FAILURE;
- }
+ try
+ {
+ communicator->destroy();
+ }
+ catch(const Ice::Exception& ex)
+ {
+ fprintf(stderr, "%s\n", ex.toString().c_str());
+ status = EXIT_FAILURE;
+ }
}
return status;
diff --git a/cppe/demo/IceE/hello/Server.cpp b/cppe/demo/IceE/hello/Server.cpp
index e428c1c9dfa..313cb6a9948 100644
--- a/cppe/demo/IceE/hello/Server.cpp
+++ b/cppe/demo/IceE/hello/Server.cpp
@@ -22,7 +22,7 @@ run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator)
}
Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("Hello");
- Ice::ObjectPtr object = new HelloI;
+ Demo::HelloPtr object = new HelloI;
adapter->add(object, communicator->stringToIdentity("hello"));
adapter->activate();
communicator->waitForShutdown();
@@ -38,29 +38,29 @@ main(int argc, char* argv[])
try
{
Ice::InitializationData initData;
- initData.properties = Ice::createProperties();
- initData.properties->load("config");
- initData.properties->setProperty("Ice.Override.Timeout", "100");
- communicator = Ice::initialize(argc, argv, initData);
- status = run(argc, argv, communicator);
+ initData.properties = Ice::createProperties();
+ initData.properties->load("config.server");
+ initData.properties->setProperty("Ice.Override.Timeout", "100");
+ communicator = Ice::initialize(argc, argv, initData);
+ status = run(argc, argv, communicator);
}
catch(const Ice::Exception& ex)
{
- fprintf(stderr, "%s\n", ex.toString().c_str());
- status = EXIT_FAILURE;
+ fprintf(stderr, "%s\n", ex.toString().c_str());
+ status = EXIT_FAILURE;
}
if(communicator)
{
- try
- {
- communicator->destroy();
- }
- catch(const Ice::Exception& ex)
- {
- fprintf(stderr, "%s\n", ex.toString().c_str());
- status = EXIT_FAILURE;
- }
+ try
+ {
+ communicator->destroy();
+ }
+ catch(const Ice::Exception& ex)
+ {
+ fprintf(stderr, "%s\n", ex.toString().c_str());
+ status = EXIT_FAILURE;
+ }
}
return status;
diff --git a/javae/demo/IceE/jdk/hello/config b/cppe/demo/IceE/hello/config.client
index 60443cdf567..0cea3d3bc26 100644
--- a/javae/demo/IceE/jdk/hello/config
+++ b/cppe/demo/IceE/hello/config.client
@@ -5,13 +5,6 @@
Hello.Proxy=hello:tcp -p 10000
#
-# The server creates one single object adapter with the name
-# "helloadapater". The following line sets the endpoints for this
-# adapter
-#
-Hello.Endpoints=tcp -p 10000
-
-#
# Warn about connection exceptions
#
Ice.Warn.Connections=1
@@ -24,7 +17,7 @@ Ice.Warn.Connections=1
# 2 = like 1, but more detailed
# 3 = like 2, but also trace data transfer
#
-Ice.Trace.Network=0
+#Ice.Trace.Network=1
#
# Protocol Tracing
@@ -32,4 +25,4 @@ Ice.Trace.Network=0
# 0 = no protocol tracing
# 1 = trace protocol messages
#
-Ice.Trace.Protocol=0
+#Ice.Trace.Protocol=1
diff --git a/cppe/demo/IceE/minimal/config b/cppe/demo/IceE/hello/config.server
index 9a0c897c2d4..147d3c96ade 100644
--- a/cppe/demo/IceE/minimal/config
+++ b/cppe/demo/IceE/hello/config.server
@@ -1,10 +1,4 @@
#
-# The client reads this property to create the reference to the
-# "hello" object in the server.
-#
-Hello.Proxy=hello:tcp -p 10000
-
-#
# The server creates one single object adapter with the name
# "Hello". The following line sets the endpoints for this
# adapter.
@@ -24,7 +18,7 @@ Ice.Warn.Connections=1
# 2 = like 1, but more detailed
# 3 = like 2, but also trace data transfer
#
-Ice.Trace.Network=0
+#Ice.Trace.Network=1
#
# Protocol Tracing
@@ -32,4 +26,4 @@ Ice.Trace.Network=0
# 0 = no protocol tracing
# 1 = trace protocol messages
#
-Ice.Trace.Protocol=0
+#Ice.Trace.Protocol=1
diff --git a/cppe/demo/IceE/latency/Client.cpp b/cppe/demo/IceE/latency/Client.cpp
index 919ec2375bb..7d2230d259f 100644
--- a/cppe/demo/IceE/latency/Client.cpp
+++ b/cppe/demo/IceE/latency/Client.cpp
@@ -23,20 +23,20 @@ run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator)
}
Ice::PropertiesPtr properties = communicator->getProperties();
- const char* proxyProperty = "Latency.Proxy";
+ const char* proxyProperty = "Ping.Proxy";
string proxy = properties->getProperty(proxyProperty);
if(proxy.empty())
{
- fprintf(stderr, "%s: property `%s' not set\n", argv[0], proxyProperty);
- return EXIT_FAILURE;
+ fprintf(stderr, "%s: property `%s' not set\n", argv[0], proxyProperty);
+ return EXIT_FAILURE;
}
Ice::ObjectPrx base = communicator->stringToProxy(proxy);
PingPrx ping = PingPrx::checkedCast(base);
if(!ping)
{
- fprintf(stderr, "%s: invalid proxy\n", argv[0]);
- return EXIT_FAILURE;
+ fprintf(stderr, "%s: invalid proxy\n", argv[0]);
+ return EXIT_FAILURE;
}
// Initial ping to setup the connection.
@@ -48,7 +48,7 @@ run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator)
printf("pinging server %d times (this may take a while)\n", repetitions);
for(int i = 0; i < repetitions; ++i)
{
- ping->ice_ping();
+ ping->ice_ping();
}
tm = IceUtil::Time::now() - tm;
@@ -68,28 +68,28 @@ main(int argc, char* argv[])
try
{
Ice::InitializationData initData;
- initData.properties = Ice::createProperties();
- initData.properties->load("config");
- communicator = Ice::initialize(argc, argv, initData);
- status = run(argc, argv, communicator);
+ initData.properties = Ice::createProperties();
+ initData.properties->load("config.client");
+ communicator = Ice::initialize(argc, argv, initData);
+ status = run(argc, argv, communicator);
}
catch(const Ice::Exception& ex)
{
- fprintf(stderr, "%s\n", ex.toString().c_str());
- status = EXIT_FAILURE;
+ fprintf(stderr, "%s\n", ex.toString().c_str());
+ status = EXIT_FAILURE;
}
if(communicator)
{
- try
- {
- communicator->destroy();
- }
- catch(const Ice::Exception& ex)
- {
- fprintf(stderr, "%s\n", ex.toString().c_str());
- status = EXIT_FAILURE;
- }
+ try
+ {
+ communicator->destroy();
+ }
+ catch(const Ice::Exception& ex)
+ {
+ fprintf(stderr, "%s\n", ex.toString().c_str());
+ status = EXIT_FAILURE;
+ }
}
return status;
diff --git a/cppe/demo/IceE/latency/Server.cpp b/cppe/demo/IceE/latency/Server.cpp
index d2abde441e3..c588ba75985 100644
--- a/cppe/demo/IceE/latency/Server.cpp
+++ b/cppe/demo/IceE/latency/Server.cpp
@@ -13,12 +13,6 @@
using namespace std;
using namespace Demo;
-class PingI : public Ping
-{
-public:
- // no methods.
-};
-
int
run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator)
{
@@ -29,7 +23,8 @@ run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator)
}
Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("Latency");
- adapter->add(new PingI, communicator->stringToIdentity("ping"));
+ Ice::ObjectPtr object = new Ping;
+ adapter->add(object, communicator->stringToIdentity("ping"));
adapter->activate();
communicator->waitForShutdown();
return EXIT_SUCCESS;
@@ -44,28 +39,28 @@ main(int argc, char* argv[])
try
{
Ice::InitializationData initData;
- initData.properties = Ice::createProperties();
- initData.properties->load("config");
- communicator = Ice::initialize(argc, argv, initData);
- status = run(argc, argv, communicator);
+ initData.properties = Ice::createProperties();
+ initData.properties->load("config.server");
+ communicator = Ice::initialize(argc, argv, initData);
+ status = run(argc, argv, communicator);
}
catch(const Ice::Exception& ex)
{
- fprintf(stderr, "%s\n", ex.toString().c_str());
- status = EXIT_FAILURE;
+ fprintf(stderr, "%s\n", ex.toString().c_str());
+ status = EXIT_FAILURE;
}
if(communicator)
{
- try
- {
- communicator->destroy();
- }
- catch(const Ice::Exception& ex)
- {
- fprintf(stderr, "%s\n", ex.toString().c_str());
- status = EXIT_FAILURE;
- }
+ try
+ {
+ communicator->destroy();
+ }
+ catch(const Ice::Exception& ex)
+ {
+ fprintf(stderr, "%s\n", ex.toString().c_str());
+ status = EXIT_FAILURE;
+ }
}
return status;
diff --git a/cppe/demo/IceE/latency/WinCEClient.cpp b/cppe/demo/IceE/latency/WinCEClient.cpp
index 753150d5c9b..70542c2bd11 100644
--- a/cppe/demo/IceE/latency/WinCEClient.cpp
+++ b/cppe/demo/IceE/latency/WinCEClient.cpp
@@ -23,35 +23,35 @@ WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
case WM_CREATE:
{
- RECT rcClient;
- GetClientRect(hWnd, &rcClient);
- editHwnd = CreateWindowEx(WS_EX_CLIENTEDGE, L"EDIT", L"",
- WS_CHILD | WS_VISIBLE | WS_VSCROLL | ES_MULTILINE,
- 0, 0, rcClient.right - rcClient.left, rcClient.bottom - rcClient.top,
- hWnd, (HMENU)101, GetModuleHandle(NULL), NULL);
- assert(editHwnd != NULL);
+ RECT rcClient;
+ GetClientRect(hWnd, &rcClient);
+ editHwnd = CreateWindowEx(WS_EX_CLIENTEDGE, L"EDIT", L"",
+ WS_CHILD | WS_VISIBLE | WS_VSCROLL | ES_MULTILINE,
+ 0, 0, rcClient.right - rcClient.left, rcClient.bottom - rcClient.top,
+ hWnd, (HMENU)101, GetModuleHandle(NULL), NULL);
+ assert(editHwnd != NULL);
}
break;
case WM_SIZE:
{
- RECT rcClient;
- GetClientRect(hWnd, &rcClient);
- SetWindowPos(editHwnd, NULL, 0, 0, rcClient.right, rcClient.bottom, SWP_NOZORDER);
+ RECT rcClient;
+ GetClientRect(hWnd, &rcClient);
+ SetWindowPos(editHwnd, NULL, 0, 0, rcClient.right, rcClient.bottom, SWP_NOZORDER);
}
break;
case WM_CLOSE:
- DestroyWindow(hWnd);
- break;
+ DestroyWindow(hWnd);
+ break;
case WM_DESTROY:
- wmDestroy = true;
- PostQuitMessage(0);
- break;
+ wmDestroy = true;
+ PostQuitMessage(0);
+ break;
default:
- return DefWindowProc(hWnd, msg, wParam, lParam);
+ return DefWindowProc(hWnd, msg, wParam, lParam);
}
return 0;
}
@@ -62,21 +62,21 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmd
static const TCHAR windowClassName[] = L"Latency Client";
WNDCLASS wc;
- wc.style = CS_HREDRAW|CS_VREDRAW;
- wc.lpfnWndProc = (WNDPROC)WndProc;
- wc.cbClsExtra = 0;
- wc.cbWndExtra = 0;
- wc.hInstance = hInstance;
- wc.hIcon = LoadIcon(NULL, 0);
- wc.hCursor = 0;
- wc.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH);
+ wc.style = CS_HREDRAW|CS_VREDRAW;
+ wc.lpfnWndProc = (WNDPROC)WndProc;
+ wc.cbClsExtra = 0;
+ wc.cbWndExtra = 0;
+ wc.hInstance = hInstance;
+ wc.hIcon = LoadIcon(NULL, 0);
+ wc.hCursor = 0;
+ wc.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH);
wc.lpszMenuName = NULL;
wc.lpszClassName = windowClassName;
if(!RegisterClass(&wc))
{
- MessageBox(NULL, L"Window Registration Failed!", L"Error!", MB_ICONEXCLAMATION | MB_OK);
- return 0;
+ MessageBox(NULL, L"Window Registration Failed!", L"Error!", MB_ICONEXCLAMATION | MB_OK);
+ return 0;
}
RECT rect;
@@ -84,20 +84,20 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmd
int width = rect.right - rect.left;
if(width > 320)
{
- width = 320;
+ width = 320;
}
int height = rect.bottom - rect.top;
if(height > 200)
{
- height = 200;
+ height = 200;
}
HWND mainWnd = CreateWindow(windowClassName, L"Latency Client", WS_VISIBLE|WS_OVERLAPPED|WS_SYSMENU|WS_SIZEBOX,
- CW_USEDEFAULT, CW_USEDEFAULT, width, height,
- NULL, NULL, hInstance, NULL);
+ CW_USEDEFAULT, CW_USEDEFAULT, width, height,
+ NULL, NULL, hInstance, NULL);
if(mainWnd == NULL)
{
- MessageBox(NULL, L"Window Creation Failed!", L"Error!", MB_ICONEXCLAMATION | MB_OK);
- return 0;
+ MessageBox(NULL, L"Window Creation Failed!", L"Error!", MB_ICONEXCLAMATION | MB_OK);
+ return 0;
}
ShowWindow(mainWnd, SW_SHOW);
@@ -109,110 +109,110 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmd
try
{
Ice::InitializationData initData;
- initData.properties = Ice::createProperties();
-
- //
- // Set a default value for Latency.Proxy so that the demo will
- // run without a configuration file.
- //
- initData.properties->setProperty("Latency.Proxy", "ping:tcp -p 10000");
-
- //
- // Now, load the configuration file if present. Under WinCE we
- // use "config.txt" since it can be edited with pocket word.
- //
- try
- {
- initData.properties->load("config.txt");
- }
- catch(const Ice::FileException&)
- {
- }
-
- communicator = Ice::initialize(__argc, __argv, initData);
-
- const char* proxyProperty = "Latency.Proxy";
- string proxy = initData.properties->getProperty(proxyProperty);
-
- PingPrx ping = PingPrx::checkedCast(communicator->stringToProxy(proxy));
- if(!ping)
- {
- MessageBox(NULL, L"invalid proxy", L"Latency Client", MB_ICONEXCLAMATION | MB_OK);
- return EXIT_FAILURE;
- }
-
- // Initial ping to setup the connection.
- ping->ice_ping();
-
- IceUtil::Time tm = IceUtil::Time::now();
-
- const int repetitions = 10000;
- wchar_t buf[1000];
- wsprintf(buf, L"pinging server %d times (this may take a while)\r\n", repetitions);
- ::SendMessage(editHwnd, EM_REPLACESEL, (WPARAM)FALSE, (LPARAM)buf);
- for(int i = 0; i < repetitions; ++i)
- {
- ping->ice_ping();
- if((i % 100) == 0)
- {
- ::SendMessage(editHwnd, EM_REPLACESEL, (WPARAM)FALSE, (LPARAM)L".");
- //
- // Run the message pump just in case the user tries to close the app.
- //
- MSG Msg;
- while(PeekMessage(&Msg, NULL, 0, 0, PM_REMOVE))
- {
- TranslateMessage(&Msg);
- DispatchMessage(&Msg);
- }
- if(wmDestroy)
- {
- break;
- }
- }
- }
-
- tm = IceUtil::Time::now() - tm;
-
- wsprintf(buf, L"\r\ntime for %d pings: %fms\r\ntime per ping: %fms\r\n",
- repetitions, tm.toMilliSecondsDouble(), tm.toMilliSecondsDouble() / repetitions);
- ::SendMessage(editHwnd, EM_REPLACESEL, (WPARAM)FALSE, (LPARAM)buf);
-
- //
- // Run the message pump.
- //
- MSG Msg;
- while(GetMessage(&Msg, NULL, 0, 0) > 0)
- {
- TranslateMessage(&Msg);
- DispatchMessage(&Msg);
- }
+ initData.properties = Ice::createProperties();
+
+ //
+ // Set a default value for Ping.Proxy so that the demo will
+ // run without a configuration file.
+ //
+ initData.properties->setProperty("Ping.Proxy", "ping:tcp -p 10000");
+
+ //
+ // Now, load the configuration file if present. Under WinCE we
+ // use "config.txt" since it can be edited with pocket word.
+ //
+ try
+ {
+ initData.properties->load("config.txt");
+ }
+ catch(const Ice::FileException&)
+ {
+ }
+
+ communicator = Ice::initialize(__argc, __argv, initData);
+
+ const char* proxyProperty = "Ping.Proxy";
+ string proxy = initData.properties->getProperty(proxyProperty);
+
+ PingPrx ping = PingPrx::checkedCast(communicator->stringToProxy(proxy));
+ if(!ping)
+ {
+ MessageBox(NULL, L"invalid proxy", L"Latency Client", MB_ICONEXCLAMATION | MB_OK);
+ return EXIT_FAILURE;
+ }
+
+ // Initial ping to setup the connection.
+ ping->ice_ping();
+
+ IceUtil::Time tm = IceUtil::Time::now();
+
+ const int repetitions = 10000;
+ wchar_t buf[1000];
+ wsprintf(buf, L"pinging server %d times (this may take a while)\r\n", repetitions);
+ ::SendMessage(editHwnd, EM_REPLACESEL, (WPARAM)FALSE, (LPARAM)buf);
+ for(int i = 0; i < repetitions; ++i)
+ {
+ ping->ice_ping();
+ if((i % 100) == 0)
+ {
+ ::SendMessage(editHwnd, EM_REPLACESEL, (WPARAM)FALSE, (LPARAM)L".");
+ //
+ // Run the message pump just in case the user tries to close the app.
+ //
+ MSG Msg;
+ while(PeekMessage(&Msg, NULL, 0, 0, PM_REMOVE))
+ {
+ TranslateMessage(&Msg);
+ DispatchMessage(&Msg);
+ }
+ if(wmDestroy)
+ {
+ break;
+ }
+ }
+ }
+
+ tm = IceUtil::Time::now() - tm;
+
+ wsprintf(buf, L"\r\ntime for %d pings: %fms\r\ntime per ping: %fms\r\n",
+ repetitions, tm.toMilliSecondsDouble(), tm.toMilliSecondsDouble() / repetitions);
+ ::SendMessage(editHwnd, EM_REPLACESEL, (WPARAM)FALSE, (LPARAM)buf);
+
+ //
+ // Run the message pump.
+ //
+ MSG Msg;
+ while(GetMessage(&Msg, NULL, 0, 0) > 0)
+ {
+ TranslateMessage(&Msg);
+ DispatchMessage(&Msg);
+ }
}
catch(const Ice::Exception& ex)
{
- TCHAR wtext[1024];
- string err = ex.toString();
- mbstowcs(wtext, err.c_str(), err.size());
- MessageBox(NULL, wtext, L"Error", MB_ICONEXCLAMATION | MB_OK);
+ TCHAR wtext[1024];
+ string err = ex.toString();
+ mbstowcs(wtext, err.c_str(), err.size());
+ MessageBox(NULL, wtext, L"Error", MB_ICONEXCLAMATION | MB_OK);
- status = EXIT_FAILURE;
+ status = EXIT_FAILURE;
}
if(communicator)
{
- try
- {
- communicator->destroy();
- }
- catch(const Ice::Exception& ex)
- {
- TCHAR wtext[1024];
- string err = ex.toString();
- mbstowcs(wtext, err.c_str(), err.size());
- MessageBox(NULL, wtext, L"Error", MB_ICONEXCLAMATION | MB_OK);
-
- status = EXIT_FAILURE;
- }
+ try
+ {
+ communicator->destroy();
+ }
+ catch(const Ice::Exception& ex)
+ {
+ TCHAR wtext[1024];
+ string err = ex.toString();
+ mbstowcs(wtext, err.c_str(), err.size());
+ MessageBox(NULL, wtext, L"Error", MB_ICONEXCLAMATION | MB_OK);
+
+ status = EXIT_FAILURE;
+ }
}
return status;
diff --git a/cppe/demo/IceE/latency/WinCEServer.cpp b/cppe/demo/IceE/latency/WinCEServer.cpp
index 4e40dcb27ef..3b9b27ddc9c 100644
--- a/cppe/demo/IceE/latency/WinCEServer.cpp
+++ b/cppe/demo/IceE/latency/WinCEServer.cpp
@@ -13,12 +13,6 @@
using namespace std;
using namespace Demo;
-class PingI : public Ping
-{
-public:
- // no methods.
-};
-
static HWND editHwnd;
static LRESULT CALLBACK
@@ -28,34 +22,34 @@ WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
case WM_CREATE:
{
- RECT rcClient;
- GetClientRect(hWnd, &rcClient);
- editHwnd = CreateWindowEx(WS_EX_CLIENTEDGE, L"EDIT", L"",
- WS_CHILD | WS_VISIBLE | WS_VSCROLL /*| WS_HSCROLL*/ | ES_MULTILINE,
- 0, 0, rcClient.right - rcClient.left, rcClient.bottom - rcClient.top,
- hWnd, (HMENU)101, GetModuleHandle(NULL), NULL);
- assert(editHwnd != NULL);
+ RECT rcClient;
+ GetClientRect(hWnd, &rcClient);
+ editHwnd = CreateWindowEx(WS_EX_CLIENTEDGE, L"EDIT", L"",
+ WS_CHILD | WS_VISIBLE | WS_VSCROLL /*| WS_HSCROLL*/ | ES_MULTILINE,
+ 0, 0, rcClient.right - rcClient.left, rcClient.bottom - rcClient.top,
+ hWnd, (HMENU)101, GetModuleHandle(NULL), NULL);
+ assert(editHwnd != NULL);
}
break;
case WM_SIZE:
{
- RECT rcClient;
- GetClientRect(hWnd, &rcClient);
- SetWindowPos(editHwnd, NULL, 0, 0, rcClient.right, rcClient.bottom, SWP_NOZORDER);
+ RECT rcClient;
+ GetClientRect(hWnd, &rcClient);
+ SetWindowPos(editHwnd, NULL, 0, 0, rcClient.right, rcClient.bottom, SWP_NOZORDER);
}
break;
case WM_CLOSE:
- DestroyWindow(hWnd);
- break;
+ DestroyWindow(hWnd);
+ break;
case WM_DESTROY:
- PostQuitMessage(0);
- break;
+ PostQuitMessage(0);
+ break;
default:
- return DefWindowProc(hWnd, msg, wParam, lParam);
+ return DefWindowProc(hWnd, msg, wParam, lParam);
}
return 0;
}
@@ -66,22 +60,22 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmd
static const TCHAR windowClassName[] = L"Latency Server";
WNDCLASS wc;
- wc.style = CS_HREDRAW|CS_VREDRAW;
- wc.lpfnWndProc = (WNDPROC)WndProc;
- wc.cbClsExtra = 0;
- wc.cbWndExtra = 0;
- wc.hInstance = hInstance;
- wc.hIcon = LoadIcon(NULL, 0);
- wc.hCursor = 0;
- wc.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH);
+ wc.style = CS_HREDRAW|CS_VREDRAW;
+ wc.lpfnWndProc = (WNDPROC)WndProc;
+ wc.cbClsExtra = 0;
+ wc.cbWndExtra = 0;
+ wc.hInstance = hInstance;
+ wc.hIcon = LoadIcon(NULL, 0);
+ wc.hCursor = 0;
+ wc.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH);
wc.lpszMenuName = NULL;
wc.lpszClassName = windowClassName;
if(!RegisterClass(&wc))
{
- MessageBox(NULL, L"Window Registration Failed!", L"Error!",
- MB_ICONEXCLAMATION | MB_OK);
- return 0;
+ MessageBox(NULL, L"Window Registration Failed!", L"Error!",
+ MB_ICONEXCLAMATION | MB_OK);
+ return 0;
}
RECT rect;
@@ -89,20 +83,20 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmd
int width = rect.right - rect.left;
if(width > 320)
{
- width = 320;
+ width = 320;
}
int height = rect.bottom - rect.top;
if(height > 200)
{
- height = 200;
+ height = 200;
}
HWND mainWnd = CreateWindow(windowClassName, L"Latency Server", WS_VISIBLE|WS_OVERLAPPED|WS_SYSMENU|WS_SIZEBOX,
- CW_USEDEFAULT, CW_USEDEFAULT, width, height,
- NULL, NULL, hInstance, NULL);
+ CW_USEDEFAULT, CW_USEDEFAULT, width, height,
+ NULL, NULL, hInstance, NULL);
if(mainWnd == NULL)
{
- MessageBox(NULL, L"Window Creation Failed!", L"Error!", MB_ICONEXCLAMATION | MB_OK);
- return 0;
+ MessageBox(NULL, L"Window Creation Failed!", L"Error!", MB_ICONEXCLAMATION | MB_OK);
+ return 0;
}
ShowWindow(mainWnd, SW_SHOW);
@@ -118,72 +112,73 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmd
try
{
Ice::InitializationData initData;
- initData.properties = Ice::createProperties();
- //
- // Set a default value for Latency.Endpoints so that the demo
- // will run without a configuration file.
- //
- initData.properties->setProperty("Latency.Endpoints","tcp -p 10000");
-
- //
- // Now, load the configuration file if present. Under WinCE we
- // use "config.txt" since it can be edited with pocket word.
- //
- try
- {
- initData.properties->load("config.txt");
- }
- catch(const Ice::FileException&)
- {
- }
-
- communicator = Ice::initialize(__argc, __argv, initData);
-
- Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("Latency");
- adapter->add(new PingI, communicator->stringToIdentity("ping"));
- adapter->activate();
-
- //
- // Display a helpful message to the user.
- //
- ::SendMessage(editHwnd, EM_REPLACESEL,
- (WPARAM)FALSE, (LPARAM)L"Close the window to terminate the server.\r\n");
-
- //
- // Run the message pump.
- //
- MSG Msg;
- while(GetMessage(&Msg, NULL, 0, 0) > 0)
- {
- TranslateMessage(&Msg);
- DispatchMessage(&Msg);
- }
+ initData.properties = Ice::createProperties();
+ //
+ // Set a default value for Latency.Endpoints so that the demo
+ // will run without a configuration file.
+ //
+ initData.properties->setProperty("Latency.Endpoints", "tcp -p 10000");
+
+ //
+ // Now, load the configuration file if present. Under WinCE we
+ // use "config.txt" since it can be edited with pocket word.
+ //
+ try
+ {
+ initData.properties->load("config.txt");
+ }
+ catch(const Ice::FileException&)
+ {
+ }
+
+ communicator = Ice::initialize(__argc, __argv, initData);
+
+ Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("Latency");
+ Ice::ObjectPtr object = new Ping;
+ adapter->add(object, communicator->stringToIdentity("ping"));
+ adapter->activate();
+
+ //
+ // Display a helpful message to the user.
+ //
+ ::SendMessage(editHwnd, EM_REPLACESEL,
+ (WPARAM)FALSE, (LPARAM)L"Close the window to terminate the server.\r\n");
+
+ //
+ // Run the message pump.
+ //
+ MSG Msg;
+ while(GetMessage(&Msg, NULL, 0, 0) > 0)
+ {
+ TranslateMessage(&Msg);
+ DispatchMessage(&Msg);
+ }
}
catch(const Ice::Exception& ex)
{
- TCHAR wtext[1024];
- string err = ex.toString();
- mbstowcs(wtext, err.c_str(), err.size());
- MessageBox(mainWnd, wtext, L"Error", MB_ICONEXCLAMATION | MB_OK);
+ TCHAR wtext[1024];
+ string err = ex.toString();
+ mbstowcs(wtext, err.c_str(), err.size());
+ MessageBox(mainWnd, wtext, L"Error", MB_ICONEXCLAMATION | MB_OK);
- status = EXIT_FAILURE;
+ status = EXIT_FAILURE;
}
if(communicator)
{
- try
- {
- communicator->destroy();
- }
- catch(const Ice::Exception& ex)
- {
- TCHAR wtext[1024];
- string err = ex.toString();
- mbstowcs(wtext, err.c_str(), err.size());
- MessageBox(mainWnd, wtext, L"Error", MB_ICONEXCLAMATION | MB_OK);
-
- status = EXIT_FAILURE;
- }
+ try
+ {
+ communicator->destroy();
+ }
+ catch(const Ice::Exception& ex)
+ {
+ TCHAR wtext[1024];
+ string err = ex.toString();
+ mbstowcs(wtext, err.c_str(), err.size());
+ MessageBox(mainWnd, wtext, L"Error", MB_ICONEXCLAMATION | MB_OK);
+
+ status = EXIT_FAILURE;
+ }
}
return status;
}
diff --git a/cppe/demo/IceE/latency/config b/cppe/demo/IceE/latency/config
deleted file mode 100644
index cb4786fad59..00000000000
--- a/cppe/demo/IceE/latency/config
+++ /dev/null
@@ -1,7 +0,0 @@
-Latency.Proxy=ping:default -p 10000 -h 127.0.0.1
-Latency.Endpoints=default -p 10000 -h 127.0.0.1
-
-#
-# Use faster blocking client side model by default.
-#
-Ice.Blocking=1
diff --git a/cppe/demo/IceE/latency/config.client b/cppe/demo/IceE/latency/config.client
new file mode 100644
index 00000000000..efede8629e4
--- /dev/null
+++ b/cppe/demo/IceE/latency/config.client
@@ -0,0 +1,5 @@
+#
+# The client reads this property to create the reference to the "Ping"
+# object in the server.
+#
+Ping.Proxy=ping:default -p 10000 -h 127.0.0.1
diff --git a/cppe/demo/IceE/latency/config.server b/cppe/demo/IceE/latency/config.server
new file mode 100644
index 00000000000..75e3479d6fe
--- /dev/null
+++ b/cppe/demo/IceE/latency/config.server
@@ -0,0 +1,10 @@
+#
+# The server creates one single object adapter with the name
+# "Latency". The following line sets the endpoints for this adapter.
+#
+Latency.Endpoints=default -p 10000 -h 127.0.0.1
+
+#
+# Warn about connection exceptions
+#
+Ice.Warn.Connections=1
diff --git a/cppe/demo/IceE/minimal/Client.cpp b/cppe/demo/IceE/minimal/Client.cpp
index a44b0ffeb55..4ab546b0d36 100644
--- a/cppe/demo/IceE/minimal/Client.cpp
+++ b/cppe/demo/IceE/minimal/Client.cpp
@@ -13,111 +13,48 @@
using namespace std;
using namespace Demo;
-void
-menu()
-{
- printf("usage:\nh: say hello\nx: exit\n?: help\n");
-}
-
-int
-run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator)
-{
- if(argc > 1)
- {
- fprintf(stderr, "%s: too many arguments\n", argv[0]);
- return EXIT_FAILURE;
- }
-
- Ice::PropertiesPtr properties = communicator->getProperties();
- const char* proxyProperty = "Hello.Proxy";
- string proxy = properties->getProperty(proxyProperty);
- if(proxy.empty())
- {
- fprintf(stderr, "%s: property `%s' not set\n", argv[0], proxyProperty);
- return EXIT_FAILURE;
- }
-
- HelloPrx hello = HelloPrx::checkedCast(communicator->stringToProxy(proxy));
- if(!hello)
- {
-
- fprintf(stderr, "%s: invalid proxy\n", argv[0]);
- return EXIT_FAILURE;
- }
-
- menu();
-
- char c = EOF;
- do
- {
- try
- {
- printf("==> ");
- do
- {
- c = getchar();
- }
- while(c != EOF && c == '\n');
- if(c == 'h')
- {
- hello->sayHello();
- }
- else if(c == 'x')
- {
- // Nothing to do
- }
- else if(c == '?')
- {
- menu();
- }
- else
- {
- printf("unknown command `%c'\n", c);
- menu();
- }
- }
- catch(const Ice::Exception& ex)
- {
- fprintf(stderr, "%s\n", ex.toString().c_str());
- }
- }
- while(c != EOF && c != 'x');
-
- return EXIT_SUCCESS;
-}
-
int
main(int argc, char* argv[])
{
-
- int status;
+ int status = EXIT_SUCCESS;
Ice::CommunicatorPtr communicator;
try
{
- Ice::InitializationData initData;
- initData.properties = Ice::createProperties();
- initData.properties->load("config");
- communicator = Ice::initialize(argc, argv, initData);
- status = run(argc, argv, communicator);
+ communicator = Ice::initialize(argc, argv);
+ if(argc > 1)
+ {
+ fprintf(stderr, "%s: too many arguments\n", argv[0]);
+ return EXIT_FAILURE;
+ }
+ HelloPrx hello = HelloPrx::checkedCast(communicator->stringToProxy("hello:tcp -p 10000"));
+ if(!hello)
+ {
+ fprintf(stderr, "%s: invalid proxy\n", argv[0]);
+ status = EXIT_FAILURE;
+ }
+ else
+ {
+ hello->sayHello();
+ }
}
catch(const Ice::Exception& ex)
{
fprintf(stderr, "%s\n", ex.toString().c_str());
- status = EXIT_FAILURE;
+ status = EXIT_FAILURE;
}
if(communicator)
{
- try
- {
- communicator->destroy();
- }
- catch(const Ice::Exception& ex)
- {
- fprintf(stderr, "%s\n", ex.toString().c_str());
- status = EXIT_FAILURE;
- }
+ try
+ {
+ communicator->destroy();
+ }
+ catch(const Ice::Exception& ex)
+ {
+ fprintf(stderr, "%s\n", ex.toString().c_str());
+ status = EXIT_FAILURE;
+ }
}
return status;
diff --git a/cppe/demo/IceE/minimal/Server.cpp b/cppe/demo/IceE/minimal/Server.cpp
index be0e478fd19..efd5afe33de 100644
--- a/cppe/demo/IceE/minimal/Server.cpp
+++ b/cppe/demo/IceE/minimal/Server.cpp
@@ -20,59 +20,47 @@ public:
virtual void
sayHello(const Ice::Current&) const
{
- printf("Hello World!\n");
+ printf("Hello World!\n");
}
};
int
-run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator)
-{
- if(argc > 1)
- {
- fprintf(stderr, "%s: too many arguments\n", argv[0]);
- return EXIT_FAILURE;
- }
-
- Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("Hello");
- Ice::ObjectPtr object = new HelloI;
- adapter->add(object, communicator->stringToIdentity("hello"));
- adapter->activate();
- communicator->waitForShutdown();
-
- return EXIT_SUCCESS;
-}
-
-int
main(int argc, char* argv[])
{
- int status;
+ int status = EXIT_SUCCESS;
Ice::CommunicatorPtr communicator;
try
{
- Ice::InitializationData initData;
- initData.properties = Ice::createProperties();
- initData.properties->load("config");
- communicator = Ice::initialize(argc, argv, initData);
- status = run(argc, argv, communicator);
+ communicator = Ice::initialize(argc, argv);
+ if(argc > 1)
+ {
+ fprintf(stderr, "%s: too many arguments\n", argv[0]);
+ return EXIT_FAILURE;
+ }
+ Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapterWithEndpoints("Hello", "tcp -p 10000");
+ Demo::HelloPtr object = new HelloI;
+ adapter->add(object, communicator->stringToIdentity("hello"));
+ adapter->activate();
+ communicator->waitForShutdown();
}
catch(const Ice::Exception& ex)
{
- fprintf(stderr, "%s\n", ex.toString().c_str());
- status = EXIT_FAILURE;
+ fprintf(stderr, "%s\n", ex.toString().c_str());
+ status = EXIT_FAILURE;
}
if(communicator)
{
- try
- {
- communicator->destroy();
- }
- catch(const Ice::Exception& ex)
- {
- fprintf(stderr, "%s\n", ex.toString().c_str());
- status = EXIT_FAILURE;
- }
+ try
+ {
+ communicator->destroy();
+ }
+ catch(const Ice::Exception& ex)
+ {
+ fprintf(stderr, "%s\n", ex.toString().c_str());
+ status = EXIT_FAILURE;
+ }
}
return status;
diff --git a/cppe/demo/IceE/minimal/WinCEClient.cpp b/cppe/demo/IceE/minimal/WinCEClient.cpp
index b53c29c6f36..8d88664baf2 100644
--- a/cppe/demo/IceE/minimal/WinCEClient.cpp
+++ b/cppe/demo/IceE/minimal/WinCEClient.cpp
@@ -25,64 +25,64 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmd
try
{
Ice::InitializationData initData;
- initData.properties = Ice::createProperties();
+ initData.properties = Ice::createProperties();
- //
- // Set a default value for "Hello.Proxy" so that the demo will
- // run without a configuration file.
- //
- initData.properties->setProperty("Hello.Proxy", "hello:tcp -p 10000");
+ //
+ // Set a default value for "Hello.Proxy" so that the demo will
+ // run without a configuration file.
+ //
+ initData.properties->setProperty("Hello.Proxy", "hello:tcp -p 10000");
- //
- // Now, load the configuration file if present. Under WinCE we
- // use "config.txt" since it can be edited with pocket word.
- //
- try
- {
- initData.properties->load("config.txt");
- }
- catch(const Ice::FileException&)
- {
- }
+ //
+ // Now, load the configuration file if present. Under WinCE we
+ // use "config.txt" since it can be edited with pocket word.
+ //
+ try
+ {
+ initData.properties->load("config.txt");
+ }
+ catch(const Ice::FileException&)
+ {
+ }
- communicator = Ice::initialize(__argc, __argv, initData);
+ communicator = Ice::initialize(__argc, __argv, initData);
- HelloPrx hello =
- HelloPrx::checkedCast(communicator->stringToProxy(initData.properties->getProperty("Hello.Proxy")));
- if(!hello)
- {
- MessageBox(NULL, L"invalid proxy", L"Minimal Client", MB_ICONEXCLAMATION | MB_OK);
- return EXIT_FAILURE;
- }
+ HelloPrx hello =
+ HelloPrx::checkedCast(communicator->stringToProxy(initData.properties->getProperty("Hello.Proxy")));
+ if(!hello)
+ {
+ MessageBox(NULL, L"invalid proxy", L"Minimal Client", MB_ICONEXCLAMATION | MB_OK);
+ return EXIT_FAILURE;
+ }
- hello->sayHello();
- MessageBox(NULL, L"Sent \"sayHello()\" message", L"Minimal Client", MB_ICONEXCLAMATION | MB_OK);
+ hello->sayHello();
+ MessageBox(NULL, L"Sent \"sayHello()\" message", L"Minimal Client", MB_ICONEXCLAMATION | MB_OK);
}
catch(const Ice::Exception& ex)
{
- TCHAR wtext[1024];
- string err = ex.toString();
- mbstowcs(wtext, err.c_str(), err.size());
- MessageBox(NULL, wtext, L"Error", MB_ICONEXCLAMATION | MB_OK);
+ TCHAR wtext[1024];
+ string err = ex.toString();
+ mbstowcs(wtext, err.c_str(), err.size());
+ MessageBox(NULL, wtext, L"Error", MB_ICONEXCLAMATION | MB_OK);
- status = EXIT_FAILURE;
+ status = EXIT_FAILURE;
}
if(communicator)
{
- try
- {
- communicator->destroy();
- }
- catch(const Ice::Exception& ex)
- {
- TCHAR wtext[1024];
- string err = ex.toString();
- mbstowcs(wtext, err.c_str(), err.size());
- MessageBox(NULL, wtext, L"Error", MB_ICONEXCLAMATION | MB_OK);
+ try
+ {
+ communicator->destroy();
+ }
+ catch(const Ice::Exception& ex)
+ {
+ TCHAR wtext[1024];
+ string err = ex.toString();
+ mbstowcs(wtext, err.c_str(), err.size());
+ MessageBox(NULL, wtext, L"Error", MB_ICONEXCLAMATION | MB_OK);
- status = EXIT_FAILURE;
- }
+ status = EXIT_FAILURE;
+ }
}
return status;
diff --git a/cppe/demo/IceE/minimal/WinCEServer.cpp b/cppe/demo/IceE/minimal/WinCEServer.cpp
index 8228e59aecf..970e02c3b4b 100644
--- a/cppe/demo/IceE/minimal/WinCEServer.cpp
+++ b/cppe/demo/IceE/minimal/WinCEServer.cpp
@@ -18,21 +18,21 @@ class HelloI : public Hello
public:
HelloI(HWND wnd)
- : _wnd(wnd)
+ : _wnd(wnd)
{
}
virtual void
sayHello(const Ice::Current&) const
{
- //
- // Its not legal to write to windows controls in a thread
- // other than main, so we post a custom message to the main
- // thread which will cause the message to be written to the
- // edit control.
- //
- static wchar_t* hello = L"Hello World\r\n";
- ::PostMessage(_wnd, WM_USER, (WPARAM)FALSE, (LPARAM)_wcsdup(hello));
+ //
+ // Its not legal to write to windows controls in a thread
+ // other than main, so we post a custom message to the main
+ // thread which will cause the message to be written to the
+ // edit control.
+ //
+ static wchar_t* hello = L"Hello World\r\n";
+ ::PostMessage(_wnd, WM_USER, (WPARAM)FALSE, (LPARAM)_wcsdup(hello));
}
private:
@@ -49,42 +49,42 @@ WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
case WM_USER:
{
- // tprint from a thread other than main. lParam holds a pointer to the text.
- ::SendMessage(editHwnd, EM_REPLACESEL, (WPARAM)wParam, (LPARAM)lParam);
- free((wchar_t*)lParam);
+ // tprint from a thread other than main. lParam holds a pointer to the text.
+ ::SendMessage(editHwnd, EM_REPLACESEL, (WPARAM)wParam, (LPARAM)lParam);
+ free((wchar_t*)lParam);
}
break;
case WM_CREATE:
{
- RECT rcClient;
- GetClientRect(hWnd, &rcClient);
- editHwnd = CreateWindowEx(WS_EX_CLIENTEDGE, L"EDIT", L"",
- WS_CHILD | WS_VISIBLE | WS_VSCROLL /*| WS_HSCROLL*/ | ES_MULTILINE,
- 0, 0, rcClient.right - rcClient.left, rcClient.bottom - rcClient.top,
- hWnd, (HMENU)101, GetModuleHandle(NULL), NULL);
- assert(editHwnd != NULL);
+ RECT rcClient;
+ GetClientRect(hWnd, &rcClient);
+ editHwnd = CreateWindowEx(WS_EX_CLIENTEDGE, L"EDIT", L"",
+ WS_CHILD | WS_VISIBLE | WS_VSCROLL /*| WS_HSCROLL*/ | ES_MULTILINE,
+ 0, 0, rcClient.right - rcClient.left, rcClient.bottom - rcClient.top,
+ hWnd, (HMENU)101, GetModuleHandle(NULL), NULL);
+ assert(editHwnd != NULL);
}
break;
case WM_SIZE:
{
- RECT rcClient;
- GetClientRect(hWnd, &rcClient);
- SetWindowPos(editHwnd, NULL, 0, 0, rcClient.right, rcClient.bottom, SWP_NOZORDER);
+ RECT rcClient;
+ GetClientRect(hWnd, &rcClient);
+ SetWindowPos(editHwnd, NULL, 0, 0, rcClient.right, rcClient.bottom, SWP_NOZORDER);
}
break;
case WM_CLOSE:
- DestroyWindow(hWnd);
- break;
+ DestroyWindow(hWnd);
+ break;
case WM_DESTROY:
- PostQuitMessage(0);
- break;
+ PostQuitMessage(0);
+ break;
default:
- return DefWindowProc(hWnd, msg, wParam, lParam);
+ return DefWindowProc(hWnd, msg, wParam, lParam);
}
return 0;
}
@@ -95,22 +95,22 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmd
static const TCHAR windowClassName[] = L"Minimal Server";
WNDCLASS wc;
- wc.style = CS_HREDRAW|CS_VREDRAW;
- wc.lpfnWndProc = (WNDPROC)WndProc;
- wc.cbClsExtra = 0;
- wc.cbWndExtra = 0;
- wc.hInstance = hInstance;
- wc.hIcon = LoadIcon(NULL, 0);
- wc.hCursor = 0;
- wc.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH);
+ wc.style = CS_HREDRAW|CS_VREDRAW;
+ wc.lpfnWndProc = (WNDPROC)WndProc;
+ wc.cbClsExtra = 0;
+ wc.cbWndExtra = 0;
+ wc.hInstance = hInstance;
+ wc.hIcon = LoadIcon(NULL, 0);
+ wc.hCursor = 0;
+ wc.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH);
wc.lpszMenuName = NULL;
wc.lpszClassName = windowClassName;
if(!RegisterClass(&wc))
{
- MessageBox(NULL, L"Window Registration Failed!", L"Error!",
- MB_ICONEXCLAMATION | MB_OK);
- return 0;
+ MessageBox(NULL, L"Window Registration Failed!", L"Error!",
+ MB_ICONEXCLAMATION | MB_OK);
+ return 0;
}
RECT rect;
@@ -118,20 +118,20 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmd
int width = rect.right - rect.left;
if(width > 320)
{
- width = 320;
+ width = 320;
}
int height = rect.bottom - rect.top;
if(height > 200)
{
- height = 200;
+ height = 200;
}
HWND mainWnd = CreateWindow(windowClassName, L"Minimal Server", WS_VISIBLE|WS_OVERLAPPED|WS_SYSMENU|WS_SIZEBOX,
- CW_USEDEFAULT, CW_USEDEFAULT, width, height,
- NULL, NULL, hInstance, NULL);
+ CW_USEDEFAULT, CW_USEDEFAULT, width, height,
+ NULL, NULL, hInstance, NULL);
if(mainWnd == NULL)
{
- MessageBox(NULL, L"Window Creation Failed!", L"Error!", MB_ICONEXCLAMATION | MB_OK);
- return 0;
+ MessageBox(NULL, L"Window Creation Failed!", L"Error!", MB_ICONEXCLAMATION | MB_OK);
+ return 0;
}
ShowWindow(mainWnd, SW_SHOW);
@@ -147,72 +147,73 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmd
try
{
Ice::InitializationData initData;
- initData.properties = Ice::createProperties();
- //
- // Set a default value for Hello.Endpoints so that the demo
- // will run without a configuration file.
- //
- initData.properties->setProperty("Hello.Endpoints","tcp -p 10000");
-
- //
- // Now, load the configuration file if present. Under WinCE we
- // use "config.txt" since it can be edited with pocket word.
- //
- try
- {
- initData.properties->load("config.txt");
- }
- catch(const Ice::FileException&)
- {
- }
-
- communicator = Ice::initialize(__argc, __argv, initData);
-
- Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("Hello");
- adapter->add(new HelloI(mainWnd), communicator->stringToIdentity("hello"));
- adapter->activate();
-
- //
- // Display a helpful message to the user.
- //
- ::SendMessage(editHwnd, EM_REPLACESEL,
- (WPARAM)FALSE, (LPARAM)L"Close the window to terminate the server.\r\n");
-
- //
- // Run the message pump.
- //
- MSG Msg;
- while(GetMessage(&Msg, NULL, 0, 0) > 0)
- {
- TranslateMessage(&Msg);
- DispatchMessage(&Msg);
- }
+ initData.properties = Ice::createProperties();
+ //
+ // Set a default value for Hello.Endpoints so that the demo
+ // will run without a configuration file.
+ //
+ initData.properties->setProperty("Hello.Endpoints","tcp -p 10000");
+
+ //
+ // Now, load the configuration file if present. Under WinCE we
+ // use "config.txt" since it can be edited with pocket word.
+ //
+ try
+ {
+ initData.properties->load("config.txt");
+ }
+ catch(const Ice::FileException&)
+ {
+ }
+
+ communicator = Ice::initialize(__argc, __argv, initData);
+
+ Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("Hello");
+ HelloPtr hello = new HelloI(mainWnd);
+ adapter->add(hello, communicator->stringToIdentity("hello"));
+ adapter->activate();
+
+ //
+ // Display a helpful message to the user.
+ //
+ ::SendMessage(editHwnd, EM_REPLACESEL,
+ (WPARAM)FALSE, (LPARAM)L"Close the window to terminate the server.\r\n");
+
+ //
+ // Run the message pump.
+ //
+ MSG Msg;
+ while(GetMessage(&Msg, NULL, 0, 0) > 0)
+ {
+ TranslateMessage(&Msg);
+ DispatchMessage(&Msg);
+ }
}
catch(const Ice::Exception& ex)
{
- TCHAR wtext[1024];
- string err = ex.toString();
- mbstowcs(wtext, err.c_str(), err.size());
- MessageBox(mainWnd, wtext, L"Error", MB_ICONEXCLAMATION | MB_OK);
+ TCHAR wtext[1024];
+ string err = ex.toString();
+ mbstowcs(wtext, err.c_str(), err.size());
+ MessageBox(mainWnd, wtext, L"Error", MB_ICONEXCLAMATION | MB_OK);
- status = EXIT_FAILURE;
+ status = EXIT_FAILURE;
}
if(communicator)
{
- try
- {
- communicator->destroy();
- }
- catch(const Ice::Exception& ex)
- {
- TCHAR wtext[1024];
- string err = ex.toString();
- mbstowcs(wtext, err.c_str(), err.size());
- MessageBox(mainWnd, wtext, L"Error", MB_ICONEXCLAMATION | MB_OK);
-
- status = EXIT_FAILURE;
- }
+ try
+ {
+ communicator->destroy();
+ }
+ catch(const Ice::Exception& ex)
+ {
+ TCHAR wtext[1024];
+ string err = ex.toString();
+ mbstowcs(wtext, err.c_str(), err.size());
+ MessageBox(mainWnd, wtext, L"Error", MB_ICONEXCLAMATION | MB_OK);
+
+ status = EXIT_FAILURE;
+ }
}
return status;
}
diff --git a/cppe/demo/IceE/throughput/Client.cpp b/cppe/demo/IceE/throughput/Client.cpp
index 00f2b168708..953a3f0dd2f 100644
--- a/cppe/demo/IceE/throughput/Client.cpp
+++ b/cppe/demo/IceE/throughput/Client.cpp
@@ -57,17 +57,18 @@ run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator)
std::string proxy = properties->getProperty(proxyProperty);
if(proxy.empty())
{
- fprintf(stderr, "%s: property `%s' not set\n", argv[0], proxyProperty);
- return EXIT_FAILURE;
+ fprintf(stderr, "%s: property `%s' not set\n", argv[0], proxyProperty);
+ return EXIT_FAILURE;
}
Ice::ObjectPrx base = communicator->stringToProxy(proxy);
ThroughputPrx throughput = ThroughputPrx::checkedCast(base);
if(!throughput)
{
- fprintf(stderr, "%s: invalid proxy\n", argv[0]);
- return EXIT_FAILURE;
+ fprintf(stderr, "%s: invalid proxy\n", argv[0]);
+ return EXIT_FAILURE;
}
+
ThroughputPrx throughputOneway = ThroughputPrx::uncheckedCast(throughput->ice_oneway());
ByteSeq byteSeq(ByteSeqSize / reduce, 0);
@@ -81,7 +82,7 @@ run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator)
for(i = 0; i < StringDoubleSeqSize / reduce; ++i)
{
structSeq[i].s = "hello";
- structSeq[i].d = 3.14;
+ structSeq[i].d = 3.14;
}
FixedSeq fixedSeq(FixedSeqSize / reduce);
@@ -92,9 +93,61 @@ run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator)
fixedSeq[i].d = 0;
}
- menu();
+ //
+ // To allow cross-language tests we may need to "warm up" the
+ // server. The warm up is to ensure that any JIT compiler will
+ // have converted any hotspots to native code. This ensures an
+ // accurate throughput measurement.
+ //
+ if(throughput->needsWarmup())
+ {
+ throughput->startWarmup();
+
+ ByteSeq emptyBytesBuf(1);
+ emptyBytesBuf.resize(1);
+ pair<const Ice::Byte*, const Ice::Byte*> emptyBytes;
+ emptyBytes.first = &emptyBytesBuf[0];
+ emptyBytes.second = emptyBytes.first + emptyBytesBuf.size();
+
+ StringSeq emptyStrings(1);
+ emptyStrings.resize(1);
+
+ StringDoubleSeq emptyStructs(1);
+ emptyStructs.resize(1);
+
+ FixedSeq emptyFixed(1);
+ emptyFixed.resize(1);
+
+ printf("warming up the server...");
+ fflush(stdout);
+ for(int i = 0; i < 10000; i++)
+ {
+ throughput->sendByteSeq(emptyBytes);
+ throughput->sendStringSeq(emptyStrings);
+ throughput->sendStructSeq(emptyStructs);
+ throughput->sendFixedSeq(emptyFixed);
+
+ throughput->recvByteSeq();
+ throughput->recvStringSeq();
+ throughput->recvStructSeq();
+ throughput->recvFixedSeq();
+
+ throughput->echoByteSeq(emptyBytesBuf);
+ throughput->echoStringSeq(emptyStrings);
+ throughput->echoStructSeq(emptyStructs);
+ throughput->echoFixedSeq(emptyFixed);
+ }
+
+ throughput->endWarmup();
- throughput->ice_ping(); // Initial ping to setup the connection.
+ printf(" ok\n");
+ }
+ else
+ {
+ throughput->ice_ping(); // Initial ping to setup the connection.
+ }
+
+ menu();
//
// By default use byte sequence.
@@ -105,300 +158,300 @@ run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator)
char c = EOF;
do
{
- try
- {
- printf("==> ");
- do
- {
- c = getchar();
- }
- while(c != EOF && c == '\n');
-
- IceUtil::Time tm = IceUtil::Time::now();
- const int repetitions = 1000;
-
- if(c == '1' || c == '2' || c == '3' || c == '4')
- {
- currentType = c;
- switch(c)
- {
- case '1':
- {
- printf("using byte sequences\n");
- seqSize = ByteSeqSize / reduce;
- break;
- }
-
- case '2':
- {
- printf("using string sequences\n");
- seqSize = StringSeqSize / reduce;
- break;
- }
-
- case '3':
- {
- printf("using variable-length struct sequences\n");
- seqSize = StringDoubleSeqSize / reduce;
- break;
- }
-
- case '4':
- {
- printf("using fixed-length struct sequences\n");
- seqSize = FixedSeqSize / reduce;
- break;
- }
- }
- }
- else if(c == 't' || c == 'o' || c == 'r' || c == 'e')
- {
- switch(c)
- {
- case 't':
- case 'o':
- {
- printf("sending");
- break;
- }
-
- case 'r':
- {
- printf("receiving");
- break;
- }
-
- case 'e':
- {
- printf("sending and receiving");
- break;
- }
- }
-
- printf(" %d", repetitions);
- switch(currentType)
- {
- case '1':
- {
- printf(" byte");
- break;
- }
-
- case '2':
- {
- printf(" string");
- break;
- }
-
- case '3':
- {
- printf(" variable-length struct");
- break;
- }
-
- case '4':
- {
- printf(" fixed-length struct");
- break;
- }
- }
- printf(" sequences of size %d", seqSize);
-
-
- if(c == 'o')
- {
- printf(" as oneway");
- }
-
- printf("...\n");
-
- for(int i = 0; i < repetitions; ++i)
- {
- switch(currentType)
- {
- case '1':
- {
- switch(c)
- {
- case 't':
- {
- throughput->sendByteSeq(byteArr);
- break;
- }
-
- case 'o':
- {
- throughputOneway->sendByteSeq(byteArr);
- break;
- }
-
- case 'r':
- {
- throughput->recvByteSeq();
- break;
- }
-
- case 'e':
- {
- throughput->echoByteSeq(byteSeq);
- break;
- }
- }
- break;
- }
-
- case '2':
- {
- switch(c)
- {
- case 't':
- {
- throughput->sendStringSeq(stringSeq);
- break;
- }
-
- case 'o':
- {
- throughputOneway->sendStringSeq(stringSeq);
- break;
- }
-
- case 'r':
- {
- throughput->recvStringSeq();
- break;
- }
-
- case 'e':
- {
- throughput->echoStringSeq(stringSeq);
- break;
- }
- }
- break;
- }
-
- case '3':
- {
- switch(c)
- {
- case 't':
- {
- throughput->sendStructSeq(structSeq);
- break;
- }
-
- case 'o':
- {
- throughputOneway->sendStructSeq(structSeq);
- break;
- }
-
- case 'r':
- {
- throughput->recvStructSeq();
- break;
- }
-
- case 'e':
- {
- throughput->echoStructSeq(structSeq);
- break;
- }
- }
- break;
- }
-
- case '4':
- {
- switch(c)
- {
- case 't':
- {
- throughput->sendFixedSeq(fixedSeq);
- break;
- }
-
- case 'o':
- {
- throughputOneway->sendFixedSeq(fixedSeq);
- break;
- }
-
- case 'r':
- {
- throughput->recvFixedSeq();
- break;
- }
-
- case 'e':
- {
- throughput->echoFixedSeq(fixedSeq);
- break;
- }
- }
- break;
- }
- }
- }
-
- tm = IceUtil::Time::now() - tm;
- printf("time for %d sequences: %lfms\n", repetitions, tm.toMilliSecondsDouble());
- printf("time per sequence: %lfms\n", tm.toMilliSecondsDouble() / repetitions);
- int wireSize = 0;
- switch(currentType)
- {
- case '1':
- {
- wireSize = 1;
- break;
- }
- case '2':
- {
- wireSize = static_cast<int>(stringSeq[0].size());
- break;
- }
- case '3':
- {
- wireSize = static_cast<int>(structSeq[0].s.size());
- wireSize += 8; // Size of double on the wire.
- break;
- }
- case '4':
- {
- wireSize = 16; // Size of two ints and a double on the wire.
- break;
- }
- }
- double mbit = repetitions * seqSize * wireSize * 8.0 / tm.toMicroSeconds();
- if(c == 'e')
- {
- mbit *= 2;
- }
- printf("throughput: %.2lfMbps\n", mbit);
- }
- else if(c == 's')
- {
- throughput->shutdown();
- }
- else if(c == 'x')
- {
- // Nothing to do
- }
- else if(c == '?')
- {
- menu();
- }
- else
- {
- printf("unknown command `%c'\n", c);
- menu();
- }
- }
- catch(const Ice::Exception& ex)
- {
- fprintf(stderr, "%s\n", ex.toString().c_str());
- }
+ try
+ {
+ printf("==> ");
+ do
+ {
+ c = getchar();
+ }
+ while(c != EOF && c == '\n');
+
+ IceUtil::Time tm = IceUtil::Time::now();
+ const int repetitions = 1000;
+
+ if(c == '1' || c == '2' || c == '3' || c == '4')
+ {
+ currentType = c;
+ switch(c)
+ {
+ case '1':
+ {
+ printf("using byte sequences\n");
+ seqSize = ByteSeqSize / reduce;
+ break;
+ }
+
+ case '2':
+ {
+ printf("using string sequences\n");
+ seqSize = StringSeqSize / reduce;
+ break;
+ }
+
+ case '3':
+ {
+ printf("using variable-length struct sequences\n");
+ seqSize = StringDoubleSeqSize / reduce;
+ break;
+ }
+
+ case '4':
+ {
+ printf("using fixed-length struct sequences\n");
+ seqSize = FixedSeqSize / reduce;
+ break;
+ }
+ }
+ }
+ else if(c == 't' || c == 'o' || c == 'r' || c == 'e')
+ {
+ switch(c)
+ {
+ case 't':
+ case 'o':
+ {
+ printf("sending");
+ break;
+ }
+
+ case 'r':
+ {
+ printf("receiving");
+ break;
+ }
+
+ case 'e':
+ {
+ printf("sending and receiving");
+ break;
+ }
+ }
+
+ printf(" %d", repetitions);
+ switch(currentType)
+ {
+ case '1':
+ {
+ printf(" byte");
+ break;
+ }
+
+ case '2':
+ {
+ printf(" string");
+ break;
+ }
+
+ case '3':
+ {
+ printf(" variable-length struct");
+ break;
+ }
+
+ case '4':
+ {
+ printf(" fixed-length struct");
+ break;
+ }
+ }
+ printf(" sequences of size %d", seqSize);
+
+
+ if(c == 'o')
+ {
+ printf(" as oneway");
+ }
+
+ printf("...\n");
+
+ for(int i = 0; i < repetitions; ++i)
+ {
+ switch(currentType)
+ {
+ case '1':
+ {
+ switch(c)
+ {
+ case 't':
+ {
+ throughput->sendByteSeq(byteArr);
+ break;
+ }
+
+ case 'o':
+ {
+ throughputOneway->sendByteSeq(byteArr);
+ break;
+ }
+
+ case 'r':
+ {
+ throughput->recvByteSeq();
+ break;
+ }
+
+ case 'e':
+ {
+ throughput->echoByteSeq(byteSeq);
+ break;
+ }
+ }
+ break;
+ }
+
+ case '2':
+ {
+ switch(c)
+ {
+ case 't':
+ {
+ throughput->sendStringSeq(stringSeq);
+ break;
+ }
+
+ case 'o':
+ {
+ throughputOneway->sendStringSeq(stringSeq);
+ break;
+ }
+
+ case 'r':
+ {
+ throughput->recvStringSeq();
+ break;
+ }
+
+ case 'e':
+ {
+ throughput->echoStringSeq(stringSeq);
+ break;
+ }
+ }
+ break;
+ }
+
+ case '3':
+ {
+ switch(c)
+ {
+ case 't':
+ {
+ throughput->sendStructSeq(structSeq);
+ break;
+ }
+
+ case 'o':
+ {
+ throughputOneway->sendStructSeq(structSeq);
+ break;
+ }
+
+ case 'r':
+ {
+ throughput->recvStructSeq();
+ break;
+ }
+
+ case 'e':
+ {
+ throughput->echoStructSeq(structSeq);
+ break;
+ }
+ }
+ break;
+ }
+
+ case '4':
+ {
+ switch(c)
+ {
+ case 't':
+ {
+ throughput->sendFixedSeq(fixedSeq);
+ break;
+ }
+
+ case 'o':
+ {
+ throughputOneway->sendFixedSeq(fixedSeq);
+ break;
+ }
+
+ case 'r':
+ {
+ throughput->recvFixedSeq();
+ break;
+ }
+
+ case 'e':
+ {
+ throughput->echoFixedSeq(fixedSeq);
+ break;
+ }
+ }
+ break;
+ }
+ }
+ }
+
+ tm = IceUtil::Time::now() - tm;
+ printf("time for %d sequences: %lfms\n", repetitions, tm.toMilliSecondsDouble());
+ printf("time per sequence: %lfms\n", tm.toMilliSecondsDouble() / repetitions);
+ int wireSize = 0;
+ switch(currentType)
+ {
+ case '1':
+ {
+ wireSize = 1;
+ break;
+ }
+ case '2':
+ {
+ wireSize = static_cast<int>(stringSeq[0].size());
+ break;
+ }
+ case '3':
+ {
+ wireSize = static_cast<int>(structSeq[0].s.size());
+ wireSize += 8; // Size of double on the wire.
+ break;
+ }
+ case '4':
+ {
+ wireSize = 16; // Size of two ints and a double on the wire.
+ break;
+ }
+ }
+ double mbit = repetitions * seqSize * wireSize * 8.0 / tm.toMicroSeconds();
+ if(c == 'e')
+ {
+ mbit *= 2;
+ }
+ printf("throughput: %.2lfMbps\n", mbit);
+ }
+ else if(c == 's')
+ {
+ throughput->shutdown();
+ }
+ else if(c == 'x')
+ {
+ // Nothing to do
+ }
+ else if(c == '?')
+ {
+ menu();
+ }
+ else
+ {
+ printf("unknown command `%c'\n", c);
+ menu();
+ }
+ }
+ catch(const Ice::Exception& ex)
+ {
+ fprintf(stderr, "%s\n", ex.toString().c_str());
+ }
}
while(c != EOF && c != 'x');
@@ -414,28 +467,28 @@ main(int argc, char* argv[])
try
{
Ice::InitializationData initData;
- initData.properties = Ice::createProperties();
- initData.properties->load("config");
- communicator = Ice::initialize(argc, argv, initData);
- status = run(argc, argv, communicator);
+ initData.properties = Ice::createProperties();
+ initData.properties->load("config.client");
+ communicator = Ice::initialize(argc, argv, initData);
+ status = run(argc, argv, communicator);
}
catch(const Ice::Exception& ex)
{
- fprintf(stderr, "%s\n", ex.toString().c_str());
- status = EXIT_FAILURE;
+ fprintf(stderr, "%s\n", ex.toString().c_str());
+ status = EXIT_FAILURE;
}
if(communicator)
{
- try
- {
- communicator->destroy();
- }
- catch(const Ice::Exception& ex)
- {
- fprintf(stderr, "%s\n", ex.toString().c_str());
- status = EXIT_FAILURE;
- }
+ try
+ {
+ communicator->destroy();
+ }
+ catch(const Ice::Exception& ex)
+ {
+ fprintf(stderr, "%s\n", ex.toString().c_str());
+ status = EXIT_FAILURE;
+ }
}
return status;
diff --git a/cppe/demo/IceE/throughput/Server.cpp b/cppe/demo/IceE/throughput/Server.cpp
index 2c22baf53b0..99790cc758b 100644
--- a/cppe/demo/IceE/throughput/Server.cpp
+++ b/cppe/demo/IceE/throughput/Server.cpp
@@ -22,14 +22,14 @@ run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator)
for(int i = 0; i < argc; ++i)
{
if(strcmp(argv[i], "--small") == 0)
- {
- reduce = 100;
- }
+ {
+ reduce = 100;
+ }
}
Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("Throughput");
- Ice::ObjectPtr object = new ThroughputI(reduce);
- adapter->add(object, communicator->stringToIdentity("throughput"));
+ Demo::ThroughputPtr servant = new ThroughputI(reduce);
+ adapter->add(servant, communicator->stringToIdentity("throughput"));
adapter->activate();
communicator->waitForShutdown();
return EXIT_SUCCESS;
@@ -44,29 +44,29 @@ main(int argc, char* argv[])
try
{
Ice::InitializationData initData;
- initData.properties = Ice::createProperties();
- initData.properties->load("config");
- initData.properties->setProperty("Ice.Override.Timeout", "100");
- communicator = Ice::initialize(argc, argv, initData);
- status = run(argc, argv, communicator);
+ initData.properties = Ice::createProperties();
+ initData.properties->load("config.server");
+ initData.properties->setProperty("Ice.Override.Timeout", "100");
+ communicator = Ice::initialize(argc, argv, initData);
+ status = run(argc, argv, communicator);
}
catch(const Ice::Exception& ex)
{
- fprintf(stderr, "%s\n", ex.toString().c_str());
- status = EXIT_FAILURE;
+ fprintf(stderr, "%s\n", ex.toString().c_str());
+ status = EXIT_FAILURE;
}
if(communicator)
{
- try
- {
- communicator->destroy();
- }
- catch(const Ice::Exception& ex)
- {
- fprintf(stderr, "%s\n", ex.toString().c_str());
- status = EXIT_FAILURE;
- }
+ try
+ {
+ communicator->destroy();
+ }
+ catch(const Ice::Exception& ex)
+ {
+ fprintf(stderr, "%s\n", ex.toString().c_str());
+ status = EXIT_FAILURE;
+ }
}
return status;
diff --git a/cppe/demo/IceE/throughput/Throughput.ice b/cppe/demo/IceE/throughput/Throughput.ice
index 180b0fcea2b..c2aabb7fd04 100644
--- a/cppe/demo/IceE/throughput/Throughput.ice
+++ b/cppe/demo/IceE/throughput/Throughput.ice
@@ -38,6 +38,10 @@ const int FixedSeqSize = 50000;
interface Throughput
{
+ bool needsWarmup();
+ void startWarmup();
+ void endWarmup();
+
void sendByteSeq(["cpp:array"] ByteSeq seq);
ByteSeq recvByteSeq();
ByteSeq echoByteSeq(ByteSeq seq);
diff --git a/cppe/demo/IceE/throughput/ThroughputI.cpp b/cppe/demo/IceE/throughput/ThroughputI.cpp
index f2e8c6ba6b5..a51a30e8a4e 100644
--- a/cppe/demo/IceE/throughput/ThroughputI.cpp
+++ b/cppe/demo/IceE/throughput/ThroughputI.cpp
@@ -17,22 +17,42 @@ ThroughputI::ThroughputI(int reduce) :
_byteSeq(ByteSeqSize / reduce, 0),
_stringSeq(StringSeqSize / reduce, "hello"),
_structSeq(StringDoubleSeqSize / reduce),
- _fixedSeq(FixedSeqSize / reduce)
+ _fixedSeq(FixedSeqSize / reduce),
+ _warmup(false)
{
int i;
for(i = 0; i < StringDoubleSeqSize / reduce; ++i)
{
- _structSeq[i].s = "hello";
- _structSeq[i].d = 3.14;
+ _structSeq[i].s = "hello";
+ _structSeq[i].d = 3.14;
}
for(i = 0; i < FixedSeqSize / reduce; ++i)
{
- _fixedSeq[i].i = 0;
- _fixedSeq[i].j = 0;
- _fixedSeq[i].d = 0;
+ _fixedSeq[i].i = 0;
+ _fixedSeq[i].j = 0;
+ _fixedSeq[i].d = 0;
}
}
+bool
+ThroughputI::needsWarmup(const Ice::Current&)
+{
+ _warmup = false;
+ return false;
+}
+
+void
+ThroughputI::startWarmup(const Ice::Current&)
+{
+ _warmup = true;
+}
+
+void
+ThroughputI::endWarmup(const Ice::Current&)
+{
+ _warmup = false;
+}
+
void
ThroughputI::sendByteSeq(const pair<const Ice::Byte*, const Ice::Byte*>&, const Ice::Current&)
{
@@ -41,7 +61,14 @@ ThroughputI::sendByteSeq(const pair<const Ice::Byte*, const Ice::Byte*>&, const
ByteSeq
ThroughputI::recvByteSeq(const Ice::Current&)
{
- return _byteSeq;
+ if(_warmup)
+ {
+ return Demo::ByteSeq();
+ }
+ else
+ {
+ return _byteSeq;
+ }
}
ByteSeq
@@ -58,7 +85,14 @@ ThroughputI::sendStringSeq(const StringSeq&, const Ice::Current&)
StringSeq
ThroughputI::recvStringSeq(const Ice::Current&)
{
- return _stringSeq;
+ if(_warmup)
+ {
+ return Demo::StringSeq();
+ }
+ else
+ {
+ return _stringSeq;
+ }
}
StringSeq
@@ -75,7 +109,14 @@ ThroughputI::sendStructSeq(const StringDoubleSeq&, const Ice::Current&)
StringDoubleSeq
ThroughputI::recvStructSeq(const Ice::Current&)
{
- return _structSeq;
+ if(_warmup)
+ {
+ return Demo::StringDoubleSeq();
+ }
+ else
+ {
+ return _structSeq;
+ }
}
StringDoubleSeq
@@ -92,7 +133,14 @@ ThroughputI::sendFixedSeq(const FixedSeq&, const Ice::Current&)
FixedSeq
ThroughputI::recvFixedSeq(const Ice::Current&)
{
- return _fixedSeq;
+ if(_warmup)
+ {
+ return Demo::FixedSeq();
+ }
+ else
+ {
+ return _fixedSeq;
+ }
}
FixedSeq
diff --git a/cppe/demo/IceE/throughput/ThroughputI.h b/cppe/demo/IceE/throughput/ThroughputI.h
index f7192387dab..40bf1adea00 100644
--- a/cppe/demo/IceE/throughput/ThroughputI.h
+++ b/cppe/demo/IceE/throughput/ThroughputI.h
@@ -18,6 +18,9 @@ public:
ThroughputI(int);
+ virtual bool needsWarmup(const Ice::Current&);
+ virtual void startWarmup(const Ice::Current&);
+ virtual void endWarmup(const Ice::Current&);
virtual void sendByteSeq(const std::pair<const Ice::Byte*, const Ice::Byte*>&, const Ice::Current&);
virtual Demo::ByteSeq recvByteSeq(const Ice::Current&);
virtual Demo::ByteSeq echoByteSeq(const Demo::ByteSeq&, const Ice::Current&);
@@ -38,6 +41,8 @@ private:
const Demo::StringSeq _stringSeq;
/*const*/ Demo::StringDoubleSeq _structSeq;
/*const*/ Demo::FixedSeq _fixedSeq;
+
+ bool _warmup;
};
#endif
diff --git a/cppe/demo/IceE/throughput/WinCEClient.cpp b/cppe/demo/IceE/throughput/WinCEClient.cpp
index dc15f3c6a4e..84ec30147d2 100644
--- a/cppe/demo/IceE/throughput/WinCEClient.cpp
+++ b/cppe/demo/IceE/throughput/WinCEClient.cpp
@@ -23,35 +23,35 @@ WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
case WM_CREATE:
{
- RECT rcClient;
- GetClientRect(hWnd, &rcClient);
- editHwnd = CreateWindowEx(WS_EX_CLIENTEDGE, L"EDIT", L"",
- WS_CHILD | WS_VISIBLE | WS_VSCROLL | ES_MULTILINE,
- 0, 0, rcClient.right - rcClient.left, rcClient.bottom - rcClient.top,
- hWnd, (HMENU)101, GetModuleHandle(NULL), NULL);
- assert(editHwnd != NULL);
+ RECT rcClient;
+ GetClientRect(hWnd, &rcClient);
+ editHwnd = CreateWindowEx(WS_EX_CLIENTEDGE, L"EDIT", L"",
+ WS_CHILD | WS_VISIBLE | WS_VSCROLL | ES_MULTILINE,
+ 0, 0, rcClient.right - rcClient.left, rcClient.bottom - rcClient.top,
+ hWnd, (HMENU)101, GetModuleHandle(NULL), NULL);
+ assert(editHwnd != NULL);
}
break;
case WM_SIZE:
{
- RECT rcClient;
- GetClientRect(hWnd, &rcClient);
- SetWindowPos(editHwnd, NULL, 0, 0, rcClient.right, rcClient.bottom, SWP_NOZORDER);
+ RECT rcClient;
+ GetClientRect(hWnd, &rcClient);
+ SetWindowPos(editHwnd, NULL, 0, 0, rcClient.right, rcClient.bottom, SWP_NOZORDER);
}
break;
case WM_CLOSE:
- DestroyWindow(hWnd);
- break;
+ DestroyWindow(hWnd);
+ break;
case WM_DESTROY:
- wmDestroy = true;
- PostQuitMessage(0);
- break;
+ wmDestroy = true;
+ PostQuitMessage(0);
+ break;
default:
- return DefWindowProc(hWnd, msg, wParam, lParam);
+ return DefWindowProc(hWnd, msg, wParam, lParam);
}
return 0;
}
@@ -62,21 +62,21 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmd
static const TCHAR windowClassName[] = L"Throughput Client";
WNDCLASS wc;
- wc.style = CS_HREDRAW|CS_VREDRAW;
- wc.lpfnWndProc = (WNDPROC)WndProc;
- wc.cbClsExtra = 0;
- wc.cbWndExtra = 0;
- wc.hInstance = hInstance;
- wc.hIcon = LoadIcon(NULL, 0);
- wc.hCursor = 0;
- wc.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH);
+ wc.style = CS_HREDRAW|CS_VREDRAW;
+ wc.lpfnWndProc = (WNDPROC)WndProc;
+ wc.cbClsExtra = 0;
+ wc.cbWndExtra = 0;
+ wc.hInstance = hInstance;
+ wc.hIcon = LoadIcon(NULL, 0);
+ wc.hCursor = 0;
+ wc.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH);
wc.lpszMenuName = NULL;
wc.lpszClassName = windowClassName;
if(!RegisterClass(&wc))
{
- MessageBox(NULL, L"Window Registration Failed!", L"Error!", MB_ICONEXCLAMATION | MB_OK);
- return 0;
+ MessageBox(NULL, L"Window Registration Failed!", L"Error!", MB_ICONEXCLAMATION | MB_OK);
+ return 0;
}
RECT rect;
@@ -84,20 +84,20 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmd
int width = rect.right - rect.left;
if(width > 320)
{
- width = 320;
+ width = 320;
}
int height = rect.bottom - rect.top;
if(height > 200)
{
- height = 200;
+ height = 200;
}
HWND mainWnd = CreateWindow(windowClassName, L"Throughput Client", WS_VISIBLE|WS_OVERLAPPED|WS_SYSMENU|WS_SIZEBOX,
- CW_USEDEFAULT, CW_USEDEFAULT, width, height,
- NULL, NULL, hInstance, NULL);
+ CW_USEDEFAULT, CW_USEDEFAULT, width, height,
+ NULL, NULL, hInstance, NULL);
if(mainWnd == NULL)
{
- MessageBox(NULL, L"Window Creation Failed!", L"Error!", MB_ICONEXCLAMATION | MB_OK);
- return 0;
+ MessageBox(NULL, L"Window Creation Failed!", L"Error!", MB_ICONEXCLAMATION | MB_OK);
+ return 0;
}
ShowWindow(mainWnd, SW_SHOW);
@@ -108,134 +108,134 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmd
try
{
- Ice::InitializationData initData;
- initData.properties = Ice::createProperties();
-
- //
- // Set a default value for Throughput.Proxy so that the demo will
- // run without a configuration file.
- //
- initData.properties->setProperty("Throughput.Proxy", "throughput:tcp -p 10000");
-
- //
- // Now, load the configuration file if present. Under WinCE we
- // use "config.txt" since it can be edited with pocket word.
- //
- try
- {
- initData.properties->load("config.txt");
- }
- catch(const Ice::FileException&)
- {
- }
-
- communicator = Ice::initialize(__argc, __argv, initData);
-
- const char* proxyProperty = "Throughput.Proxy";
- string proxy = initData.properties->getProperty(proxyProperty);
-
- ThroughputPrx throughput = ThroughputPrx::checkedCast(communicator->stringToProxy(proxy));
- if(!throughput)
- {
- MessageBox(NULL, L"invalid proxy", L"Throughput Client", MB_ICONEXCLAMATION | MB_OK);
- return EXIT_FAILURE;
- }
- ThroughputPrx throughputOneway = ThroughputPrx::uncheckedCast(throughput->ice_oneway());
+ Ice::InitializationData initData;
+ initData.properties = Ice::createProperties();
+
+ //
+ // Set a default value for Throughput.Proxy so that the demo will
+ // run without a configuration file.
+ //
+ initData.properties->setProperty("Throughput.Proxy", "throughput:tcp -p 10000");
+
+ //
+ // Now, load the configuration file if present. Under WinCE we
+ // use "config.txt" since it can be edited with pocket word.
+ //
+ try
+ {
+ initData.properties->load("config.txt");
+ }
+ catch(const Ice::FileException&)
+ {
+ }
+
+ communicator = Ice::initialize(__argc, __argv, initData);
+
+ const char* proxyProperty = "Throughput.Proxy";
+ string proxy = initData.properties->getProperty(proxyProperty);
+
+ ThroughputPrx throughput = ThroughputPrx::checkedCast(communicator->stringToProxy(proxy));
+ if(!throughput)
+ {
+ MessageBox(NULL, L"invalid proxy", L"Throughput Client", MB_ICONEXCLAMATION | MB_OK);
+ return EXIT_FAILURE;
+ }
+ ThroughputPrx throughputOneway = ThroughputPrx::uncheckedCast(throughput->ice_oneway());
//
// The amount by which we reduce buffer sizes for CE runs
//
const int reduce = 100;
- //
- // Initialize data structures
- //
- ByteSeq byteSeq(ByteSeqSize / reduce, 0);
- pair<const Ice::Byte*, const Ice::Byte*> byteArr;
- byteArr.first = &byteSeq[0];
- byteArr.second = byteArr.first + byteSeq.size();
-
- StringSeq stringSeq(StringSeqSize / reduce, "hello");
-
- StringDoubleSeq structSeq(StringDoubleSeqSize / reduce);
- int i;
- for(i = 0; i < StringDoubleSeqSize / reduce; ++i)
- {
- structSeq[i].s = "hello";
- structSeq[i].d = 3.14;
- }
-
- FixedSeq fixedSeq(FixedSeqSize / reduce);
- for(i = 0; i < FixedSeqSize / reduce; ++i)
- {
- fixedSeq[i].i = 0;
- fixedSeq[i].j = 0;
- fixedSeq[i].d = 0;
- }
-
- const int repetitions = 1000;
-
- // Initial ping to setup the connection.
- throughput->ice_ping();
-
- ::SendMessage(editHwnd, EM_REPLACESEL, (WPARAM)FALSE,
- (LPARAM)L"Running throughput tests (this may take a while)\r\n");
-
- for(int type = 0; type < 4; ++type)
- {
- wchar_t* data;
- int seqSize;
- if(type == 0)
- {
- data = L"byte";
- seqSize = ByteSeqSize / reduce;
- }
- else if(type == 1)
- {
- data = L"string";
- seqSize = StringSeqSize / reduce;
- }
- else if(type == 2)
- {
- data = L"variable-length struct";
- seqSize = StringDoubleSeqSize / reduce;
- }
- else if(type == 3)
- {
- data = L"fixed-length struct";
- seqSize = FixedSeqSize / reduce;
- }
-
- for(int mode = 0; mode < 4; ++mode)
- {
- wchar_t* action;
- wchar_t* qualifier = L"";
- if(mode == 0)
- {
- action = L"sending";
- }
- else if(mode == 1)
- {
- action = L"sending";
- qualifier = L" as oneway";
- }
- else if(mode == 2)
- {
- action = L"receiving";
- }
- else if(mode == 3)
- {
- action = L"sending and receiving";
- }
-
- wchar_t buf[1000];
- wsprintf(buf, L"\r\n%s %d %s sequences of size %d%s\r\n", action, repetitions, data, seqSize,
- qualifier);
- ::SendMessage(editHwnd, EM_REPLACESEL, (WPARAM)FALSE, (LPARAM)buf);
-
- IceUtil::Time tm = IceUtil::Time::now();
- for(i = 0; i < repetitions; ++i)
- {
+ //
+ // Initialize data structures
+ //
+ ByteSeq byteSeq(ByteSeqSize / reduce, 0);
+ pair<const Ice::Byte*, const Ice::Byte*> byteArr;
+ byteArr.first = &byteSeq[0];
+ byteArr.second = byteArr.first + byteSeq.size();
+
+ StringSeq stringSeq(StringSeqSize / reduce, "hello");
+
+ StringDoubleSeq structSeq(StringDoubleSeqSize / reduce);
+ int i;
+ for(i = 0; i < StringDoubleSeqSize / reduce; ++i)
+ {
+ structSeq[i].s = "hello";
+ structSeq[i].d = 3.14;
+ }
+
+ FixedSeq fixedSeq(FixedSeqSize / reduce);
+ for(i = 0; i < FixedSeqSize / reduce; ++i)
+ {
+ fixedSeq[i].i = 0;
+ fixedSeq[i].j = 0;
+ fixedSeq[i].d = 0;
+ }
+
+ const int repetitions = 1000;
+
+ // Initial ping to setup the connection.
+ throughput->ice_ping();
+
+ ::SendMessage(editHwnd, EM_REPLACESEL, (WPARAM)FALSE,
+ (LPARAM)L"Running throughput tests (this may take a while)\r\n");
+
+ for(int type = 0; type < 4; ++type)
+ {
+ wchar_t* data;
+ int seqSize;
+ if(type == 0)
+ {
+ data = L"byte";
+ seqSize = ByteSeqSize / reduce;
+ }
+ else if(type == 1)
+ {
+ data = L"string";
+ seqSize = StringSeqSize / reduce;
+ }
+ else if(type == 2)
+ {
+ data = L"variable-length struct";
+ seqSize = StringDoubleSeqSize / reduce;
+ }
+ else if(type == 3)
+ {
+ data = L"fixed-length struct";
+ seqSize = FixedSeqSize / reduce;
+ }
+
+ for(int mode = 0; mode < 4; ++mode)
+ {
+ wchar_t* action;
+ wchar_t* qualifier = L"";
+ if(mode == 0)
+ {
+ action = L"sending";
+ }
+ else if(mode == 1)
+ {
+ action = L"sending";
+ qualifier = L" as oneway";
+ }
+ else if(mode == 2)
+ {
+ action = L"receiving";
+ }
+ else if(mode == 3)
+ {
+ action = L"sending and receiving";
+ }
+
+ wchar_t buf[1000];
+ wsprintf(buf, L"\r\n%s %d %s sequences of size %d%s\r\n", action, repetitions, data, seqSize,
+ qualifier);
+ ::SendMessage(editHwnd, EM_REPLACESEL, (WPARAM)FALSE, (LPARAM)buf);
+
+ IceUtil::Time tm = IceUtil::Time::now();
+ for(i = 0; i < repetitions; ++i)
+ {
switch(type)
{
case 0:
@@ -361,31 +361,31 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmd
}
break;
}
- }
-
- if((i % 100) == 0)
- {
- ::SendMessage(editHwnd, EM_REPLACESEL, (WPARAM)FALSE, (LPARAM)L".");
- //
- // Run the message pump just in case the user tries to close the app.
- //
- MSG Msg;
- while(PeekMessage(&Msg, NULL, 0, 0, PM_REMOVE))
- {
- TranslateMessage(&Msg);
- DispatchMessage(&Msg);
- }
- if(wmDestroy)
- {
- break;
- }
- }
- }
- tm = IceUtil::Time::now() - tm;
-
- wsprintf(buf, L"\r\ntime for %d sequences: %.04fms\r\ntime per sequence: %.04fms\r\n",
- repetitions, tm.toMilliSecondsDouble(), tm.toMilliSecondsDouble() / repetitions);
- ::SendMessage(editHwnd, EM_REPLACESEL, (WPARAM)FALSE, (LPARAM)buf);
+ }
+
+ if((i % 100) == 0)
+ {
+ ::SendMessage(editHwnd, EM_REPLACESEL, (WPARAM)FALSE, (LPARAM)L".");
+ //
+ // Run the message pump just in case the user tries to close the app.
+ //
+ MSG Msg;
+ while(PeekMessage(&Msg, NULL, 0, 0, PM_REMOVE))
+ {
+ TranslateMessage(&Msg);
+ DispatchMessage(&Msg);
+ }
+ if(wmDestroy)
+ {
+ break;
+ }
+ }
+ }
+ tm = IceUtil::Time::now() - tm;
+
+ wsprintf(buf, L"\r\ntime for %d sequences: %.04fms\r\ntime per sequence: %.04fms\r\n",
+ repetitions, tm.toMilliSecondsDouble(), tm.toMilliSecondsDouble() / repetitions);
+ ::SendMessage(editHwnd, EM_REPLACESEL, (WPARAM)FALSE, (LPARAM)buf);
int wireSize = 0;
switch(type)
@@ -417,22 +417,22 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmd
{
mbit *= 2;
}
- wsprintf(buf, L"throughput: %.04f MBit/s\r\n", mbit);
- ::SendMessage(editHwnd, EM_REPLACESEL, (WPARAM)FALSE, (LPARAM)buf);
- }
- }
-
- ::SendMessage(editHwnd, EM_REPLACESEL, (WPARAM)FALSE, (LPARAM)L"\r\nThroughput tests completed\r\n");
+ wsprintf(buf, L"throughput: %.04f MBit/s\r\n", mbit);
+ ::SendMessage(editHwnd, EM_REPLACESEL, (WPARAM)FALSE, (LPARAM)buf);
+ }
+ }
+
+ ::SendMessage(editHwnd, EM_REPLACESEL, (WPARAM)FALSE, (LPARAM)L"\r\nThroughput tests completed\r\n");
}
catch(const Ice::Exception& ex)
{
- TCHAR wtext[1024];
- string err = ex.toString();
- mbstowcs(wtext, err.c_str(), err.size());
- MessageBox(NULL, wtext, L"Error", MB_ICONEXCLAMATION | MB_OK);
+ TCHAR wtext[1024];
+ string err = ex.toString();
+ mbstowcs(wtext, err.c_str(), err.size());
+ MessageBox(NULL, wtext, L"Error", MB_ICONEXCLAMATION | MB_OK);
- status = EXIT_FAILURE;
+ status = EXIT_FAILURE;
}
//
@@ -441,25 +441,25 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmd
MSG Msg;
while(GetMessage(&Msg, NULL, 0, 0) > 0)
{
- TranslateMessage(&Msg);
- DispatchMessage(&Msg);
+ TranslateMessage(&Msg);
+ DispatchMessage(&Msg);
}
if(communicator)
{
- try
- {
- communicator->destroy();
- }
- catch(const Ice::Exception& ex)
- {
- TCHAR wtext[1024];
- string err = ex.toString();
- mbstowcs(wtext, err.c_str(), err.size());
- MessageBox(NULL, wtext, L"Error", MB_ICONEXCLAMATION | MB_OK);
-
- status = EXIT_FAILURE;
- }
+ try
+ {
+ communicator->destroy();
+ }
+ catch(const Ice::Exception& ex)
+ {
+ TCHAR wtext[1024];
+ string err = ex.toString();
+ mbstowcs(wtext, err.c_str(), err.size());
+ MessageBox(NULL, wtext, L"Error", MB_ICONEXCLAMATION | MB_OK);
+
+ status = EXIT_FAILURE;
+ }
}
return status;
diff --git a/cppe/demo/IceE/throughput/WinCEServer.cpp b/cppe/demo/IceE/throughput/WinCEServer.cpp
index b80eacc7fe5..a8d8c4a5b11 100644
--- a/cppe/demo/IceE/throughput/WinCEServer.cpp
+++ b/cppe/demo/IceE/throughput/WinCEServer.cpp
@@ -22,34 +22,34 @@ WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
case WM_CREATE:
{
- RECT rcClient;
- GetClientRect(hWnd, &rcClient);
- editHwnd = CreateWindowEx(WS_EX_CLIENTEDGE, L"EDIT", L"",
- WS_CHILD | WS_VISIBLE | WS_VSCROLL | ES_MULTILINE,
- 0, 0, rcClient.right - rcClient.left, rcClient.bottom - rcClient.top,
- hWnd, (HMENU)101, GetModuleHandle(NULL), NULL);
- assert(editHwnd != NULL);
+ RECT rcClient;
+ GetClientRect(hWnd, &rcClient);
+ editHwnd = CreateWindowEx(WS_EX_CLIENTEDGE, L"EDIT", L"",
+ WS_CHILD | WS_VISIBLE | WS_VSCROLL | ES_MULTILINE,
+ 0, 0, rcClient.right - rcClient.left, rcClient.bottom - rcClient.top,
+ hWnd, (HMENU)101, GetModuleHandle(NULL), NULL);
+ assert(editHwnd != NULL);
}
break;
case WM_SIZE:
{
- RECT rcClient;
- GetClientRect(hWnd, &rcClient);
- SetWindowPos(editHwnd, NULL, 0, 0, rcClient.right, rcClient.bottom, SWP_NOZORDER);
+ RECT rcClient;
+ GetClientRect(hWnd, &rcClient);
+ SetWindowPos(editHwnd, NULL, 0, 0, rcClient.right, rcClient.bottom, SWP_NOZORDER);
}
break;
case WM_CLOSE:
- DestroyWindow(hWnd);
- break;
+ DestroyWindow(hWnd);
+ break;
case WM_DESTROY:
- PostQuitMessage(0);
- break;
+ PostQuitMessage(0);
+ break;
default:
- return DefWindowProc(hWnd, msg, wParam, lParam);
+ return DefWindowProc(hWnd, msg, wParam, lParam);
}
return 0;
}
@@ -60,22 +60,22 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmd
static const TCHAR windowClassName[] = L"Throughput Server";
WNDCLASS wc;
- wc.style = CS_HREDRAW|CS_VREDRAW;
- wc.lpfnWndProc = (WNDPROC)WndProc;
- wc.cbClsExtra = 0;
- wc.cbWndExtra = 0;
- wc.hInstance = hInstance;
- wc.hIcon = LoadIcon(NULL, 0);
- wc.hCursor = 0;
- wc.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH);
+ wc.style = CS_HREDRAW|CS_VREDRAW;
+ wc.lpfnWndProc = (WNDPROC)WndProc;
+ wc.cbClsExtra = 0;
+ wc.cbWndExtra = 0;
+ wc.hInstance = hInstance;
+ wc.hIcon = LoadIcon(NULL, 0);
+ wc.hCursor = 0;
+ wc.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH);
wc.lpszMenuName = NULL;
wc.lpszClassName = windowClassName;
if(!RegisterClass(&wc))
{
- MessageBox(NULL, L"Window Registration Failed!", L"Error!",
- MB_ICONEXCLAMATION | MB_OK);
- return 0;
+ MessageBox(NULL, L"Window Registration Failed!", L"Error!",
+ MB_ICONEXCLAMATION | MB_OK);
+ return 0;
}
RECT rect;
@@ -83,20 +83,20 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmd
int width = rect.right - rect.left;
if(width > 320)
{
- width = 320;
+ width = 320;
}
int height = rect.bottom - rect.top;
if(height > 200)
{
- height = 200;
+ height = 200;
}
HWND mainWnd = CreateWindow(windowClassName, L"Throughput Server", WS_VISIBLE|WS_OVERLAPPED|WS_SYSMENU|WS_SIZEBOX,
- CW_USEDEFAULT, CW_USEDEFAULT, width, height,
- NULL, NULL, hInstance, NULL);
+ CW_USEDEFAULT, CW_USEDEFAULT, width, height,
+ NULL, NULL, hInstance, NULL);
if(mainWnd == NULL)
{
- MessageBox(NULL, L"Window Creation Failed!", L"Error!", MB_ICONEXCLAMATION | MB_OK);
- return 0;
+ MessageBox(NULL, L"Window Creation Failed!", L"Error!", MB_ICONEXCLAMATION | MB_OK);
+ return 0;
}
ShowWindow(mainWnd, SW_SHOW);
@@ -112,74 +112,74 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmd
try
{
Ice::InitializationData initData;
- initData.properties = Ice::createProperties();
-
- //
- // Set a default value for Latency.Endpoints so that the demo
- // will run without a configuration file.
- //
- initData.properties->setProperty("Throughput.Endpoints","tcp -p 10000");
-
- //
- // Now, load the configuration file if present. Under WinCE we
- // use "config.txt" since it can be edited with pocket word.
- //
- try
- {
- initData.properties->load("config.txt");
- }
- catch(const Ice::FileException&)
- {
- }
-
- communicator = Ice::initialize(__argc, __argv, initData);
-
- Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("Throughput");
- Ice::ObjectPtr object = new ThroughputI(100);
- adapter->add(object, communicator->stringToIdentity("throughput"));
- adapter->activate();
-
- //
- // Display a helpful message to the user.
- //
- ::SendMessage(editHwnd, EM_REPLACESEL,
- (WPARAM)FALSE, (LPARAM)L"Close the window to terminate the server.\r\n");
-
- //
- // Run the message pump.
- //
- MSG Msg;
- while(GetMessage(&Msg, NULL, 0, 0) > 0)
- {
- TranslateMessage(&Msg);
- DispatchMessage(&Msg);
- }
+ initData.properties = Ice::createProperties();
+
+ //
+ // Set a default value for Latency.Endpoints so that the demo
+ // will run without a configuration file.
+ //
+ initData.properties->setProperty("Throughput.Endpoints","tcp -p 10000");
+
+ //
+ // Now, load the configuration file if present. Under WinCE we
+ // use "config.txt" since it can be edited with pocket word.
+ //
+ try
+ {
+ initData.properties->load("config.txt");
+ }
+ catch(const Ice::FileException&)
+ {
+ }
+
+ communicator = Ice::initialize(__argc, __argv, initData);
+
+ Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("Throughput");
+ Demo::ThroughputPtr servant = new ThroughputI(100);
+ adapter->add(servant, communicator->stringToIdentity("throughput"));
+ adapter->activate();
+
+ //
+ // Display a helpful message to the user.
+ //
+ ::SendMessage(editHwnd, EM_REPLACESEL,
+ (WPARAM)FALSE, (LPARAM)L"Close the window to terminate the server.\r\n");
+
+ //
+ // Run the message pump.
+ //
+ MSG Msg;
+ while(GetMessage(&Msg, NULL, 0, 0) > 0)
+ {
+ TranslateMessage(&Msg);
+ DispatchMessage(&Msg);
+ }
}
catch(const Ice::Exception& ex)
{
- TCHAR wtext[1024];
- string err = ex.toString();
- mbstowcs(wtext, err.c_str(), err.size());
- MessageBox(mainWnd, wtext, L"Error", MB_ICONEXCLAMATION | MB_OK);
+ TCHAR wtext[1024];
+ string err = ex.toString();
+ mbstowcs(wtext, err.c_str(), err.size());
+ MessageBox(mainWnd, wtext, L"Error", MB_ICONEXCLAMATION | MB_OK);
- status = EXIT_FAILURE;
+ status = EXIT_FAILURE;
}
if(communicator)
{
- try
- {
- communicator->destroy();
- }
- catch(const Ice::Exception& ex)
- {
- TCHAR wtext[1024];
- string err = ex.toString();
- mbstowcs(wtext, err.c_str(), err.size());
- MessageBox(mainWnd, wtext, L"Error", MB_ICONEXCLAMATION | MB_OK);
-
- status = EXIT_FAILURE;
- }
+ try
+ {
+ communicator->destroy();
+ }
+ catch(const Ice::Exception& ex)
+ {
+ TCHAR wtext[1024];
+ string err = ex.toString();
+ mbstowcs(wtext, err.c_str(), err.size());
+ MessageBox(mainWnd, wtext, L"Error", MB_ICONEXCLAMATION | MB_OK);
+
+ status = EXIT_FAILURE;
+ }
}
return status;
}
diff --git a/cppe/demo/IceE/throughput/config b/cppe/demo/IceE/throughput/config
deleted file mode 100644
index cdc6b93326a..00000000000
--- a/cppe/demo/IceE/throughput/config
+++ /dev/null
@@ -1,7 +0,0 @@
-Throughput.Proxy=throughput:default -p 10000 -h 127.0.0.1
-Throughput.Endpoints=default -p 10000 -h 127.0.0.1
-
-#
-# Use faster blocking client side model by default.
-#
-Ice.Blocking=1
diff --git a/cppe/demo/IceE/throughput/config.client b/cppe/demo/IceE/throughput/config.client
new file mode 100644
index 00000000000..02ef8276f6c
--- /dev/null
+++ b/cppe/demo/IceE/throughput/config.client
@@ -0,0 +1,5 @@
+#
+# The client reads this property to create the reference to the
+# "Throughput" object in the server.
+#
+Throughput.Proxy=throughput:default -p 10000 -h 127.0.0.1
diff --git a/cppe/demo/IceE/throughput/config.server b/cppe/demo/IceE/throughput/config.server
new file mode 100644
index 00000000000..1a301bb3ed6
--- /dev/null
+++ b/cppe/demo/IceE/throughput/config.server
@@ -0,0 +1,11 @@
+#
+# The server creates one single object adapter with the name
+# "Throughput". The following line sets the endpoints for this
+# adapter.
+#
+Throughput.Endpoints=default -p 10000 -h 127.0.0.1
+
+#
+# Warn about connection exceptions
+#
+Ice.Warn.Connections=1
diff --git a/cppe/demo/IceE/workqueue/WorkQueue.cpp b/cppe/demo/IceE/workqueue/WorkQueue.cpp
index 0a209127e08..1bf33a30efe 100644
--- a/cppe/demo/IceE/workqueue/WorkQueue.cpp
+++ b/cppe/demo/IceE/workqueue/WorkQueue.cpp
@@ -24,28 +24,28 @@ public:
virtual void
run()
{
- while(1)
- {
- string item = nextItem();
- if(item == "destroy")
- {
- break;
- }
+ while(1)
+ {
+ string item = nextItem();
+ if(item == "destroy")
+ {
+ break;
+ }
- printf("work item: %s\n", item.c_str());
- IceUtil::ThreadControl::sleep(IceUtil::Time::seconds(1));
- }
+ printf("work item: %s\n", item.c_str());
+ IceUtil::ThreadControl::sleep(IceUtil::Time::seconds(1));
+ }
}
void
add(const string& item)
{
- IceUtil::Monitor<IceUtil::Mutex>::Lock lock(_monitor);
- if(_queue.empty())
- {
- _monitor.notify();
- }
- _queue.push_back(item);
+ IceUtil::Monitor<IceUtil::Mutex>::Lock lock(_monitor);
+ if(_queue.empty())
+ {
+ _monitor.notify();
+ }
+ _queue.push_back(item);
}
private:
@@ -53,15 +53,15 @@ private:
string
nextItem()
{
- IceUtil::Monitor<IceUtil::Mutex>::Lock lock(_monitor);
- while(_queue.empty())
- {
- _monitor.wait();
- }
-
- string item = _queue.front();
- _queue.pop_front();
- return item;
+ IceUtil::Monitor<IceUtil::Mutex>::Lock lock(_monitor);
+ while(_queue.empty())
+ {
+ _monitor.wait();
+ }
+
+ string item = _queue.front();
+ _queue.pop_front();
+ return item;
}
@@ -76,29 +76,29 @@ main()
{
try
{
- WorkQueuePtr h = new WorkQueue();
- IceUtil::ThreadControl control = h->start();
- printf("Pushing work items");
- printf("."); fflush(stdout);
- h->add("item1");
- printf("."); fflush(stdout);
- h->add("item2");
- printf("."); fflush(stdout);
- h->add("item3");
- printf("."); fflush(stdout);
- h->add("item4");
- printf("."); fflush(stdout);
- h->add("item5");
- printf("."); fflush(stdout);
- h->add("destroy");
- printf(" ok\n");
- printf("Waiting for WorkQueue to terminate\n");
- control.join();
+ WorkQueuePtr h = new WorkQueue();
+ IceUtil::ThreadControl control = h->start();
+ printf("Pushing work items");
+ printf("."); fflush(stdout);
+ h->add("item1");
+ printf("."); fflush(stdout);
+ h->add("item2");
+ printf("."); fflush(stdout);
+ h->add("item3");
+ printf("."); fflush(stdout);
+ h->add("item4");
+ printf("."); fflush(stdout);
+ h->add("item5");
+ printf("."); fflush(stdout);
+ h->add("destroy");
+ printf(" ok\n");
+ printf("Waiting for WorkQueue to terminate\n");
+ control.join();
}
catch(const IceUtil::Exception& ex)
{
- fprintf(stderr, "%s\n", ex.toString().c_str());
- return EXIT_FAILURE;
+ fprintf(stderr, "%s\n", ex.toString().c_str());
+ return EXIT_FAILURE;
}
return EXIT_SUCCESS;
diff --git a/cppe/include/IceE/AbstractMutex.h b/cppe/include/IceE/AbstractMutex.h
index e19a14178d6..77f54bed9df 100644
--- a/cppe/include/IceE/AbstractMutex.h
+++ b/cppe/include/IceE/AbstractMutex.h
@@ -38,17 +38,17 @@ public:
virtual void lock() const
{
- T::lock();
+ T::lock();
}
virtual void unlock() const
{
- T::unlock();
+ T::unlock();
}
virtual bool tryLock() const
{
- return T::tryLock();
+ return T::tryLock();
}
virtual ~AbstractMutexI()
@@ -65,17 +65,17 @@ public:
virtual void lock() const
{
- T::readLock();
+ T::readLock();
}
virtual void unlock() const
{
- T::unlock();
+ T::unlock();
}
virtual bool tryLock() const
{
- return T::tryReadLock();
+ return T::tryReadLock();
}
virtual ~AbstractMutexReadI()
@@ -92,17 +92,17 @@ public:
virtual void lock() const
{
- T::writeLock();
+ T::writeLock();
}
virtual void unlock() const
{
- T::unlock();
+ T::unlock();
}
virtual bool tryLock() const
{
- return T::tryWriteLock();
+ return T::tryWriteLock();
}
virtual ~AbstractMutexWriteI()
diff --git a/cppe/include/IceE/BasicStream.h b/cppe/include/IceE/BasicStream.h
index 2bc6cc488c1..a39c96aedf1 100644
--- a/cppe/include/IceE/BasicStream.h
+++ b/cppe/include/IceE/BasicStream.h
@@ -87,31 +87,31 @@ public:
const Ice::StringConverterPtr& stringConverter, const Ice::WstringConverterPtr& wstringConverter,
#endif
bool unlimited = false) :
- Buffer(messageSizeMax),
- _instance(instance),
- _currentReadEncaps(0),
- _currentWriteEncaps(0),
- _messageSizeMax(messageSizeMax),
+ Buffer(messageSizeMax),
+ _instance(instance),
+ _currentReadEncaps(0),
+ _currentWriteEncaps(0),
+ _messageSizeMax(messageSizeMax),
_unlimited(unlimited),
#ifdef ICEE_HAS_WSTRING
_stringConverter(stringConverter),
_wstringConverter(wstringConverter),
#endif
- _seqDataStack(0)
+ _seqDataStack(0)
{
- // Inlined for performance reasons.
+ // Inlined for performance reasons.
}
~BasicStream()
{
- // Inlined for performance reasons.
-
- if(_currentReadEncaps != &_preAllocatedReadEncaps ||
- _currentWriteEncaps != &_preAllocatedWriteEncaps ||
- _seqDataStack)
- {
- clear(); // Not inlined.
- }
+ // Inlined for performance reasons.
+
+ if(_currentReadEncaps != &_preAllocatedReadEncaps ||
+ _currentWriteEncaps != &_preAllocatedWriteEncaps ||
+ _seqDataStack)
+ {
+ clear(); // Not inlined.
+ }
}
ICE_API void clear();
@@ -126,168 +126,168 @@ public:
void resize(Container::size_type sz)
{
- if(!_unlimited && sz > _messageSizeMax)
- {
- Ice::throwMemoryLimitException(__FILE__, __LINE__);
- }
-
- b.resize(sz);
+ if(!_unlimited && sz > _messageSizeMax)
+ {
+ Ice::throwMemoryLimitException(__FILE__, __LINE__);
+ }
+
+ b.resize(sz);
}
void reset() // Inlined for performance reasons.
{
b.reset();
- i = b.begin();
+ i = b.begin();
}
ICE_API void startSeq(int, int);
void checkSeq()
{
- checkSeq(static_cast<int>(b.end() - i));
+ checkSeq(static_cast<int>(b.end() - i));
}
void checkSeq(int bytesLeft)
{
- //
- // Check, given the number of elements requested for this sequence,
- // that this sequence, plus the sum of the sizes of the remaining
- // number of elements of all enclosing sequences, would still fit
- // within the message.
- //
- int size = 0;
- SeqData* sd = _seqDataStack;
- do
- {
- size += (sd->numElements - 1) * sd->minSize;
- sd = sd->previous;
- }
- while(sd);
-
- if(size > bytesLeft)
- {
- Ice::throwUnmarshalOutOfBoundsException(__FILE__, __LINE__);
- }
+ //
+ // Check, given the number of elements requested for this sequence,
+ // that this sequence, plus the sum of the sizes of the remaining
+ // number of elements of all enclosing sequences, would still fit
+ // within the message.
+ //
+ int size = 0;
+ SeqData* sd = _seqDataStack;
+ do
+ {
+ size += (sd->numElements - 1) * sd->minSize;
+ sd = sd->previous;
+ }
+ while(sd);
+
+ if(size > bytesLeft)
+ {
+ Ice::throwUnmarshalOutOfBoundsException(__FILE__, __LINE__);
+ }
}
ICE_API void checkFixedSeq(int, int); // For sequences of fixed-size types.
void endElement()
{
- assert(_seqDataStack);
- --_seqDataStack->numElements;
+ assert(_seqDataStack);
+ --_seqDataStack->numElements;
}
ICE_API void endSeq(int);
void startWriteEncaps()
{
- WriteEncaps* oldEncaps = _currentWriteEncaps;
- if(!oldEncaps) // First allocated encaps?
- {
- _currentWriteEncaps = &_preAllocatedWriteEncaps;
- }
- else
- {
- _currentWriteEncaps = new WriteEncaps();
- _currentWriteEncaps->previous = oldEncaps;
- }
- _currentWriteEncaps->start = b.size();
-
- write(Ice::Int(0)); // Placeholder for the encapsulation length.
- write(encodingMajor);
- write(encodingMinor);
+ WriteEncaps* oldEncaps = _currentWriteEncaps;
+ if(!oldEncaps) // First allocated encaps?
+ {
+ _currentWriteEncaps = &_preAllocatedWriteEncaps;
+ }
+ else
+ {
+ _currentWriteEncaps = new WriteEncaps();
+ _currentWriteEncaps->previous = oldEncaps;
+ }
+ _currentWriteEncaps->start = b.size();
+
+ write(Ice::Int(0)); // Placeholder for the encapsulation length.
+ write(encodingMajor);
+ write(encodingMinor);
}
void endWriteEncaps()
{
- assert(_currentWriteEncaps);
- Container::size_type start = _currentWriteEncaps->start;
- Ice::Int sz = static_cast<Ice::Int>(b.size() - start); // Size includes size and version.
- Ice::Byte* dest = &(*(b.begin() + start));
+ assert(_currentWriteEncaps);
+ Container::size_type start = _currentWriteEncaps->start;
+ Ice::Int sz = static_cast<Ice::Int>(b.size() - start); // Size includes size and version.
+ Ice::Byte* dest = &(*(b.begin() + start));
#ifdef ICE_BIG_ENDIAN
- const Ice::Byte* src = reinterpret_cast<const Ice::Byte*>(&sz) + sizeof(Ice::Int) - 1;
- *dest++ = *src--;
- *dest++ = *src--;
- *dest++ = *src--;
- *dest = *src;
+ const Ice::Byte* src = reinterpret_cast<const Ice::Byte*>(&sz) + sizeof(Ice::Int) - 1;
+ *dest++ = *src--;
+ *dest++ = *src--;
+ *dest++ = *src--;
+ *dest = *src;
#else
- const Ice::Byte* src = reinterpret_cast<const Ice::Byte*>(&sz);
- *dest++ = *src++;
- *dest++ = *src++;
- *dest++ = *src++;
- *dest = *src;
+ const Ice::Byte* src = reinterpret_cast<const Ice::Byte*>(&sz);
+ *dest++ = *src++;
+ *dest++ = *src++;
+ *dest++ = *src++;
+ *dest = *src;
#endif
- WriteEncaps* oldEncaps = _currentWriteEncaps;
- _currentWriteEncaps = _currentWriteEncaps->previous;
- if(oldEncaps == &_preAllocatedWriteEncaps)
- {
- oldEncaps->reset();
- }
- else
- {
- delete oldEncaps;
- }
+ WriteEncaps* oldEncaps = _currentWriteEncaps;
+ _currentWriteEncaps = _currentWriteEncaps->previous;
+ if(oldEncaps == &_preAllocatedWriteEncaps)
+ {
+ oldEncaps->reset();
+ }
+ else
+ {
+ delete oldEncaps;
+ }
}
void startReadEncaps()
{
- ReadEncaps* oldEncaps = _currentReadEncaps;
- if(!oldEncaps) // First allocated encaps?
- {
- _currentReadEncaps = &_preAllocatedReadEncaps;
- }
- else
- {
- _currentReadEncaps = new ReadEncaps();
- _currentReadEncaps->previous = oldEncaps;
- }
- _currentReadEncaps->start = i - b.begin();
-
- //
- // I don't use readSize() and writeSize() for encapsulations,
- // because when creating an encapsulation, I must know in advance
- // how many bytes the size information will require in the data
- // stream. If I use an Int, it is always 4 bytes. For
- // readSize()/writeSize(), it could be 1 or 5 bytes.
- //
- Ice::Int sz;
- read(sz);
- if(sz < 0)
- {
- Ice::throwNegativeSizeException(__FILE__, __LINE__);
- }
- if(i - sizeof(Ice::Int) + sz > b.end())
- {
- Ice::throwUnmarshalOutOfBoundsException(__FILE__, __LINE__);
- }
- _currentReadEncaps->sz = sz;
-
- Ice::Byte eMajor;
- Ice::Byte eMinor;
- read(eMajor);
- read(eMinor);
- if(eMajor != encodingMajor
- || static_cast<unsigned char>(eMinor) > static_cast<unsigned char>(encodingMinor))
- {
- Ice::throwUnsupportedEncodingException(__FILE__, __LINE__, eMajor, eMinor, encodingMajor, encodingMinor);
- }
- _currentReadEncaps->encodingMajor = eMajor;
- _currentReadEncaps->encodingMinor = eMinor;
+ ReadEncaps* oldEncaps = _currentReadEncaps;
+ if(!oldEncaps) // First allocated encaps?
+ {
+ _currentReadEncaps = &_preAllocatedReadEncaps;
+ }
+ else
+ {
+ _currentReadEncaps = new ReadEncaps();
+ _currentReadEncaps->previous = oldEncaps;
+ }
+ _currentReadEncaps->start = i - b.begin();
+
+ //
+ // I don't use readSize() and writeSize() for encapsulations,
+ // because when creating an encapsulation, I must know in advance
+ // how many bytes the size information will require in the data
+ // stream. If I use an Int, it is always 4 bytes. For
+ // readSize()/writeSize(), it could be 1 or 5 bytes.
+ //
+ Ice::Int sz;
+ read(sz);
+ if(sz < 0)
+ {
+ Ice::throwNegativeSizeException(__FILE__, __LINE__);
+ }
+ if(i - sizeof(Ice::Int) + sz > b.end())
+ {
+ Ice::throwUnmarshalOutOfBoundsException(__FILE__, __LINE__);
+ }
+ _currentReadEncaps->sz = sz;
+
+ Ice::Byte eMajor;
+ Ice::Byte eMinor;
+ read(eMajor);
+ read(eMinor);
+ if(eMajor != encodingMajor
+ || static_cast<unsigned char>(eMinor) > static_cast<unsigned char>(encodingMinor))
+ {
+ Ice::throwUnsupportedEncodingException(__FILE__, __LINE__, eMajor, eMinor, encodingMajor, encodingMinor);
+ }
+ _currentReadEncaps->encodingMajor = eMajor;
+ _currentReadEncaps->encodingMinor = eMinor;
}
void endReadEncaps()
{
- assert(_currentReadEncaps);
- Container::size_type start = _currentReadEncaps->start;
- Ice::Int sz = _currentReadEncaps->sz;
- i = b.begin() + start + sz;
-
- ReadEncaps* oldEncaps = _currentReadEncaps;
- _currentReadEncaps = _currentReadEncaps->previous;
- if(oldEncaps == &_preAllocatedReadEncaps)
- {
- oldEncaps->reset();
- }
- else
- {
- delete oldEncaps;
- }
+ assert(_currentReadEncaps);
+ Container::size_type start = _currentReadEncaps->start;
+ Ice::Int sz = _currentReadEncaps->sz;
+ i = b.begin() + start + sz;
+
+ ReadEncaps* oldEncaps = _currentReadEncaps;
+ _currentReadEncaps = _currentReadEncaps->previous;
+ if(oldEncaps == &_preAllocatedReadEncaps)
+ {
+ oldEncaps->reset();
+ }
+ else
+ {
+ delete oldEncaps;
+ }
}
ICE_API Ice::Int getReadEncapsSize();
ICE_API void skipEncaps();
@@ -301,16 +301,16 @@ public:
void writeSize(Ice::Int v) // Inlined for performance reasons.
{
- assert(v >= 0);
- if(v > 254)
- {
- write(Ice::Byte(255));
- write(v);
- }
- else
- {
- write(static_cast<Ice::Byte>(v));
- }
+ assert(v >= 0);
+ if(v > 254)
+ {
+ write(Ice::Byte(255));
+ write(v);
+ }
+ else
+ {
+ write(static_cast<Ice::Byte>(v));
+ }
}
void rewriteSize(Ice::Int v, Container::iterator dest)
@@ -342,21 +342,21 @@ public:
void
readSize(Ice::Int& v) // Inlined for performance reasons.
{
- Ice::Byte byte;
- read(byte);
- unsigned val = static_cast<unsigned char>(byte);
- if(val == 255)
- {
- read(v);
- if(v < 0)
- {
- Ice::throwNegativeSizeException(__FILE__, __LINE__);
- }
- }
- else
- {
- v = static_cast<Ice::Int>(static_cast<unsigned char>(byte));
- }
+ Ice::Byte byte;
+ read(byte);
+ unsigned val = static_cast<unsigned char>(byte);
+ if(val == 255)
+ {
+ read(v);
+ if(v < 0)
+ {
+ Ice::throwNegativeSizeException(__FILE__, __LINE__);
+ }
+ }
+ else
+ {
+ v = static_cast<Ice::Int>(static_cast<unsigned char>(byte));
+ }
}
ICE_API void writeBlob(const std::vector<Ice::Byte>&);
@@ -364,42 +364,42 @@ public:
void writeBlob(const Ice::Byte* v, Container::size_type sz)
{
- if(sz > 0)
- {
- Container::size_type pos = b.size();
- resize(pos + sz);
- memcpy(&b[pos], &v[0], sz);
- }
+ if(sz > 0)
+ {
+ Container::size_type pos = b.size();
+ resize(pos + sz);
+ memcpy(&b[pos], &v[0], sz);
+ }
}
void readBlob(const Ice::Byte*& v, Container::size_type sz)
{
- if(sz > 0)
- {
- v = i;
- if(static_cast<Container::size_type>(b.end() - i) < sz)
- {
- Ice::throwUnmarshalOutOfBoundsException(__FILE__, __LINE__);
- }
- i += sz;
- }
- else
- {
- v = i;
- }
+ if(sz > 0)
+ {
+ v = i;
+ if(static_cast<Container::size_type>(b.end() - i) < sz)
+ {
+ Ice::throwUnmarshalOutOfBoundsException(__FILE__, __LINE__);
+ }
+ i += sz;
+ }
+ else
+ {
+ v = i;
+ }
}
void write(Ice::Byte v) // Inlined for performance reasons.
{
- b.push_back(v);
+ b.push_back(v);
}
void read(Ice::Byte& v) // Inlined for performance reasons.
{
- if(i >= b.end())
- {
- Ice::throwUnmarshalOutOfBoundsException(__FILE__, __LINE__);
- }
- v = *i++;
+ if(i >= b.end())
+ {
+ Ice::throwUnmarshalOutOfBoundsException(__FILE__, __LINE__);
+ }
+ v = *i++;
}
ICE_API void write(const Ice::Byte*, const Ice::Byte*);
@@ -407,17 +407,17 @@ public:
void write(bool v) // Inlined for performance reasons.
{
- b.push_back(static_cast<Ice::Byte>(v));
+ b.push_back(static_cast<Ice::Byte>(v));
}
ICE_API void write(const std::vector<bool>&);
ICE_API void write(const bool*, const bool*);
void read(bool& v) // Inlined for performance reasons.
{
- if(i >= b.end())
- {
- Ice::throwUnmarshalOutOfBoundsException(__FILE__, __LINE__);
- }
- v = *i++;
+ if(i >= b.end())
+ {
+ Ice::throwUnmarshalOutOfBoundsException(__FILE__, __LINE__);
+ }
+ v = *i++;
}
ICE_API void read(std::vector<bool>&);
ICE_API bool* read(std::pair<const bool*, const bool*>&);
@@ -431,44 +431,44 @@ public:
void
write(Ice::Int v) // Inlined for performance reasons.
{
- Container::size_type pos = b.size();
- resize(pos + sizeof(Ice::Int));
- Ice::Byte* dest = &b[pos];
+ Container::size_type pos = b.size();
+ resize(pos + sizeof(Ice::Int));
+ Ice::Byte* dest = &b[pos];
#ifdef ICE_BIG_ENDIAN
- const Ice::Byte* src = reinterpret_cast<const Ice::Byte*>(&v) + sizeof(Ice::Int) - 1;
- *dest++ = *src--;
- *dest++ = *src--;
- *dest++ = *src--;
- *dest = *src;
+ const Ice::Byte* src = reinterpret_cast<const Ice::Byte*>(&v) + sizeof(Ice::Int) - 1;
+ *dest++ = *src--;
+ *dest++ = *src--;
+ *dest++ = *src--;
+ *dest = *src;
#else
- const Ice::Byte* src = reinterpret_cast<const Ice::Byte*>(&v);
- *dest++ = *src++;
- *dest++ = *src++;
- *dest++ = *src++;
- *dest = *src;
+ const Ice::Byte* src = reinterpret_cast<const Ice::Byte*>(&v);
+ *dest++ = *src++;
+ *dest++ = *src++;
+ *dest++ = *src++;
+ *dest = *src;
#endif
}
void read(Ice::Int& v) // Inlined for performance reasons.
{
- if(b.end() - i < static_cast<int>(sizeof(Ice::Int)))
- {
- Ice::throwUnmarshalOutOfBoundsException(__FILE__, __LINE__);
- }
- const Ice::Byte* src = &(*i);
- i += sizeof(Ice::Int);
+ if(b.end() - i < static_cast<int>(sizeof(Ice::Int)))
+ {
+ Ice::throwUnmarshalOutOfBoundsException(__FILE__, __LINE__);
+ }
+ const Ice::Byte* src = &(*i);
+ i += sizeof(Ice::Int);
#ifdef ICE_BIG_ENDIAN
- Ice::Byte* dest = reinterpret_cast<Ice::Byte*>(&v) + sizeof(Ice::Int) - 1;
- *dest-- = *src++;
- *dest-- = *src++;
- *dest-- = *src++;
- *dest = *src;
+ Ice::Byte* dest = reinterpret_cast<Ice::Byte*>(&v) + sizeof(Ice::Int) - 1;
+ *dest-- = *src++;
+ *dest-- = *src++;
+ *dest-- = *src++;
+ *dest = *src;
#else
- Ice::Byte* dest = reinterpret_cast<Ice::Byte*>(&v);
- *dest++ = *src++;
- *dest++ = *src++;
- *dest++ = *src++;
- *dest = *src;
+ Ice::Byte* dest = reinterpret_cast<Ice::Byte*>(&v);
+ *dest++ = *src++;
+ *dest++ = *src++;
+ *dest++ = *src++;
+ *dest = *src;
#endif
}
@@ -529,14 +529,14 @@ public:
ICE_API void write(const std::string*, const std::string*, bool = true);
void read(std::string& v, bool convert = true)
{
- Ice::Int sz;
- readSize(sz);
- if(sz > 0)
- {
- if(b.end() - i < sz)
- {
- Ice::throwUnmarshalOutOfBoundsException(__FILE__, __LINE__);
- }
+ Ice::Int sz;
+ readSize(sz);
+ if(sz > 0)
+ {
+ if(b.end() - i < sz)
+ {
+ Ice::throwUnmarshalOutOfBoundsException(__FILE__, __LINE__);
+ }
#ifdef ICEE_HAS_WSTRING
if(convert && _stringConverter != 0)
{
@@ -548,12 +548,12 @@ public:
std::string(reinterpret_cast<const char*>(&*i), reinterpret_cast<const char*>(&*i) + sz).swap(v);
// v.assign(reinterpret_cast<const char*>(&(*i)), sz);
}
- i += sz;
- }
- else
- {
- v.clear();
- }
+ i += sz;
+ }
+ else
+ {
+ v.clear();
+ }
}
ICE_API void read(std::vector<std::string>&, bool = true);
@@ -600,36 +600,36 @@ private:
{
public:
- ReadEncaps() : previous(0) { } // Inlined for performance reasons.
- ~ReadEncaps() { } // Inlined for performance reasons.
+ ReadEncaps() : previous(0) { } // Inlined for performance reasons.
+ ~ReadEncaps() { } // Inlined for performance reasons.
- void reset() { previous = 0; } // Inlined for performance reasons.
- ICE_API void swap(ReadEncaps&);
+ void reset() { previous = 0; } // Inlined for performance reasons.
+ ICE_API void swap(ReadEncaps&);
- Container::size_type start;
- Ice::Int sz;
+ Container::size_type start;
+ Ice::Int sz;
- Ice::Byte encodingMajor;
- Ice::Byte encodingMinor;
+ Ice::Byte encodingMajor;
+ Ice::Byte encodingMinor;
- ReadEncaps* previous;
+ ReadEncaps* previous;
};
class WriteEncaps : private ::IceUtil::noncopyable
{
public:
- WriteEncaps() : writeIndex(0), previous(0) { } // Inlined for performance reasons.
- ~WriteEncaps() { } // Inlined for performance reasons.
+ WriteEncaps() : writeIndex(0), previous(0) { } // Inlined for performance reasons.
+ ~WriteEncaps() { } // Inlined for performance reasons.
- void reset() { writeIndex = 0; previous = 0; } // Inlined for performance reasons.
- ICE_API void swap(WriteEncaps&);
+ void reset() { writeIndex = 0; previous = 0; } // Inlined for performance reasons.
+ ICE_API void swap(WriteEncaps&);
- Container::size_type start;
+ Container::size_type start;
- Ice::Int writeIndex;
+ Ice::Int writeIndex;
- WriteEncaps* previous;
+ WriteEncaps* previous;
};
ReadEncaps* _currentReadEncaps;
@@ -651,10 +651,10 @@ private:
struct SeqData
{
- SeqData(int, int);
- int numElements;
- int minSize;
- SeqData* previous;
+ SeqData(int, int);
+ int numElements;
+ int minSize;
+ SeqData* previous;
};
SeqData* _seqDataStack;
};
diff --git a/cppe/include/IceE/Buffer.h b/cppe/include/IceE/Buffer.h
index 84d1d8b8893..196354d1685 100644
--- a/cppe/include/IceE/Buffer.h
+++ b/cppe/include/IceE/Buffer.h
@@ -32,156 +32,156 @@ public:
{
public:
- //
- // Standard vector-like operations.
- //
-
- typedef Ice::Byte value_type;
- typedef Ice::Byte* iterator;
- typedef const Ice::Byte* const_iterator;
- typedef Ice::Byte& reference;
- typedef const Ice::Byte& const_reference;
- typedef Ice::Byte* pointer;
- typedef int difference_type;
- typedef size_t size_type;
+ //
+ // Standard vector-like operations.
+ //
+
+ typedef Ice::Byte value_type;
+ typedef Ice::Byte* iterator;
+ typedef const Ice::Byte* const_iterator;
+ typedef Ice::Byte& reference;
+ typedef const Ice::Byte& const_reference;
+ typedef Ice::Byte* pointer;
+ typedef int difference_type;
+ typedef size_t size_type;
#ifdef ICE_SMALL_MESSAGE_BUFFER_OPTIMIZATION
- Container(size_type maxCapacity) :
- _buf(_fixed),
- _size(0),
- _capacity(ICE_BUFFER_FIXED_SIZE),
- _maxCapacity(maxCapacity)
- {
- }
+ Container(size_type maxCapacity) :
+ _buf(_fixed),
+ _size(0),
+ _capacity(ICE_BUFFER_FIXED_SIZE),
+ _maxCapacity(maxCapacity)
+ {
+ }
#else
- Container(size_type maxCapacity) :
- _buf(0),
- _size(0),
- _capacity(0),
- _maxCapacity(maxCapacity)
- {
- }
+ Container(size_type maxCapacity) :
+ _buf(0),
+ _size(0),
+ _capacity(0),
+ _maxCapacity(maxCapacity)
+ {
+ }
#endif
- ~Container()
- {
+ ~Container()
+ {
#ifdef ICE_SMALL_MESSAGE_BUFFER_OPTIMIZATION
- if(_buf != _fixed)
- {
- free(_buf);
- }
+ if(_buf != _fixed)
+ {
+ free(_buf);
+ }
#else
- free(_buf);
+ free(_buf);
#endif
- }
-
- iterator begin()
- {
- return _buf;
- }
-
- const_iterator begin() const
- {
- return _buf;
- }
-
- iterator end()
- {
- return _buf + _size;
- }
-
- const_iterator end() const
- {
- return _buf + _size;
- }
-
- size_type size() const
- {
- return _size;
- }
-
- bool empty() const
- {
- return !_size;
- }
-
- ICE_API void swap(Container&);
-
- ICE_API void clear();
-
- void resize(size_type n) // Inlined for performance reasons.
+ }
+
+ iterator begin()
+ {
+ return _buf;
+ }
+
+ const_iterator begin() const
+ {
+ return _buf;
+ }
+
+ iterator end()
+ {
+ return _buf + _size;
+ }
+
+ const_iterator end() const
+ {
+ return _buf + _size;
+ }
+
+ size_type size() const
+ {
+ return _size;
+ }
+
+ bool empty() const
+ {
+ return !_size;
+ }
+
+ ICE_API void swap(Container&);
+
+ ICE_API void clear();
+
+ void resize(size_type n) // Inlined for performance reasons.
+ {
+ if(n == 0)
+ {
+ clear();
+ }
+ else if(n > _capacity)
+ {
+ reserve(n);
+ }
+ _size = n;
+ }
+
+ void reset()
+ {
+ if(_size > 0 && _size * 2 < _capacity)
+ {
+ //
+ // If the current buffer size is smaller than the
+ // buffer capacity, we shrink the buffer memory to the
+ // current size. This is to avoid holding on too much
+ // memory if it's not needed anymore.
+ //
+ if(++_shrinkCounter > 2)
+ {
+ reserve(_size);
+ _shrinkCounter = 0;
+ }
+ }
+ else
+ {
+ _shrinkCounter = 0;
+ }
+ _size = 0;
+ }
+
+ void push_back(value_type v)
+ {
+ resize(_size + 1);
+ _buf[_size - 1] = v;
+ }
+
+ reference operator[](size_type n)
+ {
+ assert(n < _size);
+ return _buf[n];
+ }
+
+ const_reference operator[](size_type n) const
{
- if(n == 0)
- {
- clear();
- }
- else if(n > _capacity)
- {
- reserve(n);
- }
- _size = n;
- }
-
- void reset()
- {
- if(_size > 0 && _size * 2 < _capacity)
- {
- //
- // If the current buffer size is smaller than the
- // buffer capacity, we shrink the buffer memory to the
- // current size. This is to avoid holding on too much
- // memory if it's not needed anymore.
- //
- if(++_shrinkCounter > 2)
- {
- reserve(_size);
- _shrinkCounter = 0;
- }
- }
- else
- {
- _shrinkCounter = 0;
- }
- _size = 0;
- }
-
- void push_back(value_type v)
- {
- resize(_size + 1);
- _buf[_size - 1] = v;
- }
-
- reference operator[](size_type n)
- {
- assert(n < _size);
- return _buf[n];
- }
-
- const_reference operator[](size_type n) const
- {
- assert(n < _size);
- return _buf[n];
- }
+ assert(n < _size);
+ return _buf[n];
+ }
private:
- ICE_API Container(const Container&);
- ICE_API void operator=(const Container&);
- ICE_API void reserve(size_type);
+ ICE_API Container(const Container&);
+ ICE_API void operator=(const Container&);
+ ICE_API void reserve(size_type);
- pointer _buf;
- size_type _size;
- size_type _capacity;
- size_type _maxCapacity;
- int _shrinkCounter;
+ pointer _buf;
+ size_type _size;
+ size_type _capacity;
+ size_type _maxCapacity;
+ int _shrinkCounter;
#ifdef ICE_SMALL_MESSAGE_BUFFER_OPTIMIZATION
- //
- // For small buffers, we stack-allocate the memory. Only when
- // a buffer size larger than _fixedSize is requested, we
- // allocate memory dynamically.
- //
- value_type _fixed[ICE_BUFFER_FIXED_SIZE];
+ //
+ // For small buffers, we stack-allocate the memory. Only when
+ // a buffer size larger than _fixedSize is requested, we
+ // allocate memory dynamically.
+ //
+ value_type _fixed[ICE_BUFFER_FIXED_SIZE];
#endif
};
diff --git a/cppe/include/IceE/Cond.h b/cppe/include/IceE/Cond.h
index b7a4810cc04..34b6b3b7152 100644
--- a/cppe/include/IceE/Cond.h
+++ b/cppe/include/IceE/Cond.h
@@ -87,11 +87,11 @@ public:
template <typename Lock> inline void
wait(const Lock& lock) const
{
- if(!lock.acquired())
- {
- throw ThreadLockedException(__FILE__, __LINE__);
- }
- waitImpl(lock._mutex);
+ if(!lock.acquired())
+ {
+ throw ThreadLockedException(__FILE__, __LINE__);
+ }
+ waitImpl(lock._mutex);
}
//
@@ -104,11 +104,11 @@ public:
template <typename Lock> inline bool
timedWait(const Lock& lock, const Time& timeout) const
{
- if(!lock.acquired())
- {
- throw ThreadLockedException(__FILE__, __LINE__);
- }
- return timedWaitImpl(lock._mutex, timeout);
+ if(!lock.acquired())
+ {
+ throw ThreadLockedException(__FILE__, __LINE__);
+ }
+ return timedWaitImpl(lock._mutex, timeout);
}
private:
@@ -204,7 +204,7 @@ Cond::waitImpl(const M& mutex) const
if(rc != 0)
{
- throw ThreadSyscallException(__FILE__, __LINE__, rc);
+ throw ThreadSyscallException(__FILE__, __LINE__, rc);
}
}
@@ -225,15 +225,15 @@ Cond::timedWaitImpl(const M& mutex, const Time& timeout) const
if(rc != 0)
{
- //
- // pthread_cond_timedwait returns ETIMEOUT in the event of a
- // timeout.
- //
- if(rc != ETIMEDOUT)
- {
- throw ThreadSyscallException(__FILE__, __LINE__, rc);
- }
- return false;
+ //
+ // pthread_cond_timedwait returns ETIMEOUT in the event of a
+ // timeout.
+ //
+ if(rc != ETIMEDOUT)
+ {
+ throw ThreadSyscallException(__FILE__, __LINE__, rc);
+ }
+ return false;
}
return true;
}
diff --git a/cppe/include/IceE/Connection.h b/cppe/include/IceE/Connection.h
index 7a76ae59024..6479cc74c97 100644
--- a/cppe/include/IceE/Connection.h
+++ b/cppe/include/IceE/Connection.h
@@ -52,9 +52,9 @@ public:
enum DestructionReason
{
#ifndef ICEE_PURE_CLIENT
- ObjectAdapterDeactivated,
+ ObjectAdapterDeactivated,
#endif
- CommunicatorDestroyed
+ CommunicatorDestroyed
};
void activate();
@@ -104,10 +104,10 @@ private:
#ifndef ICEE_PURE_CLIENT
Connection(const IceInternal::InstancePtr&, const IceInternal::TransceiverPtr&,
- const IceInternal::EndpointPtr&, const ObjectAdapterPtr&);
+ const IceInternal::EndpointPtr&, const ObjectAdapterPtr&);
#else
Connection(const IceInternal::InstancePtr&, const IceInternal::TransceiverPtr&,
- const IceInternal::EndpointPtr&);
+ const IceInternal::EndpointPtr&);
#endif
~Connection();
@@ -118,13 +118,13 @@ private:
enum State
{
- StateNotValidated,
- StateActive,
+ StateNotValidated,
+ StateActive,
#ifndef ICEE_PURE_CLIENT
- StateHolding,
+ StateHolding,
#endif
- StateClosing,
- StateClosed
+ StateClosing,
+ StateClosed
};
void validate();
@@ -151,13 +151,13 @@ private:
class ThreadPerConnection : public IceUtil::Thread
{
public:
-
- ThreadPerConnection(const ConnectionPtr&);
- virtual void run();
+
+ ThreadPerConnection(const ConnectionPtr&);
+ virtual void run();
private:
-
- ConnectionPtr _connection;
+
+ ConnectionPtr _connection;
};
friend class ThreadPerConnection;
// Defined as mutable because "isFinished() const" sets this to 0.
diff --git a/cppe/include/IceE/DisableWarnings.h b/cppe/include/IceE/DisableWarnings.h
index 94cb4761451..d85290e9dcd 100644
--- a/cppe/include/IceE/DisableWarnings.h
+++ b/cppe/include/IceE/DisableWarnings.h
@@ -21,11 +21,11 @@
//
#if defined(_MSC_VER) && _MSC_VER >= 1400
-# define _CRT_SECURE_NO_DEPRECATE 1 // C4996 '<C function>' was declared deprecated/
+# define _CRT_SECURE_NO_DEPRECATE 1 // C4996 '<C function>' was declared deprecated/
#endif
#if defined(_MSC_VER) && _MSC_VER >= 1300
-# pragma warning( 4 : 4996 ) // C4996 'std::<function>' was declared deprecated
+# pragma warning( 4 : 4996 ) // C4996 'std::<function>' was declared deprecated
#endif
#endif
diff --git a/cppe/include/IceE/FactoryTable.h b/cppe/include/IceE/FactoryTable.h
index e10c6135d4a..d5a0cb26698 100644
--- a/cppe/include/IceE/FactoryTable.h
+++ b/cppe/include/IceE/FactoryTable.h
@@ -23,7 +23,7 @@ public:
~FactoryTable();
};
-static FactoryTable factoryTableInitializer; // Dummy variable to force initialization of factoryTable
+static FactoryTable factoryTableInitializer; // Dummy variable to force initialization of factoryTable
extern ICE_API FactoryTableDef* factoryTable;
diff --git a/cppe/include/IceE/Functional.h b/cppe/include/IceE/Functional.h
index a529a8be329..26179a389bc 100644
--- a/cppe/include/IceE/Functional.h
+++ b/cppe/include/IceE/Functional.h
@@ -32,7 +32,7 @@ public:
explicit MemFun(MemberFN p) : _mfn(p) { }
R operator()(H handle) const
{
- return (handle.get() ->* _mfn)();
+ return (handle.get() ->* _mfn)();
}
};
@@ -47,7 +47,7 @@ public:
explicit MemFun1(MemberFN p) : _mfn(p) { }
R operator()(H handle, A arg) const
{
- return (handle.get() ->* _mfn)(arg);
+ return (handle.get() ->* _mfn)(arg);
}
};
@@ -62,7 +62,7 @@ public:
explicit VoidMemFun(MemberFN p) : _mfn(p) { }
void operator()(H handle) const
{
- (handle.get() ->* _mfn)();
+ (handle.get() ->* _mfn)();
}
};
@@ -77,7 +77,7 @@ public:
explicit VoidMemFun1(MemberFN p) : _mfn(p) { }
void operator()(H handle, A arg) const
{
- (handle.get() ->* _mfn)(arg);
+ (handle.get() ->* _mfn)(arg);
}
};
@@ -92,7 +92,7 @@ public:
explicit SecondMemFun(MemberFN p) : _mfn(p) { }
R operator()(std::pair<K, H> pair) const
{
- return (pair.second.get() ->* _mfn)();
+ return (pair.second.get() ->* _mfn)();
}
};
@@ -107,7 +107,7 @@ public:
explicit SecondMemFun1(MemberFN p) : _mfn(p) { }
R operator()(std::pair<K, H> pair, A arg) const
{
- return (pair.second.get() ->* _mfn)(arg);
+ return (pair.second.get() ->* _mfn)(arg);
}
};
@@ -122,7 +122,7 @@ public:
explicit SecondVoidMemFun(MemberFN p) : _mfn(p) { }
void operator()(std::pair<K, H> pair) const
{
- (pair.second.get() ->* _mfn)();
+ (pair.second.get() ->* _mfn)();
}
};
@@ -137,7 +137,7 @@ public:
explicit SecondVoidMemFun1(MemberFN p) : _mfn(p) { }
void operator()(std::pair<K, H> pair, A arg) const
{
- (pair.second.get() ->* _mfn)(arg);
+ (pair.second.get() ->* _mfn)(arg);
}
};
@@ -152,7 +152,7 @@ public:
explicit ConstMemFun(MemberFN p) : _mfn(p) { }
R operator()(H handle) const
{
- return (handle.get() ->* _mfn)();
+ return (handle.get() ->* _mfn)();
}
};
@@ -167,7 +167,7 @@ public:
explicit ConstMemFun1(MemberFN p) : _mfn(p) { }
R operator()(H handle, A arg) const
{
- return (handle.get() ->* _mfn)(arg);
+ return (handle.get() ->* _mfn)(arg);
}
};
@@ -182,7 +182,7 @@ public:
explicit ConstVoidMemFun(MemberFN p) : _mfn(p) { }
void operator()(H handle) const
{
- (handle.get() ->* _mfn)();
+ (handle.get() ->* _mfn)();
}
};
@@ -197,7 +197,7 @@ public:
explicit ConstVoidMemFun1(MemberFN p) : _mfn(p) { }
void operator()(H handle, A arg) const
{
- (handle.get() ->* _mfn)(arg);
+ (handle.get() ->* _mfn)(arg);
}
};
@@ -212,7 +212,7 @@ public:
explicit SecondConstMemFun(MemberFN p) : _mfn(p) { }
R operator()(std::pair<K, H> pair) const
{
- return (pair.second.get() ->* _mfn)();
+ return (pair.second.get() ->* _mfn)();
}
};
@@ -227,7 +227,7 @@ public:
explicit SecondConstMemFun1(MemberFN p) : _mfn(p) { }
R operator()(std::pair<K, H> pair, A arg) const
{
- return (pair.second.get() ->* _mfn)(arg);
+ return (pair.second.get() ->* _mfn)(arg);
}
};
@@ -242,7 +242,7 @@ public:
explicit SecondConstVoidMemFun(MemberFN p) : _mfn(p) { }
void operator()(std::pair<K, H> pair) const
{
- (pair.second.get() ->* _mfn)();
+ (pair.second.get() ->* _mfn)();
}
};
@@ -257,7 +257,7 @@ public:
explicit SecondConstVoidMemFun1(MemberFN p) : _mfn(p) { }
void operator()(std::pair<K, H> pair, A arg) const
{
- (pair.second.get() ->* _mfn)(arg);
+ (pair.second.get() ->* _mfn)(arg);
}
};
diff --git a/cppe/include/IceE/Handle.h b/cppe/include/IceE/Handle.h
index f9947c09974..1f29a6290ab 100644
--- a/cppe/include/IceE/Handle.h
+++ b/cppe/include/IceE/Handle.h
@@ -29,51 +29,51 @@ public:
T* get() const
{
- return _ptr;
+ return _ptr;
}
T* operator->() const
{
- if(!_ptr)
- {
- //
- // We don't throw directly NullHandleException here to
- // keep the code size of this method to a minimun (the
- // assembly code for throwing an exception is much bigger
- // than just a function call). This maximises the chances
- // of inlining by compiler optimization.
- //
- throwNullHandleException(__FILE__, __LINE__);
- }
-
- return _ptr;
+ if(!_ptr)
+ {
+ //
+ // We don't throw directly NullHandleException here to
+ // keep the code size of this method to a minimun (the
+ // assembly code for throwing an exception is much bigger
+ // than just a function call). This maximises the chances
+ // of inlining by compiler optimization.
+ //
+ throwNullHandleException(__FILE__, __LINE__);
+ }
+
+ return _ptr;
}
T& operator*() const
{
- if(!_ptr)
- {
- //
- // We don't throw directly NullHandleException here to
- // keep the code size of this method to a minimun (the
- // assembly code for throwing an exception is much bigger
- // than just a function call). This maximises the chances
- // of inlining by compiler optimization.
- //
- throwNullHandleException(__FILE__, __LINE__);
- }
-
- return *_ptr;
+ if(!_ptr)
+ {
+ //
+ // We don't throw directly NullHandleException here to
+ // keep the code size of this method to a minimun (the
+ // assembly code for throwing an exception is much bigger
+ // than just a function call). This maximises the chances
+ // of inlining by compiler optimization.
+ //
+ throwNullHandleException(__FILE__, __LINE__);
+ }
+
+ return *_ptr;
}
operator bool() const
{
- return _ptr ? true : false;
+ return _ptr ? true : false;
}
void swap(HandleBase& other)
{
- std::swap(_ptr, other._ptr);
+ std::swap(_ptr, other._ptr);
}
T* _ptr;
@@ -96,12 +96,12 @@ inline bool operator==(const HandleBase<T>& lhs, const HandleBase<U>& rhs)
U* r = rhs.get();
if(l && r)
{
- return *l == *r;
+ return *l == *r;
}
else
{
- return !l && !r;
- }
+ return !l && !r;
+ }
}
template<typename T, typename U>
@@ -117,11 +117,11 @@ inline bool operator<(const HandleBase<T>& lhs, const HandleBase<U>& rhs)
U* r = rhs.get();
if(l && r)
{
- return *l < *r;
+ return *l < *r;
}
else
{
- return !l && r;
+ return !l && r;
}
}
@@ -150,114 +150,114 @@ public:
Handle(T* p = 0)
{
- this->_ptr = p;
+ this->_ptr = p;
- if(this->_ptr)
- {
- this->_ptr->__incRef();
- }
+ if(this->_ptr)
+ {
+ this->_ptr->__incRef();
+ }
}
template<typename Y>
Handle(const Handle<Y>& r)
{
- this->_ptr = r._ptr;
+ this->_ptr = r._ptr;
- if(this->_ptr)
- {
- this->_ptr->__incRef();
- }
+ if(this->_ptr)
+ {
+ this->_ptr->__incRef();
+ }
}
Handle(const Handle& r)
{
- this->_ptr = r._ptr;
+ this->_ptr = r._ptr;
- if(this->_ptr)
- {
- this->_ptr->__incRef();
- }
+ if(this->_ptr)
+ {
+ this->_ptr->__incRef();
+ }
}
~Handle()
{
- if(this->_ptr)
- {
- this->_ptr->__decRef();
- }
+ if(this->_ptr)
+ {
+ this->_ptr->__decRef();
+ }
}
Handle& operator=(T* p)
{
- if(this->_ptr != p)
- {
- if(p)
- {
- p->__incRef();
- }
-
- T* ptr = this->_ptr;
- this->_ptr = p;
-
- if(ptr)
- {
- ptr->__decRef();
- }
- }
- return *this;
+ if(this->_ptr != p)
+ {
+ if(p)
+ {
+ p->__incRef();
+ }
+
+ T* ptr = this->_ptr;
+ this->_ptr = p;
+
+ if(ptr)
+ {
+ ptr->__decRef();
+ }
+ }
+ return *this;
}
template<typename Y>
Handle& operator=(const Handle<Y>& r)
{
- if(this->_ptr != r._ptr)
- {
- if(r._ptr)
- {
- r._ptr->__incRef();
- }
-
- T* ptr = this->_ptr;
- this->_ptr = r._ptr;
-
- if(ptr)
- {
- ptr->__decRef();
- }
- }
- return *this;
+ if(this->_ptr != r._ptr)
+ {
+ if(r._ptr)
+ {
+ r._ptr->__incRef();
+ }
+
+ T* ptr = this->_ptr;
+ this->_ptr = r._ptr;
+
+ if(ptr)
+ {
+ ptr->__decRef();
+ }
+ }
+ return *this;
}
Handle& operator=(const Handle& r)
{
- if(this->_ptr != r._ptr)
- {
- if(r._ptr)
- {
- r._ptr->__incRef();
- }
-
- T* ptr = this->_ptr;
- this->_ptr = r._ptr;
-
- if(ptr)
- {
- ptr->__decRef();
- }
- }
- return *this;
+ if(this->_ptr != r._ptr)
+ {
+ if(r._ptr)
+ {
+ r._ptr->__incRef();
+ }
+
+ T* ptr = this->_ptr;
+ this->_ptr = r._ptr;
+
+ if(ptr)
+ {
+ ptr->__decRef();
+ }
+ }
+ return *this;
}
template<class Y>
static Handle dynamicCast(const HandleBase<Y>& r)
{
- return Handle(dynamic_cast<T*>(r._ptr));
+ return Handle(dynamic_cast<T*>(r._ptr));
}
template<class Y>
static Handle dynamicCast(Y* p)
{
- return Handle(dynamic_cast<T*>(p));
+ return Handle(dynamic_cast<T*>(p));
}
};
@@ -284,146 +284,146 @@ public:
Handle(T* p = 0)
{
- this->_ptr = p;
+ this->_ptr = p;
- if(this->_ptr)
- {
- upCast(this->_ptr)->__incRef();
- }
+ if(this->_ptr)
+ {
+ upCast(this->_ptr)->__incRef();
+ }
}
template<typename Y>
Handle(const Handle<Y>& r)
{
- this->_ptr = r._ptr;
+ this->_ptr = r._ptr;
- if(this->_ptr)
- {
- upCast(this->_ptr)->__incRef();
- }
+ if(this->_ptr)
+ {
+ upCast(this->_ptr)->__incRef();
+ }
}
template<typename Y>
Handle(const ::IceUtil::Handle<Y>& r)
{
- this->_ptr = r._ptr;
+ this->_ptr = r._ptr;
- if(this->_ptr)
- {
- upCast(this->_ptr)->__incRef();
- }
+ if(this->_ptr)
+ {
+ upCast(this->_ptr)->__incRef();
+ }
}
Handle(const Handle& r)
{
- this->_ptr = r._ptr;
+ this->_ptr = r._ptr;
- if(this->_ptr)
- {
- upCast(this->_ptr)->__incRef();
- }
+ if(this->_ptr)
+ {
+ upCast(this->_ptr)->__incRef();
+ }
}
~Handle()
{
- if(this->_ptr)
- {
- upCast(this->_ptr)->__decRef();
- }
+ if(this->_ptr)
+ {
+ upCast(this->_ptr)->__decRef();
+ }
}
Handle& operator=(T* p)
{
- if(this->_ptr != p)
- {
- if(p)
- {
- upCast(p)->__incRef();
- }
-
- T* ptr = this->_ptr;
- this->_ptr = p;
-
- if(ptr)
- {
- upCast(ptr)->__decRef();
- }
- }
- return *this;
+ if(this->_ptr != p)
+ {
+ if(p)
+ {
+ upCast(p)->__incRef();
+ }
+
+ T* ptr = this->_ptr;
+ this->_ptr = p;
+
+ if(ptr)
+ {
+ upCast(ptr)->__decRef();
+ }
+ }
+ return *this;
}
template<typename Y>
Handle& operator=(const Handle<Y>& r)
{
- if(this->_ptr != r._ptr)
- {
- if(r._ptr)
- {
+ if(this->_ptr != r._ptr)
+ {
+ if(r._ptr)
+ {
upCast(r._ptr)->__incRef();
- }
+ }
- T* ptr = this->_ptr;
- this->_ptr = r._ptr;
+ T* ptr = this->_ptr;
+ this->_ptr = r._ptr;
- if(ptr)
- {
- upCast(ptr)->__decRef();
- }
- }
- return *this;
+ if(ptr)
+ {
+ upCast(ptr)->__decRef();
+ }
+ }
+ return *this;
}
template<typename Y>
Handle& operator=(const ::IceUtil::Handle<Y>& r)
{
- if(this->_ptr != r._ptr)
- {
- if(r._ptr)
- {
- upCast(r._ptr)->__incRef();
- }
-
- T* ptr = this->_ptr;
- this->_ptr = r._ptr;
-
- if(ptr)
- {
- upCast(ptr)->__decRef();
- }
- }
- return *this;
+ if(this->_ptr != r._ptr)
+ {
+ if(r._ptr)
+ {
+ upCast(r._ptr)->__incRef();
+ }
+
+ T* ptr = this->_ptr;
+ this->_ptr = r._ptr;
+
+ if(ptr)
+ {
+ upCast(ptr)->__decRef();
+ }
+ }
+ return *this;
}
Handle& operator=(const Handle& r)
{
- if(this->_ptr != r._ptr)
- {
- if(r._ptr)
- {
- upCast(r._ptr)->__incRef();
- }
-
- T* ptr = this->_ptr;
- this->_ptr = r._ptr;
-
- if(ptr)
- {
- upCast(ptr)->__decRef();
- }
- }
- return *this;
+ if(this->_ptr != r._ptr)
+ {
+ if(r._ptr)
+ {
+ upCast(r._ptr)->__incRef();
+ }
+
+ T* ptr = this->_ptr;
+ this->_ptr = r._ptr;
+
+ if(ptr)
+ {
+ upCast(ptr)->__decRef();
+ }
+ }
+ return *this;
}
template<class Y>
static Handle dynamicCast(const ::IceUtil::HandleBase<Y>& r)
{
- return Handle(dynamic_cast<T*>(r._ptr));
+ return Handle(dynamic_cast<T*>(r._ptr));
}
template<class Y>
static Handle dynamicCast(Y* p)
{
- return Handle(dynamic_cast<T*>(p));
+ return Handle(dynamic_cast<T*>(p));
}
};
diff --git a/cppe/include/IceE/Initialize.h b/cppe/include/IceE/Initialize.h
index 31f1d828ac8..d2c54a88706 100644
--- a/cppe/include/IceE/Initialize.h
+++ b/cppe/include/IceE/Initialize.h
@@ -55,10 +55,10 @@ struct InitializationData
};
ICE_API CommunicatorPtr initialize(int&, char*[], const InitializationData& = InitializationData(),
- Int = ICEE_INT_VERSION);
+ Int = ICEE_INT_VERSION);
ICE_API CommunicatorPtr initialize(StringSeq&, const InitializationData& = InitializationData(),
- Int = ICEE_INT_VERSION);
+ Int = ICEE_INT_VERSION);
ICE_API CommunicatorPtr initialize(const InitializationData& = InitializationData(), Int = ICEE_INT_VERSION);
diff --git a/cppe/include/IceE/Lock.h b/cppe/include/IceE/Lock.h
index e2e1baef852..36d754066cb 100644
--- a/cppe/include/IceE/Lock.h
+++ b/cppe/include/IceE/Lock.h
@@ -44,63 +44,63 @@ class LockT
public:
LockT(const T& mutex) :
- _mutex(mutex)
+ _mutex(mutex)
{
- _mutex.lock();
- _acquired = true;
+ _mutex.lock();
+ _acquired = true;
}
~LockT()
{
- if (_acquired)
- {
- _mutex.unlock();
- }
+ if (_acquired)
+ {
+ _mutex.unlock();
+ }
}
void acquire() const
{
- if (_acquired)
- {
- throw ThreadLockedException(__FILE__, __LINE__);
- }
- _mutex.lock();
- _acquired = true;
+ if (_acquired)
+ {
+ throw ThreadLockedException(__FILE__, __LINE__);
+ }
+ _mutex.lock();
+ _acquired = true;
}
bool tryAcquire() const
{
- if (_acquired)
- {
- throw ThreadLockedException(__FILE__, __LINE__);
- }
- _acquired = _mutex.tryLock();
- return _acquired;
+ if (_acquired)
+ {
+ throw ThreadLockedException(__FILE__, __LINE__);
+ }
+ _acquired = _mutex.tryLock();
+ return _acquired;
}
void release() const
{
- if (!_acquired)
- {
- throw ThreadLockedException(__FILE__, __LINE__);
- }
- _mutex.unlock();
- _acquired = false;
+ if (!_acquired)
+ {
+ throw ThreadLockedException(__FILE__, __LINE__);
+ }
+ _mutex.unlock();
+ _acquired = false;
}
bool acquired() const
{
- return _acquired;
+ return _acquired;
}
protected:
// TryLockT's contructor
LockT(const T& mutex, bool) :
- _mutex(mutex)
+ _mutex(mutex)
{
- _acquired = _mutex.tryLock();
+ _acquired = _mutex.tryLock();
}
private:
@@ -126,7 +126,7 @@ class TryLockT : public LockT<T>
public:
TryLockT(const T& mutex) :
- LockT<T>(mutex, true)
+ LockT<T>(mutex, true)
{}
};
diff --git a/cppe/include/IceE/Monitor.h b/cppe/include/IceE/Monitor.h
index 6d83ce18ffd..54993ec3c69 100644
--- a/cppe/include/IceE/Monitor.h
+++ b/cppe/include/IceE/Monitor.h
@@ -89,11 +89,11 @@ IceUtil::Monitor<T>::lock() const
_mutex.lock();
if(_mutex.willUnlock())
{
- //
- // On the first mutex acquisition reset the number pending
- // notifications.
- //
- _nnotify = 0;
+ //
+ // On the first mutex acquisition reset the number pending
+ // notifications.
+ //
+ _nnotify = 0;
}
}
@@ -102,13 +102,13 @@ IceUtil::Monitor<T>::unlock() const
{
if(_mutex.willUnlock())
{
- //
- // Perform any pending notifications.
- //
- if(_nnotify != 0)
- {
- notifyImpl(_nnotify);
- }
+ //
+ // Perform any pending notifications.
+ //
+ if(_nnotify != 0)
+ {
+ notifyImpl(_nnotify);
+ }
}
_mutex.unlock();
@@ -116,12 +116,12 @@ IceUtil::Monitor<T>::unlock() const
int nnotify = _nnotify;
if(_mutex.unlock())
{
- //
- // Perform any pending notifications.
- //
- if(nnotify != 0)
+ //
+ // Perform any pending notifications.
+ //
+ if(nnotify != 0)
{
- notifyImpl(nnotify);
+ notifyImpl(nnotify);
}
}
*/
@@ -133,11 +133,11 @@ IceUtil::Monitor<T>::tryLock() const
bool result = _mutex.tryLock();
if(result && _mutex.willUnlock())
{
- //
- // On the first mutex acquisition reset the number pending
- // notifications.
- //
- _nnotify = 0;
+ //
+ // On the first mutex acquisition reset the number pending
+ // notifications.
+ //
+ _nnotify = 0;
}
return result;
}
@@ -150,7 +150,7 @@ IceUtil::Monitor<T>::wait() const
//
if(_nnotify != 0)
{
- notifyImpl(_nnotify);
+ notifyImpl(_nnotify);
}
//
@@ -158,15 +158,15 @@ IceUtil::Monitor<T>::wait() const
//
try
{
- _cond.waitImpl(_mutex);
- //
- // Reset the nnotify count once wait() returns.
- //
+ _cond.waitImpl(_mutex);
+ //
+ // Reset the nnotify count once wait() returns.
+ //
}
catch(...)
{
- _nnotify = 0;
- throw;
+ _nnotify = 0;
+ throw;
}
_nnotify = 0;
@@ -180,7 +180,7 @@ IceUtil::Monitor<T>::timedWait(const Time& timeout) const
//
if(_nnotify != 0)
{
- notifyImpl(_nnotify);
+ notifyImpl(_nnotify);
}
bool rc;
@@ -189,16 +189,16 @@ IceUtil::Monitor<T>::timedWait(const Time& timeout) const
//
try
{
- rc = _cond.timedWaitImpl(_mutex, timeout);
+ rc = _cond.timedWaitImpl(_mutex, timeout);
- //
- // Reset the nnotify count once wait() returns.
- //
+ //
+ // Reset the nnotify count once wait() returns.
+ //
}
catch(...)
{
- _nnotify = 0;
- throw;
+ _nnotify = 0;
+ throw;
}
_nnotify = 0;
@@ -214,7 +214,7 @@ IceUtil::Monitor<T>::notify()
//
if(_nnotify != -1)
{
- ++_nnotify;
+ ++_nnotify;
}
}
@@ -236,19 +236,19 @@ IceUtil::Monitor<T>::notifyImpl(int nnotify) const
//
if(nnotify == -1)
{
- _cond.broadcast();
- return;
+ _cond.broadcast();
+ return;
}
else
{
- //
- // Otherwise notify n times.
- //
- while(nnotify > 0)
- {
- _cond.signal();
- --nnotify;
- }
+ //
+ // Otherwise notify n times.
+ //
+ while(nnotify > 0)
+ {
+ _cond.signal();
+ --nnotify;
+ }
}
}
diff --git a/cppe/include/IceE/Mutex.h b/cppe/include/IceE/Mutex.h
index 67d131abcde..08a80bec3c0 100644
--- a/cppe/include/IceE/Mutex.h
+++ b/cppe/include/IceE/Mutex.h
@@ -87,7 +87,7 @@ private:
#else
struct LockState
{
- pthread_mutex_t* mutex;
+ pthread_mutex_t* mutex;
};
#endif
@@ -140,11 +140,11 @@ Mutex::tryLock() const
{
if(!TryEnterCriticalSection(&_mutex))
{
- return false;
+ return false;
}
if(_mutex.RecursionCount > 1)
{
- LeaveCriticalSection(&_mutex);
+ LeaveCriticalSection(&_mutex);
throw ThreadLockedException(__FILE__, __LINE__);
}
return true;
@@ -178,7 +178,7 @@ Mutex::Mutex() :
_mutex = CreateMutex(0, false, 0);
if(_mutex == 0)
{
- throw ThreadSyscallException(__FILE__, __LINE__, GetLastError());
+ throw ThreadSyscallException(__FILE__, __LINE__, GetLastError());
}
}
@@ -188,7 +188,7 @@ Mutex::~Mutex()
BOOL rc = CloseHandle(_mutex);
if(rc == 0)
{
- throw ThreadSyscallException(__FILE__, __LINE__, GetLastError());
+ throw ThreadSyscallException(__FILE__, __LINE__, GetLastError());
}
}
@@ -198,14 +198,14 @@ Mutex::lock() const
DWORD rc = WaitForSingleObject(_mutex, INFINITE);
if(rc != WAIT_OBJECT_0)
{
- if(rc == WAIT_FAILED)
- {
- throw ThreadSyscallException(__FILE__, __LINE__, GetLastError());
- }
- else
- {
- throw ThreadSyscallException(__FILE__, __LINE__, 0);
- }
+ if(rc == WAIT_FAILED)
+ {
+ throw ThreadSyscallException(__FILE__, __LINE__, GetLastError());
+ }
+ else
+ {
+ throw ThreadSyscallException(__FILE__, __LINE__, 0);
+ }
}
_recursionCount++;
}
@@ -216,18 +216,18 @@ Mutex::tryLock() const
DWORD rc = WaitForSingleObject(_mutex, 0);
if(rc != WAIT_OBJECT_0)
{
- return false;
+ return false;
}
else if(_recursionCount == 1)
{
- _recursionCount++;
- unlock();
+ _recursionCount++;
+ unlock();
throw ThreadLockedException(__FILE__, __LINE__);
}
else
{
- _recursionCount++;
- return true;
+ _recursionCount++;
+ return true;
}
}
@@ -238,7 +238,7 @@ Mutex::unlock() const
BOOL rc = ReleaseMutex(_mutex);
if(rc == 0)
{
- throw ThreadSyscallException(__FILE__, __LINE__, GetLastError());
+ throw ThreadSyscallException(__FILE__, __LINE__, GetLastError());
}
}
@@ -287,7 +287,7 @@ Mutex::Mutex()
if(rc != 0)
{
- throw ThreadSyscallException(__FILE__, __LINE__, rc);
+ throw ThreadSyscallException(__FILE__, __LINE__, rc);
}
}
@@ -340,7 +340,7 @@ Mutex::unlock() const
int rc = pthread_mutex_unlock(&_mutex);
if(rc != 0)
{
- throw ThreadSyscallException(__FILE__, __LINE__, rc);
+ throw ThreadSyscallException(__FILE__, __LINE__, rc);
}
}
diff --git a/cppe/include/IceE/Object.h b/cppe/include/IceE/Object.h
index 11fe467c968..b8cd0bf0727 100644
--- a/cppe/include/IceE/Object.h
+++ b/cppe/include/IceE/Object.h
@@ -65,10 +65,10 @@ protected:
static void __checkMode(OperationMode expected, OperationMode received) // Inline for performance reasons.
{
- if(expected != received)
- {
- __invalidMode(expected, received); // Not inlined.
- }
+ if(expected != received)
+ {
+ __invalidMode(expected, received); // Not inlined.
+ }
}
static void __invalidMode(OperationMode, OperationMode);
};
diff --git a/cppe/include/IceE/ObjectAdapter.h b/cppe/include/IceE/ObjectAdapter.h
index 5d44274bd3b..3eb4d4a226f 100644
--- a/cppe/include/IceE/ObjectAdapter.h
+++ b/cppe/include/IceE/ObjectAdapter.h
@@ -91,11 +91,11 @@ public:
private:
ObjectAdapter(const IceInternal::InstancePtr&, const CommunicatorPtr&, const IceInternal::ObjectAdapterFactoryPtr&,
- const std::string&, const std::string&
+ const std::string&, const std::string&
#ifdef ICEE_HAS_ROUTER
- , const RouterPrx&
+ , const RouterPrx&
#endif
- );
+ );
~ObjectAdapter();
friend class IceInternal::ObjectAdapterFactory;
diff --git a/cppe/include/IceE/Outgoing.h b/cppe/include/IceE/Outgoing.h
index 55ae1f42094..3e52544a35f 100644
--- a/cppe/include/IceE/Outgoing.h
+++ b/cppe/include/IceE/Outgoing.h
@@ -61,11 +61,11 @@ public:
enum State
{
- StateUnsent,
- StateInProgress,
- StateOK,
- StateUserException,
- StateLocalException
+ StateUnsent,
+ StateInProgress,
+ StateOK,
+ StateUserException,
+ StateLocalException
};
Outgoing(Ice::Connection*, Reference*, const std::string&, Ice::OperationMode, const Ice::Context*);
diff --git a/cppe/include/IceE/Proxy.h b/cppe/include/IceE/Proxy.h
index 99439e0f359..74c88f220a3 100644
--- a/cppe/include/IceE/Proxy.h
+++ b/cppe/include/IceE/Proxy.h
@@ -97,13 +97,13 @@ public:
ICE_DEPRECATED_API ::Ice::Int ice_hash() const
{
- return ice_getHash();
+ return ice_getHash();
}
ICE_API ::Ice::Int ice_getHash() const;
ICE_DEPRECATED_API ::Ice::CommunicatorPtr ice_communicator() const
{
- return ice_getCommunicator();
+ return ice_getCommunicator();
}
ICE_API ::Ice::CommunicatorPtr ice_getCommunicator() const;
@@ -148,21 +148,21 @@ public:
ICE_API ::Ice::Identity ice_getIdentity() const;
ICE_DEPRECATED_API ::Ice::ObjectPrx ice_newIdentity(const ::Ice::Identity& id) const
{
- return ice_identity(id);
+ return ice_identity(id);
}
ICE_API ::Ice::ObjectPrx ice_identity(const ::Ice::Identity&) const;
ICE_API ::Ice::Context ice_getContext() const;
ICE_DEPRECATED_API ::Ice::ObjectPrx ice_newContext(const ::Ice::Context& ctx) const
{
- return ice_context(ctx);
+ return ice_context(ctx);
}
ICE_API ::Ice::ObjectPrx ice_context(const ::Ice::Context&) const;
ICE_API const ::std::string& ice_getFacet() const;
ICE_DEPRECATED_API ::Ice::ObjectPrx ice_newFacet(const ::std::string& facet) const
{
- return ice_facet(facet);
+ return ice_facet(facet);
}
ICE_API ::Ice::ObjectPrx ice_facet(const ::std::string&) const;
@@ -226,14 +226,14 @@ public:
ICE_DEPRECATED_API ::Ice::ConnectionPtr ice_connection()
{
- return ice_getConnection();
+ return ice_getConnection();
}
ICE_API ::Ice::ConnectionPtr ice_getConnection();
ICE_API ::Ice::ConnectionPtr ice_getCachedConnection() const;
::IceInternal::ReferencePtr __reference() const
{
- return _reference;
+ return _reference;
}
ICE_API void __copyFrom(const ::Ice::ObjectPrx&);
@@ -258,15 +258,15 @@ private:
void setup(const ::IceInternal::ReferencePtr& ref)
{
- //
- // No need to synchronize "*this", as this operation is only
- // called upon initialization.
- //
-
- assert(!_reference);
- assert(!_connection);
-
- _reference = ref;
+ //
+ // No need to synchronize "*this", as this operation is only
+ // called upon initialization.
+ //
+
+ assert(!_reference);
+ assert(!_connection);
+
+ _reference = ref;
}
friend class ::IceInternal::ProxyFactory;
@@ -288,7 +288,7 @@ struct ProxyIdentityLess : std::binary_function<bool, ObjectPrx&, ObjectPrx&>
{
bool operator()(const ObjectPrx& lhs, const ObjectPrx& rhs) const
{
- return proxyIdentityLess(lhs, rhs);
+ return proxyIdentityLess(lhs, rhs);
}
};
@@ -296,7 +296,7 @@ struct ProxyIdentityEqual : std::binary_function<bool, ObjectPrx&, ObjectPrx&>
{
bool operator()(const ObjectPrx& lhs, const ObjectPrx& rhs) const
{
- return proxyIdentityEqual(lhs, rhs);
+ return proxyIdentityEqual(lhs, rhs);
}
};
@@ -304,7 +304,7 @@ struct ProxyIdentityAndFacetLess : std::binary_function<bool, ObjectPrx&, Object
{
bool operator()(const ObjectPrx& lhs, const ObjectPrx& rhs) const
{
- return proxyIdentityAndFacetLess(lhs, rhs);
+ return proxyIdentityAndFacetLess(lhs, rhs);
}
};
@@ -312,7 +312,7 @@ struct ProxyIdentityAndFacetEqual : std::binary_function<bool, ObjectPrx&, Objec
{
bool operator()(const ObjectPrx& lhs, const ObjectPrx& rhs) const
{
- return proxyIdentityAndFacetEqual(lhs, rhs);
+ return proxyIdentityAndFacetEqual(lhs, rhs);
}
};
@@ -391,14 +391,14 @@ checkedCastImpl(const ::Ice::ObjectPrx& b)
P d = 0;
if(b.get())
{
- typedef typename P::element_type T;
+ typedef typename P::element_type T;
- d = dynamic_cast<T*>(b.get());
- if(!d && b->ice_isA(T::ice_staticId()))
- {
- d = new T;
- d->__copyFrom(b);
- }
+ d = dynamic_cast<T*>(b.get());
+ if(!d && b->ice_isA(T::ice_staticId()))
+ {
+ d = new T;
+ d->__copyFrom(b);
+ }
}
return d;
}
@@ -409,14 +409,14 @@ checkedCastImpl(const ::Ice::ObjectPrx& b, const ::Ice::Context& ctx)
P d = 0;
if(b.get())
{
- typedef typename P::element_type T;
+ typedef typename P::element_type T;
- d = dynamic_cast<T*>(b.get());
- if(!d && b->ice_isA(T::ice_staticId(), ctx))
- {
- d = new T;
- d->__copyFrom(b);
- }
+ d = dynamic_cast<T*>(b.get());
+ if(!d && b->ice_isA(T::ice_staticId(), ctx))
+ {
+ d = new T;
+ d->__copyFrom(b);
+ }
}
return d;
}
@@ -427,14 +427,14 @@ uncheckedCastImpl(const ::Ice::ObjectPrx& b)
P d = 0;
if(b)
{
- typedef typename P::element_type T;
+ typedef typename P::element_type T;
- d = dynamic_cast<T*>(b.get());
- if(!d)
- {
- d = new T;
- d->__copyFrom(b);
- }
+ d = dynamic_cast<T*>(b.get());
+ if(!d)
+ {
+ d = new T;
+ d->__copyFrom(b);
+ }
}
return d;
}
@@ -473,7 +473,7 @@ uncheckedCastImpl< ::Ice::ObjectPrx>(const ::Ice::ObjectPrx& b, const std::strin
::Ice::ObjectPrx d = 0;
if(b)
{
- d = b->ice_facet(f);
+ d = b->ice_facet(f);
}
return d;
}
@@ -488,8 +488,8 @@ checkedCastImpl(const ::Ice::ObjectPrx& b, const std::string& f)
if(bb)
{
- d = new T;
- d->__copyFrom(bb);
+ d = new T;
+ d->__copyFrom(bb);
}
return d;
}
@@ -504,8 +504,8 @@ checkedCastImpl(const ::Ice::ObjectPrx& b, const std::string& f, const ::Ice::Co
if(bb)
{
- d = new T;
- d->__copyFrom(bb);
+ d = new T;
+ d->__copyFrom(bb);
}
return d;
}
@@ -516,11 +516,11 @@ uncheckedCastImpl(const ::Ice::ObjectPrx& b, const std::string& f)
P d = 0;
if(b)
{
- typedef typename P::element_type T;
+ typedef typename P::element_type T;
- ::Ice::ObjectPrx bb = b->ice_facet(f);
- d = new T;
- d->__copyFrom(bb);
+ ::Ice::ObjectPrx bb = b->ice_facet(f);
+ d = new T;
+ d->__copyFrom(bb);
}
return d;
}
diff --git a/cppe/include/IceE/ProxyHandle.h b/cppe/include/IceE/ProxyHandle.h
index 1dbf3743dea..3c04cf444d5 100644
--- a/cppe/include/IceE/ProxyHandle.h
+++ b/cppe/include/IceE/ProxyHandle.h
@@ -131,130 +131,130 @@ public:
ProxyHandle(T* p = 0)
{
- this->_ptr = p;
+ this->_ptr = p;
- if(this->_ptr)
- {
- upCast(this->_ptr)->__incRef();
- }
+ if(this->_ptr)
+ {
+ upCast(this->_ptr)->__incRef();
+ }
}
template<typename Y>
ProxyHandle(const ProxyHandle<Y>& r)
{
- this->_ptr = r._ptr;
+ this->_ptr = r._ptr;
- if(this->_ptr)
- {
- upCast(this->_ptr)->__incRef();
- }
+ if(this->_ptr)
+ {
+ upCast(this->_ptr)->__incRef();
+ }
}
template<typename Y>
ProxyHandle(const ::IceUtil::Handle<Y>& r)
{
- this->_ptr = r._ptr;
+ this->_ptr = r._ptr;
- if(this->_ptr)
- {
- upCast(this->_ptr)->__incRef();
- }
+ if(this->_ptr)
+ {
+ upCast(this->_ptr)->__incRef();
+ }
}
ProxyHandle(const ProxyHandle& r)
{
- this->_ptr = r._ptr;
+ this->_ptr = r._ptr;
- if(this->_ptr)
- {
- upCast(this->_ptr)->__incRef();
- }
+ if(this->_ptr)
+ {
+ upCast(this->_ptr)->__incRef();
+ }
}
~ProxyHandle()
{
- if(this->_ptr)
- {
- upCast(this->_ptr)->__decRef();
- }
+ if(this->_ptr)
+ {
+ upCast(this->_ptr)->__decRef();
+ }
}
ProxyHandle& operator=(T* p)
{
- if(this->_ptr != p)
- {
- if(p)
- {
- upCast(p)->__incRef();
- }
-
- if(this->_ptr)
- {
- upCast(this->_ptr)->__decRef();
- }
-
- this->_ptr = p;
- }
- return *this;
+ if(this->_ptr != p)
+ {
+ if(p)
+ {
+ upCast(p)->__incRef();
+ }
+
+ if(this->_ptr)
+ {
+ upCast(this->_ptr)->__decRef();
+ }
+
+ this->_ptr = p;
+ }
+ return *this;
}
template<typename Y>
ProxyHandle& operator=(const ProxyHandle<Y>& r)
{
- if(this->_ptr != r._ptr)
- {
- if(r._ptr)
- {
- upCast(r._ptr)->__incRef();
- }
-
- if(this->_ptr)
- {
- upCast(this->_ptr)->__decRef();
- }
-
- this->_ptr = r._ptr;
- }
- return *this;
+ if(this->_ptr != r._ptr)
+ {
+ if(r._ptr)
+ {
+ upCast(r._ptr)->__incRef();
+ }
+
+ if(this->_ptr)
+ {
+ upCast(this->_ptr)->__decRef();
+ }
+
+ this->_ptr = r._ptr;
+ }
+ return *this;
}
template<typename Y>
ProxyHandle& operator=(const ::IceUtil::Handle<Y>& r)
{
- if(this->_ptr != r._ptr)
- {
- if(r._ptr)
- {
- upCast(r._ptr)->__incRef();
- }
-
- if(this->_ptr)
- {
- upCast(this->_ptr)->__decRef();
- }
-
- this->_ptr = r._ptr;
- }
- return *this;
+ if(this->_ptr != r._ptr)
+ {
+ if(r._ptr)
+ {
+ upCast(r._ptr)->__incRef();
+ }
+
+ if(this->_ptr)
+ {
+ upCast(this->_ptr)->__decRef();
+ }
+
+ this->_ptr = r._ptr;
+ }
+ return *this;
}
ProxyHandle& operator=(const ProxyHandle& r)
{
- if(this->_ptr != r._ptr)
- {
- if(r._ptr)
- {
- upCast(r._ptr)->__incRef();
- }
-
- if(this->_ptr)
- {
- upCast(this->_ptr)->__decRef();
- }
-
- this->_ptr = r._ptr;
- }
- return *this;
+ if(this->_ptr != r._ptr)
+ {
+ if(r._ptr)
+ {
+ upCast(r._ptr)->__incRef();
+ }
+
+ if(this->_ptr)
+ {
+ upCast(this->_ptr)->__decRef();
+ }
+
+ this->_ptr = r._ptr;
+ }
+ return *this;
}
::IceProxy::Ice::Object* __upCast() const
@@ -265,39 +265,39 @@ public:
template<class Y>
static ProxyHandle checkedCast(const ProxyHandle<Y>& r)
{
- Y* tag = 0;
- return ::IceInternal::checkedCastHelper<T>(r, tag);
+ Y* tag = 0;
+ return ::IceInternal::checkedCastHelper<T>(r, tag);
}
template<class Y>
static ProxyHandle checkedCast(const ProxyHandle<Y>& r, const std::string& f)
{
- return ::IceInternal::checkedCastImpl<ProxyHandle>(r, f);
+ return ::IceInternal::checkedCastImpl<ProxyHandle>(r, f);
}
template<class Y>
static ProxyHandle checkedCast(const ProxyHandle<Y>& r, const ::Ice::Context& ctx)
{
- return ::IceInternal::checkedCastHelper<T>(r, ctx);
+ return ::IceInternal::checkedCastHelper<T>(r, ctx);
}
template<class Y>
static ProxyHandle checkedCast(const ProxyHandle<Y>& r, const std::string& f, const ::Ice::Context& ctx)
{
- return ::IceInternal::checkedCastImpl<ProxyHandle>(r, f, ctx);
+ return ::IceInternal::checkedCastImpl<ProxyHandle>(r, f, ctx);
}
template<class Y>
static ProxyHandle uncheckedCast(const ProxyHandle<Y>& r)
{
- Y* tag = 0;
- return::IceInternal::uncheckedCastHelper<T>(r, tag);
+ Y* tag = 0;
+ return::IceInternal::uncheckedCastHelper<T>(r, tag);
}
template<class Y>
static ProxyHandle uncheckedCast(const ProxyHandle<Y>& r, const std::string& f)
{
- return ::IceInternal::uncheckedCastImpl<ProxyHandle>(r, f);
+ return ::IceInternal::uncheckedCastImpl<ProxyHandle>(r, f);
}
};
diff --git a/cppe/include/IceE/RecMutex.h b/cppe/include/IceE/RecMutex.h
index 20cc59b9eb4..48cee28f5b8 100644
--- a/cppe/include/IceE/RecMutex.h
+++ b/cppe/include/IceE/RecMutex.h
@@ -77,13 +77,13 @@ private:
#ifdef _WIN32
struct LockState
{
- int count;
+ int count;
};
#else
struct LockState
{
- pthread_mutex_t* mutex;
- int count;
+ pthread_mutex_t* mutex;
+ int count;
};
#endif
diff --git a/cppe/include/IceE/ScopedArray.h b/cppe/include/IceE/ScopedArray.h
index 7b40d3736a6..5d8a72b99ea 100644
--- a/cppe/include/IceE/ScopedArray.h
+++ b/cppe/include/IceE/ScopedArray.h
@@ -28,25 +28,25 @@ public:
~ScopedArray()
{
if(_ptr != 0)
- {
- delete[] _ptr;
- }
+ {
+ delete[] _ptr;
+ }
}
void reset(T* ptr = 0)
{
- assert(ptr == 0 || ptr != _ptr);
+ assert(ptr == 0 || ptr != _ptr);
if(_ptr != 0)
- {
- delete[] _ptr;
- }
- _ptr = ptr;
+ {
+ delete[] _ptr;
+ }
+ _ptr = ptr;
}
T& operator[](size_t i) const
{
- assert(_ptr != 0);
- assert(i >= 0);
+ assert(_ptr != 0);
+ assert(i >= 0);
return _ptr[i];
}
@@ -58,8 +58,8 @@ public:
void swap(ScopedArray& a)
{
T* tmp = a._ptr;
- a._ptr = _ptr;
- _ptr = tmp;
+ a._ptr = _ptr;
+ _ptr = tmp;
}
private:
diff --git a/cppe/include/IceE/Shared.h b/cppe/include/IceE/Shared.h
index 7df23f2214a..6db635520ea 100644
--- a/cppe/include/IceE/Shared.h
+++ b/cppe/include/IceE/Shared.h
@@ -61,9 +61,9 @@ inline void ice_atomic_set(ice_atomic_t* v, int i)
inline void ice_atomic_inc(ice_atomic_t *v)
{
__asm__ __volatile__(
- "lock ; incl %0"
- :"=m" (v->counter)
- :"m" (v->counter));
+ "lock ; incl %0"
+ :"=m" (v->counter)
+ :"m" (v->counter));
}
/**
@@ -80,9 +80,9 @@ inline int ice_atomic_dec_and_test(ice_atomic_t *v)
{
unsigned char c;
__asm__ __volatile__(
- "lock ; decl %0; sete %1"
- :"=m" (v->counter), "=qm" (c)
- :"m" (v->counter) : "memory");
+ "lock ; decl %0; sete %1"
+ :"=m" (v->counter), "=qm" (c)
+ :"m" (v->counter) : "memory");
return c != 0;
}
@@ -97,10 +97,10 @@ inline int ice_atomic_exchange_add(int i, ice_atomic_t* v)
{
int tmp = i;
__asm__ __volatile__(
- "lock ; xadd %0,(%2)"
- :"+r"(tmp), "=m"(v->counter)
- :"r"(v), "m"(v->counter)
- : "memory");
+ "lock ; xadd %0,(%2)"
+ :"+r"(tmp), "=m"(v->counter)
+ :"r"(v), "m"(v->counter)
+ : "memory");
return tmp + i;
}
@@ -147,31 +147,31 @@ public:
void __incRef()
{
- assert(_ref >= 0);
- ++_ref;
+ assert(_ref >= 0);
+ ++_ref;
}
void __decRef()
{
- assert(_ref > 0);
- if(--_ref == 0)
- {
- if(!_noDelete)
- {
- _noDelete = true;
- delete this;
- }
- }
+ assert(_ref > 0);
+ if(--_ref == 0)
+ {
+ if(!_noDelete)
+ {
+ _noDelete = true;
+ delete this;
+ }
+ }
}
int __getRef() const
{
- return _ref;
+ return _ref;
}
void __setNoDelete(bool b)
{
- _noDelete = b;
+ _noDelete = b;
}
private:
@@ -199,49 +199,49 @@ public:
void __incRef()
{
#if defined(_WIN32)
- assert(InterlockedExchangeAdd(&_ref, 0) >= 0);
- InterlockedIncrement(&_ref);
+ assert(InterlockedExchangeAdd(&_ref, 0) >= 0);
+ InterlockedIncrement(&_ref);
#elif defined(ICEE_HAS_ATOMIC_FUNCTIONS)
- assert(ice_atomic_exchange_add(0, &_ref) >= 0);
- ice_atomic_inc(&_ref);
+ assert(ice_atomic_exchange_add(0, &_ref) >= 0);
+ ice_atomic_inc(&_ref);
#else
- _mutex.lock();
- assert(_ref >= 0);
- ++_ref;
- _mutex.unlock();
+ _mutex.lock();
+ assert(_ref >= 0);
+ ++_ref;
+ _mutex.unlock();
#endif
}
void __decRef()
{
#if defined(_WIN32)
- assert(InterlockedExchangeAdd(&_ref, 0) > 0);
- if(InterlockedDecrement(&_ref) == 0 && !_noDelete)
- {
- _noDelete = true;
- delete this;
- }
+ assert(InterlockedExchangeAdd(&_ref, 0) > 0);
+ if(InterlockedDecrement(&_ref) == 0 && !_noDelete)
+ {
+ _noDelete = true;
+ delete this;
+ }
#elif defined(ICEE_HAS_ATOMIC_FUNCTIONS)
- assert(ice_atomic_exchange_add(0, &_ref) > 0);
- if(ice_atomic_dec_and_test(&_ref) && !_noDelete)
- {
- _noDelete = true;
- delete this;
- }
+ assert(ice_atomic_exchange_add(0, &_ref) > 0);
+ if(ice_atomic_dec_and_test(&_ref) && !_noDelete)
+ {
+ _noDelete = true;
+ delete this;
+ }
#else
- _mutex.lock();
- bool doDelete = false;
- assert(_ref > 0);
- if(--_ref == 0)
- {
- doDelete = !_noDelete;
- _noDelete = true;
- }
- _mutex.unlock();
- if(doDelete)
- {
- delete this;
- }
+ _mutex.lock();
+ bool doDelete = false;
+ assert(_ref > 0);
+ if(--_ref == 0)
+ {
+ doDelete = !_noDelete;
+ _noDelete = true;
+ }
+ _mutex.unlock();
+ if(doDelete)
+ {
+ delete this;
+ }
#endif
}
diff --git a/cppe/include/IceE/StaticMutex.h b/cppe/include/IceE/StaticMutex.h
index a30fd67a90f..b69c7fadc03 100644
--- a/cppe/include/IceE/StaticMutex.h
+++ b/cppe/include/IceE/StaticMutex.h
@@ -88,7 +88,7 @@ private:
#else
struct LockState
{
- pthread_mutex_t* mutex;
+ pthread_mutex_t* mutex;
};
#endif
@@ -141,7 +141,7 @@ StaticMutex::lock() const
{
if(!initialized())
{
- initialize();
+ initialize();
}
EnterCriticalSection(_mutex);
#ifndef _WIN32_WCE
@@ -154,16 +154,16 @@ StaticMutex::tryLock() const
{
if(!initialized())
{
- initialize();
+ initialize();
}
if(!TryEnterCriticalSection(_mutex))
{
- return false;
+ return false;
}
#ifndef _WIN32_WCE
if(_mutex->RecursionCount > 1)
{
- LeaveCriticalSection(_mutex);
+ LeaveCriticalSection(_mutex);
throw ThreadLockedException(__FILE__, __LINE__);
}
#endif
@@ -195,7 +195,7 @@ StaticMutex::lock(LockState&) const
{
if(!initialized())
{
- initialize();
+ initialize();
}
EnterCriticalSection(_mutex);
}
@@ -243,7 +243,7 @@ StaticMutex::unlock() const
int rc = pthread_mutex_unlock(&_mutex);
if(rc != 0)
{
- throw ThreadSyscallException(__FILE__, __LINE__, rc);
+ throw ThreadSyscallException(__FILE__, __LINE__, rc);
}
}
diff --git a/cppe/include/IceE/StringConverter.h b/cppe/include/IceE/StringConverter.h
index 649bd65c6af..d2e2f7eaec1 100644
--- a/cppe/include/IceE/StringConverter.h
+++ b/cppe/include/IceE/StringConverter.h
@@ -50,13 +50,13 @@ public:
// past the last byte returned by getMoreBytes).
//
virtual Byte* toUTF8(const charT* sourceStart, const charT* sourceEnd,
- UTF8Buffer&) const = 0;
+ UTF8Buffer&) const = 0;
//
// Unmarshals a UTF-8 sequence into a basic_string
//
virtual void fromUTF8(const Byte* sourceStart, const Byte* sourceEnd,
- std::basic_string<charT>& target) const = 0;
+ std::basic_string<charT>& target) const = 0;
};
typedef BasicStringConverter<char> StringConverter;
diff --git a/cppe/include/IceE/Thread.h b/cppe/include/IceE/Thread.h
index 24320757bbf..bb8f2bdd7a4 100644
--- a/cppe/include/IceE/Thread.h
+++ b/cppe/include/IceE/Thread.h
@@ -140,8 +140,8 @@ protected:
#endif
private:
- Thread(const Thread&); // Copying is forbidden
- void operator=(const Thread&); // Assignment is forbidden
+ Thread(const Thread&); // Copying is forbidden
+ void operator=(const Thread&); // Assignment is forbidden
};
typedef Handle<Thread> ThreadPtr;
diff --git a/cppe/include/IceE/Time.h b/cppe/include/IceE/Time.h
index 754fdcab135..991acffa63d 100644
--- a/cppe/include/IceE/Time.h
+++ b/cppe/include/IceE/Time.h
@@ -44,142 +44,142 @@ public:
Time operator-() const
{
- return Time(-_usec);
+ return Time(-_usec);
}
Time operator-(const Time& rhs) const
{
- return Time(_usec - rhs._usec);
+ return Time(_usec - rhs._usec);
}
Time operator+(const Time& rhs) const
{
- return Time(_usec + rhs._usec);
+ return Time(_usec + rhs._usec);
}
Time& operator+=(const Time& rhs)
{
- _usec += rhs._usec;
- return *this;
+ _usec += rhs._usec;
+ return *this;
}
Time& operator-=(const Time& rhs)
{
- _usec -= rhs._usec;
- return *this;
+ _usec -= rhs._usec;
+ return *this;
}
bool operator<(const Time& rhs) const
{
- return _usec < rhs._usec;
+ return _usec < rhs._usec;
}
bool operator<=(const Time& rhs) const
{
- return _usec <= rhs._usec;
+ return _usec <= rhs._usec;
}
bool operator>(const Time& rhs) const
{
- return _usec > rhs._usec;
+ return _usec > rhs._usec;
}
bool operator>=(const Time& rhs) const
{
- return _usec >= rhs._usec;
+ return _usec >= rhs._usec;
}
bool operator==(const Time& rhs) const
{
- return _usec == rhs._usec;
+ return _usec == rhs._usec;
}
bool operator!=(const Time& rhs) const
{
- return _usec != rhs._usec;
+ return _usec != rhs._usec;
}
double operator/(const Time& rhs) const
{
- return (double)_usec / (double)rhs._usec;
+ return (double)_usec / (double)rhs._usec;
}
Time& operator*=(int rhs)
{
- _usec *= rhs;
- return *this;
+ _usec *= rhs;
+ return *this;
}
Time operator*(int rhs) const
{
- Time t;
- t._usec = _usec * rhs;
- return t;
+ Time t;
+ t._usec = _usec * rhs;
+ return t;
}
Time& operator/=(int rhs)
{
- _usec /= rhs;
- return *this;
+ _usec /= rhs;
+ return *this;
}
Time operator/(int rhs) const
{
- Time t;
- t._usec = _usec / rhs;
- return t;
+ Time t;
+ t._usec = _usec / rhs;
+ return t;
}
Time& operator*=(Int64 rhs)
{
- _usec *= rhs;
- return *this;
+ _usec *= rhs;
+ return *this;
}
Time operator*(Int64 rhs) const
{
- Time t;
- t._usec = _usec * rhs;
- return t;
+ Time t;
+ t._usec = _usec * rhs;
+ return t;
}
Time& operator/=(Int64 rhs)
{
- _usec /= rhs;
- return *this;
+ _usec /= rhs;
+ return *this;
}
Time operator/(Int64 rhs) const
{
- Time t;
- t._usec = _usec / rhs;
- return t;
+ Time t;
+ t._usec = _usec / rhs;
+ return t;
}
Time& operator*=(double rhs)
{
- _usec = static_cast<Int64>(static_cast<double>(_usec) * rhs);
- return *this;
+ _usec = static_cast<Int64>(static_cast<double>(_usec) * rhs);
+ return *this;
}
Time operator*(double rhs) const
{
- Time t;
- t._usec = static_cast<Int64>(static_cast<double>(_usec) * rhs);
- return t;
+ Time t;
+ t._usec = static_cast<Int64>(static_cast<double>(_usec) * rhs);
+ return t;
}
Time& operator/=(double rhs)
{
- _usec = static_cast<Int64>(static_cast<double>(_usec) / rhs);
- return *this;
+ _usec = static_cast<Int64>(static_cast<double>(_usec) / rhs);
+ return *this;
}
Time operator/(double rhs) const
{
- Time t;
- t._usec = static_cast<Int64>(static_cast<double>(_usec) / rhs);
- return t;
+ Time t;
+ t._usec = static_cast<Int64>(static_cast<double>(_usec) / rhs);
+ return t;
}
private:
diff --git a/cppe/include/IceE/Unicode.h b/cppe/include/IceE/Unicode.h
index 5f225fe6605..f42c25b3f3c 100644
--- a/cppe/include/IceE/Unicode.h
+++ b/cppe/include/IceE/Unicode.h
@@ -97,10 +97,10 @@ ICE_API std::wstring stringToWstring(const std::string&);
enum ConversionResult
{
- conversionOK, /* conversion successful */
- sourceExhausted, /* partial character in source, but hit end */
- targetExhausted, /* insuff. room in target for conversion */
- sourceIllegal /* source sequence is illegal/malformed */
+ conversionOK, /* conversion successful */
+ sourceExhausted, /* partial character in source, but hit end */
+ targetExhausted, /* insuff. room in target for conversion */
+ sourceIllegal /* source sequence is illegal/malformed */
};
@@ -117,15 +117,15 @@ isLegalUTF8Sequence(const Byte* source, const Byte* end);
ICE_API ConversionResult
convertUTFWstringToUTF8(const wchar_t*& sourceStart, const wchar_t* sourceEnd,
- Byte*& targetStart, Byte* targetEnd, ConversionFlags flags);
+ Byte*& targetStart, Byte* targetEnd, ConversionFlags flags);
ICE_API ConversionResult
convertUTF8ToUTFWstring(const Byte*& sourceStart, const Byte* sourceEnd,
- wchar_t*& targetStart, wchar_t* targetEnd, ConversionFlags flags);
+ wchar_t*& targetStart, wchar_t* targetEnd, ConversionFlags flags);
ICE_API ConversionResult
convertUTF8ToUTFWstring(const Byte*& sourceStart, const Byte* sourceEnd,
- std::wstring& target, ConversionFlags flags);
+ std::wstring& target, ConversionFlags flags);
diff --git a/cppe/slice/IceE/Locator.ice b/cppe/slice/IceE/Locator.ice
index 086f2d3a0cd..1018140af1e 100644
--- a/cppe/slice/IceE/Locator.ice
+++ b/cppe/slice/IceE/Locator.ice
@@ -91,7 +91,7 @@ interface Locator
*
**/
["nonmutating", "cpp:const"] idempotent Object* findObjectById(Ice::Identity id)
- throws ObjectNotFoundException;
+ throws ObjectNotFoundException;
/**
*
@@ -107,7 +107,7 @@ interface Locator
*
**/
["nonmutating", "cpp:const"] idempotent Object* findAdapterById(string id)
- throws AdapterNotFoundException;
+ throws AdapterNotFoundException;
/**
*
@@ -152,7 +152,7 @@ interface LocatorRegistry
*
**/
idempotent void setAdapterDirectProxy(string id, Object* proxy)
- throws AdapterNotFoundException, AdapterAlreadyActiveException;
+ throws AdapterNotFoundException, AdapterAlreadyActiveException;
/**
*
@@ -180,7 +180,7 @@ interface LocatorRegistry
*
**/
["amd"] idempotent void setReplicatedAdapterDirectProxy(string adapterId, string replicaGroupId, Object* proxy)
- throws AdapterNotFoundException, AdapterAlreadyActiveException, InvalidReplicaGroupIdException;
+ throws AdapterNotFoundException, AdapterAlreadyActiveException, InvalidReplicaGroupIdException;
};
};
diff --git a/cppe/src/IceE/BasicStream.cpp b/cppe/src/IceE/BasicStream.cpp
index 62424ac4afd..32a01112f7a 100644
--- a/cppe/src/IceE/BasicStream.cpp
+++ b/cppe/src/IceE/BasicStream.cpp
@@ -27,23 +27,23 @@ IceInternal::BasicStream::clear()
{
while(_currentReadEncaps && _currentReadEncaps != &_preAllocatedReadEncaps)
{
- ReadEncaps* oldEncaps = _currentReadEncaps;
- _currentReadEncaps = _currentReadEncaps->previous;
- delete oldEncaps;
+ ReadEncaps* oldEncaps = _currentReadEncaps;
+ _currentReadEncaps = _currentReadEncaps->previous;
+ delete oldEncaps;
}
while(_currentWriteEncaps && _currentWriteEncaps != &_preAllocatedWriteEncaps)
{
- WriteEncaps* oldEncaps = _currentWriteEncaps;
- _currentWriteEncaps = _currentWriteEncaps->previous;
- delete oldEncaps;
+ WriteEncaps* oldEncaps = _currentWriteEncaps;
+ _currentWriteEncaps = _currentWriteEncaps->previous;
+ delete oldEncaps;
}
while(_seqDataStack)
{
- SeqData* oldSeqData = _seqDataStack;
- _seqDataStack = _seqDataStack->previous;
- delete oldSeqData;
+ SeqData* oldSeqData = _seqDataStack;
+ _seqDataStack = _seqDataStack->previous;
+ delete oldSeqData;
}
}
@@ -65,34 +65,34 @@ IceInternal::BasicStream::swap(BasicStream& other)
if(_currentReadEncaps || other._currentReadEncaps)
{
- _preAllocatedReadEncaps.swap(other._preAllocatedReadEncaps);
+ _preAllocatedReadEncaps.swap(other._preAllocatedReadEncaps);
- if(!_currentReadEncaps)
- {
- _currentReadEncaps = &_preAllocatedReadEncaps;
- other._currentReadEncaps = 0;
- }
- else if(!other._currentReadEncaps)
- {
- other._currentReadEncaps = &other._preAllocatedReadEncaps;
- _currentReadEncaps = 0;
- }
+ if(!_currentReadEncaps)
+ {
+ _currentReadEncaps = &_preAllocatedReadEncaps;
+ other._currentReadEncaps = 0;
+ }
+ else if(!other._currentReadEncaps)
+ {
+ other._currentReadEncaps = &other._preAllocatedReadEncaps;
+ _currentReadEncaps = 0;
+ }
}
if(_currentWriteEncaps || other._currentWriteEncaps)
{
- _preAllocatedWriteEncaps.swap(other._preAllocatedWriteEncaps);
+ _preAllocatedWriteEncaps.swap(other._preAllocatedWriteEncaps);
- if(!_currentWriteEncaps)
- {
- _currentWriteEncaps = &_preAllocatedWriteEncaps;
- other._currentWriteEncaps = 0;
- }
- else if(!other._currentWriteEncaps)
- {
- other._currentWriteEncaps = &other._preAllocatedWriteEncaps;
- _currentWriteEncaps = 0;
- }
+ if(!_currentWriteEncaps)
+ {
+ _currentWriteEncaps = &_preAllocatedWriteEncaps;
+ other._currentWriteEncaps = 0;
+ }
+ else if(!other._currentWriteEncaps)
+ {
+ other._currentWriteEncaps = &other._preAllocatedWriteEncaps;
+ _currentWriteEncaps = 0;
+ }
}
std::swap(_seqDataStack, other._seqDataStack);
@@ -152,7 +152,7 @@ IceInternal::BasicStream::startSeq(int numElements, int minSize)
{
if(numElements == 0) // Optimization to avoid pushing a useless stack frame.
{
- return;
+ return;
}
//
@@ -165,17 +165,17 @@ IceInternal::BasicStream::startSeq(int numElements, int minSize)
int bytesLeft = static_cast<int>(b.end() - i);
if(_seqDataStack->previous == 0) // Outermost sequence
{
- //
- // The sequence must fit within the message.
- //
- if(numElements * minSize > bytesLeft)
- {
- throwUnmarshalOutOfBoundsException(__FILE__, __LINE__);
- }
+ //
+ // The sequence must fit within the message.
+ //
+ if(numElements * minSize > bytesLeft)
+ {
+ throwUnmarshalOutOfBoundsException(__FILE__, __LINE__);
+ }
}
else // Nested sequence
{
- checkSeq(bytesLeft);
+ checkSeq(bytesLeft);
}
}
@@ -185,17 +185,17 @@ IceInternal::BasicStream::checkFixedSeq(int numElements, int elemSize)
int bytesLeft = static_cast<int>(b.end() - i);
if(_seqDataStack == 0) // Outermost sequence
{
- //
- // The sequence must fit within the message.
- //
- if(numElements * elemSize > bytesLeft)
- {
- throwUnmarshalOutOfBoundsException(__FILE__, __LINE__);
- }
+ //
+ // The sequence must fit within the message.
+ //
+ if(numElements * elemSize > bytesLeft)
+ {
+ throwUnmarshalOutOfBoundsException(__FILE__, __LINE__);
+ }
}
else // Nested sequence
{
- checkSeq(bytesLeft - numElements * elemSize);
+ checkSeq(bytesLeft - numElements * elemSize);
}
}
@@ -204,7 +204,7 @@ IceInternal::BasicStream::endSeq(int sz)
{
if(sz == 0) // Pop only if something was pushed previously.
{
- return;
+ return;
}
//
@@ -251,11 +251,11 @@ IceInternal::BasicStream::skipEncaps()
read(sz);
if(sz < 0)
{
- throwNegativeSizeException(__FILE__, __LINE__);
+ throwNegativeSizeException(__FILE__, __LINE__);
}
if(i - sizeof(Int) + sz > b.end())
{
- throwUnmarshalOutOfBoundsException(__FILE__, __LINE__);
+ throwUnmarshalOutOfBoundsException(__FILE__, __LINE__);
}
i += sz - sizeof(Int);
}
@@ -294,7 +294,7 @@ IceInternal::BasicStream::startReadSlice()
read(sz);
if(sz < 0)
{
- throwNegativeSizeException(__FILE__, __LINE__);
+ throwNegativeSizeException(__FILE__, __LINE__);
}
_readSlice = i - b.begin();
}
@@ -311,12 +311,12 @@ IceInternal::BasicStream::skipSlice()
read(sz);
if(sz < 0)
{
- throwNegativeSizeException(__FILE__, __LINE__);
+ throwNegativeSizeException(__FILE__, __LINE__);
}
i += sz - sizeof(Int);
if(i > b.end())
{
- throwUnmarshalOutOfBoundsException(__FILE__, __LINE__);
+ throwUnmarshalOutOfBoundsException(__FILE__, __LINE__);
}
}
@@ -325,9 +325,9 @@ IceInternal::BasicStream::writeBlob(const vector<Byte>& v)
{
if(!v.empty())
{
- Container::size_type pos = b.size();
- resize(pos + v.size());
- memcpy(&b[pos], &v[0], v.size());
+ Container::size_type pos = b.size();
+ resize(pos + v.size());
+ memcpy(&b[pos], &v[0], v.size());
}
}
@@ -336,16 +336,16 @@ IceInternal::BasicStream::readBlob(vector<Byte>& v, Int sz)
{
if(sz > 0)
{
- if(b.end() - i < sz)
- {
- throwUnmarshalOutOfBoundsException(__FILE__, __LINE__);
- }
- vector<Byte>(i, i + sz).swap(v);
- i += sz;
+ if(b.end() - i < sz)
+ {
+ throwUnmarshalOutOfBoundsException(__FILE__, __LINE__);
+ }
+ vector<Byte>(i, i + sz).swap(v);
+ i += sz;
}
else
{
- v.clear();
+ v.clear();
}
}
@@ -356,14 +356,14 @@ IceInternal::BasicStream::read(pair<const Byte*, const Byte*>& v)
readSize(sz);
if(sz > 0)
{
- checkFixedSeq(sz, 1);
- v.first = i;
- v.second = i + sz;
- i += sz;
+ checkFixedSeq(sz, 1);
+ v.first = i;
+ v.second = i + sz;
+ i += sz;
}
else
{
- v.first = v.second = i;
+ v.first = v.second = i;
}
}
@@ -374,9 +374,9 @@ IceInternal::BasicStream::write(const Byte* begin, const Byte* end)
writeSize(sz);
if(sz > 0)
{
- Container::size_type pos = b.size();
- resize(pos + sz);
- memcpy(&b[pos], begin, sz);
+ Container::size_type pos = b.size();
+ resize(pos + sz);
+ memcpy(&b[pos], begin, sz);
}
}
@@ -387,9 +387,9 @@ IceInternal::BasicStream::write(const vector<bool>& v)
writeSize(sz);
if(sz > 0)
{
- Container::size_type pos = b.size();
- resize(pos + sz);
- copy(v.begin(), v.end(), b.begin() + pos);
+ Container::size_type pos = b.size();
+ resize(pos + sz);
+ copy(v.begin(), v.end(), b.begin() + pos);
}
}
@@ -403,7 +403,7 @@ struct BasicStreamWriteBoolHelper
{
for(int idx = 0; idx < sz; ++idx)
{
- b[pos + idx] = static_cast<Ice::Byte>(*(begin + idx));
+ b[pos + idx] = static_cast<Ice::Byte>(*(begin + idx));
}
}
};
@@ -428,7 +428,7 @@ IceInternal::BasicStream::write(const bool* begin, const bool* end)
{
Container::size_type pos = b.size();
resize(pos + sz);
- BasicStreamWriteBoolHelper<sizeof(bool)>::write(begin, pos, b, sz);
+ BasicStreamWriteBoolHelper<sizeof(bool)>::write(begin, pos, b, sz);
}
}
@@ -461,11 +461,11 @@ struct BasicStreamReadBoolHelper
bool* array = new bool[sz];
for(int idx = 0; idx < sz; ++idx)
{
- array[idx] = static_cast<bool>(*(i + idx));
+ array[idx] = static_cast<bool>(*(i + idx));
}
v.first = array;
v.second = array + sz;
- return array;
+ return array;
}
};
@@ -476,7 +476,7 @@ struct BasicStreamReadBoolHelper<1>
{
v.first = reinterpret_cast<bool*>(i);
v.second = reinterpret_cast<bool*>(i) + sz;
- return 0;
+ return 0;
}
};
@@ -491,7 +491,7 @@ IceInternal::BasicStream::read(pair<const bool*, const bool*>& v)
if(sz > 0)
{
checkFixedSeq(sz, 1);
- result = BasicStreamReadBoolHelper<sizeof(bool)>::read(v, sz, i);
+ result = BasicStreamReadBoolHelper<sizeof(bool)>::read(v, sz, i);
i += sz;
}
else
@@ -524,7 +524,7 @@ IceInternal::BasicStream::read(Short& v)
{
if(b.end() - i < static_cast<int>(sizeof(Short)))
{
- throwUnmarshalOutOfBoundsException(__FILE__, __LINE__);
+ throwUnmarshalOutOfBoundsException(__FILE__, __LINE__);
}
const Byte* src = &(*i);
i += sizeof(Short);
@@ -546,19 +546,19 @@ IceInternal::BasicStream::write(const Short* begin, const Short* end)
writeSize(sz);
if(sz > 0)
{
- Container::size_type pos = b.size();
- resize(pos + sz * sizeof(Short));
+ Container::size_type pos = b.size();
+ resize(pos + sz * sizeof(Short));
#ifdef ICE_BIG_ENDIAN
- const Byte* src = reinterpret_cast<const Byte*>(begin) + sizeof(Short) - 1;
- Byte* dest = &(*(b.begin() + pos));
- for(int j = 0 ; j < sz ; ++j)
- {
- *dest++ = *src--;
- *dest++ = *src--;
- src += 2 * sizeof(Short);
- }
+ const Byte* src = reinterpret_cast<const Byte*>(begin) + sizeof(Short) - 1;
+ Byte* dest = &(*(b.begin() + pos));
+ for(int j = 0 ; j < sz ; ++j)
+ {
+ *dest++ = *src--;
+ *dest++ = *src--;
+ src += 2 * sizeof(Short);
+ }
#else
- memcpy(&b[pos], reinterpret_cast<const Byte*>(begin), sz * sizeof(Short));
+ memcpy(&b[pos], reinterpret_cast<const Byte*>(begin), sz * sizeof(Short));
#endif
}
}
@@ -570,26 +570,26 @@ IceInternal::BasicStream::read(vector<Short>& v)
readSize(sz);
if(sz > 0)
{
- checkFixedSeq(sz, static_cast<int>(sizeof(Short)));
- Container::iterator begin = i;
- i += sz * static_cast<int>(sizeof(Short));
- v.resize(sz);
+ checkFixedSeq(sz, static_cast<int>(sizeof(Short)));
+ Container::iterator begin = i;
+ i += sz * static_cast<int>(sizeof(Short));
+ v.resize(sz);
#ifdef ICE_BIG_ENDIAN
- const Byte* src = &(*begin);
- Byte* dest = reinterpret_cast<Byte*>(&v[0]) + sizeof(Short) - 1;
- for(int j = 0 ; j < sz ; ++j)
- {
- *dest-- = *src++;
- *dest-- = *src++;
- dest += 2 * sizeof(Short);
- }
+ const Byte* src = &(*begin);
+ Byte* dest = reinterpret_cast<Byte*>(&v[0]) + sizeof(Short) - 1;
+ for(int j = 0 ; j < sz ; ++j)
+ {
+ *dest-- = *src++;
+ *dest-- = *src++;
+ dest += 2 * sizeof(Short);
+ }
#else
- copy(begin, i, reinterpret_cast<Byte*>(&v[0]));
+ copy(begin, i, reinterpret_cast<Byte*>(&v[0]));
#endif
}
else
{
- v.clear();
+ v.clear();
}
}
@@ -641,21 +641,21 @@ IceInternal::BasicStream::write(const Int* begin, const Int* end)
writeSize(sz);
if(sz > 0)
{
- Container::size_type pos = b.size();
- resize(pos + sz * sizeof(Int));
+ Container::size_type pos = b.size();
+ resize(pos + sz * sizeof(Int));
#ifdef ICE_BIG_ENDIAN
- const Byte* src = reinterpret_cast<const Byte*>(begin) + sizeof(Int) - 1;
- Byte* dest = &(*(b.begin() + pos));
- for(int j = 0 ; j < sz ; ++j)
- {
- *dest++ = *src--;
- *dest++ = *src--;
- *dest++ = *src--;
- *dest++ = *src--;
- src += 2 * sizeof(Int);
- }
+ const Byte* src = reinterpret_cast<const Byte*>(begin) + sizeof(Int) - 1;
+ Byte* dest = &(*(b.begin() + pos));
+ for(int j = 0 ; j < sz ; ++j)
+ {
+ *dest++ = *src--;
+ *dest++ = *src--;
+ *dest++ = *src--;
+ *dest++ = *src--;
+ src += 2 * sizeof(Int);
+ }
#else
- memcpy(&b[pos], reinterpret_cast<const Byte*>(begin), sz * sizeof(Int));
+ memcpy(&b[pos], reinterpret_cast<const Byte*>(begin), sz * sizeof(Int));
#endif
}
}
@@ -667,28 +667,28 @@ IceInternal::BasicStream::read(vector<Int>& v)
readSize(sz);
if(sz > 0)
{
- checkFixedSeq(sz, static_cast<int>(sizeof(Int)));
- Container::iterator begin = i;
- i += sz * static_cast<int>(sizeof(Int));
- v.resize(sz);
+ checkFixedSeq(sz, static_cast<int>(sizeof(Int)));
+ Container::iterator begin = i;
+ i += sz * static_cast<int>(sizeof(Int));
+ v.resize(sz);
#ifdef ICE_BIG_ENDIAN
- const Byte* src = &(*begin);
- Byte* dest = reinterpret_cast<Byte*>(&v[0]) + sizeof(Int) - 1;
- for(int j = 0 ; j < sz ; ++j)
- {
- *dest-- = *src++;
- *dest-- = *src++;
- *dest-- = *src++;
- *dest-- = *src++;
- dest += 2 * sizeof(Int);
- }
+ const Byte* src = &(*begin);
+ Byte* dest = reinterpret_cast<Byte*>(&v[0]) + sizeof(Int) - 1;
+ for(int j = 0 ; j < sz ; ++j)
+ {
+ *dest-- = *src++;
+ *dest-- = *src++;
+ *dest-- = *src++;
+ *dest-- = *src++;
+ dest += 2 * sizeof(Int);
+ }
#else
- copy(begin, i, reinterpret_cast<Byte*>(&v[0]));
+ copy(begin, i, reinterpret_cast<Byte*>(&v[0]));
#endif
}
else
{
- v.clear();
+ v.clear();
}
}
@@ -769,7 +769,7 @@ IceInternal::BasicStream::read(Long& v)
{
if(b.end() - i < static_cast<int>(sizeof(Long)))
{
- throwUnmarshalOutOfBoundsException(__FILE__, __LINE__);
+ throwUnmarshalOutOfBoundsException(__FILE__, __LINE__);
}
const Byte* src = &(*i);
i += sizeof(Long);
@@ -803,25 +803,25 @@ IceInternal::BasicStream::write(const Long* begin, const Long* end)
writeSize(sz);
if(sz > 0)
{
- Container::size_type pos = b.size();
- resize(pos + sz * sizeof(Long));
+ Container::size_type pos = b.size();
+ resize(pos + sz * sizeof(Long));
#ifdef ICE_BIG_ENDIAN
- const Byte* src = reinterpret_cast<const Byte*>(begin) + sizeof(Long) - 1;
- Byte* dest = &(*(b.begin() + pos));
- for(int j = 0 ; j < sz ; ++j)
- {
- *dest++ = *src--;
- *dest++ = *src--;
- *dest++ = *src--;
- *dest++ = *src--;
- *dest++ = *src--;
- *dest++ = *src--;
- *dest++ = *src--;
- *dest++ = *src--;
- src += 2 * sizeof(Long);
- }
+ const Byte* src = reinterpret_cast<const Byte*>(begin) + sizeof(Long) - 1;
+ Byte* dest = &(*(b.begin() + pos));
+ for(int j = 0 ; j < sz ; ++j)
+ {
+ *dest++ = *src--;
+ *dest++ = *src--;
+ *dest++ = *src--;
+ *dest++ = *src--;
+ *dest++ = *src--;
+ *dest++ = *src--;
+ *dest++ = *src--;
+ *dest++ = *src--;
+ src += 2 * sizeof(Long);
+ }
#else
- memcpy(&b[pos], reinterpret_cast<const Byte*>(begin), sz * sizeof(Long));
+ memcpy(&b[pos], reinterpret_cast<const Byte*>(begin), sz * sizeof(Long));
#endif
}
}
@@ -833,32 +833,32 @@ IceInternal::BasicStream::read(vector<Long>& v)
readSize(sz);
if(sz > 0)
{
- checkFixedSeq(sz, static_cast<int>(sizeof(Long)));
- Container::iterator begin = i;
- i += sz * static_cast<int>(sizeof(Long));
- v.resize(sz);
+ checkFixedSeq(sz, static_cast<int>(sizeof(Long)));
+ Container::iterator begin = i;
+ i += sz * static_cast<int>(sizeof(Long));
+ v.resize(sz);
#ifdef ICE_BIG_ENDIAN
- const Byte* src = &(*begin);
- Byte* dest = reinterpret_cast<Byte*>(&v[0]) + sizeof(Long) - 1;
- for(int j = 0 ; j < sz ; ++j)
- {
- *dest-- = *src++;
- *dest-- = *src++;
- *dest-- = *src++;
- *dest-- = *src++;
- *dest-- = *src++;
- *dest-- = *src++;
- *dest-- = *src++;
- *dest-- = *src++;
- dest += 2 * sizeof(Long);
- }
+ const Byte* src = &(*begin);
+ Byte* dest = reinterpret_cast<Byte*>(&v[0]) + sizeof(Long) - 1;
+ for(int j = 0 ; j < sz ; ++j)
+ {
+ *dest-- = *src++;
+ *dest-- = *src++;
+ *dest-- = *src++;
+ *dest-- = *src++;
+ *dest-- = *src++;
+ *dest-- = *src++;
+ *dest-- = *src++;
+ *dest-- = *src++;
+ dest += 2 * sizeof(Long);
+ }
#else
- copy(begin, i, reinterpret_cast<Byte*>(&v[0]));
+ copy(begin, i, reinterpret_cast<Byte*>(&v[0]));
#endif
}
else
{
- v.clear();
+ v.clear();
}
}
@@ -935,7 +935,7 @@ IceInternal::BasicStream::read(Float& v)
{
if(b.end() - i < static_cast<int>(sizeof(Float)))
{
- throwUnmarshalOutOfBoundsException(__FILE__, __LINE__);
+ throwUnmarshalOutOfBoundsException(__FILE__, __LINE__);
}
const Byte* src = &(*i);
i += sizeof(Float);
@@ -961,21 +961,21 @@ IceInternal::BasicStream::write(const Float* begin, const Float* end)
writeSize(sz);
if(sz > 0)
{
- Container::size_type pos = b.size();
- resize(pos + sz * sizeof(Float));
+ Container::size_type pos = b.size();
+ resize(pos + sz * sizeof(Float));
#ifdef ICE_BIG_ENDIAN
- const Byte* src = reinterpret_cast<const Byte*>(begin) + sizeof(Float) - 1;
- Byte* dest = &(*(b.begin() + pos));
- for(int j = 0 ; j < sz ; ++j)
- {
- *dest++ = *src--;
- *dest++ = *src--;
- *dest++ = *src--;
- *dest++ = *src--;
- src += 2 * sizeof(Float);
- }
+ const Byte* src = reinterpret_cast<const Byte*>(begin) + sizeof(Float) - 1;
+ Byte* dest = &(*(b.begin() + pos));
+ for(int j = 0 ; j < sz ; ++j)
+ {
+ *dest++ = *src--;
+ *dest++ = *src--;
+ *dest++ = *src--;
+ *dest++ = *src--;
+ src += 2 * sizeof(Float);
+ }
#else
- memcpy(&b[pos], reinterpret_cast<const Byte*>(begin), sz * sizeof(Float));
+ memcpy(&b[pos], reinterpret_cast<const Byte*>(begin), sz * sizeof(Float));
#endif
}
}
@@ -987,28 +987,28 @@ IceInternal::BasicStream::read(vector<Float>& v)
readSize(sz);
if(sz > 0)
{
- checkFixedSeq(sz, static_cast<int>(sizeof(Float)));
- Container::iterator begin = i;
- i += sz * static_cast<int>(sizeof(Float));
- v.resize(sz);
+ checkFixedSeq(sz, static_cast<int>(sizeof(Float)));
+ Container::iterator begin = i;
+ i += sz * static_cast<int>(sizeof(Float));
+ v.resize(sz);
#ifdef ICE_BIG_ENDIAN
- const Byte* src = &(*begin);
- Byte* dest = reinterpret_cast<Byte*>(&v[0]) + sizeof(Float) - 1;
- for(int j = 0 ; j < sz ; ++j)
- {
- *dest-- = *src++;
- *dest-- = *src++;
- *dest-- = *src++;
- *dest-- = *src++;
- dest += 2 * sizeof(Float);
- }
+ const Byte* src = &(*begin);
+ Byte* dest = reinterpret_cast<Byte*>(&v[0]) + sizeof(Float) - 1;
+ for(int j = 0 ; j < sz ; ++j)
+ {
+ *dest-- = *src++;
+ *dest-- = *src++;
+ *dest-- = *src++;
+ *dest-- = *src++;
+ dest += 2 * sizeof(Float);
+ }
#else
- copy(begin, i, reinterpret_cast<Byte*>(&v[0]));
+ copy(begin, i, reinterpret_cast<Byte*>(&v[0]));
#endif
}
else
{
- v.clear();
+ v.clear();
}
}
@@ -1100,7 +1100,7 @@ IceInternal::BasicStream::read(Double& v)
{
if(b.end() - i < static_cast<int>(sizeof(Double)))
{
- throwUnmarshalOutOfBoundsException(__FILE__, __LINE__);
+ throwUnmarshalOutOfBoundsException(__FILE__, __LINE__);
}
const Byte* src = &(*i);
i += sizeof(Double);
@@ -1145,28 +1145,28 @@ IceInternal::BasicStream::write(const Double* begin, const Double* end)
writeSize(sz);
if(sz > 0)
{
- Container::size_type pos = b.size();
- resize(pos + sz * sizeof(Double));
+ Container::size_type pos = b.size();
+ resize(pos + sz * sizeof(Double));
#ifdef ICE_BIG_ENDIAN
- const Byte* src = reinterpret_cast<const Byte*>(begin) + sizeof(Double) - 1;
- Byte* dest = &(*(b.begin() + pos));
- for(int j = 0 ; j < sz ; ++j)
- {
- *dest++ = *src--;
- *dest++ = *src--;
- *dest++ = *src--;
- *dest++ = *src--;
- *dest++ = *src--;
- *dest++ = *src--;
- *dest++ = *src--;
- *dest++ = *src--;
- src += 2 * sizeof(Double);
- }
+ const Byte* src = reinterpret_cast<const Byte*>(begin) + sizeof(Double) - 1;
+ Byte* dest = &(*(b.begin() + pos));
+ for(int j = 0 ; j < sz ; ++j)
+ {
+ *dest++ = *src--;
+ *dest++ = *src--;
+ *dest++ = *src--;
+ *dest++ = *src--;
+ *dest++ = *src--;
+ *dest++ = *src--;
+ *dest++ = *src--;
+ *dest++ = *src--;
+ src += 2 * sizeof(Double);
+ }
#elif defined(__arm__) && defined(__linux)
- const Byte* src = reinterpret_cast<const Byte*>(begin);
- Byte* dest = &(*(b.begin() + pos));
- for(int j = 0 ; j < sz ; ++j)
- {
+ const Byte* src = reinterpret_cast<const Byte*>(begin);
+ Byte* dest = &(*(b.begin() + pos));
+ for(int j = 0 ; j < sz ; ++j)
+ {
dest[4] = *src++;
dest[5] = *src++;
dest[6] = *src++;
@@ -1176,9 +1176,9 @@ IceInternal::BasicStream::write(const Double* begin, const Double* end)
dest[2] = *src++;
dest[3] = *src++;
dest += sizeof(Double);
- }
+ }
#else
- memcpy(&b[pos], reinterpret_cast<const Byte*>(begin), sz * sizeof(Double));
+ memcpy(&b[pos], reinterpret_cast<const Byte*>(begin), sz * sizeof(Double));
#endif
}
}
@@ -1190,47 +1190,47 @@ IceInternal::BasicStream::read(vector<Double>& v)
readSize(sz);
if(sz > 0)
{
- checkFixedSeq(sz, static_cast<int>(sizeof(Double)));
- Container::iterator begin = i;
- i += sz * static_cast<int>(sizeof(Double));
- v.resize(sz);
+ checkFixedSeq(sz, static_cast<int>(sizeof(Double)));
+ Container::iterator begin = i;
+ i += sz * static_cast<int>(sizeof(Double));
+ v.resize(sz);
#ifdef ICE_BIG_ENDIAN
- const Byte* src = &(*begin);
- Byte* dest = reinterpret_cast<Byte*>(&v[0]) + sizeof(Double) - 1;
- for(int j = 0 ; j < sz ; ++j)
- {
- *dest-- = *src++;
- *dest-- = *src++;
- *dest-- = *src++;
- *dest-- = *src++;
- *dest-- = *src++;
- *dest-- = *src++;
- *dest-- = *src++;
- *dest-- = *src++;
- dest += 2 * sizeof(Double);
- }
+ const Byte* src = &(*begin);
+ Byte* dest = reinterpret_cast<Byte*>(&v[0]) + sizeof(Double) - 1;
+ for(int j = 0 ; j < sz ; ++j)
+ {
+ *dest-- = *src++;
+ *dest-- = *src++;
+ *dest-- = *src++;
+ *dest-- = *src++;
+ *dest-- = *src++;
+ *dest-- = *src++;
+ *dest-- = *src++;
+ *dest-- = *src++;
+ dest += 2 * sizeof(Double);
+ }
#elif defined(__arm__) && defined(__linux)
- const Byte* src = &(*begin);
- Byte* dest = reinterpret_cast<Byte*>(&v[0]);
- for(int j = 0 ; j < sz ; ++j)
- {
- dest[4] = *src++;
- dest[5] = *src++;
- dest[6] = *src++;
- dest[7] = *src++;
- dest[0] = *src++;
- dest[1] = *src++;
- dest[2] = *src++;
- dest[3] = *src++;
- dest += sizeof(Double);
- }
+ const Byte* src = &(*begin);
+ Byte* dest = reinterpret_cast<Byte*>(&v[0]);
+ for(int j = 0 ; j < sz ; ++j)
+ {
+ dest[4] = *src++;
+ dest[5] = *src++;
+ dest[6] = *src++;
+ dest[7] = *src++;
+ dest[0] = *src++;
+ dest[1] = *src++;
+ dest[2] = *src++;
+ dest[3] = *src++;
+ dest += sizeof(Double);
+ }
#else
- copy(begin, i, reinterpret_cast<Byte*>(&v[0]));
+ copy(begin, i, reinterpret_cast<Byte*>(&v[0]));
#endif
}
else
{
- v.clear();
+ v.clear();
}
}
@@ -1381,10 +1381,10 @@ IceInternal::BasicStream::write(const string* begin, const string* end, bool con
writeSize(sz);
if(sz > 0)
{
- for(int i = 0; i < sz; ++i)
- {
- write(begin[i], convert);
- }
+ for(int i = 0; i < sz; ++i)
+ {
+ write(begin[i], convert);
+ }
}
}
@@ -1395,19 +1395,19 @@ IceInternal::BasicStream::read(vector<string>& v, bool convert)
readSize(sz);
if(sz > 0)
{
- startSeq(sz, 1);
- v.resize(sz);
- for(int i = 0; i < sz; ++i)
- {
- read(v[i], convert);
- checkSeq();
- endElement();
- }
- endSeq(sz);
+ startSeq(sz, 1);
+ v.resize(sz);
+ for(int i = 0; i < sz; ++i)
+ {
+ read(v[i], convert);
+ checkSeq();
+ endElement();
+ }
+ endSeq(sz);
}
else
{
- v.clear();
+ v.clear();
}
}
@@ -1510,7 +1510,7 @@ IceInternal::BasicStream::read(vector<wstring>& v)
}
else
{
- v.clear();
+ v.clear();
}
}
@@ -1545,33 +1545,33 @@ IceInternal::BasicStream::throwException()
read(id, false);
for(;;)
{
- //
- // Look for a factory for this ID.
- //
- UserExceptionFactoryPtr factory = factoryTable->getExceptionFactory(id);
- if(factory)
- {
- //
- // Got factory -- get the factory to instantiate the
- // exception, initialize the exception members, and throw
- // the exception.
- //
- try
- {
- factory->createAndThrow();
- }
- catch(UserException& ex)
- {
- ex.__read(this, false);
- assert(!usesClasses);
- ex.ice_throw();
- }
- }
- else
- {
- skipSlice(); // Slice off what we don't understand.
- read(id, false); // Read type id for next slice.
- }
+ //
+ // Look for a factory for this ID.
+ //
+ UserExceptionFactoryPtr factory = factoryTable->getExceptionFactory(id);
+ if(factory)
+ {
+ //
+ // Got factory -- get the factory to instantiate the
+ // exception, initialize the exception members, and throw
+ // the exception.
+ //
+ try
+ {
+ factory->createAndThrow();
+ }
+ catch(UserException& ex)
+ {
+ ex.__read(this, false);
+ assert(!usesClasses);
+ ex.ice_throw();
+ }
+ }
+ else
+ {
+ skipSlice(); // Slice off what we don't understand.
+ read(id, false); // Read type id for next slice.
+ }
}
//
diff --git a/cppe/src/IceE/Buffer.cpp b/cppe/src/IceE/Buffer.cpp
index 55ac2fb2fb6..94025d59d1e 100644
--- a/cppe/src/IceE/Buffer.cpp
+++ b/cppe/src/IceE/Buffer.cpp
@@ -35,32 +35,32 @@ IceInternal::Buffer::Container::swap(Container& other)
#ifdef ICE_SMALL_MESSAGE_BUFFER_OPTIMIZATION
if(_buf == _fixed)
{
- if(other._buf == other._fixed)
- {
- value_type tmp[ICE_BUFFER_FIXED_SIZE];
- memcpy(tmp, _fixed, _size);
- memcpy(_fixed, other._fixed, other._size);
- memcpy(other._fixed, tmp, _size);
- }
- else
- {
- _buf = other._buf;
- memcpy(other._fixed, _fixed, _size);
- other._buf = other._fixed;
- }
+ if(other._buf == other._fixed)
+ {
+ value_type tmp[ICE_BUFFER_FIXED_SIZE];
+ memcpy(tmp, _fixed, _size);
+ memcpy(_fixed, other._fixed, other._size);
+ memcpy(other._fixed, tmp, _size);
+ }
+ else
+ {
+ _buf = other._buf;
+ memcpy(other._fixed, _fixed, _size);
+ other._buf = other._fixed;
+ }
}
else
{
- if(other._buf == other._fixed)
- {
- other._buf = _buf;
- memcpy(_fixed, other._fixed, other._size);
- _buf = _fixed;
- }
- else
- {
- std::swap(_buf, other._buf);
- }
+ if(other._buf == other._fixed)
+ {
+ other._buf = _buf;
+ memcpy(_fixed, other._fixed, other._size);
+ _buf = _fixed;
+ }
+ else
+ {
+ std::swap(_buf, other._buf);
+ }
}
#else
std::swap(_buf, other._buf);
@@ -77,8 +77,8 @@ IceInternal::Buffer::Container::clear()
#ifdef ICE_SMALL_MESSAGE_BUFFER_OPTIMIZATION
if(_buf != _fixed)
{
- free(_buf);
- _buf = _fixed;
+ free(_buf);
+ _buf = _fixed;
}
_size = 0;
_capacity = ICE_BUFFER_FIXED_SIZE;
@@ -95,43 +95,43 @@ IceInternal::Buffer::Container::reserve(size_type n)
{
if(n > _capacity)
{
- _capacity = std::max<size_type>(n, std::min(2 * _capacity, _maxCapacity));
- _capacity = std::max<size_type>(static_cast<size_type>(240), _capacity);
+ _capacity = std::max<size_type>(n, std::min(2 * _capacity, _maxCapacity));
+ _capacity = std::max<size_type>(static_cast<size_type>(240), _capacity);
}
else if(n < _capacity)
{
- _capacity = n;
+ _capacity = n;
}
else
{
- return;
+ return;
}
#ifdef ICE_SMALL_MESSAGE_BUFFER_OPTIMIZATION
if(_buf != _fixed)
{
- _buf = reinterpret_cast<pointer>(realloc(_buf, _capacity));
+ _buf = reinterpret_cast<pointer>(realloc(_buf, _capacity));
}
else if(_capacity > ICE_BUFFER_FIXED_SIZE)
{
- _buf = reinterpret_cast<pointer>(malloc(_capacity));
- memcpy(_buf, _fixed, _size);
+ _buf = reinterpret_cast<pointer>(malloc(_capacity));
+ memcpy(_buf, _fixed, _size);
}
#else
if(_buf)
{
- _buf = reinterpret_cast<pointer>(realloc(_buf, _capacity));
+ _buf = reinterpret_cast<pointer>(realloc(_buf, _capacity));
}
else
{
- _buf = reinterpret_cast<pointer>(malloc(_capacity));
+ _buf = reinterpret_cast<pointer>(malloc(_capacity));
}
#endif
-
+
if(!_buf)
{
- SyscallException ex(__FILE__, __LINE__);
- ex.error = getSystemErrno();
- throw ex;
+ SyscallException ex(__FILE__, __LINE__);
+ ex.error = getSystemErrno();
+ throw ex;
}
}
diff --git a/cppe/src/IceE/Communicator.cpp b/cppe/src/IceE/Communicator.cpp
index 2bfa0b04ee2..c25d2860d09 100644
--- a/cppe/src/IceE/Communicator.cpp
+++ b/cppe/src/IceE/Communicator.cpp
@@ -102,9 +102,9 @@ Ice::Communicator::createObjectAdapterWithEndpoints(const string& name, const st
{
return _instance->objectAdapterFactory()->createObjectAdapter(name, endpoints
#ifdef ICEE_HAS_ROUTER
- , 0
+ , 0
# endif
- );
+ );
}
#ifdef ICEE_HAS_ROUTER
@@ -178,12 +178,12 @@ Ice::Communicator::Communicator(const InitializationData& initData)
__setNoDelete(true);
try
{
- const_cast<InstancePtr&>(_instance) = new Instance(this, initData);
+ const_cast<InstancePtr&>(_instance) = new Instance(this, initData);
}
catch(...)
{
- __setNoDelete(false);
- throw;
+ __setNoDelete(false);
+ throw;
}
__setNoDelete(false);
}
@@ -192,8 +192,8 @@ Ice::Communicator::~Communicator()
{
if(!_instance->destroyed())
{
- Warning out(_instance->initializationData().logger);
- out << "Ice::Communicator::destroy() has not been called";
+ Warning out(_instance->initializationData().logger);
+ out << "Ice::Communicator::destroy() has not been called";
}
}
@@ -202,11 +202,11 @@ Ice::Communicator::finishSetup(int& argc, char* argv[])
{
try
{
- _instance->finishSetup(argc, argv);
+ _instance->finishSetup(argc, argv);
}
catch(...)
{
- _instance->destroy();
- throw;
+ _instance->destroy();
+ throw;
}
}
diff --git a/cppe/src/IceE/Cond.cpp b/cppe/src/IceE/Cond.cpp
index a761cb9f894..760cdd612d8 100644
--- a/cppe/src/IceE/Cond.cpp
+++ b/cppe/src/IceE/Cond.cpp
@@ -20,7 +20,7 @@ IceUtil::Semaphore::Semaphore(long initial)
_sem = CreateSemaphore(0, initial, 0x7fffffff, 0);
if(_sem == INVALID_HANDLE_VALUE)
{
- throw ThreadSyscallException(__FILE__, __LINE__, GetLastError());
+ throw ThreadSyscallException(__FILE__, __LINE__, GetLastError());
}
}
@@ -35,7 +35,7 @@ IceUtil::Semaphore::wait() const
int rc = WaitForSingleObject(_sem, INFINITE);
if(rc != WAIT_OBJECT_0)
{
- throw ThreadSyscallException(__FILE__, __LINE__, GetLastError());
+ throw ThreadSyscallException(__FILE__, __LINE__, GetLastError());
}
}
@@ -47,7 +47,7 @@ IceUtil::Semaphore::timedWait(const Time& timeout) const
int rc = WaitForSingleObject(_sem, msec);
if(rc != WAIT_TIMEOUT && rc != WAIT_OBJECT_0)
{
- throw ThreadSyscallException(__FILE__, __LINE__, GetLastError());
+ throw ThreadSyscallException(__FILE__, __LINE__, GetLastError());
}
return rc != WAIT_TIMEOUT;
}
@@ -58,7 +58,7 @@ IceUtil::Semaphore::post(int count) const
int rc = ReleaseSemaphore(_sem, count, 0);
if(rc == 0)
{
- throw ThreadSyscallException(__FILE__, __LINE__, GetLastError());
+ throw ThreadSyscallException(__FILE__, __LINE__, GetLastError());
}
}
@@ -97,26 +97,26 @@ IceUtil::Cond::wake(bool broadcast)
if(_unblocked != 0)
{
- _blocked -= _unblocked;
- _unblocked = 0;
+ _blocked -= _unblocked;
+ _unblocked = 0;
}
if(_blocked > 0)
{
- //
- // Unblock some number of waiters.
- //
- _toUnblock = (broadcast) ? _blocked : 1;
- _internal.unlock();
- _queue.post();
+ //
+ // Unblock some number of waiters.
+ //
+ _toUnblock = (broadcast) ? _blocked : 1;
+ _internal.unlock();
+ _queue.post();
}
else
{
- //
- // Otherwise no blocked waiters, release gate & mutex.
- //
- _gate.post();
- _internal.unlock();
+ //
+ // Otherwise no blocked waiters, release gate & mutex.
+ //
+ _gate.post();
+ _internal.unlock();
}
}
@@ -136,26 +136,26 @@ IceUtil::Cond::postWait(bool timedOut) const
if(_toUnblock != 0)
{
- bool last = --_toUnblock == 0;
- _internal.unlock();
-
- if(timedOut)
- {
- _queue.wait();
- }
-
- if(last)
- {
- _gate.post();
- }
- else
- {
- _queue.post();
- }
+ bool last = --_toUnblock == 0;
+ _internal.unlock();
+
+ if(timedOut)
+ {
+ _queue.wait();
+ }
+
+ if(last)
+ {
+ _gate.post();
+ }
+ else
+ {
+ _queue.post();
+ }
}
else
{
- _internal.unlock();
+ _internal.unlock();
}
}
@@ -164,13 +164,13 @@ IceUtil::Cond::dowait() const
{
try
{
- _queue.wait();
- postWait(false);
+ _queue.wait();
+ postWait(false);
}
catch(...)
{
- postWait(false);
- throw;
+ postWait(false);
+ throw;
}
}
@@ -179,14 +179,14 @@ IceUtil::Cond::timedDowait(const Time& timeout) const
{
try
{
- bool rc = _queue.timedWait(timeout);
- postWait(!rc);
- return rc;
+ bool rc = _queue.timedWait(timeout);
+ postWait(!rc);
+ return rc;
}
catch(...)
{
- postWait(false);
- throw;
+ postWait(false);
+ throw;
}
}
@@ -201,19 +201,19 @@ IceUtil::Cond::Cond()
rc = pthread_condattr_init(&attr);
if(rc != 0)
{
- throw ThreadSyscallException(__FILE__, __LINE__, rc);
+ throw ThreadSyscallException(__FILE__, __LINE__, rc);
}
rc = pthread_cond_init(&_cond, &attr);
if(rc != 0)
{
- throw ThreadSyscallException(__FILE__, __LINE__, rc);
+ throw ThreadSyscallException(__FILE__, __LINE__, rc);
}
rc = pthread_condattr_destroy(&attr);
if(rc != 0)
{
- throw ThreadSyscallException(__FILE__, __LINE__, rc);
+ throw ThreadSyscallException(__FILE__, __LINE__, rc);
}
}
@@ -230,7 +230,7 @@ IceUtil::Cond::signal()
int rc = pthread_cond_signal(&_cond);
if(rc != 0)
{
- throw ThreadSyscallException(__FILE__, __LINE__, rc);
+ throw ThreadSyscallException(__FILE__, __LINE__, rc);
}
}
@@ -240,7 +240,7 @@ IceUtil::Cond::broadcast()
int rc = pthread_cond_broadcast(&_cond);
if(rc != 0)
{
- throw ThreadSyscallException(__FILE__, __LINE__, rc);
+ throw ThreadSyscallException(__FILE__, __LINE__, rc);
}
}
diff --git a/cppe/src/IceE/Connection.cpp b/cppe/src/IceE/Connection.cpp
index 122f61a6aaf..f133b99f572 100644
--- a/cppe/src/IceE/Connection.cpp
+++ b/cppe/src/IceE/Connection.cpp
@@ -41,13 +41,13 @@ Ice::Connection::waitForValidation()
while(_state == StateNotValidated)
{
- wait();
+ wait();
}
if(_state >= StateClosing)
{
- assert(_exception.get());
- _exception->ice_throw();
+ assert(_exception.get());
+ _exception->ice_throw();
}
}
@@ -75,18 +75,18 @@ Ice::Connection::destroy(DestructionReason reason)
switch(reason)
{
#ifndef ICEE_PURE_CLIENT
- case ObjectAdapterDeactivated:
- {
- setState(StateClosing, ObjectAdapterDeactivatedException(__FILE__, __LINE__));
- break;
- }
+ case ObjectAdapterDeactivated:
+ {
+ setState(StateClosing, ObjectAdapterDeactivatedException(__FILE__, __LINE__));
+ break;
+ }
#endif
- case CommunicatorDestroyed:
- {
- setState(StateClosing, CommunicatorDestroyedException(__FILE__, __LINE__));
- break;
- }
+ case CommunicatorDestroyed:
+ {
+ setState(StateClosing, CommunicatorDestroyedException(__FILE__, __LINE__));
+ break;
+ }
}
}
@@ -97,25 +97,25 @@ Ice::Connection::close(bool force)
if(force)
{
- setState(StateClosed, ForcedCloseConnectionException(__FILE__, __LINE__));
+ setState(StateClosed, ForcedCloseConnectionException(__FILE__, __LINE__));
}
else
{
#ifndef ICEE_PURE_BLOCKING_CLIENT
- //
- // If we do a graceful shutdown, then we wait until all
- // outstanding requests have been completed. Otherwise, the
- // CloseConnectionException will cause all outstanding
- // requests to be retried, regardless of whether the server
- // has processed them or not.
- //
- while(!_requests.empty())
- {
- wait();
- }
+ //
+ // If we do a graceful shutdown, then we wait until all
+ // outstanding requests have been completed. Otherwise, the
+ // CloseConnectionException will cause all outstanding
+ // requests to be retried, regardless of whether the server
+ // has processed them or not.
+ //
+ while(!_requests.empty())
+ {
+ wait();
+ }
#endif
- setState(StateClosing, CloseConnectionException(__FILE__, __LINE__));
+ setState(StateClosing, CloseConnectionException(__FILE__, __LINE__));
}
}
@@ -140,32 +140,32 @@ Ice::Connection::isFinished() const
#endif
{
- //
- // We can use trylock here, because as long as there are still
- // threads operating in this connection object, connection
- // destruction is considered as not yet finished.
- //
- IceUtil::Monitor<IceUtil::Mutex>::TryLock sync(*this);
-
- if(!sync.acquired())
- {
- return false;
- }
+ //
+ // We can use trylock here, because as long as there are still
+ // threads operating in this connection object, connection
+ // destruction is considered as not yet finished.
+ //
+ IceUtil::Monitor<IceUtil::Mutex>::TryLock sync(*this);
+
+ if(!sync.acquired())
+ {
+ return false;
+ }
- if(_transceiver != 0
+ if(_transceiver != 0
#ifndef ICEE_PURE_BLOCKING_CLIENT
- || _dispatchCount != 0 || (_threadPerConnection && _threadPerConnection->isAlive())
+ || _dispatchCount != 0 || (_threadPerConnection && _threadPerConnection->isAlive())
#endif
- )
- {
- return false;
- }
+ )
+ {
+ return false;
+ }
- assert(_state == StateClosed);
+ assert(_state == StateClosed);
#ifndef ICEE_PURE_BLOCKING_CLIENT
- threadPerConnection = _threadPerConnection;
- _threadPerConnection = 0;
+ threadPerConnection = _threadPerConnection;
+ _threadPerConnection = 0;
#endif
}
@@ -200,7 +200,7 @@ Ice::Connection::waitUntilHolding() const
while(_state < StateHolding || _dispatchCount > 0)
{
- wait();
+ wait();
}
}
@@ -214,74 +214,74 @@ Ice::Connection::waitUntilFinished()
#endif
{
- IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
-
- //
- // We wait indefinitely until connection closing has been
- // initiated. We also wait indefinitely until all outstanding
- // requests are completed. Otherwise we couldn't guarantee
- // that there are no outstanding calls when deactivate() is
- // called on the servant locators.
- //
- while(_state < StateClosing || _dispatchCount > 0)
- {
- wait();
- }
-
- //
- // Now we must wait until close() has been called on the
- // transceiver.
- //
- while(_transceiver)
- {
- if(_state != StateClosed && _endpoint->timeout() >= 0)
- {
- IceUtil::Time timeout = IceUtil::Time::milliSeconds(_endpoint->timeout());
- IceUtil::Time waitTime = _stateTime + timeout - IceUtil::Time::now();
-
- if(waitTime > IceUtil::Time())
- {
- //
- // We must wait a bit longer until we close this
- // connection.
- //
- if(!timedWait(waitTime))
- {
- setState(StateClosed, CloseTimeoutException(__FILE__, __LINE__));
- }
- }
- else
- {
- //
- // We already waited long enough, so let's close this
- // connection!
- //
- setState(StateClosed, CloseTimeoutException(__FILE__, __LINE__));
- }
-
- //
- // No return here, we must still wait until close() is
- // called on the _transceiver.
- //
- }
- else
- {
- wait();
- }
- }
-
- assert(_state == StateClosed);
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
+
+ //
+ // We wait indefinitely until connection closing has been
+ // initiated. We also wait indefinitely until all outstanding
+ // requests are completed. Otherwise we couldn't guarantee
+ // that there are no outstanding calls when deactivate() is
+ // called on the servant locators.
+ //
+ while(_state < StateClosing || _dispatchCount > 0)
+ {
+ wait();
+ }
+
+ //
+ // Now we must wait until close() has been called on the
+ // transceiver.
+ //
+ while(_transceiver)
+ {
+ if(_state != StateClosed && _endpoint->timeout() >= 0)
+ {
+ IceUtil::Time timeout = IceUtil::Time::milliSeconds(_endpoint->timeout());
+ IceUtil::Time waitTime = _stateTime + timeout - IceUtil::Time::now();
+
+ if(waitTime > IceUtil::Time())
+ {
+ //
+ // We must wait a bit longer until we close this
+ // connection.
+ //
+ if(!timedWait(waitTime))
+ {
+ setState(StateClosed, CloseTimeoutException(__FILE__, __LINE__));
+ }
+ }
+ else
+ {
+ //
+ // We already waited long enough, so let's close this
+ // connection!
+ //
+ setState(StateClosed, CloseTimeoutException(__FILE__, __LINE__));
+ }
+
+ //
+ // No return here, we must still wait until close() is
+ // called on the _transceiver.
+ //
+ }
+ else
+ {
+ wait();
+ }
+ }
+
+ assert(_state == StateClosed);
#ifndef ICEE_PURE_BLOCKING_CLIENT
- threadPerConnection = _threadPerConnection;
- _threadPerConnection = 0;
+ threadPerConnection = _threadPerConnection;
+ _threadPerConnection = 0;
#endif
}
#ifndef ICEE_PURE_BLOCKING_CLIENT
if(threadPerConnection)
{
- threadPerConnection->getThreadControl().join();
+ threadPerConnection->getThreadControl().join();
}
#endif
}
@@ -292,194 +292,194 @@ Ice::Connection::sendRequest(BasicStream* os, Outgoing* out)
bool requestSent = false;
try
{
- Lock sendSync(_sendMonitor);
- if(!_transceiver)
- {
- assert(_exception.get());
- //
- // If the connection is closed before we even have a chance
- // to send our request, we always try to send the request
- // again.
- //
- throw LocalExceptionWrapper(*_exception.get(), true);
- }
-
- Int requestId;
- if(out)
- {
- //
- // Create a new unique request ID.
- //
- requestId = _nextRequestId++;
- if(requestId <= 0)
- {
- _nextRequestId = 1;
- requestId = _nextRequestId++;
- }
-
- //
- // Fill in the request ID.
- //
- Byte* dest = &(os->b[0]) + headerSize;
+ Lock sendSync(_sendMonitor);
+ if(!_transceiver)
+ {
+ assert(_exception.get());
+ //
+ // If the connection is closed before we even have a chance
+ // to send our request, we always try to send the request
+ // again.
+ //
+ throw LocalExceptionWrapper(*_exception.get(), true);
+ }
+
+ Int requestId;
+ if(out)
+ {
+ //
+ // Create a new unique request ID.
+ //
+ requestId = _nextRequestId++;
+ if(requestId <= 0)
+ {
+ _nextRequestId = 1;
+ requestId = _nextRequestId++;
+ }
+
+ //
+ // Fill in the request ID.
+ //
+ Byte* dest = &(os->b[0]) + headerSize;
#ifdef ICE_BIG_ENDIAN
- const Byte* src = reinterpret_cast<const Byte*>(&requestId) + sizeof(Ice::Int) - 1;
- *dest++ = *src--;
- *dest++ = *src--;
- *dest++ = *src--;
- *dest = *src;
+ const Byte* src = reinterpret_cast<const Byte*>(&requestId) + sizeof(Ice::Int) - 1;
+ *dest++ = *src--;
+ *dest++ = *src--;
+ *dest++ = *src--;
+ *dest = *src;
#else
- const Byte* src = reinterpret_cast<const Byte*>(&requestId);
- *dest++ = *src++;
- *dest++ = *src++;
- *dest++ = *src++;
- *dest = *src;
+ const Byte* src = reinterpret_cast<const Byte*>(&requestId);
+ *dest++ = *src++;
+ *dest++ = *src++;
+ *dest++ = *src++;
+ *dest = *src;
#endif
#ifndef ICEE_PURE_BLOCKING_CLIENT
- if(!_blocking)
- {
- _requestsHint = _requests.insert(_requests.end(), pair<const Int, Outgoing*>(requestId, out));
- }
+ if(!_blocking)
+ {
+ _requestsHint = _requests.insert(_requests.end(), pair<const Int, Outgoing*>(requestId, out));
+ }
#endif
- }
+ }
- //
- // Fill in the message size.
- //
- const Int sz = static_cast<Int>(os->b.size());
- Byte* dest = &(os->b[0]) + 10;
+ //
+ // Fill in the message size.
+ //
+ const Int sz = static_cast<Int>(os->b.size());
+ Byte* dest = &(os->b[0]) + 10;
#ifdef ICE_BIG_ENDIAN
- const Byte* src = reinterpret_cast<const Byte*>(&sz) + sizeof(Ice::Int) - 1;
- *dest++ = *src--;
- *dest++ = *src--;
- *dest++ = *src--;
- *dest = *src;
+ const Byte* src = reinterpret_cast<const Byte*>(&sz) + sizeof(Ice::Int) - 1;
+ *dest++ = *src--;
+ *dest++ = *src--;
+ *dest++ = *src--;
+ *dest = *src;
#else
- const Byte* src = reinterpret_cast<const Byte*>(&sz);
- *dest++ = *src++;
- *dest++ = *src++;
- *dest++ = *src++;
- *dest = *src;
+ const Byte* src = reinterpret_cast<const Byte*>(&sz);
+ *dest++ = *src++;
+ *dest++ = *src++;
+ *dest++ = *src++;
+ *dest = *src;
#endif
-
- //
- // Send the request.
- //
- os->i = os->b.begin();
- if(_traceLevels->protocol >= 1)
- {
- traceRequest("sending request", *os, _logger, _traceLevels);
- }
- _transceiver->write(*os);
- requestSent = true;
-
- if(!out)
- {
- return;
- }
-
+
+ //
+ // Send the request.
+ //
+ os->i = os->b.begin();
+ if(_traceLevels->protocol >= 1)
+ {
+ traceRequest("sending request", *os, _logger, _traceLevels);
+ }
+ _transceiver->write(*os);
+ requestSent = true;
+
+ if(!out)
+ {
+ return;
+ }
+
#ifndef ICEE_PURE_BLOCKING_CLIENT
- if(_blocking)
- {
+ if(_blocking)
+ {
#endif
- //
- // Re-use the stream for reading the reply.
- //
- os->reset();
-
- Int receivedRequestId = 0;
+ //
+ // Re-use the stream for reading the reply.
+ //
+ os->reset();
+
+ Int receivedRequestId = 0;
#ifndef ICEE_PURE_CLIENT
- Int invokeNum = 0;
- readStreamAndParseMessage(*os, receivedRequestId, invokeNum);
- if(invokeNum > 0)
- {
- throwUnknownMessageException(__FILE__, __LINE__);
- }
- else if(requestId != receivedRequestId)
- {
- throwUnknownRequestIdException(__FILE__, __LINE__);
- }
+ Int invokeNum = 0;
+ readStreamAndParseMessage(*os, receivedRequestId, invokeNum);
+ if(invokeNum > 0)
+ {
+ throwUnknownMessageException(__FILE__, __LINE__);
+ }
+ else if(requestId != receivedRequestId)
+ {
+ throwUnknownRequestIdException(__FILE__, __LINE__);
+ }
#else
- readStreamAndParseMessage(*os, receivedRequestId);
- if(requestId != receivedRequestId)
- {
- throwUnknownRequestIdException(__FILE__, __LINE__);
- }
+ readStreamAndParseMessage(*os, receivedRequestId);
+ if(requestId != receivedRequestId)
+ {
+ throwUnknownRequestIdException(__FILE__, __LINE__);
+ }
#endif
- out->finished(*os);
+ out->finished(*os);
#ifndef ICEE_PURE_BLOCKING_CLIENT
- }
- else
- {
- //
- // Wait until the request has completed, or until the request times out.
- //
- Int tout = timeout();
- IceUtil::Time expireTime;
- if(tout > 0)
- {
- expireTime = IceUtil::Time::now() + IceUtil::Time::milliSeconds(tout);
- }
-
- while(out->state() == Outgoing::StateInProgress)
- {
- if(tout > 0)
- {
- IceUtil::Time now = IceUtil::Time::now();
- if(now < expireTime)
- {
- _sendMonitor.timedWait(expireTime - now);
- }
-
- //
- // Make sure we woke up because of timeout and not another response.
- //
- if(out->state() == Outgoing::StateInProgress && IceUtil::Time::now() > expireTime)
- {
- throw TimeoutException(__FILE__, __LINE__);
- }
- }
- else
- {
- _sendMonitor.wait();
- }
- }
- }
+ }
+ else
+ {
+ //
+ // Wait until the request has completed, or until the request times out.
+ //
+ Int tout = timeout();
+ IceUtil::Time expireTime;
+ if(tout > 0)
+ {
+ expireTime = IceUtil::Time::now() + IceUtil::Time::milliSeconds(tout);
+ }
+
+ while(out->state() == Outgoing::StateInProgress)
+ {
+ if(tout > 0)
+ {
+ IceUtil::Time now = IceUtil::Time::now();
+ if(now < expireTime)
+ {
+ _sendMonitor.timedWait(expireTime - now);
+ }
+
+ //
+ // Make sure we woke up because of timeout and not another response.
+ //
+ if(out->state() == Outgoing::StateInProgress && IceUtil::Time::now() > expireTime)
+ {
+ throw TimeoutException(__FILE__, __LINE__);
+ }
+ }
+ else
+ {
+ _sendMonitor.wait();
+ }
+ }
+ }
#endif
}
catch(const LocalException& ex)
{
- {
- IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
- setState(StateClosed, ex);
- assert(_exception.get());
- if(!requestSent)
- {
- _exception->ice_throw();
- }
- }
-
- //
- // If the request was already sent, we don't throw directly
- // but instead we set the Outgoing object exception with
- // finished(). Throwing directly would break "at-most-once"
- // (see also comment in Outgoing.invoke())
- //
- IceUtil::Monitor<IceUtil::Mutex>::Lock sendSync(_sendMonitor);
+ {
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
+ setState(StateClosed, ex);
+ assert(_exception.get());
+ if(!requestSent)
+ {
+ _exception->ice_throw();
+ }
+ }
+
+ //
+ // If the request was already sent, we don't throw directly
+ // but instead we set the Outgoing object exception with
+ // finished(). Throwing directly would break "at-most-once"
+ // (see also comment in Outgoing.invoke())
+ //
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sendSync(_sendMonitor);
#ifndef ICEE_PURE_BLOCKING_CLIENT
- if(_blocking)
- {
+ if(_blocking)
+ {
#endif
- out->finished(ex);
+ out->finished(ex);
#ifndef ICEE_PURE_BLOCKING_CLIENT
- }
- else
- {
- while(out->state() == Outgoing::StateInProgress)
- {
- _sendMonitor.wait(); // Wait for the thread to propagate the exception to the Outgoing object.
- }
- }
+ }
+ else
+ {
+ while(out->state() == Outgoing::StateInProgress)
+ {
+ _sendMonitor.wait(); // Wait for the thread to propagate the exception to the Outgoing object.
+ }
+ }
#endif
}
}
@@ -496,12 +496,12 @@ Ice::Connection::prepareBatchRequest(BasicStream* os)
//
while(_batchStreamInUse && !_exception.get())
{
- wait();
+ wait();
}
if(_exception.get())
{
- _exception->ice_throw();
+ _exception->ice_throw();
}
assert(_state > StateNotValidated);
@@ -509,15 +509,15 @@ Ice::Connection::prepareBatchRequest(BasicStream* os)
if(_batchStream.b.empty())
{
- try
- {
- _batchStream.writeBlob(requestBatchHdr, sizeof(requestBatchHdr));
- }
- catch(const LocalException& ex)
- {
- setState(StateClosed, ex);
- ex.ice_throw();
- }
+ try
+ {
+ _batchStream.writeBlob(requestBatchHdr, sizeof(requestBatchHdr));
+ }
+ catch(const LocalException& ex)
+ {
+ setState(StateClosed, ex);
+ ex.ice_throw();
+ }
}
_batchStreamInUse = true;
@@ -655,111 +655,111 @@ void
Ice::Connection::flushBatchRequestsInternal(bool ignoreInUse)
{
{
- IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
if(!ignoreInUse)
{
- while(_batchStreamInUse && !_exception.get())
- {
- wait();
- }
+ while(_batchStreamInUse && !_exception.get())
+ {
+ wait();
+ }
+ }
+
+ if(_exception.get())
+ {
+ _exception->ice_throw();
}
-
- if(_exception.get())
- {
- _exception->ice_throw();
- }
- if(_batchStream.b.empty())
- {
- return; // Nothing to do.
- }
+ if(_batchStream.b.empty())
+ {
+ return; // Nothing to do.
+ }
- assert(_state > StateNotValidated);
- assert(_state < StateClosing);
+ assert(_state > StateNotValidated);
+ assert(_state < StateClosing);
- _batchStream.i = _batchStream.b.begin();
+ _batchStream.i = _batchStream.b.begin();
- //
- // Prevent that new batch requests are added while we are
- // flushing.
- //
- _batchStreamInUse = true;
+ //
+ // Prevent that new batch requests are added while we are
+ // flushing.
+ //
+ _batchStreamInUse = true;
}
try
{
- Lock sendSync(_sendMonitor);
+ Lock sendSync(_sendMonitor);
- if(!_transceiver) // Has the transceiver already been closed?
- {
- assert(_exception.get());
- _exception->ice_throw(); // The exception is immutable at this point.
- }
+ if(!_transceiver) // Has the transceiver already been closed?
+ {
+ assert(_exception.get());
+ _exception->ice_throw(); // The exception is immutable at this point.
+ }
- //
- // Fill in the number of requests in the batch.
- //
- Byte* dest = &(_batchStream.b[0]) + headerSize;
+ //
+ // Fill in the number of requests in the batch.
+ //
+ Byte* dest = &(_batchStream.b[0]) + headerSize;
#ifdef ICE_BIG_ENDIAN
- const Byte* src = reinterpret_cast<const Byte*>(&_batchRequestNum) + sizeof(Ice::Int) - 1;
- *dest++ = *src--;
- *dest++ = *src--;
- *dest++ = *src--;
- *dest = *src;
+ const Byte* src = reinterpret_cast<const Byte*>(&_batchRequestNum) + sizeof(Ice::Int) - 1;
+ *dest++ = *src--;
+ *dest++ = *src--;
+ *dest++ = *src--;
+ *dest = *src;
#else
- const Byte* src = reinterpret_cast<const Byte*>(&_batchRequestNum);
- *dest++ = *src++;
- *dest++ = *src++;
- *dest++ = *src++;
- *dest = *src;
+ const Byte* src = reinterpret_cast<const Byte*>(&_batchRequestNum);
+ *dest++ = *src++;
+ *dest++ = *src++;
+ *dest++ = *src++;
+ *dest = *src;
#endif
-
- const Int sz = static_cast<Int>(_batchStream.b.size());
- dest = &(_batchStream.b[0]) + 10;
+
+ const Int sz = static_cast<Int>(_batchStream.b.size());
+ dest = &(_batchStream.b[0]) + 10;
#ifdef ICE_BIG_ENDIAN
- src = reinterpret_cast<const Byte*>(&sz) + sizeof(Ice::Int) - 1;
- *dest++ = *src--;
- *dest++ = *src--;
- *dest++ = *src--;
- *dest = *src;
+ src = reinterpret_cast<const Byte*>(&sz) + sizeof(Ice::Int) - 1;
+ *dest++ = *src--;
+ *dest++ = *src--;
+ *dest++ = *src--;
+ *dest = *src;
#else
- src = reinterpret_cast<const Byte*>(&sz);
- *dest++ = *src++;
- *dest++ = *src++;
- *dest++ = *src++;
- *dest = *src;
+ src = reinterpret_cast<const Byte*>(&sz);
+ *dest++ = *src++;
+ *dest++ = *src++;
+ *dest++ = *src++;
+ *dest = *src;
#endif
-
- //
- // Send the batch request.
- //
- _batchStream.i = _batchStream.b.begin();
- if(_traceLevels->protocol >= 1)
- {
- traceBatchRequest("sending batch request", _batchStream, _logger, _traceLevels);
- }
- _transceiver->write(_batchStream);
+
+ //
+ // Send the batch request.
+ //
+ _batchStream.i = _batchStream.b.begin();
+ if(_traceLevels->protocol >= 1)
+ {
+ traceBatchRequest("sending batch request", _batchStream, _logger, _traceLevels);
+ }
+ _transceiver->write(_batchStream);
}
catch(const LocalException& ex)
{
- IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
- setState(StateClosed, ex);
- assert(_exception.get());
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
+ setState(StateClosed, ex);
+ assert(_exception.get());
- //
- // Since batch requests are all oneways, we
- // must report the exception to the caller.
- //
- _exception->ice_throw();
+ //
+ // Since batch requests are all oneways, we
+ // must report the exception to the caller.
+ //
+ _exception->ice_throw();
}
{
- IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
- //
- // Reset the batch stream, and notify that flushing is over.
- //
+ //
+ // Reset the batch stream, and notify that flushing is over.
+ //
resetBatch(!ignoreInUse);
}
}
@@ -797,69 +797,69 @@ Ice::Connection::sendResponse(BasicStream* os)
{
try
{
- Lock sendSync(_sendMonitor);
+ Lock sendSync(_sendMonitor);
- if(!_transceiver) // Has the transceiver already been closed?
- {
- assert(_exception.get());
- _exception->ice_throw(); // The exception is immutable at this point.
- }
+ if(!_transceiver) // Has the transceiver already been closed?
+ {
+ assert(_exception.get());
+ _exception->ice_throw(); // The exception is immutable at this point.
+ }
- const Int sz = static_cast<Int>(os->b.size());
- Byte* dest = &(os->b[0]) + 10;
+ const Int sz = static_cast<Int>(os->b.size());
+ Byte* dest = &(os->b[0]) + 10;
#ifdef ICE_BIG_ENDIAN
- const Byte* src = reinterpret_cast<const Byte*>(&sz) + sizeof(Ice::Int) - 1;
- *dest++ = *src--;
- *dest++ = *src--;
- *dest++ = *src--;
- *dest = *src;
+ const Byte* src = reinterpret_cast<const Byte*>(&sz) + sizeof(Ice::Int) - 1;
+ *dest++ = *src--;
+ *dest++ = *src--;
+ *dest++ = *src--;
+ *dest = *src;
#else
- const Byte* src = reinterpret_cast<const Byte*>(&sz);
- *dest++ = *src++;
- *dest++ = *src++;
- *dest++ = *src++;
- *dest = *src;
+ const Byte* src = reinterpret_cast<const Byte*>(&sz);
+ *dest++ = *src++;
+ *dest++ = *src++;
+ *dest++ = *src++;
+ *dest = *src;
#endif
-
- //
- // Send the reply.
- //
- os->i = os->b.begin();
- if(_traceLevels->protocol >= 1)
- {
- traceReply("sending reply", *os, _logger, _traceLevels);
- }
- _transceiver->write(*os);
+
+ //
+ // Send the reply.
+ //
+ os->i = os->b.begin();
+ if(_traceLevels->protocol >= 1)
+ {
+ traceReply("sending reply", *os, _logger, _traceLevels);
+ }
+ _transceiver->write(*os);
}
catch(const LocalException& ex)
{
- IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
- setState(StateClosed, ex);
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
+ setState(StateClosed, ex);
}
{
- IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
- assert(_state > StateNotValidated);
+ assert(_state > StateNotValidated);
- try
- {
- assert(_dispatchCount > 0);
- if(--_dispatchCount == 0)
- {
- notifyAll();
- }
-
- if(_state == StateClosing && _dispatchCount == 0)
- {
- initiateShutdown();
- }
- }
- catch(const LocalException& ex)
- {
- setState(StateClosed, ex);
- }
+ try
+ {
+ assert(_dispatchCount > 0);
+ if(--_dispatchCount == 0)
+ {
+ notifyAll();
+ }
+
+ if(_state == StateClosing && _dispatchCount == 0)
+ {
+ initiateShutdown();
+ }
+ }
+ catch(const LocalException& ex)
+ {
+ setState(StateClosed, ex);
+ }
}
}
@@ -872,20 +872,20 @@ Ice::Connection::sendNoResponse()
try
{
- assert(_dispatchCount > 0);
- if(--_dispatchCount == 0)
- {
- notifyAll();
- }
+ assert(_dispatchCount > 0);
+ if(--_dispatchCount == 0)
+ {
+ notifyAll();
+ }
- if(_state == StateClosing && _dispatchCount == 0)
- {
- initiateShutdown();
- }
+ if(_state == StateClosing && _dispatchCount == 0)
+ {
+ initiateShutdown();
+ }
}
catch(const LocalException& ex)
{
- setState(StateClosed, ex);
+ setState(StateClosed, ex);
}
}
@@ -916,12 +916,12 @@ Ice::Connection::setAdapter(const ObjectAdapterPtr& adapter)
//
while(_dispatchCount > 0)
{
- wait();
+ wait();
}
if(_exception.get())
{
- _exception->ice_throw();
+ _exception->ice_throw();
}
assert(_state < StateClosing);
@@ -946,7 +946,7 @@ Ice::Connection::createProxy(const Identity& ident) const
vector<ConnectionPtr> connections;
connections.push_back(const_cast<Connection*>(this));
ReferencePtr ref = _instance->referenceFactory()->create(ident, Ice::Context(), "", ReferenceModeTwoway,
- connections);
+ connections);
return _instance->proxyFactory()->referenceToProxy(ref);
}
@@ -972,28 +972,28 @@ Ice::Connection::toString() const
#ifndef ICEE_PURE_CLIENT
Ice::Connection::Connection(const InstancePtr& instance,
- const TransceiverPtr& transceiver,
- const EndpointPtr& endpoint,
- const ObjectAdapterPtr& adapter) :
+ const TransceiverPtr& transceiver,
+ const EndpointPtr& endpoint,
+ const ObjectAdapterPtr& adapter) :
#else
Ice::Connection::Connection(const InstancePtr& instance,
- const TransceiverPtr& transceiver,
- const EndpointPtr& endpoint) :
+ const TransceiverPtr& transceiver,
+ const EndpointPtr& endpoint) :
#endif
- _instance(instance),
- _transceiver(transceiver),
- _desc(transceiver->toString()),
- _type(transceiver->type()),
- _endpoint(endpoint),
- _logger(_instance->initializationData().logger), // Cached for better performance.
- _traceLevels(_instance->traceLevels()), // Cached for better performance.
- _warn(_instance->initializationData().properties->getPropertyAsInt("Ice.Warn.Connections") > 0),
+ _instance(instance),
+ _transceiver(transceiver),
+ _desc(transceiver->toString()),
+ _type(transceiver->type()),
+ _endpoint(endpoint),
+ _logger(_instance->initializationData().logger), // Cached for better performance.
+ _traceLevels(_instance->traceLevels()), // Cached for better performance.
+ _warn(_instance->initializationData().properties->getPropertyAsInt("Ice.Warn.Connections") > 0),
#ifndef ICEE_PURE_CLIENT
- _in(_instance.get(), this, _stream, adapter),
+ _in(_instance.get(), this, _stream, adapter),
#endif
#ifndef ICEE_PURE_BLOCKING_CLIENT
- _stream(_instance.get(), _instance->messageSizeMax()
+ _stream(_instance.get(), _instance->messageSizeMax()
#ifdef ICEE_HAS_WSTRING
, _instance->initializationData().stringConverter, _instance->initializationData().wstringConverter
#endif
@@ -1002,19 +1002,19 @@ Ice::Connection::Connection(const InstancePtr& instance,
#ifdef ICEE_HAS_BATCH
_batchAutoFlush(
_instance->initializationData().properties->getPropertyAsIntWithDefault("Ice.BatchAutoFlush", 1) > 0),
- _batchStream(_instance.get(), _instance->messageSizeMax(),
+ _batchStream(_instance.get(), _instance->messageSizeMax(),
#ifdef ICEE_HAS_WSTRING
_instance->initializationData().stringConverter, _instance->initializationData().wstringConverter,
#endif
_batchAutoFlush),
- _batchStreamInUse(false),
- _batchRequestNum(0),
+ _batchStreamInUse(false),
+ _batchRequestNum(0),
_batchMarker(0),
#endif
- _dispatchCount(0),
- _state(StateNotValidated),
- _stateTime(IceUtil::Time::now()),
- _nextRequestId(1)
+ _dispatchCount(0),
+ _state(StateNotValidated),
+ _stateTime(IceUtil::Time::now()),
+ _nextRequestId(1)
#ifndef ICEE_PURE_BLOCKING_CLIENT
, _requestsHint(_requests.end())
#endif
@@ -1027,18 +1027,18 @@ Ice::Connection::Connection(const InstancePtr& instance,
# endif
if(_blocking)
{
- _transceiver->setTimeouts(_endpoint->timeout(), _endpoint->timeout());
+ _transceiver->setTimeouts(_endpoint->timeout(), _endpoint->timeout());
}
else
{
#ifdef _WIN32
- //
- // On Windows, the recv() call doesn't return if the socket is
- // shutdown. We use the timeout to not block indefinitely.
- //
- _transceiver->setTimeouts(_endpoint->timeout(), _endpoint->timeout());
+ //
+ // On Windows, the recv() call doesn't return if the socket is
+ // shutdown. We use the timeout to not block indefinitely.
+ //
+ _transceiver->setTimeouts(_endpoint->timeout(), _endpoint->timeout());
#else
- _transceiver->setTimeouts(-1, _endpoint->timeout());
+ _transceiver->setTimeouts(-1, _endpoint->timeout());
#endif
}
#else
@@ -1050,38 +1050,38 @@ Ice::Connection::Connection(const InstancePtr& instance,
#else
if(_blocking)
{
- validate();
+ validate();
}
else
{
__setNoDelete(true);
try
{
- //
- // If we are in thread per connection mode, create the thread
- // for this connection.
- //
- _threadPerConnection = new ThreadPerConnection(this);
- _threadPerConnection->start(_instance->threadPerConnectionStackSize());
+ //
+ // If we are in thread per connection mode, create the thread
+ // for this connection.
+ //
+ _threadPerConnection = new ThreadPerConnection(this);
+ _threadPerConnection->start(_instance->threadPerConnectionStackSize());
}
catch(const Ice::Exception& ex)
{
- {
- Error out(_logger);
- out << "cannot create thread for connection:\n" << ex.toString();
- }
-
- try
- {
- _transceiver->close();
- }
- catch(const LocalException&)
- {
- // Here we ignore any exceptions in close().
- }
-
- __setNoDelete(false);
- ex.ice_throw();
+ {
+ Error out(_logger);
+ out << "cannot create thread for connection:\n" << ex.toString();
+ }
+
+ try
+ {
+ _transceiver->close();
+ }
+ catch(const LocalException&)
+ {
+ // Here we ignore any exceptions in close().
+ }
+
+ __setNoDelete(false);
+ ex.ice_throw();
}
__setNoDelete(false);
}
@@ -1108,25 +1108,25 @@ Ice::Connection::validate()
{
IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
-
- //
- // The connection might already be closed (e.g.: the communicator
- // was destroyed or object adapter deactivated.)
- //
- assert(_state == StateNotValidated || _state == StateClosed);
- if(_state == StateClosed)
- {
- assert(_exception.get());
- _exception->ice_throw();
- }
+
+ //
+ // The connection might already be closed (e.g.: the communicator
+ // was destroyed or object adapter deactivated.)
+ //
+ assert(_state == StateNotValidated || _state == StateClosed);
+ if(_state == StateClosed)
+ {
+ assert(_exception.get());
+ _exception->ice_throw();
+ }
if(_in.getAdapter())
{
- active = true; // The server side has the active role for connection validation.
+ active = true; // The server side has the active role for connection validation.
}
else
{
- active = false; // The client side has the passive role for connection validation.
+ active = false; // The client side has the passive role for connection validation.
}
}
#endif
@@ -1136,111 +1136,111 @@ Ice::Connection::validate()
Int timeout;
if(_instance->defaultsAndOverrides()->overrideConnectTimeout)
{
- timeout = _instance->defaultsAndOverrides()->overrideConnectTimeoutValue;
+ timeout = _instance->defaultsAndOverrides()->overrideConnectTimeoutValue;
}
else
{
- timeout = _endpoint->timeout();
+ timeout = _endpoint->timeout();
}
#ifndef ICEE_PURE_CLIENT
if(active)
{
- BasicStream os(_instance.get(), _instance->messageSizeMax()
+ BasicStream os(_instance.get(), _instance->messageSizeMax()
#ifdef ICEE_HAS_WSTRING
, _instance->initializationData().stringConverter,
_instance->initializationData().wstringConverter
#endif
);
- os.write(magic[0]);
- os.write(magic[1]);
- os.write(magic[2]);
- os.write(magic[3]);
- os.write(protocolMajor);
- os.write(protocolMinor);
- os.write(encodingMajor);
- os.write(encodingMinor);
- os.write(validateConnectionMsg);
- os.write(static_cast<Byte>(0)); // Compression status (always zero for validate connection).
- os.write(headerSize); // Message size.
- os.i = os.b.begin();
- if(_traceLevels->protocol >= 1)
- {
- traceHeader("sending validate connection", os, _logger, _traceLevels);
- }
- try
- {
- _transceiver->writeWithTimeout(os, timeout);
- }
- catch(const TimeoutException&)
- {
- throw ConnectTimeoutException(__FILE__, __LINE__);
- }
+ os.write(magic[0]);
+ os.write(magic[1]);
+ os.write(magic[2]);
+ os.write(magic[3]);
+ os.write(protocolMajor);
+ os.write(protocolMinor);
+ os.write(encodingMajor);
+ os.write(encodingMinor);
+ os.write(validateConnectionMsg);
+ os.write(static_cast<Byte>(0)); // Compression status (always zero for validate connection).
+ os.write(headerSize); // Message size.
+ os.i = os.b.begin();
+ if(_traceLevels->protocol >= 1)
+ {
+ traceHeader("sending validate connection", os, _logger, _traceLevels);
+ }
+ try
+ {
+ _transceiver->writeWithTimeout(os, timeout);
+ }
+ catch(const TimeoutException&)
+ {
+ throw ConnectTimeoutException(__FILE__, __LINE__);
+ }
}
else
#endif
{
- BasicStream is(_instance.get(), _instance->messageSizeMax()
+ BasicStream is(_instance.get(), _instance->messageSizeMax()
#ifdef ICEE_HAS_WSTRING
, _instance->initializationData().stringConverter,
_instance->initializationData().wstringConverter
#endif
);
- is.b.resize(headerSize);
- is.i = is.b.begin();
- try
- {
- _transceiver->readWithTimeout(is, timeout);
- }
- catch(const TimeoutException&)
- {
- throw ConnectTimeoutException(__FILE__, __LINE__);
- }
- assert(is.i == is.b.end());
- is.i = is.b.begin();
- Ice::Byte m[4];
- is.read(m[0]);
- is.read(m[1]);
- is.read(m[2]);
- is.read(m[3]);
- if(m[0] != magic[0] || m[1] != magic[1] || m[2] != magic[2] || m[3] != magic[3])
- {
- throwBadMagicException(__FILE__, __LINE__, Ice::ByteSeq(&m[0], &m[0] + sizeof(m)));
- }
- Byte pMajor;
- Byte pMinor;
- is.read(pMajor);
- is.read(pMinor);
- if(pMajor != protocolMajor)
- {
- throwUnsupportedProtocolException(__FILE__, __LINE__, pMajor, pMinor, protocolMajor, protocolMinor);
- }
- Byte eMajor;
- Byte eMinor;
- is.read(eMajor);
- is.read(eMinor);
- if(eMajor != encodingMajor)
- {
- throwUnsupportedEncodingException(__FILE__, __LINE__, eMajor, eMinor, encodingMajor, encodingMinor);
- }
- Byte messageType;
- is.read(messageType);
- if(messageType != validateConnectionMsg)
- {
- throwConnectionNotValidatedException(__FILE__, __LINE__);
- }
+ is.b.resize(headerSize);
+ is.i = is.b.begin();
+ try
+ {
+ _transceiver->readWithTimeout(is, timeout);
+ }
+ catch(const TimeoutException&)
+ {
+ throw ConnectTimeoutException(__FILE__, __LINE__);
+ }
+ assert(is.i == is.b.end());
+ is.i = is.b.begin();
+ Ice::Byte m[4];
+ is.read(m[0]);
+ is.read(m[1]);
+ is.read(m[2]);
+ is.read(m[3]);
+ if(m[0] != magic[0] || m[1] != magic[1] || m[2] != magic[2] || m[3] != magic[3])
+ {
+ throwBadMagicException(__FILE__, __LINE__, Ice::ByteSeq(&m[0], &m[0] + sizeof(m)));
+ }
+ Byte pMajor;
+ Byte pMinor;
+ is.read(pMajor);
+ is.read(pMinor);
+ if(pMajor != protocolMajor)
+ {
+ throwUnsupportedProtocolException(__FILE__, __LINE__, pMajor, pMinor, protocolMajor, protocolMinor);
+ }
+ Byte eMajor;
+ Byte eMinor;
+ is.read(eMajor);
+ is.read(eMinor);
+ if(eMajor != encodingMajor)
+ {
+ throwUnsupportedEncodingException(__FILE__, __LINE__, eMajor, eMinor, encodingMajor, encodingMinor);
+ }
+ Byte messageType;
+ is.read(messageType);
+ if(messageType != validateConnectionMsg)
+ {
+ throwConnectionNotValidatedException(__FILE__, __LINE__);
+ }
Byte compress;
is.read(compress); // Ignore compression status for validate connection.
- Int size;
- is.read(size);
- if(size != headerSize)
- {
- throwIllegalMessageSizeException(__FILE__, __LINE__);
- }
- if(_traceLevels->protocol >= 1)
- {
- traceHeader("received validate connection", is, _logger, _traceLevels);
- }
+ Int size;
+ is.read(size);
+ if(size != headerSize)
+ {
+ throwIllegalMessageSizeException(__FILE__, __LINE__);
+ }
+ if(_traceLevels->protocol >= 1)
+ {
+ traceHeader("received validate connection", is, _logger, _traceLevels);
+ }
}
}
catch(const LocalException& ex)
@@ -1269,41 +1269,41 @@ Ice::Connection::setState(State state, const LocalException& ex)
if(_state == state) // Don't switch twice.
{
- return;
+ return;
}
if(!_exception.get())
{
- //
- // If we are in closed state, an exception must be set.
- //
- assert(_state != StateClosed);
-
- _exception.reset(dynamic_cast<LocalException*>(ex.ice_clone()));
-
- if(_warn)
- {
- //
- // We don't warn if we are not validated.
- //
- if(_state > StateNotValidated)
- {
- //
- // Don't warn about certain expected exceptions.
- //
- if(!(dynamic_cast<const CloseConnectionException*>(_exception.get()) ||
- dynamic_cast<const ForcedCloseConnectionException*>(_exception.get()) ||
- dynamic_cast<const CommunicatorDestroyedException*>(_exception.get()) ||
+ //
+ // If we are in closed state, an exception must be set.
+ //
+ assert(_state != StateClosed);
+
+ _exception.reset(dynamic_cast<LocalException*>(ex.ice_clone()));
+
+ if(_warn)
+ {
+ //
+ // We don't warn if we are not validated.
+ //
+ if(_state > StateNotValidated)
+ {
+ //
+ // Don't warn about certain expected exceptions.
+ //
+ if(!(dynamic_cast<const CloseConnectionException*>(_exception.get()) ||
+ dynamic_cast<const ForcedCloseConnectionException*>(_exception.get()) ||
+ dynamic_cast<const CommunicatorDestroyedException*>(_exception.get()) ||
#ifndef ICEE_PURE_CLIENT
- dynamic_cast<const ObjectAdapterDeactivatedException*>(_exception.get()) ||
+ dynamic_cast<const ObjectAdapterDeactivatedException*>(_exception.get()) ||
#endif
- (dynamic_cast<const ConnectionLostException*>(_exception.get()) && _state == StateClosing)))
- {
- Warning out(_logger);
- out << "connection exception:\n" << (*_exception.get()).toString() << "\n" << _desc;
- }
- }
- }
+ (dynamic_cast<const ConnectionLostException*>(_exception.get()) && _state == StateClosing)))
+ {
+ Warning out(_logger);
+ out << "connection exception:\n" << (*_exception.get()).toString() << "\n" << _desc;
+ }
+ }
+ }
}
//
@@ -1319,91 +1319,91 @@ Ice::Connection::setState(State state)
{
if(_state == state) // Don't switch twice.
{
- return;
+ return;
}
switch(state)
{
case StateNotValidated:
{
- assert(false);
- break;
+ assert(false);
+ break;
}
case StateActive:
{
- //
- // Can only switch from holding or not validated to
- // active.
- //
+ //
+ // Can only switch from holding or not validated to
+ // active.
+ //
#ifdef ICEE_PURE_CLIENT
- if(_state != StateNotValidated)
- {
- return;
- }
+ if(_state != StateNotValidated)
+ {
+ return;
+ }
#else
- if(_state != StateHolding && _state != StateNotValidated)
- {
- return;
- }
+ if(_state != StateHolding && _state != StateNotValidated)
+ {
+ return;
+ }
#endif
- break;
+ break;
}
-
+
#ifndef ICEE_PURE_CLIENT
case StateHolding:
{
- //
- // Can only switch from active or not validated to
- // holding.
- //
- if(_state != StateActive && _state != StateNotValidated)
- {
- return;
- }
- break;
+ //
+ // Can only switch from active or not validated to
+ // holding.
+ //
+ if(_state != StateActive && _state != StateNotValidated)
+ {
+ return;
+ }
+ break;
}
#endif
case StateClosing:
{
- //
- // Can't change back from closed.
- //
- if(_state == StateClosed)
- {
- return;
- }
- break;
+ //
+ // Can't change back from closed.
+ //
+ if(_state == StateClosed)
+ {
+ return;
+ }
+ break;
}
-
+
case StateClosed:
{
- //
- // We shutdown both for reading and writing. This will
- // unblock and read call with an exception. The thread
- // per connection then closes the transceiver.
- //
- _transceiver->shutdownReadWrite();
+ //
+ // We shutdown both for reading and writing. This will
+ // unblock and read call with an exception. The thread
+ // per connection then closes the transceiver.
+ //
+ _transceiver->shutdownReadWrite();
- //
- // In blocking mode, we close the transceiver now.
- //
+ //
+ // In blocking mode, we close the transceiver now.
+ //
#ifndef ICEE_PURE_BLOCKING_CLIENT
- if(_blocking)
+ if(_blocking)
#endif
- {
- Lock sync(_sendMonitor);
- try
- {
- _transceiver->close();
- }
- catch(const Ice::LocalException&)
- {
- }
- _transceiver = 0;
- }
- break;
+ {
+ Lock sync(_sendMonitor);
+ try
+ {
+ _transceiver->close();
+ }
+ catch(const Ice::LocalException&)
+ {
+ }
+ _transceiver = 0;
+ }
+ break;
}
}
@@ -1414,21 +1414,21 @@ Ice::Connection::setState(State state)
if(_state == StateClosing && _dispatchCount == 0)
{
- try
- {
- initiateShutdown();
+ try
+ {
+ initiateShutdown();
#ifndef ICEE_PURE_BLOCKING_CLIENT
- if(_blocking)
+ if(_blocking)
#endif
- {
- setState(StateClosed);
- }
- }
- catch(const LocalException& ex)
- {
- setState(StateClosed, ex);
- }
+ {
+ setState(StateClosed);
+ }
+ }
+ catch(const LocalException& ex)
+ {
+ setState(StateClosed, ex);
+ }
}
}
@@ -1467,7 +1467,7 @@ Ice::Connection::initiateShutdown() const
os.i = os.b.begin();
if(_traceLevels->protocol >= 1)
{
- traceHeader("sending close connection", os, _logger, _traceLevels);
+ traceHeader("sending close connection", os, _logger, _traceLevels);
}
_transceiver->write(os);
@@ -1503,20 +1503,20 @@ Ice::Connection::readStreamAndParseMessage(IceInternal::BasicStream& stream, Int
stream.readBlob(header, headerSize);
if(header[0] != magic[0] || header[1] != magic[1] || header[2] != magic[2] || header[3] != magic[3])
{
- throwBadMagicException(__FILE__, __LINE__, Ice::ByteSeq(&header[0], &header[0] + sizeof(magic)));
+ throwBadMagicException(__FILE__, __LINE__, Ice::ByteSeq(&header[0], &header[0] + sizeof(magic)));
}
if(header[4] != protocolMajor)
{
- throwUnsupportedProtocolException(__FILE__, __LINE__, header[4], header[5], protocolMajor, protocolMinor);
+ throwUnsupportedProtocolException(__FILE__, __LINE__, header[4], header[5], protocolMajor, protocolMinor);
}
if(header[6] != encodingMajor)
{
- throwUnsupportedEncodingException(__FILE__, __LINE__, header[6], header[7], encodingMajor, encodingMinor);
+ throwUnsupportedEncodingException(__FILE__, __LINE__, header[6], header[7], encodingMajor, encodingMinor);
}
const Byte messageType = header[8];
if(header[9] == 2)
{
- throw FeatureNotSupportedException(__FILE__, __LINE__, "compression");
+ throw FeatureNotSupportedException(__FILE__, __LINE__, "compression");
}
Int size;
@@ -1524,21 +1524,21 @@ Ice::Connection::readStreamAndParseMessage(IceInternal::BasicStream& stream, Int
stream.read(size);
if(size < headerSize)
{
- throwIllegalMessageSizeException(__FILE__, __LINE__);
+ throwIllegalMessageSizeException(__FILE__, __LINE__);
}
if(size > static_cast<Int>(_instance->messageSizeMax()))
{
- throwMemoryLimitException(__FILE__, __LINE__);
+ throwMemoryLimitException(__FILE__, __LINE__);
}
if(size > static_cast<Int>(stream.b.size()))
{
- stream.b.resize(size);
+ stream.b.resize(size);
}
stream.i = stream.b.begin() + pos;
if(stream.i != stream.b.end())
{
- _transceiver->read(stream);
+ _transceiver->read(stream);
}
assert(stream.i == stream.b.end());
@@ -1548,74 +1548,74 @@ Ice::Connection::readStreamAndParseMessage(IceInternal::BasicStream& stream, Int
{
case closeConnectionMsg:
{
- if(_traceLevels->protocol >= 1)
- {
- traceHeader("received close connection", stream, _logger, _traceLevels);
- }
- throw CloseConnectionException(__FILE__, __LINE__);
- break;
+ if(_traceLevels->protocol >= 1)
+ {
+ traceHeader("received close connection", stream, _logger, _traceLevels);
+ }
+ throw CloseConnectionException(__FILE__, __LINE__);
+ break;
}
-
+
case replyMsg:
{
- if(_traceLevels->protocol >= 1)
- {
- traceReply("received reply", stream, _logger, _traceLevels);
- }
- stream.read(requestId);
- break;
- }
-
+ if(_traceLevels->protocol >= 1)
+ {
+ traceReply("received reply", stream, _logger, _traceLevels);
+ }
+ stream.read(requestId);
+ break;
+ }
+
#ifndef ICEE_PURE_CLIENT
case requestMsg:
{
- if(_traceLevels->protocol >= 1)
- {
- traceRequest("received request", stream, _logger, _traceLevels);
- }
- stream.read(requestId);
- invokeNum = 1;
- break;
+ if(_traceLevels->protocol >= 1)
+ {
+ traceRequest("received request", stream, _logger, _traceLevels);
+ }
+ stream.read(requestId);
+ invokeNum = 1;
+ break;
}
-
+
case requestBatchMsg:
{
- if(_traceLevels->protocol >= 1)
- {
- traceBatchRequest("received batch request", stream, _logger, _traceLevels);
- }
- stream.read(invokeNum);
- if(invokeNum < 0)
- {
- invokeNum = 0;
- throwNegativeSizeException(__FILE__, __LINE__);
- }
- break;
+ if(_traceLevels->protocol >= 1)
+ {
+ traceBatchRequest("received batch request", stream, _logger, _traceLevels);
+ }
+ stream.read(invokeNum);
+ if(invokeNum < 0)
+ {
+ invokeNum = 0;
+ throwNegativeSizeException(__FILE__, __LINE__);
+ }
+ break;
}
#endif
-
+
case validateConnectionMsg:
{
- if(_traceLevels->protocol >= 1)
- {
- traceHeader("received validate connection", stream, _logger, _traceLevels);
- }
- if(_warn)
- {
- Warning out(_logger);
- out << "ignoring unexpected validate connection message:\n" << _desc;
- }
- break;
- }
-
+ if(_traceLevels->protocol >= 1)
+ {
+ traceHeader("received validate connection", stream, _logger, _traceLevels);
+ }
+ if(_warn)
+ {
+ Warning out(_logger);
+ out << "ignoring unexpected validate connection message:\n" << _desc;
+ }
+ break;
+ }
+
default:
{
- if(_traceLevels->protocol >= 1)
- {
- traceHeader("received unknown message\n(invalid, closing connection)", stream, _logger, _traceLevels);
- }
- throwUnknownMessageException(__FILE__, __LINE__);
- break;
+ if(_traceLevels->protocol >= 1)
+ {
+ traceHeader("received unknown message\n(invalid, closing connection)", stream, _logger, _traceLevels);
+ }
+ throwUnknownMessageException(__FILE__, __LINE__);
+ break;
}
}
}
@@ -1636,17 +1636,17 @@ Ice::Connection::run()
}
catch(const LocalException&)
{
- Lock sync(*this);
+ Lock sync(*this);
assert(_state == StateClosed);
- Lock sendSync(_sendMonitor);
+ Lock sendSync(_sendMonitor);
try
{
- _transceiver->close();
+ _transceiver->close();
}
catch(const LocalException&)
{
- // Here we ignore any exceptions in close().
+ // Here we ignore any exceptions in close().
}
_transceiver = 0;
@@ -1660,224 +1660,224 @@ Ice::Connection::run()
while(!closed)
{
- Int requestId = 0;
+ Int requestId = 0;
#ifndef ICEE_PURE_CLIENT
- Int invokeNum = 0;
- _in.os()->reset();
+ Int invokeNum = 0;
+ _in.os()->reset();
#endif
- _stream.reset();
-
- //
- // Read and parse the next message. We don't need to lock the
- // send monitor here as we have the guarantee that
- // _transceiver won't be set to 0 by another thread, the
- // thread per connection is the only thread that can set
- // _transceiver to 0.
- //
- try
- {
+ _stream.reset();
+
+ //
+ // Read and parse the next message. We don't need to lock the
+ // send monitor here as we have the guarantee that
+ // _transceiver won't be set to 0 by another thread, the
+ // thread per connection is the only thread that can set
+ // _transceiver to 0.
+ //
+ try
+ {
#ifndef ICEE_PURE_CLIENT
- readStreamAndParseMessage(_stream, requestId, invokeNum);
+ readStreamAndParseMessage(_stream, requestId, invokeNum);
#else
- readStreamAndParseMessage(_stream, requestId);
+ readStreamAndParseMessage(_stream, requestId);
#endif
- }
+ }
#ifdef _WIN32
- catch(const Ice::TimeoutException&)
- {
- //
- // See the comment in the Connection constructor. This is
- // necessary to not block in recv() indefinitely.
- //
- continue;
- }
+ catch(const Ice::TimeoutException&)
+ {
+ //
+ // See the comment in the Connection constructor. This is
+ // necessary to not block in recv() indefinitely.
+ //
+ continue;
+ }
#endif
- catch(const Ice::LocalException& ex)
- {
- IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
- setState(StateClosed, ex);
- }
-
- {
- IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
- if(_state != StateClosed)
- {
+ catch(const Ice::LocalException& ex)
+ {
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
+ setState(StateClosed, ex);
+ }
+
+ {
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
+ if(_state != StateClosed)
+ {
#ifndef ICEE_PURE_CLIENT
- if(invokeNum > 0) // We received a request or a batch request
- {
- if(_state == StateClosing)
- {
- if(_traceLevels->protocol >= 1)
- {
- string req = invokeNum > 1 ? "received batch request" : "received request";
- req += " during closing\n(ignored by server, client will retry)";
- traceRequest( req.c_str(), _stream, _logger, _traceLevels);
- }
- invokeNum = 0;
- }
- _dispatchCount += invokeNum;
- }
- else
+ if(invokeNum > 0) // We received a request or a batch request
+ {
+ if(_state == StateClosing)
+ {
+ if(_traceLevels->protocol >= 1)
+ {
+ string req = invokeNum > 1 ? "received batch request" : "received request";
+ req += " during closing\n(ignored by server, client will retry)";
+ traceRequest( req.c_str(), _stream, _logger, _traceLevels);
+ }
+ invokeNum = 0;
+ }
+ _dispatchCount += invokeNum;
+ }
+ else
#endif
- if(requestId > 0)
- {
- //
- // The message is a reply, we search the Outgoing object waiting
- // for this reply and pass it the stream before to notify the
- // send monitor to wake up threads waiting for replies.
- //
- try
- {
- Lock sync(_sendMonitor);
-
- map<Int, Outgoing*>::iterator p = _requests.end();
- if(p != _requestsHint)
- {
- if(_requestsHint->first == requestId)
- {
- p = _requestsHint;
- }
- }
-
- if(p == _requests.end())
- {
- p = _requests.find(requestId);
- }
-
- if(p == _requests.end())
- {
- throwUnknownRequestIdException(__FILE__, __LINE__);
- }
-
- p->second->finished(_stream);
-
- if(p == _requestsHint)
- {
- _requests.erase(p++);
- _requestsHint = p;
- }
- else
- {
- _requests.erase(p);
- }
- _sendMonitor.notifyAll(); // Wake up threads waiting in sendRequest()
- }
- catch(const Ice::LocalException& ex)
- {
- setState(StateClosed, ex);
- }
- }
- }
+ if(requestId > 0)
+ {
+ //
+ // The message is a reply, we search the Outgoing object waiting
+ // for this reply and pass it the stream before to notify the
+ // send monitor to wake up threads waiting for replies.
+ //
+ try
+ {
+ Lock sync(_sendMonitor);
+
+ map<Int, Outgoing*>::iterator p = _requests.end();
+ if(p != _requestsHint)
+ {
+ if(_requestsHint->first == requestId)
+ {
+ p = _requestsHint;
+ }
+ }
+
+ if(p == _requests.end())
+ {
+ p = _requests.find(requestId);
+ }
+
+ if(p == _requests.end())
+ {
+ throwUnknownRequestIdException(__FILE__, __LINE__);
+ }
+
+ p->second->finished(_stream);
+
+ if(p == _requestsHint)
+ {
+ _requests.erase(p++);
+ _requestsHint = p;
+ }
+ else
+ {
+ _requests.erase(p);
+ }
+ _sendMonitor.notifyAll(); // Wake up threads waiting in sendRequest()
+ }
+ catch(const Ice::LocalException& ex)
+ {
+ setState(StateClosed, ex);
+ }
+ }
+ }
#ifndef ICEE_PURE_CLIENT
- while(_state == StateHolding)
- {
- wait();
- }
+ while(_state == StateHolding)
+ {
+ wait();
+ }
#endif
- if(_state == StateClosed)
- {
- Lock sync(_sendMonitor);
- try
- {
- _transceiver->close();
- }
- catch(const LocalException&)
- {
- }
- _transceiver = 0;
- notifyAll();
-
- //
- // We cannot simply return here. We have to make sure
- // that all requests are notified about the closed
- // connection below.
- //
- closed = true;
- }
-
- if(_state == StateClosed || _state == StateClosing)
- {
- Lock sync(_sendMonitor);
- assert(_exception.get());
- for(map<Int, Outgoing*>::iterator p = _requests.begin(); p != _requests.end(); ++p)
- {
- p->second->finished(*_exception.get()); // The exception is immutable at this point.
- }
- _requests.clear();
- _sendMonitor.notifyAll(); // Wake up threads waiting in sendRequest()
- }
- }
-
- //
- // Method invocation (or multiple invocations for batch
- // messages) must be done outside the thread synchronization,
- // so that nested calls are possible.
- //
+ if(_state == StateClosed)
+ {
+ Lock sync(_sendMonitor);
+ try
+ {
+ _transceiver->close();
+ }
+ catch(const LocalException&)
+ {
+ }
+ _transceiver = 0;
+ notifyAll();
+
+ //
+ // We cannot simply return here. We have to make sure
+ // that all requests are notified about the closed
+ // connection below.
+ //
+ closed = true;
+ }
+
+ if(_state == StateClosed || _state == StateClosing)
+ {
+ Lock sync(_sendMonitor);
+ assert(_exception.get());
+ for(map<Int, Outgoing*>::iterator p = _requests.begin(); p != _requests.end(); ++p)
+ {
+ p->second->finished(*_exception.get()); // The exception is immutable at this point.
+ }
+ _requests.clear();
+ _sendMonitor.notifyAll(); // Wake up threads waiting in sendRequest()
+ }
+ }
+
+ //
+ // Method invocation (or multiple invocations for batch
+ // messages) must be done outside the thread synchronization,
+ // so that nested calls are possible.
+ //
#ifndef ICEE_PURE_CLIENT
- try
- {
- for(;invokeNum > 0; --invokeNum)
- {
- //
- // Prepare the response if necessary.
- //
- const bool response = requestId != 0;
- if(response)
- {
- assert(invokeNum == 1); // No further invocations if a response is expected.
-
- //
- // Add the reply header and request id.
- //
- BasicStream* os = _in.os();
- os->writeBlob(replyHdr, sizeof(replyHdr));
- os->write(requestId);
- }
-
- //
- // Dispatch the incoming request.
- //
- _in.invoke(response, requestId);
- }
- }
- catch(const LocalException& ex)
- {
- IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
- setState(StateClosed, ex);
- }
- catch(const std::exception& ex)
- {
- IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
- UnknownException uex(__FILE__, __LINE__);
- uex.unknown = string("std::exception: ") + ex.what();
- setState(StateClosed, uex);
- }
- catch(...)
- {
- IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
- UnknownException uex(__FILE__, __LINE__);
- uex.unknown = "unknown c++ exception";
- setState(StateClosed, uex);
- }
-
- //
- // If invoke() above raised an exception, and therefore neither
- // sendResponse() nor sendNoResponse() has been called, then we
- // must decrement _dispatchCount here.
- //
- if(invokeNum > 0)
- {
- IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
- assert(_dispatchCount > 0);
- _dispatchCount -= invokeNum;
- assert(_dispatchCount >= 0);
- if(_dispatchCount == 0)
- {
- notifyAll();
- }
- }
+ try
+ {
+ for(;invokeNum > 0; --invokeNum)
+ {
+ //
+ // Prepare the response if necessary.
+ //
+ const bool response = requestId != 0;
+ if(response)
+ {
+ assert(invokeNum == 1); // No further invocations if a response is expected.
+
+ //
+ // Add the reply header and request id.
+ //
+ BasicStream* os = _in.os();
+ os->writeBlob(replyHdr, sizeof(replyHdr));
+ os->write(requestId);
+ }
+
+ //
+ // Dispatch the incoming request.
+ //
+ _in.invoke(response, requestId);
+ }
+ }
+ catch(const LocalException& ex)
+ {
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
+ setState(StateClosed, ex);
+ }
+ catch(const std::exception& ex)
+ {
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
+ UnknownException uex(__FILE__, __LINE__);
+ uex.unknown = string("std::exception: ") + ex.what();
+ setState(StateClosed, uex);
+ }
+ catch(...)
+ {
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
+ UnknownException uex(__FILE__, __LINE__);
+ uex.unknown = "unknown c++ exception";
+ setState(StateClosed, uex);
+ }
+
+ //
+ // If invoke() above raised an exception, and therefore neither
+ // sendResponse() nor sendNoResponse() has been called, then we
+ // must decrement _dispatchCount here.
+ //
+ if(invokeNum > 0)
+ {
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
+ assert(_dispatchCount > 0);
+ _dispatchCount -= invokeNum;
+ assert(_dispatchCount >= 0);
+ if(_dispatchCount == 0)
+ {
+ notifyAll();
+ }
+ }
#endif
}
}
@@ -1892,22 +1892,22 @@ Ice::Connection::ThreadPerConnection::run()
{
try
{
- _connection->run();
+ _connection->run();
}
catch(const Exception& ex)
- {
- Error out(_connection->_logger);
- out << "exception in thread per connection:\n" << _connection->toString() << ex.toString();
+ {
+ Error out(_connection->_logger);
+ out << "exception in thread per connection:\n" << _connection->toString() << ex.toString();
}
catch(const std::exception& ex)
{
- Error out(_connection->_logger);
- out << "std::exception in thread per connection:\n" << _connection->toString() << ex.what();
+ Error out(_connection->_logger);
+ out << "std::exception in thread per connection:\n" << _connection->toString() << ex.what();
}
catch(...)
{
- Error out(_connection->_logger);
- out << "unknown exception in thread per connection:\n" << _connection->toString();
+ Error out(_connection->_logger);
+ out << "unknown exception in thread per connection:\n" << _connection->toString();
}
_connection = 0; // Resolve cyclic dependency.
diff --git a/cppe/src/IceE/ConvertUTF.cpp b/cppe/src/IceE/ConvertUTF.cpp
index 7575bcc5c86..ea3812228b2 100644
--- a/cppe/src/IceE/ConvertUTF.cpp
+++ b/cppe/src/IceE/ConvertUTF.cpp
@@ -39,10 +39,10 @@
Author: Mark E. Davis, 1994.
Rev History: Rick McGowan, fixes & updates May 2001.
Sept 2001: fixed const & error conditions per
- mods suggested by S. Parent & A. Lillich.
+ mods suggested by S. Parent & A. Lillich.
June 2002: Tim Dodd added detection and handling of incomplete
- source sequences, enhanced error detection, added casts
- to eliminate compiler warnings.
+ source sequences, enhanced error detection, added casts
+ to eliminate compiler warnings.
July 2003: slight mods to back out aggressive FFFE detection.
Jan 2004: updated switches in from-UTF8 conversions.
Oct 2004: updated to use UNI_MAX_LEGAL_UTF32 in UTF-32 conversions.
@@ -70,8 +70,8 @@ static const UTF32 halfMask = 0x3FFUL;
#define UNI_SUR_HIGH_END (UTF32)0xDBFF
#define UNI_SUR_LOW_START (UTF32)0xDC00
#define UNI_SUR_LOW_END (UTF32)0xDFFF
-// #define false 0
-// #define true 1
+// #define false 0
+// #define true 1
/* --------------------------------------------------------------------- */
@@ -100,7 +100,7 @@ static const char trailingBytesForUTF8[256] = {
* in a UTF-8 sequence.
*/
static const UTF32 offsetsFromUTF8[6] = { 0x00000000UL, 0x00003080UL, 0x000E2080UL,
- 0x03C82080UL, 0xFA082080UL, 0x82082080UL };
+ 0x03C82080UL, 0xFA082080UL, 0x82082080UL };
/*
* Once the bits are split out into bytes of UTF-8, this is a mask OR-ed
@@ -124,67 +124,67 @@ static const UTF8 firstByteMark[7] = { 0x00, 0x00, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC
/* --------------------------------------------------------------------- */
ConversionResult ConvertUTF16toUTF8 (
- const UTF16** sourceStart, const UTF16* sourceEnd,
- UTF8** targetStart, UTF8* targetEnd, ConversionFlags flags) {
+ const UTF16** sourceStart, const UTF16* sourceEnd,
+ UTF8** targetStart, UTF8* targetEnd, ConversionFlags flags) {
ConversionResult result = conversionOK;
const UTF16* source = *sourceStart;
UTF8* target = *targetStart;
while (source < sourceEnd) {
- UTF32 ch;
- unsigned short bytesToWrite = 0;
- const UTF32 byteMask = 0xBF;
- const UTF32 byteMark = 0x80;
- const UTF16* oldSource = source; /* In case we have to back up because of target overflow. */
- ch = *source++;
- /* If we have a surrogate pair, convert to UTF32 first. */
- if (ch >= UNI_SUR_HIGH_START && ch <= UNI_SUR_HIGH_END) {
- /* If the 16 bits following the high surrogate are in the source buffer... */
- if (source < sourceEnd) {
- UTF32 ch2 = *source;
- /* If it's a low surrogate, convert to UTF32. */
- if (ch2 >= UNI_SUR_LOW_START && ch2 <= UNI_SUR_LOW_END) {
- ch = ((ch - UNI_SUR_HIGH_START) << halfShift)
- + (ch2 - UNI_SUR_LOW_START) + halfBase;
- ++source;
- } else if (flags == strictConversion) { /* it's an unpaired high surrogate */
- --source; /* return to the illegal value itself */
- result = sourceIllegal;
- break;
- }
- } else { /* We don't have the 16 bits following the high surrogate. */
- --source; /* return to the high surrogate */
- result = sourceExhausted;
- break;
- }
- } else if (flags == strictConversion) {
- /* UTF-16 surrogate values are illegal in UTF-32 */
- if (ch >= UNI_SUR_LOW_START && ch <= UNI_SUR_LOW_END) {
- --source; /* return to the illegal value itself */
- result = sourceIllegal;
- break;
- }
- }
- /* Figure out how many bytes the result will require */
- if (ch < (UTF32)0x80) { bytesToWrite = 1;
- } else if (ch < (UTF32)0x800) { bytesToWrite = 2;
- } else if (ch < (UTF32)0x10000) { bytesToWrite = 3;
- } else if (ch < (UTF32)0x110000) { bytesToWrite = 4;
- } else { bytesToWrite = 3;
- ch = UNI_REPLACEMENT_CHAR;
- }
-
- target += bytesToWrite;
- if (target > targetEnd) {
- source = oldSource; /* Back up source pointer! */
- target -= bytesToWrite; result = targetExhausted; break;
- }
- switch (bytesToWrite) { /* note: everything falls through. */
- case 4: *--target = (UTF8)((ch | byteMark) & byteMask); ch >>= 6;
- case 3: *--target = (UTF8)((ch | byteMark) & byteMask); ch >>= 6;
- case 2: *--target = (UTF8)((ch | byteMark) & byteMask); ch >>= 6;
- case 1: *--target = (UTF8)(ch | firstByteMark[bytesToWrite]);
- }
- target += bytesToWrite;
+ UTF32 ch;
+ unsigned short bytesToWrite = 0;
+ const UTF32 byteMask = 0xBF;
+ const UTF32 byteMark = 0x80;
+ const UTF16* oldSource = source; /* In case we have to back up because of target overflow. */
+ ch = *source++;
+ /* If we have a surrogate pair, convert to UTF32 first. */
+ if (ch >= UNI_SUR_HIGH_START && ch <= UNI_SUR_HIGH_END) {
+ /* If the 16 bits following the high surrogate are in the source buffer... */
+ if (source < sourceEnd) {
+ UTF32 ch2 = *source;
+ /* If it's a low surrogate, convert to UTF32. */
+ if (ch2 >= UNI_SUR_LOW_START && ch2 <= UNI_SUR_LOW_END) {
+ ch = ((ch - UNI_SUR_HIGH_START) << halfShift)
+ + (ch2 - UNI_SUR_LOW_START) + halfBase;
+ ++source;
+ } else if (flags == strictConversion) { /* it's an unpaired high surrogate */
+ --source; /* return to the illegal value itself */
+ result = sourceIllegal;
+ break;
+ }
+ } else { /* We don't have the 16 bits following the high surrogate. */
+ --source; /* return to the high surrogate */
+ result = sourceExhausted;
+ break;
+ }
+ } else if (flags == strictConversion) {
+ /* UTF-16 surrogate values are illegal in UTF-32 */
+ if (ch >= UNI_SUR_LOW_START && ch <= UNI_SUR_LOW_END) {
+ --source; /* return to the illegal value itself */
+ result = sourceIllegal;
+ break;
+ }
+ }
+ /* Figure out how many bytes the result will require */
+ if (ch < (UTF32)0x80) { bytesToWrite = 1;
+ } else if (ch < (UTF32)0x800) { bytesToWrite = 2;
+ } else if (ch < (UTF32)0x10000) { bytesToWrite = 3;
+ } else if (ch < (UTF32)0x110000) { bytesToWrite = 4;
+ } else { bytesToWrite = 3;
+ ch = UNI_REPLACEMENT_CHAR;
+ }
+
+ target += bytesToWrite;
+ if (target > targetEnd) {
+ source = oldSource; /* Back up source pointer! */
+ target -= bytesToWrite; result = targetExhausted; break;
+ }
+ switch (bytesToWrite) { /* note: everything falls through. */
+ case 4: *--target = (UTF8)((ch | byteMark) & byteMask); ch >>= 6;
+ case 3: *--target = (UTF8)((ch | byteMark) & byteMask); ch >>= 6;
+ case 2: *--target = (UTF8)((ch | byteMark) & byteMask); ch >>= 6;
+ case 1: *--target = (UTF8)(ch | firstByteMark[bytesToWrite]);
+ }
+ target += bytesToWrite;
}
*sourceStart = source;
*targetStart = target;
@@ -209,19 +209,19 @@ static Boolean isLegalUTF8(const UTF8 *source, int length) {
const UTF8 *srcptr = source+length;
switch (length) {
default: return false;
- /* Everything else falls through when "true"... */
+ /* Everything else falls through when "true"... */
case 4: if ((a = (*--srcptr)) < 0x80 || a > 0xBF) return false;
case 3: if ((a = (*--srcptr)) < 0x80 || a > 0xBF) return false;
case 2: if ((a = (*--srcptr)) > 0xBF) return false;
- switch (*source) {
- /* no fall-through in this inner switch */
- case 0xE0: if (a < 0xA0) return false; break;
- case 0xED: if (a > 0x9F) return false; break;
- case 0xF0: if (a < 0x90) return false; break;
- case 0xF4: if (a > 0x8F) return false; break;
- default: if (a < 0x80) return false;
- }
+ switch (*source) {
+ /* no fall-through in this inner switch */
+ case 0xE0: if (a < 0xA0) return false; break;
+ case 0xED: if (a > 0x9F) return false; break;
+ case 0xF0: if (a < 0x90) return false; break;
+ case 0xF4: if (a > 0x8F) return false; break;
+ default: if (a < 0x80) return false;
+ }
case 1: if (*source >= 0x80 && *source < 0xC2) return false;
}
@@ -260,70 +260,70 @@ Boolean isLegalUTF8Sequence(const UTF8 *source, const UTF8 *sourceEnd) {
/* --------------------------------------------------------------------- */
ConversionResult ConvertUTF8toUTF16 (
- const UTF8** sourceStart, const UTF8* sourceEnd,
- UTF16** targetStart, UTF16* targetEnd, ConversionFlags flags) {
+ const UTF8** sourceStart, const UTF8* sourceEnd,
+ UTF16** targetStart, UTF16* targetEnd, ConversionFlags flags) {
ConversionResult result = conversionOK;
const UTF8* source = *sourceStart;
UTF16* target = *targetStart;
while (source < sourceEnd) {
- UTF32 ch = 0;
- unsigned short extraBytesToRead = trailingBytesForUTF8[*source];
- if (source + extraBytesToRead >= sourceEnd) {
- result = sourceExhausted; break;
- }
- /* Do this check whether lenient or strict */
- if (! isLegalUTF8(source, extraBytesToRead+1)) {
- result = sourceIllegal;
- break;
- }
- /*
- * The cases all fall through. See "Note A" below.
- */
- switch (extraBytesToRead) {
- case 5: ch += *source++; ch <<= 6; /* remember, illegal UTF-8 */
- case 4: ch += *source++; ch <<= 6; /* remember, illegal UTF-8 */
- case 3: ch += *source++; ch <<= 6;
- case 2: ch += *source++; ch <<= 6;
- case 1: ch += *source++; ch <<= 6;
- case 0: ch += *source++;
- }
- ch -= offsetsFromUTF8[extraBytesToRead];
-
- if (target >= targetEnd) {
- source -= (extraBytesToRead+1); /* Back up source pointer! */
- result = targetExhausted; break;
- }
- if (ch <= UNI_MAX_BMP) { /* Target is a character <= 0xFFFF */
- /* UTF-16 surrogate values are illegal in UTF-32 */
- if (ch >= UNI_SUR_HIGH_START && ch <= UNI_SUR_LOW_END) {
- if (flags == strictConversion) {
- source -= (extraBytesToRead+1); /* return to the illegal value itself */
- result = sourceIllegal;
- break;
- } else {
- *target++ = UNI_REPLACEMENT_CHAR;
- }
- } else {
- *target++ = (UTF16)ch; /* normal case */
- }
- } else if (ch > UNI_MAX_UTF16) {
- if (flags == strictConversion) {
- result = sourceIllegal;
- source -= (extraBytesToRead+1); /* return to the start */
- break; /* Bail out; shouldn't continue */
- } else {
- *target++ = UNI_REPLACEMENT_CHAR;
- }
- } else {
- /* target is a character in range 0xFFFF - 0x10FFFF. */
- if (target + 1 >= targetEnd) {
- source -= (extraBytesToRead+1); /* Back up source pointer! */
- result = targetExhausted; break;
- }
- ch -= halfBase;
- *target++ = (UTF16)((ch >> halfShift) + UNI_SUR_HIGH_START);
- *target++ = (UTF16)((ch & halfMask) + UNI_SUR_LOW_START);
- }
+ UTF32 ch = 0;
+ unsigned short extraBytesToRead = trailingBytesForUTF8[*source];
+ if (source + extraBytesToRead >= sourceEnd) {
+ result = sourceExhausted; break;
+ }
+ /* Do this check whether lenient or strict */
+ if (! isLegalUTF8(source, extraBytesToRead+1)) {
+ result = sourceIllegal;
+ break;
+ }
+ /*
+ * The cases all fall through. See "Note A" below.
+ */
+ switch (extraBytesToRead) {
+ case 5: ch += *source++; ch <<= 6; /* remember, illegal UTF-8 */
+ case 4: ch += *source++; ch <<= 6; /* remember, illegal UTF-8 */
+ case 3: ch += *source++; ch <<= 6;
+ case 2: ch += *source++; ch <<= 6;
+ case 1: ch += *source++; ch <<= 6;
+ case 0: ch += *source++;
+ }
+ ch -= offsetsFromUTF8[extraBytesToRead];
+
+ if (target >= targetEnd) {
+ source -= (extraBytesToRead+1); /* Back up source pointer! */
+ result = targetExhausted; break;
+ }
+ if (ch <= UNI_MAX_BMP) { /* Target is a character <= 0xFFFF */
+ /* UTF-16 surrogate values are illegal in UTF-32 */
+ if (ch >= UNI_SUR_HIGH_START && ch <= UNI_SUR_LOW_END) {
+ if (flags == strictConversion) {
+ source -= (extraBytesToRead+1); /* return to the illegal value itself */
+ result = sourceIllegal;
+ break;
+ } else {
+ *target++ = UNI_REPLACEMENT_CHAR;
+ }
+ } else {
+ *target++ = (UTF16)ch; /* normal case */
+ }
+ } else if (ch > UNI_MAX_UTF16) {
+ if (flags == strictConversion) {
+ result = sourceIllegal;
+ source -= (extraBytesToRead+1); /* return to the start */
+ break; /* Bail out; shouldn't continue */
+ } else {
+ *target++ = UNI_REPLACEMENT_CHAR;
+ }
+ } else {
+ /* target is a character in range 0xFFFF - 0x10FFFF. */
+ if (target + 1 >= targetEnd) {
+ source -= (extraBytesToRead+1); /* Back up source pointer! */
+ result = targetExhausted; break;
+ }
+ ch -= halfBase;
+ *target++ = (UTF16)((ch >> halfShift) + UNI_SUR_HIGH_START);
+ *target++ = (UTF16)((ch & halfMask) + UNI_SUR_LOW_START);
+ }
}
*sourceStart = source;
*targetStart = target;
@@ -333,50 +333,50 @@ ConversionResult ConvertUTF8toUTF16 (
/* --------------------------------------------------------------------- */
ConversionResult ConvertUTF32toUTF8 (
- const UTF32** sourceStart, const UTF32* sourceEnd,
- UTF8** targetStart, UTF8* targetEnd, ConversionFlags flags) {
+ const UTF32** sourceStart, const UTF32* sourceEnd,
+ UTF8** targetStart, UTF8* targetEnd, ConversionFlags flags) {
ConversionResult result = conversionOK;
const UTF32* source = *sourceStart;
UTF8* target = *targetStart;
while (source < sourceEnd) {
- UTF32 ch;
- unsigned short bytesToWrite = 0;
- const UTF32 byteMask = 0xBF;
- const UTF32 byteMark = 0x80;
- ch = *source++;
- if (flags == strictConversion ) {
- /* UTF-16 surrogate values are illegal in UTF-32 */
- if (ch >= UNI_SUR_HIGH_START && ch <= UNI_SUR_LOW_END) {
- --source; /* return to the illegal value itself */
- result = sourceIllegal;
- break;
- }
- }
- /*
- * Figure out how many bytes the result will require. Turn any
- * illegally large UTF32 things (> Plane 17) into replacement chars.
- */
- if (ch < (UTF32)0x80) { bytesToWrite = 1;
- } else if (ch < (UTF32)0x800) { bytesToWrite = 2;
- } else if (ch < (UTF32)0x10000) { bytesToWrite = 3;
- } else if (ch <= UNI_MAX_LEGAL_UTF32) { bytesToWrite = 4;
- } else { bytesToWrite = 3;
- ch = UNI_REPLACEMENT_CHAR;
- result = sourceIllegal;
- }
-
- target += bytesToWrite;
- if (target > targetEnd) {
- --source; /* Back up source pointer! */
- target -= bytesToWrite; result = targetExhausted; break;
- }
- switch (bytesToWrite) { /* note: everything falls through. */
- case 4: *--target = (UTF8)((ch | byteMark) & byteMask); ch >>= 6;
- case 3: *--target = (UTF8)((ch | byteMark) & byteMask); ch >>= 6;
- case 2: *--target = (UTF8)((ch | byteMark) & byteMask); ch >>= 6;
- case 1: *--target = (UTF8) (ch | firstByteMark[bytesToWrite]);
- }
- target += bytesToWrite;
+ UTF32 ch;
+ unsigned short bytesToWrite = 0;
+ const UTF32 byteMask = 0xBF;
+ const UTF32 byteMark = 0x80;
+ ch = *source++;
+ if (flags == strictConversion ) {
+ /* UTF-16 surrogate values are illegal in UTF-32 */
+ if (ch >= UNI_SUR_HIGH_START && ch <= UNI_SUR_LOW_END) {
+ --source; /* return to the illegal value itself */
+ result = sourceIllegal;
+ break;
+ }
+ }
+ /*
+ * Figure out how many bytes the result will require. Turn any
+ * illegally large UTF32 things (> Plane 17) into replacement chars.
+ */
+ if (ch < (UTF32)0x80) { bytesToWrite = 1;
+ } else if (ch < (UTF32)0x800) { bytesToWrite = 2;
+ } else if (ch < (UTF32)0x10000) { bytesToWrite = 3;
+ } else if (ch <= UNI_MAX_LEGAL_UTF32) { bytesToWrite = 4;
+ } else { bytesToWrite = 3;
+ ch = UNI_REPLACEMENT_CHAR;
+ result = sourceIllegal;
+ }
+
+ target += bytesToWrite;
+ if (target > targetEnd) {
+ --source; /* Back up source pointer! */
+ target -= bytesToWrite; result = targetExhausted; break;
+ }
+ switch (bytesToWrite) { /* note: everything falls through. */
+ case 4: *--target = (UTF8)((ch | byteMark) & byteMask); ch >>= 6;
+ case 3: *--target = (UTF8)((ch | byteMark) & byteMask); ch >>= 6;
+ case 2: *--target = (UTF8)((ch | byteMark) & byteMask); ch >>= 6;
+ case 1: *--target = (UTF8) (ch | firstByteMark[bytesToWrite]);
+ }
+ target += bytesToWrite;
}
*sourceStart = source;
*targetStart = target;
@@ -386,59 +386,59 @@ ConversionResult ConvertUTF32toUTF8 (
/* --------------------------------------------------------------------- */
ConversionResult ConvertUTF8toUTF32 (
- const UTF8** sourceStart, const UTF8* sourceEnd,
- UTF32** targetStart, UTF32* targetEnd, ConversionFlags flags) {
+ const UTF8** sourceStart, const UTF8* sourceEnd,
+ UTF32** targetStart, UTF32* targetEnd, ConversionFlags flags) {
ConversionResult result = conversionOK;
const UTF8* source = *sourceStart;
UTF32* target = *targetStart;
while (source < sourceEnd) {
- UTF32 ch = 0;
- unsigned short extraBytesToRead = trailingBytesForUTF8[*source];
- if (source + extraBytesToRead >= sourceEnd) {
- result = sourceExhausted; break;
- }
- /* Do this check whether lenient or strict */
- if (! isLegalUTF8(source, extraBytesToRead+1)) {
- result = sourceIllegal;
- break;
- }
- /*
- * The cases all fall through. See "Note A" below.
- */
- switch (extraBytesToRead) {
- case 5: ch += *source++; ch <<= 6;
- case 4: ch += *source++; ch <<= 6;
- case 3: ch += *source++; ch <<= 6;
- case 2: ch += *source++; ch <<= 6;
- case 1: ch += *source++; ch <<= 6;
- case 0: ch += *source++;
- }
- ch -= offsetsFromUTF8[extraBytesToRead];
-
- if (target >= targetEnd) {
- source -= (extraBytesToRead+1); /* Back up the source pointer! */
- result = targetExhausted; break;
- }
- if (ch <= UNI_MAX_LEGAL_UTF32) {
- /*
- * UTF-16 surrogate values are illegal in UTF-32, and anything
- * over Plane 17 (> 0x10FFFF) is illegal.
- */
- if (ch >= UNI_SUR_HIGH_START && ch <= UNI_SUR_LOW_END) {
- if (flags == strictConversion) {
- source -= (extraBytesToRead+1); /* return to the illegal value itself */
- result = sourceIllegal;
- break;
- } else {
- *target++ = UNI_REPLACEMENT_CHAR;
- }
- } else {
- *target++ = ch;
- }
- } else { /* i.e., ch > UNI_MAX_LEGAL_UTF32 */
- result = sourceIllegal;
- *target++ = UNI_REPLACEMENT_CHAR;
- }
+ UTF32 ch = 0;
+ unsigned short extraBytesToRead = trailingBytesForUTF8[*source];
+ if (source + extraBytesToRead >= sourceEnd) {
+ result = sourceExhausted; break;
+ }
+ /* Do this check whether lenient or strict */
+ if (! isLegalUTF8(source, extraBytesToRead+1)) {
+ result = sourceIllegal;
+ break;
+ }
+ /*
+ * The cases all fall through. See "Note A" below.
+ */
+ switch (extraBytesToRead) {
+ case 5: ch += *source++; ch <<= 6;
+ case 4: ch += *source++; ch <<= 6;
+ case 3: ch += *source++; ch <<= 6;
+ case 2: ch += *source++; ch <<= 6;
+ case 1: ch += *source++; ch <<= 6;
+ case 0: ch += *source++;
+ }
+ ch -= offsetsFromUTF8[extraBytesToRead];
+
+ if (target >= targetEnd) {
+ source -= (extraBytesToRead+1); /* Back up the source pointer! */
+ result = targetExhausted; break;
+ }
+ if (ch <= UNI_MAX_LEGAL_UTF32) {
+ /*
+ * UTF-16 surrogate values are illegal in UTF-32, and anything
+ * over Plane 17 (> 0x10FFFF) is illegal.
+ */
+ if (ch >= UNI_SUR_HIGH_START && ch <= UNI_SUR_LOW_END) {
+ if (flags == strictConversion) {
+ source -= (extraBytesToRead+1); /* return to the illegal value itself */
+ result = sourceIllegal;
+ break;
+ } else {
+ *target++ = UNI_REPLACEMENT_CHAR;
+ }
+ } else {
+ *target++ = ch;
+ }
+ } else { /* i.e., ch > UNI_MAX_LEGAL_UTF32 */
+ result = sourceIllegal;
+ *target++ = UNI_REPLACEMENT_CHAR;
+ }
}
*sourceStart = source;
*targetStart = target;
@@ -451,14 +451,14 @@ ConversionResult ConvertUTF8toUTF32 (
The fall-through switches in UTF-8 reading code save a
temp variable, some decrements & conditionals. The switches
are equivalent to the following loop:
- {
- int tmpBytesToRead = extraBytesToRead+1;
- do {
- ch += *source++;
- --tmpBytesToRead;
- if (tmpBytesToRead) ch <<= 6;
- } while (tmpBytesToRead > 0);
- }
+ {
+ int tmpBytesToRead = extraBytesToRead+1;
+ do {
+ ch += *source++;
+ --tmpBytesToRead;
+ if (tmpBytesToRead) ch <<= 6;
+ } while (tmpBytesToRead > 0);
+ }
In UTF-8 writing code, the switches on "bytesToWrite" are
similarly unrolled loops.
diff --git a/cppe/src/IceE/ConvertUTF.h b/cppe/src/IceE/ConvertUTF.h
index 92f461a91e5..07e2c0afcd8 100644
--- a/cppe/src/IceE/ConvertUTF.h
+++ b/cppe/src/IceE/ConvertUTF.h
@@ -62,12 +62,12 @@
the respective buffers.
Input parameters:
- sourceStart - pointer to a pointer to the source buffer.
- The contents of this are modified on return so that
- it points at the next thing to be converted.
- targetStart - similarly, pointer to pointer to the target buffer.
- sourceEnd, targetEnd - respectively pointers to the ends of the
- two buffers, for overflow checking only.
+ sourceStart - pointer to a pointer to the source buffer.
+ The contents of this are modified on return so that
+ it points at the next thing to be converted.
+ targetStart - similarly, pointer to pointer to the target buffer.
+ sourceEnd, targetEnd - respectively pointers to the ends of the
+ two buffers, for overflow checking only.
These conversion functions take a ConversionFlags argument. When this
flag is set to strict, both irregular sequences and isolated surrogates
@@ -84,15 +84,15 @@
they constitute an error.
Output parameters:
- The value "sourceIllegal" is returned from some routines if the input
- sequence is malformed. When "sourceIllegal" is returned, the source
- value will point to the illegal value that caused the problem. E.g.,
- in UTF-8 when a sequence is malformed, it points to the start of the
- malformed sequence.
+ The value "sourceIllegal" is returned from some routines if the input
+ sequence is malformed. When "sourceIllegal" is returned, the source
+ value will point to the illegal value that caused the problem. E.g.,
+ in UTF-8 when a sequence is malformed, it points to the start of the
+ malformed sequence.
Author: Mark E. Davis, 1994.
Rev History: Rick McGowan, fixes & updates May 2001.
- Fixes & updates, Sept 2001.
+ Fixes & updates, Sept 2001.
------------------------------------------------------------------------ */
@@ -107,10 +107,10 @@
namespace IceUtil
{
-typedef unsigned int UTF32; /* at least 32 bits */
-typedef unsigned short UTF16; /* at least 16 bits */
-typedef unsigned char UTF8; /* typically 8 bits */
-typedef bool Boolean; /* 0 or 1 */
+typedef unsigned int UTF32; /* at least 32 bits */
+typedef unsigned short UTF16; /* at least 16 bits */
+typedef unsigned char UTF8; /* typically 8 bits */
+typedef bool Boolean; /* 0 or 1 */
/* Some fundamental constants */
#define UNI_REPLACEMENT_CHAR (UTF32)0x0000FFFD
@@ -127,7 +127,7 @@ ConversionResult ConvertUTF8toUTF16(
ConversionResult ConvertUTF16toUTF8 (
const UTF16** sourceStart, const UTF16* sourceEnd,
UTF8** targetStart, UTF8* targetEnd, ConversionFlags flags);
-
+
ConversionResult ConvertUTF8toUTF32(
const UTF8** sourceStart, const UTF8* sourceEnd,
UTF32** targetStart, UTF32* targetEnd, ConversionFlags flags);
diff --git a/cppe/src/IceE/Current.cpp b/cppe/src/IceE/Current.cpp
index 9b5543f9e39..0ae5348eefb 100644
--- a/cppe/src/IceE/Current.cpp
+++ b/cppe/src/IceE/Current.cpp
@@ -20,35 +20,35 @@ Ice::Current::operator!=(const Current& __rhs) const
{
if(this == &__rhs)
{
- return false;
+ return false;
}
if(adapter != __rhs.adapter)
{
- return true;
+ return true;
}
if(con != __rhs.con)
{
- return true;
+ return true;
}
if(id != __rhs.id)
{
- return true;
+ return true;
}
if(facet != __rhs.facet)
{
- return true;
+ return true;
}
if(operation != __rhs.operation)
{
- return true;
+ return true;
}
if(mode != __rhs.mode)
{
- return true;
+ return true;
}
if(ctx != __rhs.ctx)
{
- return true;
+ return true;
}
return false;
}
@@ -58,63 +58,63 @@ Ice::Current::operator<(const Current& __rhs) const
{
if(this == &__rhs)
{
- return false;
+ return false;
}
if(adapter < __rhs.adapter)
{
- return true;
+ return true;
}
else if(__rhs.adapter < adapter)
{
- return false;
+ return false;
}
if(con < __rhs.con)
{
- return true;
+ return true;
}
else if(__rhs.con < con)
{
- return false;
+ return false;
}
if(id < __rhs.id)
{
- return true;
+ return true;
}
else if(__rhs.id < id)
{
- return false;
+ return false;
}
if(facet < __rhs.facet)
{
- return true;
+ return true;
}
else if(__rhs.facet < facet)
{
- return false;
+ return false;
}
if(operation < __rhs.operation)
{
- return true;
+ return true;
}
else if(__rhs.operation < operation)
{
- return false;
+ return false;
}
if(mode < __rhs.mode)
{
- return true;
+ return true;
}
else if(__rhs.mode < mode)
{
- return false;
+ return false;
}
if(ctx < __rhs.ctx)
{
- return true;
+ return true;
}
else if(__rhs.ctx < ctx)
{
- return false;
+ return false;
}
return false;
}
diff --git a/cppe/src/IceE/DefaultsAndOverrides.cpp b/cppe/src/IceE/DefaultsAndOverrides.cpp
index 1f1a2e6f75c..7b47da40d5c 100644
--- a/cppe/src/IceE/DefaultsAndOverrides.cpp
+++ b/cppe/src/IceE/DefaultsAndOverrides.cpp
@@ -34,15 +34,15 @@ IceInternal::DefaultsAndOverrides::DefaultsAndOverrides(const PropertiesPtr& pro
value = properties->getProperty("Ice.Override.Timeout");
if(!value.empty())
{
- const_cast<bool&>(overrideTimeout) = true;
- const_cast<Int&>(overrideTimeoutValue) = properties->getPropertyAsInt("Ice.Override.Timeout");
+ const_cast<bool&>(overrideTimeout) = true;
+ const_cast<Int&>(overrideTimeoutValue) = properties->getPropertyAsInt("Ice.Override.Timeout");
}
value = properties->getProperty("Ice.Override.ConnectTimeout");
if(!value.empty())
{
- const_cast<bool&>(overrideConnectTimeout) = true;
- const_cast<Int&>(overrideConnectTimeoutValue) = properties->getPropertyAsInt("Ice.Override.ConnectTimeout");
+ const_cast<bool&>(overrideConnectTimeout) = true;
+ const_cast<Int&>(overrideConnectTimeoutValue) = properties->getPropertyAsInt("Ice.Override.ConnectTimeout");
}
#ifdef ICEE_HAS_LOCATOR
diff --git a/cppe/src/IceE/ExceptionBase.cpp b/cppe/src/IceE/ExceptionBase.cpp
index 1396a516f3a..83467e3a8a5 100644
--- a/cppe/src/IceE/ExceptionBase.cpp
+++ b/cppe/src/IceE/ExceptionBase.cpp
@@ -99,12 +99,12 @@ IceUtil::NullHandleException::NullHandleException(const char* file, int line) :
if(nullHandleAbort)
{
#ifdef _WIN32_WCE
- //
- // WinCE does not appear to have abort()
- //
- exit(-1);
+ //
+ // WinCE does not appear to have abort()
+ //
+ exit(-1);
#else
- abort();
+ abort();
#endif
}
}
diff --git a/cppe/src/IceE/FactoryTableDef.cpp b/cppe/src/IceE/FactoryTableDef.cpp
index db0ffdfbb8d..127312d6b53 100644
--- a/cppe/src/IceE/FactoryTableDef.cpp
+++ b/cppe/src/IceE/FactoryTableDef.cpp
@@ -17,11 +17,11 @@
namespace IceInternal
{
-FactoryTableWrapper factoryTableWrapper; // Single global instance of the wrapper object that
- // initializes factoryTable.
+FactoryTableWrapper factoryTableWrapper; // Single global instance of the wrapper object that
+ // initializes factoryTable.
-ICE_API FactoryTableDef* factoryTable; // Single global instance of the factory table for
- // non-local exceptions and non-abstract classes
+ICE_API FactoryTableDef* factoryTable; // Single global instance of the factory table for
+ // non-local exceptions and non-abstract classes
}
//
@@ -35,11 +35,11 @@ IceInternal::FactoryTableDef::addExceptionFactory(const std::string& t, const Ic
EFTable::iterator i = _eft.find(t);
if(i == _eft.end())
{
- _eft[t] = EFPair(f, 1);
+ _eft[t] = EFPair(f, 1);
}
else
{
- i->second.second++;
+ i->second.second++;
}
}
@@ -54,23 +54,23 @@ IceInternal::FactoryTableDef::getExceptionFactory(const std::string& t) const
#ifdef __APPLE__
if(i == _eft.end())
{
- lock.release();
-
- //
- // Try to find the symbol, if found this should trigger the
- // object static constructors to be called.
- //
- std::string symbol = "__F";
- for(std::string::const_iterator p = t.begin(); p != t.end(); ++p)
- {
- symbol += ((*p) == ':') ? '_' : *p;
- }
- symbol += "__initializer";
- dlsym(RTLD_DEFAULT, symbol.c_str());
-
- lock.acquire();
-
- i = _eft.find(t);
+ lock.release();
+
+ //
+ // Try to find the symbol, if found this should trigger the
+ // object static constructors to be called.
+ //
+ std::string symbol = "__F";
+ for(std::string::const_iterator p = t.begin(); p != t.end(); ++p)
+ {
+ symbol += ((*p) == ':') ? '_' : *p;
+ }
+ symbol += "__initializer";
+ dlsym(RTLD_DEFAULT, symbol.c_str());
+
+ lock.acquire();
+
+ i = _eft.find(t);
}
#endif
return i != _eft.end() ? i->second.first : IceInternal::UserExceptionFactoryPtr();
@@ -89,10 +89,10 @@ IceInternal::FactoryTableDef::removeExceptionFactory(const std::string& t)
EFTable::iterator i = _eft.find(t);
if(i != _eft.end())
{
- if(--i->second.second == 0)
- {
- _eft.erase(i);
- }
+ if(--i->second.second == 0)
+ {
+ _eft.erase(i);
+ }
}
}
@@ -122,7 +122,7 @@ IceInternal::FactoryTableWrapper::initialize()
IceUtil::StaticMutex::Lock lock(_m);
if(_initCount == 0)
{
- factoryTable = new FactoryTableDef;
+ factoryTable = new FactoryTableDef;
}
++_initCount;
}
@@ -136,9 +136,9 @@ IceInternal::FactoryTableWrapper::finalize()
IceUtil::StaticMutex::Lock lock(_m);
if(--_initCount == 0)
{
- delete factoryTable;
+ delete factoryTable;
}
}
IceUtil::StaticMutex IceInternal::FactoryTableWrapper::_m = ICE_STATIC_MUTEX_INITIALIZER;
-int IceInternal::FactoryTableWrapper::_initCount = 0; // Initialization count
+int IceInternal::FactoryTableWrapper::_initCount = 0; // Initialization count
diff --git a/cppe/src/IceE/Incoming.cpp b/cppe/src/IceE/Incoming.cpp
index 4f5dbb63848..3ea3984b4bf 100644
--- a/cppe/src/IceE/Incoming.cpp
+++ b/cppe/src/IceE/Incoming.cpp
@@ -45,15 +45,15 @@ IceInternal::Incoming::setAdapter(const Ice::ObjectAdapterPtr& adapter)
_adapter = adapter;
if(_adapter)
{
- _servantManager = _adapter->getServantManager().get();
- if(!_servantManager)
- {
- _adapter = 0;
- }
+ _servantManager = _adapter->getServantManager().get();
+ if(!_servantManager)
+ {
+ _adapter = 0;
+ }
}
else
{
- _servantManager = 0;
+ _servantManager = 0;
}
}
@@ -85,26 +85,26 @@ IceInternal::Incoming::invoke(bool response, Int requestId)
// string facet;
// if(!facetPath.empty())
// {
-// if(facetPath.size() > 1)
-// {
-// throw MarshalException(__FILE__, __LINE__);
-// }
-// facet.swap(facetPath[0]);
+// if(facetPath.size() > 1)
+// {
+// throw MarshalException(__FILE__, __LINE__);
+// }
+// facet.swap(facetPath[0]);
// }
// _current.facet.swap(facet);
Int sz;
_is.readSize(sz);
if(sz > 0)
{
- if(sz > 1)
- {
- throw MarshalException(__FILE__, __LINE__);
- }
- _is.read(_current.facet);
+ if(sz > 1)
+ {
+ throw MarshalException(__FILE__, __LINE__);
+ }
+ _is.read(_current.facet);
}
else
{
- _current.facet.clear();
+ _current.facet.clear();
}
_is.read(_current.operation, false);
@@ -116,19 +116,19 @@ IceInternal::Incoming::invoke(bool response, Int requestId)
_is.readSize(sz);
while(sz--)
{
- pair<const string, string> pr;
- _is.read(const_cast<string&>(pr.first));
- _is.read(pr.second);
- _current.ctx.insert(_current.ctx.end(), pr);
+ pair<const string, string> pr;
+ _is.read(const_cast<string&>(pr.first));
+ _is.read(pr.second);
+ _current.ctx.insert(_current.ctx.end(), pr);
}
_is.startReadEncaps();
if(response)
{
- assert(_os.b.size() == headerSize + 4); // Reply status position.
- _os.write(replyOK);
- _os.startWriteEncaps();
+ assert(_os.b.size() == headerSize + 4); // Reply status position.
+ _os.write(replyOK);
+ _os.startWriteEncaps();
}
@@ -143,294 +143,294 @@ IceInternal::Incoming::invoke(bool response, Int requestId)
try
{
- Ice::ObjectPtr servant;
- if(_servantManager)
- {
- servant = _servantManager->findServant(_current.id, _current.facet);
- }
-
- if(!servant)
- {
- if(_servantManager && _servantManager->hasServant(_current.id))
- {
- replyStatus = replyFacetNotExist;
- }
- else
- {
- replyStatus = replyObjectNotExist;
- }
- }
- else
- {
- dispatchStatus = servant->__dispatch(*this, _current);
+ Ice::ObjectPtr servant;
+ if(_servantManager)
+ {
+ servant = _servantManager->findServant(_current.id, _current.facet);
+ }
+
+ if(!servant)
+ {
+ if(_servantManager && _servantManager->hasServant(_current.id))
+ {
+ replyStatus = replyFacetNotExist;
+ }
+ else
+ {
+ replyStatus = replyObjectNotExist;
+ }
+ }
+ else
+ {
+ dispatchStatus = servant->__dispatch(*this, _current);
if(dispatchStatus == DispatchUserException)
{
replyStatus = replyUserException;
}
- }
+ }
}
catch(RequestFailedException& ex)
{
- _is.endReadEncaps();
-
- if(ex.id.name.empty())
- {
- ex.id = _current.id;
- }
-
- if(ex.facet.empty() && !_current.facet.empty())
- {
- ex.facet = _current.facet;
- }
-
- if(ex.operation.empty() && !_current.operation.empty())
- {
- ex.operation = _current.operation;
- }
-
- if(_os.instance()->initializationData().properties->getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 1)
- {
- __warning(ex);
- }
-
- if(response)
- {
- _os.endWriteEncaps();
- _os.b.resize(headerSize + 4); // Reply status position.
- if(dynamic_cast<ObjectNotExistException*>(&ex))
- {
- _os.write(replyObjectNotExist);
- }
- else if(dynamic_cast<FacetNotExistException*>(&ex))
- {
- _os.write(replyFacetNotExist);
- }
- else if(dynamic_cast<OperationNotExistException*>(&ex))
- {
- _os.write(replyOperationNotExist);
- }
- else
- {
- assert(false);
- }
-
- ex.id.__write(&_os);
-
- //
- // For compatibility with the old FacetPath.
- //
- if(ex.facet.empty())
- {
- _os.write(static_cast<string*>(0), static_cast<string*>(0));
- }
- else
- {
- _os.write(&ex.facet, &ex.facet + 1);
- }
-
- _os.write(ex.operation, false);
-
- _connection->sendResponse(&_os);
- }
- else
- {
- _connection->sendNoResponse();
- }
-
- return;
+ _is.endReadEncaps();
+
+ if(ex.id.name.empty())
+ {
+ ex.id = _current.id;
+ }
+
+ if(ex.facet.empty() && !_current.facet.empty())
+ {
+ ex.facet = _current.facet;
+ }
+
+ if(ex.operation.empty() && !_current.operation.empty())
+ {
+ ex.operation = _current.operation;
+ }
+
+ if(_os.instance()->initializationData().properties->getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 1)
+ {
+ __warning(ex);
+ }
+
+ if(response)
+ {
+ _os.endWriteEncaps();
+ _os.b.resize(headerSize + 4); // Reply status position.
+ if(dynamic_cast<ObjectNotExistException*>(&ex))
+ {
+ _os.write(replyObjectNotExist);
+ }
+ else if(dynamic_cast<FacetNotExistException*>(&ex))
+ {
+ _os.write(replyFacetNotExist);
+ }
+ else if(dynamic_cast<OperationNotExistException*>(&ex))
+ {
+ _os.write(replyOperationNotExist);
+ }
+ else
+ {
+ assert(false);
+ }
+
+ ex.id.__write(&_os);
+
+ //
+ // For compatibility with the old FacetPath.
+ //
+ if(ex.facet.empty())
+ {
+ _os.write(static_cast<string*>(0), static_cast<string*>(0));
+ }
+ else
+ {
+ _os.write(&ex.facet, &ex.facet + 1);
+ }
+
+ _os.write(ex.operation, false);
+
+ _connection->sendResponse(&_os);
+ }
+ else
+ {
+ _connection->sendNoResponse();
+ }
+
+ return;
}
catch(const UnknownLocalException& ex)
{
- _is.endReadEncaps();
-
- if(_os.instance()->initializationData().properties->getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 0)
- {
- __warning(ex);
- }
-
- if(response)
- {
- _os.endWriteEncaps();
- _os.b.resize(headerSize + 4); // Reply status position.
- _os.write(replyUnknownLocalException);
- _os.write(ex.unknown, false);
- _connection->sendResponse(&_os);
- }
- else
- {
- _connection->sendNoResponse();
- }
-
- return;
+ _is.endReadEncaps();
+
+ if(_os.instance()->initializationData().properties->getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 0)
+ {
+ __warning(ex);
+ }
+
+ if(response)
+ {
+ _os.endWriteEncaps();
+ _os.b.resize(headerSize + 4); // Reply status position.
+ _os.write(replyUnknownLocalException);
+ _os.write(ex.unknown, false);
+ _connection->sendResponse(&_os);
+ }
+ else
+ {
+ _connection->sendNoResponse();
+ }
+
+ return;
}
catch(const UnknownUserException& ex)
{
- _is.endReadEncaps();
-
- if(_os.instance()->initializationData().properties->getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 0)
- {
- __warning(ex);
- }
-
- if(response)
- {
- _os.endWriteEncaps();
- _os.b.resize(headerSize + 4); // Reply status position.
- _os.write(replyUnknownUserException);
- _os.write(ex.unknown, false);
- _connection->sendResponse(&_os);
- }
- else
- {
- _connection->sendNoResponse();
- }
-
- return;
+ _is.endReadEncaps();
+
+ if(_os.instance()->initializationData().properties->getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 0)
+ {
+ __warning(ex);
+ }
+
+ if(response)
+ {
+ _os.endWriteEncaps();
+ _os.b.resize(headerSize + 4); // Reply status position.
+ _os.write(replyUnknownUserException);
+ _os.write(ex.unknown, false);
+ _connection->sendResponse(&_os);
+ }
+ else
+ {
+ _connection->sendNoResponse();
+ }
+
+ return;
}
catch(const UnknownException& ex)
{
- _is.endReadEncaps();
-
- if(_os.instance()->initializationData().properties->getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 0)
- {
- __warning(ex);
- }
-
- if(response)
- {
- _os.endWriteEncaps();
- _os.b.resize(headerSize + 4); // Reply status position.
- _os.write(replyUnknownException);
- _os.write(ex.unknown, false);
- _connection->sendResponse(&_os);
- }
- else
- {
- _connection->sendNoResponse();
- }
-
- return;
+ _is.endReadEncaps();
+
+ if(_os.instance()->initializationData().properties->getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 0)
+ {
+ __warning(ex);
+ }
+
+ if(response)
+ {
+ _os.endWriteEncaps();
+ _os.b.resize(headerSize + 4); // Reply status position.
+ _os.write(replyUnknownException);
+ _os.write(ex.unknown, false);
+ _connection->sendResponse(&_os);
+ }
+ else
+ {
+ _connection->sendNoResponse();
+ }
+
+ return;
}
catch(const LocalException& ex)
{
- _is.endReadEncaps();
-
- if(_os.instance()->initializationData().properties->getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 0)
- {
- __warning(ex);
- }
-
- if(response)
- {
- _os.endWriteEncaps();
- _os.b.resize(headerSize + 4); // Reply status position.
- _os.write(replyUnknownLocalException);
- _os.write(ex.toString(), false);
- _connection->sendResponse(&_os);
- }
- else
- {
- _connection->sendNoResponse();
- }
-
- return;
+ _is.endReadEncaps();
+
+ if(_os.instance()->initializationData().properties->getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 0)
+ {
+ __warning(ex);
+ }
+
+ if(response)
+ {
+ _os.endWriteEncaps();
+ _os.b.resize(headerSize + 4); // Reply status position.
+ _os.write(replyUnknownLocalException);
+ _os.write(ex.toString(), false);
+ _connection->sendResponse(&_os);
+ }
+ else
+ {
+ _connection->sendNoResponse();
+ }
+
+ return;
}
catch(const UserException& ex)
{
- _is.endReadEncaps();
-
- if(_os.instance()->initializationData().properties->getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 0)
- {
- __warning(ex);
- }
-
- if(response)
- {
- _os.endWriteEncaps();
- _os.b.resize(headerSize + 4); // Reply status position.
- _os.write(replyUnknownUserException);
- _os.write(ex.toString(), false);
- _connection->sendResponse(&_os);
- }
- else
- {
- _connection->sendNoResponse();
- }
-
- return;
+ _is.endReadEncaps();
+
+ if(_os.instance()->initializationData().properties->getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 0)
+ {
+ __warning(ex);
+ }
+
+ if(response)
+ {
+ _os.endWriteEncaps();
+ _os.b.resize(headerSize + 4); // Reply status position.
+ _os.write(replyUnknownUserException);
+ _os.write(ex.toString(), false);
+ _connection->sendResponse(&_os);
+ }
+ else
+ {
+ _connection->sendNoResponse();
+ }
+
+ return;
}
catch(const Exception& ex)
{
- _is.endReadEncaps();
-
- if(_os.instance()->initializationData().properties->getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 0)
- {
- __warning(ex);
- }
-
- if(response)
- {
- _os.endWriteEncaps();
- _os.b.resize(headerSize + 4); // Reply status position.
- _os.write(replyUnknownException);
- _os.write(ex.toString(), false);
- _connection->sendResponse(&_os);
- }
- else
- {
- _connection->sendNoResponse();
- }
-
- return;
+ _is.endReadEncaps();
+
+ if(_os.instance()->initializationData().properties->getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 0)
+ {
+ __warning(ex);
+ }
+
+ if(response)
+ {
+ _os.endWriteEncaps();
+ _os.b.resize(headerSize + 4); // Reply status position.
+ _os.write(replyUnknownException);
+ _os.write(ex.toString(), false);
+ _connection->sendResponse(&_os);
+ }
+ else
+ {
+ _connection->sendNoResponse();
+ }
+
+ return;
}
catch(const std::exception& ex)
{
- _is.endReadEncaps();
-
- if(_os.instance()->initializationData().properties->getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 0)
- {
- __warning(string("std::exception: ") + ex.what());
- }
-
- if(response)
- {
- _os.endWriteEncaps();
- _os.b.resize(headerSize + 4); // Reply status position.
- _os.write(replyUnknownException);
- string msg = string("std::exception: ") + ex.what();
- _os.write(msg, false);
- _connection->sendResponse(&_os);
- }
- else
- {
- _connection->sendNoResponse();
- }
-
- return;
+ _is.endReadEncaps();
+
+ if(_os.instance()->initializationData().properties->getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 0)
+ {
+ __warning(string("std::exception: ") + ex.what());
+ }
+
+ if(response)
+ {
+ _os.endWriteEncaps();
+ _os.b.resize(headerSize + 4); // Reply status position.
+ _os.write(replyUnknownException);
+ string msg = string("std::exception: ") + ex.what();
+ _os.write(msg, false);
+ _connection->sendResponse(&_os);
+ }
+ else
+ {
+ _connection->sendNoResponse();
+ }
+
+ return;
}
catch(...)
{
- _is.endReadEncaps();
-
- if(_os.instance()->initializationData().properties->getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 0)
- {
- __warning("unknown c++ exception");
- }
-
- if(response)
- {
- _os.endWriteEncaps();
- _os.b.resize(headerSize + 4); // Reply status position.
- _os.write(replyUnknownException);
- _os.write(string("unknown c++ exception"), false);
- _connection->sendResponse(&_os);
- }
- else
- {
- _connection->sendNoResponse();
- }
-
- return;
+ _is.endReadEncaps();
+
+ if(_os.instance()->initializationData().properties->getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 0)
+ {
+ __warning("unknown c++ exception");
+ }
+
+ if(response)
+ {
+ _os.endWriteEncaps();
+ _os.b.resize(headerSize + 4); // Reply status position.
+ _os.write(replyUnknownException);
+ _os.write(string("unknown c++ exception"), false);
+ _connection->sendResponse(&_os);
+ }
+ else
+ {
+ _connection->sendNoResponse();
+ }
+
+ return;
}
//
@@ -443,42 +443,42 @@ IceInternal::Incoming::invoke(bool response, Int requestId)
if(response)
{
- _os.endWriteEncaps();
-
- if(replyStatus != replyOK && replyStatus != replyUserException)
- {
- assert(replyStatus == replyObjectNotExist ||
- replyStatus == replyFacetNotExist);
-
- _os.b.resize(headerSize + 4); // Reply status position.
- _os.write(replyStatus);
-
- _current.id.__write(&_os);
-
- //
- // For compatibility with the old FacetPath.
- //
- if(_current.facet.empty())
- {
- _os.write(static_cast<string*>(0), static_cast<string*>(0));
- }
- else
- {
- _os.write(&_current.facet, &_current.facet + 1);
- }
-
- _os.write(_current.operation, false);
- }
- else
- {
- *(_os.b.begin() + headerSize + 4) = replyStatus; // Reply status position.
- }
-
- _connection->sendResponse(&_os);
+ _os.endWriteEncaps();
+
+ if(replyStatus != replyOK && replyStatus != replyUserException)
+ {
+ assert(replyStatus == replyObjectNotExist ||
+ replyStatus == replyFacetNotExist);
+
+ _os.b.resize(headerSize + 4); // Reply status position.
+ _os.write(replyStatus);
+
+ _current.id.__write(&_os);
+
+ //
+ // For compatibility with the old FacetPath.
+ //
+ if(_current.facet.empty())
+ {
+ _os.write(static_cast<string*>(0), static_cast<string*>(0));
+ }
+ else
+ {
+ _os.write(&_current.facet, &_current.facet + 1);
+ }
+
+ _os.write(_current.operation, false);
+ }
+ else
+ {
+ *(_os.b.begin() + headerSize + 4) = replyStatus; // Reply status position.
+ }
+
+ _connection->sendResponse(&_os);
}
else
{
- _connection->sendNoResponse();
+ _connection->sendNoResponse();
}
}
diff --git a/cppe/src/IceE/IncomingConnectionFactory.cpp b/cppe/src/IceE/IncomingConnectionFactory.cpp
index 8d124ad232c..d3c9cee90e3 100644
--- a/cppe/src/IceE/IncomingConnectionFactory.cpp
+++ b/cppe/src/IceE/IncomingConnectionFactory.cpp
@@ -53,22 +53,22 @@ IceInternal::IncomingConnectionFactory::waitUntilHolding() const
list<ConnectionPtr> connections;
{
- IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
-
- //
- // First we wait until the connection factory itself is in holding
- // state.
- //
- while(_state < StateHolding)
- {
- wait();
- }
-
- //
- // We want to wait until all connections are in holding state
- // outside the thread synchronization.
- //
- connections = _connections;
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
+
+ //
+ // First we wait until the connection factory itself is in holding
+ // state.
+ //
+ while(_state < StateHolding)
+ {
+ wait();
+ }
+
+ //
+ // We want to wait until all connections are in holding state
+ // outside the thread synchronization.
+ //
+ connections = _connections;
}
//
@@ -84,30 +84,30 @@ IceInternal::IncomingConnectionFactory::waitUntilFinished()
list<ConnectionPtr> connections;
{
- IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
-
- //
- // First we wait until the factory is destroyed. If we are using
- // an acceptor, we also wait for it to be closed.
- //
- while(_state != StateClosed || _acceptor)
- {
- wait();
- }
-
- threadPerIncomingConnectionFactory = _threadPerIncomingConnectionFactory;
- _threadPerIncomingConnectionFactory = 0;
-
- //
- // We want to wait until all connections are finished outside the
- // thread synchronization.
- //
- connections.swap(_connections);
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
+
+ //
+ // First we wait until the factory is destroyed. If we are using
+ // an acceptor, we also wait for it to be closed.
+ //
+ while(_state != StateClosed || _acceptor)
+ {
+ wait();
+ }
+
+ threadPerIncomingConnectionFactory = _threadPerIncomingConnectionFactory;
+ _threadPerIncomingConnectionFactory = 0;
+
+ //
+ // We want to wait until all connections are finished outside the
+ // thread synchronization.
+ //
+ connections.swap(_connections);
}
if(threadPerIncomingConnectionFactory)
{
- threadPerIncomingConnectionFactory->getThreadControl().join();
+ threadPerIncomingConnectionFactory->getThreadControl().join();
}
for_each(connections.begin(), connections.end(), Ice::voidMemFun(&Connection::waitUntilFinished));
@@ -131,7 +131,7 @@ IceInternal::IncomingConnectionFactory::connections() const
// Only copy connections which have not been destroyed.
//
remove_copy_if(_connections.begin(), _connections.end(), back_inserter(result),
- Ice::constMemFun(&Connection::isDestroyed));
+ Ice::constMemFun(&Connection::isDestroyed));
return result;
}
@@ -143,14 +143,14 @@ IceInternal::IncomingConnectionFactory::flushBatchRequests()
for(list<ConnectionPtr>::const_iterator p = c.begin(); p != c.end(); ++p)
{
- try
- {
- (*p)->flushBatchRequests();
- }
- catch(const LocalException&)
- {
- // Ignore.
- }
+ try
+ {
+ (*p)->flushBatchRequests();
+ }
+ catch(const LocalException&)
+ {
+ // Ignore.
+ }
}
}
@@ -161,7 +161,7 @@ IceInternal::IncomingConnectionFactory::toString() const
if(_transceiver)
{
- return _transceiver->toString();
+ return _transceiver->toString();
}
assert(_acceptor);
@@ -169,8 +169,8 @@ IceInternal::IncomingConnectionFactory::toString() const
}
IceInternal::IncomingConnectionFactory::IncomingConnectionFactory(const InstancePtr& instance,
- const EndpointPtr& endpoint,
- const ObjectAdapterPtr& adapter) :
+ const EndpointPtr& endpoint,
+ const ObjectAdapterPtr& adapter) :
_instance(instance),
_endpoint(endpoint),
_adapter(adapter),
@@ -179,8 +179,8 @@ IceInternal::IncomingConnectionFactory::IncomingConnectionFactory(const Instance
{
if(_instance->defaultsAndOverrides()->overrideTimeout)
{
- const_cast<EndpointPtr&>(_endpoint) =
- _endpoint->timeout(_instance->defaultsAndOverrides()->overrideTimeoutValue);
+ const_cast<EndpointPtr&>(_endpoint) =
+ _endpoint->timeout(_instance->defaultsAndOverrides()->overrideTimeoutValue);
}
_acceptor = _endpoint->acceptor(const_cast<EndpointPtr&>(_endpoint));
@@ -190,36 +190,36 @@ IceInternal::IncomingConnectionFactory::IncomingConnectionFactory(const Instance
__setNoDelete(true);
try
{
- //
- // If we are in thread per connection mode, we also use one
- // thread per incoming connection factory, that accepts new
- // connections on this endpoint.
- //
- _threadPerIncomingConnectionFactory = new ThreadPerIncomingConnectionFactory(this);
- _threadPerIncomingConnectionFactory->start(_instance->threadPerConnectionStackSize());
+ //
+ // If we are in thread per connection mode, we also use one
+ // thread per incoming connection factory, that accepts new
+ // connections on this endpoint.
+ //
+ _threadPerIncomingConnectionFactory = new ThreadPerIncomingConnectionFactory(this);
+ _threadPerIncomingConnectionFactory->start(_instance->threadPerConnectionStackSize());
}
catch(const Ice::Exception& ex)
{
- {
- Error out(_instance->initializationData().logger);
- out << "cannot create thread for incoming connection factory:\n" << ex.toString();
- }
-
- try
- {
- _acceptor->close();
- }
- catch(const LocalException&)
- {
- // Here we ignore any exceptions in close().
- }
-
- _state = StateClosed;
- _acceptor = 0;
- _threadPerIncomingConnectionFactory = 0;
-
- __setNoDelete(false);
- ex.ice_throw();
+ {
+ Error out(_instance->initializationData().logger);
+ out << "cannot create thread for incoming connection factory:\n" << ex.toString();
+ }
+
+ try
+ {
+ _acceptor->close();
+ }
+ catch(const LocalException&)
+ {
+ // Here we ignore any exceptions in close().
+ }
+
+ _state = StateClosed;
+ _acceptor = 0;
+ _threadPerIncomingConnectionFactory = 0;
+
+ __setNoDelete(false);
+ ex.ice_throw();
}
__setNoDelete(false);
}
@@ -239,52 +239,52 @@ IceInternal::IncomingConnectionFactory::setState(State state)
{
if(_state == state) // Don't switch twice.
{
- return;
+ return;
}
switch(state)
{
- case StateActive:
- {
- if(_state != StateHolding) // Can only switch from holding to active.
- {
- return;
- }
- for_each(_connections.begin(), _connections.end(), Ice::voidMemFun(&Connection::activate));
- break;
- }
-
- case StateHolding:
- {
- if(_state != StateActive) // Can only switch from active to holding.
- {
- return;
- }
- for_each(_connections.begin(), _connections.end(), Ice::voidMemFun(&Connection::hold));
- break;
- }
-
- case StateClosed:
- {
- if(_acceptor)
- {
- //
- // Connect to our own acceptor, which unblocks our
- // thread per incoming connection factory stuck in accept().
- //
- _acceptor->connectToSelf();
- }
+ case StateActive:
+ {
+ if(_state != StateHolding) // Can only switch from holding to active.
+ {
+ return;
+ }
+ for_each(_connections.begin(), _connections.end(), Ice::voidMemFun(&Connection::activate));
+ break;
+ }
+
+ case StateHolding:
+ {
+ if(_state != StateActive) // Can only switch from active to holding.
+ {
+ return;
+ }
+ for_each(_connections.begin(), _connections.end(), Ice::voidMemFun(&Connection::hold));
+ break;
+ }
+
+ case StateClosed:
+ {
+ if(_acceptor)
+ {
+ //
+ // Connect to our own acceptor, which unblocks our
+ // thread per incoming connection factory stuck in accept().
+ //
+ _acceptor->connectToSelf();
+ }
#ifdef _STLP_BEGIN_NAMESPACE
- // voidbind2nd is an STLport extension for broken compilers in IceE/Functional.h
- for_each(_connections.begin(), _connections.end(),
- voidbind2nd(Ice::voidMemFun1(&Connection::destroy), Connection::ObjectAdapterDeactivated));
+ // voidbind2nd is an STLport extension for broken compilers in IceE/Functional.h
+ for_each(_connections.begin(), _connections.end(),
+ voidbind2nd(Ice::voidMemFun1(&Connection::destroy), Connection::ObjectAdapterDeactivated));
#else
- for_each(_connections.begin(), _connections.end(),
- bind2nd(Ice::voidMemFun1(&Connection::destroy), Connection::ObjectAdapterDeactivated));
+ for_each(_connections.begin(), _connections.end(),
+ bind2nd(Ice::voidMemFun1(&Connection::destroy), Connection::ObjectAdapterDeactivated));
#endif
- break;
- }
+ break;
+ }
}
_state = state;
@@ -298,109 +298,109 @@ IceInternal::IncomingConnectionFactory::run()
while(true)
{
- //
- // We must accept new connections outside the thread
- // synchronization, because we use blocking accept.
- //
- TransceiverPtr transceiver;
- try
- {
- transceiver = _acceptor->accept();
- }
- catch(const SocketException&)
- {
- // Ignore socket exceptions.
- }
- catch(const TimeoutException&)
- {
- // Ignore timeouts.
- }
- catch(const LocalException& ex)
- {
- // Warn about other Ice local exceptions.
- if(_warn)
- {
- Warning out(_instance->initializationData().logger);
- out << "connection exception:\n" << ex.toString() << "\n" << _acceptor->toString();
- }
- }
-
- ConnectionPtr connection;
-
- {
- IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
-
- while(_state == StateHolding)
- {
- wait();
- }
-
- if(_state == StateClosed)
- {
- if(transceiver)
- {
- try
- {
- transceiver->close();
- }
- catch(const LocalException&)
- {
- // Here we ignore any exceptions in close().
- }
- }
-
- try
- {
- _acceptor->close();
- }
- catch(const LocalException& ex)
- {
- _acceptor = 0;
- notifyAll();
- ex.ice_throw();
- }
-
- _acceptor = 0;
- notifyAll();
- return;
- }
-
- assert(_state == StateActive);
-
- //
- // Reap connections for which destruction has completed.
- //
- _connections.erase(remove_if(_connections.begin(), _connections.end(),
- Ice::constMemFun(&Connection::isFinished)),
- _connections.end());
-
- //
- // Create a connection object for the connection.
- //
- if(transceiver)
- {
- try
- {
- connection = new Connection(_instance, transceiver, _endpoint, _adapter);
- }
- catch(const LocalException&)
- {
- return;
- }
-
- _connections.push_back(connection);
- }
- }
-
- //
- // In thread per connection mode, the connection's thread will
- // take care of connection validation and activation. We don't
- // want to block this thread waiting until validation is
- // complete because it is the only thread that can accept
- // connections with this factory's acceptor. Therefore we
- // don't call validate() and activate() from the connection
- // factory in thread per connection mode.
- //
+ //
+ // We must accept new connections outside the thread
+ // synchronization, because we use blocking accept.
+ //
+ TransceiverPtr transceiver;
+ try
+ {
+ transceiver = _acceptor->accept();
+ }
+ catch(const SocketException&)
+ {
+ // Ignore socket exceptions.
+ }
+ catch(const TimeoutException&)
+ {
+ // Ignore timeouts.
+ }
+ catch(const LocalException& ex)
+ {
+ // Warn about other Ice local exceptions.
+ if(_warn)
+ {
+ Warning out(_instance->initializationData().logger);
+ out << "connection exception:\n" << ex.toString() << "\n" << _acceptor->toString();
+ }
+ }
+
+ ConnectionPtr connection;
+
+ {
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
+
+ while(_state == StateHolding)
+ {
+ wait();
+ }
+
+ if(_state == StateClosed)
+ {
+ if(transceiver)
+ {
+ try
+ {
+ transceiver->close();
+ }
+ catch(const LocalException&)
+ {
+ // Here we ignore any exceptions in close().
+ }
+ }
+
+ try
+ {
+ _acceptor->close();
+ }
+ catch(const LocalException& ex)
+ {
+ _acceptor = 0;
+ notifyAll();
+ ex.ice_throw();
+ }
+
+ _acceptor = 0;
+ notifyAll();
+ return;
+ }
+
+ assert(_state == StateActive);
+
+ //
+ // Reap connections for which destruction has completed.
+ //
+ _connections.erase(remove_if(_connections.begin(), _connections.end(),
+ Ice::constMemFun(&Connection::isFinished)),
+ _connections.end());
+
+ //
+ // Create a connection object for the connection.
+ //
+ if(transceiver)
+ {
+ try
+ {
+ connection = new Connection(_instance, transceiver, _endpoint, _adapter);
+ }
+ catch(const LocalException&)
+ {
+ return;
+ }
+
+ _connections.push_back(connection);
+ }
+ }
+
+ //
+ // In thread per connection mode, the connection's thread will
+ // take care of connection validation and activation. We don't
+ // want to block this thread waiting until validation is
+ // complete because it is the only thread that can accept
+ // connections with this factory's acceptor. Therefore we
+ // don't call validate() and activate() from the connection
+ // factory in thread per connection mode.
+ //
}
}
@@ -415,22 +415,22 @@ IceInternal::IncomingConnectionFactory::ThreadPerIncomingConnectionFactory::run(
{
try
{
- _factory->run();
+ _factory->run();
}
catch(const Exception& ex)
- {
- Error out(_factory->_instance->initializationData().logger);
- out << "exception in thread per incoming connection factory:\n" << _factory->toString() << ex.toString();
+ {
+ Error out(_factory->_instance->initializationData().logger);
+ out << "exception in thread per incoming connection factory:\n" << _factory->toString() << ex.toString();
}
catch(const std::exception& ex)
{
- Error out(_factory->_instance->initializationData().logger);
- out << "std::exception in thread per incoming connection factory:\n" << _factory->toString() << ex.what();
+ Error out(_factory->_instance->initializationData().logger);
+ out << "std::exception in thread per incoming connection factory:\n" << _factory->toString() << ex.what();
}
catch(...)
{
- Error out(_factory->_instance->initializationData().logger);
- out << "unknown exception in thread per incoming connection factory:\n" << _factory->toString();
+ Error out(_factory->_instance->initializationData().logger);
+ out << "unknown exception in thread per incoming connection factory:\n" << _factory->toString();
}
_factory = 0; // Resolve cyclic dependency.
diff --git a/cppe/src/IceE/IncomingConnectionFactory.h b/cppe/src/IceE/IncomingConnectionFactory.h
index 766816054fa..0150c81b017 100644
--- a/cppe/src/IceE/IncomingConnectionFactory.h
+++ b/cppe/src/IceE/IncomingConnectionFactory.h
@@ -55,9 +55,9 @@ private:
enum State
{
- StateActive,
- StateHolding,
- StateClosed
+ StateActive,
+ StateHolding,
+ StateClosed
};
void setState(State);
@@ -67,13 +67,13 @@ private:
class ThreadPerIncomingConnectionFactory : public IceUtil::Thread
{
public:
-
- ThreadPerIncomingConnectionFactory(const IncomingConnectionFactoryPtr&);
- virtual void run();
+
+ ThreadPerIncomingConnectionFactory(const IncomingConnectionFactoryPtr&);
+ virtual void run();
private:
-
- IncomingConnectionFactoryPtr _factory;
+
+ IncomingConnectionFactoryPtr _factory;
};
friend class ThreadPerIncomingConnectionFactory;
IceUtil::ThreadPtr _threadPerIncomingConnectionFactory;
diff --git a/cppe/src/IceE/Initialize.cpp b/cppe/src/IceE/Initialize.cpp
index 9c10c2e0605..13d09f0e2a8 100644
--- a/cppe/src/IceE/Initialize.cpp
+++ b/cppe/src/IceE/Initialize.cpp
@@ -56,7 +56,7 @@ Ice::stringSeqToArgs(const StringSeq& args, int& argc, char* argv[])
//
if(argv)
{
- argv[argc] = 0;
+ argv[argc] = 0;
}
}
@@ -113,7 +113,7 @@ inline void checkIceVersion(Int version)
//
if(ICEE_INT_VERSION / 100 != version / 100)
{
- throw VersionMismatchException(__FILE__, __LINE__);
+ throw VersionMismatchException(__FILE__, __LINE__);
}
//
// The caller's patch level cannot be greater than library's patch level. (Patch level changes are
@@ -121,7 +121,7 @@ inline void checkIceVersion(Int version)
//
if(version % 100 > ICEE_INT_VERSION % 100)
{
- throw VersionMismatchException(__FILE__, __LINE__);
+ throw VersionMismatchException(__FILE__, __LINE__);
}
#endif
}
@@ -149,42 +149,42 @@ Ice::initialize(StringSeq& args, const InitializationData& initializationData, I
CommunicatorPtr communicator;
try
{
- //
- // Make a dummy argc/argv.
- // (We can't use argsToStringSeq() because that requires an already initialized argv.)
- //
- int argc = args.size();
- origArgc = argc;
- argv = new char*[args.size() + 1];
- int i;
- for(i = 0; i != argc; ++i)
- {
- argv[i] = new char[args[i].size() + 1];
+ //
+ // Make a dummy argc/argv.
+ // (We can't use argsToStringSeq() because that requires an already initialized argv.)
+ //
+ int argc = args.size();
+ origArgc = argc;
+ argv = new char*[args.size() + 1];
+ int i;
+ for(i = 0; i != argc; ++i)
+ {
+ argv[i] = new char[args[i].size() + 1];
#if defined(_MSC_VER) && (_MSC_VER >= 1400)
- strcpy_s(argv[i], args[i].size() + 1, args[i].c_str());
+ strcpy_s(argv[i], args[i].size() + 1, args[i].c_str());
#else
- strcpy(argv[i], args[i].c_str());
+ strcpy(argv[i], args[i].c_str());
#endif
- }
- argv[argc] = 0;
-
- communicator = initialize(argc, argv, initializationData, version);
-
- args = argsToStringSeq(argc, argv);
-
- for(i = 0; i < origArgc; ++i)
- {
- delete[] argv[i];
- }
- delete[] argv;
+ }
+ argv[argc] = 0;
+
+ communicator = initialize(argc, argv, initializationData, version);
+
+ args = argsToStringSeq(argc, argv);
+
+ for(i = 0; i < origArgc; ++i)
+ {
+ delete[] argv[i];
+ }
+ delete[] argv;
}
catch(...)
{
- for(int i = 0; i < origArgc; ++i)
- {
- delete[] argv[i];
- }
- delete[] argv;
+ for(int i = 0; i < origArgc; ++i)
+ {
+ delete[] argv[i];
+ }
+ delete[] argv;
throw;
}
return communicator;
diff --git a/cppe/src/IceE/Instance.cpp b/cppe/src/IceE/Instance.cpp
index 27cc1453802..81221c987bd 100644
--- a/cppe/src/IceE/Instance.cpp
+++ b/cppe/src/IceE/Instance.cpp
@@ -88,7 +88,7 @@ IceInternal::Instance::routerManager() const
if(_state == StateDestroyed)
{
- throw CommunicatorDestroyedException(__FILE__, __LINE__);
+ throw CommunicatorDestroyedException(__FILE__, __LINE__);
}
return _routerManager;
@@ -105,7 +105,7 @@ IceInternal::Instance::locatorManager() const
if(_state == StateDestroyed)
{
- throw CommunicatorDestroyedException(__FILE__, __LINE__);
+ throw CommunicatorDestroyedException(__FILE__, __LINE__);
}
return _locatorManager;
@@ -120,7 +120,7 @@ IceInternal::Instance::referenceFactory() const
if(_state == StateDestroyed)
{
- throw CommunicatorDestroyedException(__FILE__, __LINE__);
+ throw CommunicatorDestroyedException(__FILE__, __LINE__);
}
return _referenceFactory;
@@ -133,7 +133,7 @@ IceInternal::Instance::proxyFactory() const
if(_state == StateDestroyed)
{
- throw CommunicatorDestroyedException(__FILE__, __LINE__);
+ throw CommunicatorDestroyedException(__FILE__, __LINE__);
}
return _proxyFactory;
@@ -146,7 +146,7 @@ IceInternal::Instance::outgoingConnectionFactory() const
if(_state == StateDestroyed)
{
- throw CommunicatorDestroyedException(__FILE__, __LINE__);
+ throw CommunicatorDestroyedException(__FILE__, __LINE__);
}
return _outgoingConnectionFactory;
@@ -160,7 +160,7 @@ IceInternal::Instance::objectAdapterFactory() const
if(_state == StateDestroyed)
{
- throw CommunicatorDestroyedException(__FILE__, __LINE__);
+ throw CommunicatorDestroyedException(__FILE__, __LINE__);
}
return _objectAdapterFactory;
@@ -183,7 +183,7 @@ IceInternal::Instance::endpointFactory() const
if(_state == StateDestroyed)
{
- throw CommunicatorDestroyedException(__FILE__, __LINE__);
+ throw CommunicatorDestroyedException(__FILE__, __LINE__);
}
return _endpointFactory;
@@ -200,16 +200,16 @@ IceInternal::Instance::flushBatchRequests()
#endif
{
- IceUtil::RecMutex::Lock sync(*this);
+ IceUtil::RecMutex::Lock sync(*this);
- if(_state == StateDestroyed)
- {
- throw CommunicatorDestroyedException(__FILE__, __LINE__);
- }
+ if(_state == StateDestroyed)
+ {
+ throw CommunicatorDestroyedException(__FILE__, __LINE__);
+ }
- connectionFactory = _outgoingConnectionFactory;
+ connectionFactory = _outgoingConnectionFactory;
#ifndef ICEE_PURE_CLIENT
- adapterFactory = _objectAdapterFactory;
+ adapterFactory = _objectAdapterFactory;
#endif
}
@@ -337,181 +337,181 @@ IceInternal::Instance::Instance(const CommunicatorPtr& communicator, const Initi
{
try
{
- __setNoDelete(true);
-
- IceUtil::StaticMutex::Lock sync(staticMutex);
- instanceCount++;
-
- if(!oneOffDone)
- {
- //
- // StdOut and StdErr redirection
- //
-
- string stdOutFilename = _initData.properties->getProperty("Ice.StdOut");
- string stdErrFilename = _initData.properties->getProperty("Ice.StdErr");
-
- if(stdOutFilename != "")
- {
- FILE * file;
+ __setNoDelete(true);
+
+ IceUtil::StaticMutex::Lock sync(staticMutex);
+ instanceCount++;
+
+ if(!oneOffDone)
+ {
+ //
+ // StdOut and StdErr redirection
+ //
+
+ string stdOutFilename = _initData.properties->getProperty("Ice.StdOut");
+ string stdErrFilename = _initData.properties->getProperty("Ice.StdErr");
+
+ if(stdOutFilename != "")
+ {
+ FILE * file;
#ifdef _WIN32_WCE
- wchar_t* wtext = new wchar_t[sizeof(wchar_t) * stdOutFilename.length()];
- mbstowcs(wtext, stdOutFilename.c_str(), stdOutFilename.length());
- file = _wfreopen(wtext, L"a", stdout);
- delete wtext;
+ wchar_t* wtext = new wchar_t[sizeof(wchar_t) * stdOutFilename.length()];
+ mbstowcs(wtext, stdOutFilename.c_str(), stdOutFilename.length());
+ file = _wfreopen(wtext, L"a", stdout);
+ delete wtext;
#else
- file = freopen(stdOutFilename.c_str(), "a", stdout);
-#endif
- if(file == 0)
- {
- SyscallException ex(__FILE__, __LINE__);
- ex.error = getSystemErrno();
- throw ex;
- }
- }
-
- if(stdErrFilename != "")
- {
- FILE* file;
+ file = freopen(stdOutFilename.c_str(), "a", stdout);
+#endif
+ if(file == 0)
+ {
+ SyscallException ex(__FILE__, __LINE__);
+ ex.error = getSystemErrno();
+ throw ex;
+ }
+ }
+
+ if(stdErrFilename != "")
+ {
+ FILE* file;
#ifdef _WIN32_WCE
- wchar_t* wtext = new wchar_t[sizeof(wchar_t) * stdErrFilename.length()];
- mbstowcs(wtext, stdErrFilename.c_str(), stdErrFilename.length());
- file = _wfreopen(wtext, L"a", stderr);
- delete wtext;
+ wchar_t* wtext = new wchar_t[sizeof(wchar_t) * stdErrFilename.length()];
+ mbstowcs(wtext, stdErrFilename.c_str(), stdErrFilename.length());
+ file = _wfreopen(wtext, L"a", stderr);
+ delete wtext;
#else
- file = freopen(stdErrFilename.c_str(), "a", stderr);
-#endif
- if(file == 0)
- {
- SyscallException ex(__FILE__, __LINE__);
- ex.error = getSystemErrno();
- throw ex;
- }
- }
-
- unsigned int seed = static_cast<unsigned int>(IceUtil::Time::now().toMicroSeconds());
- srand(seed);
+ file = freopen(stdErrFilename.c_str(), "a", stderr);
+#endif
+ if(file == 0)
+ {
+ SyscallException ex(__FILE__, __LINE__);
+ ex.error = getSystemErrno();
+ throw ex;
+ }
+ }
+
+ unsigned int seed = static_cast<unsigned int>(IceUtil::Time::now().toMicroSeconds());
+ srand(seed);
#ifndef _WIN32
- srand48(seed);
-#endif
-
- if(_initData.properties->getPropertyAsInt("Ice.NullHandleAbort") > 0)
- {
- IceUtil::nullHandleAbort = true;
- }
-
+ srand48(seed);
+#endif
+
+ if(_initData.properties->getPropertyAsInt("Ice.NullHandleAbort") > 0)
+ {
+ IceUtil::nullHandleAbort = true;
+ }
+
#ifndef _WIN32
- string newUser = _initData.properties->getProperty("Ice.ChangeUser");
- if(!newUser.empty())
- {
- struct passwd* pw = getpwnam(newUser.c_str());
- if(!pw)
- {
- SyscallException ex(__FILE__, __LINE__);
- ex.error = getSystemErrno();
- throw ex;
- }
-
- if(setgid(pw->pw_gid) == -1)
- {
- SyscallException ex(__FILE__, __LINE__);
- ex.error = getSystemErrno();
- throw ex;
- }
-
- if(setuid(pw->pw_uid) == -1)
- {
- SyscallException ex(__FILE__, __LINE__);
- ex.error = getSystemErrno();
- throw ex;
- }
- }
-#endif
- oneOffDone = true;
- }
-
- if(instanceCount == 1)
- {
-
+ string newUser = _initData.properties->getProperty("Ice.ChangeUser");
+ if(!newUser.empty())
+ {
+ struct passwd* pw = getpwnam(newUser.c_str());
+ if(!pw)
+ {
+ SyscallException ex(__FILE__, __LINE__);
+ ex.error = getSystemErrno();
+ throw ex;
+ }
+
+ if(setgid(pw->pw_gid) == -1)
+ {
+ SyscallException ex(__FILE__, __LINE__);
+ ex.error = getSystemErrno();
+ throw ex;
+ }
+
+ if(setuid(pw->pw_uid) == -1)
+ {
+ SyscallException ex(__FILE__, __LINE__);
+ ex.error = getSystemErrno();
+ throw ex;
+ }
+ }
+#endif
+ oneOffDone = true;
+ }
+
+ if(instanceCount == 1)
+ {
+
#ifdef _WIN32
- WORD version = MAKEWORD(1, 1);
- WSADATA data;
- if(WSAStartup(version, &data) != 0)
- {
- SocketException ex(__FILE__, __LINE__);
- ex.error = WSAGetLastError();
- throw ex;
- }
-#endif
-
+ WORD version = MAKEWORD(1, 1);
+ WSADATA data;
+ if(WSAStartup(version, &data) != 0)
+ {
+ SocketException ex(__FILE__, __LINE__);
+ ex.error = WSAGetLastError();
+ throw ex;
+ }
+#endif
+
#ifndef _WIN32
- struct sigaction action;
- action.sa_handler = SIG_IGN;
- sigemptyset(&action.sa_mask);
- action.sa_flags = 0;
- sigaction(SIGPIPE, &action, 0);
-#endif
- }
-
- sync.release();
-
-
- if(!_initData.logger)
- {
- _initData.logger = new LoggerI(_initData.properties->getProperty("Ice.ProgramName"));
- }
-
- const_cast<TraceLevelsPtr&>(_traceLevels) = new TraceLevels(_initData.properties);
-
- const_cast<DefaultsAndOverridesPtr&>(_defaultsAndOverrides) = new DefaultsAndOverrides(_initData.properties);
-
- {
- static const int defaultMessageSizeMax = 1024;
- Int num = _initData.properties->getPropertyAsIntWithDefault("Ice.MessageSizeMax", defaultMessageSizeMax);
- if(num < 1)
- {
- const_cast<size_t&>(_messageSizeMax) = defaultMessageSizeMax * 1024; // Ignore non-sensical values.
- }
- else if(static_cast<size_t>(num) > (size_t)(0x7fffffff / 1024))
- {
- const_cast<size_t&>(_messageSizeMax) = static_cast<size_t>(0x7fffffff);
- }
- else
- {
- // Property is in kilobytes, _messageSizeMax in bytes.
- const_cast<size_t&>(_messageSizeMax) = static_cast<size_t>(num) * 1024;
- }
- }
+ struct sigaction action;
+ action.sa_handler = SIG_IGN;
+ sigemptyset(&action.sa_mask);
+ action.sa_flags = 0;
+ sigaction(SIGPIPE, &action, 0);
+#endif
+ }
+
+ sync.release();
+
+
+ if(!_initData.logger)
+ {
+ _initData.logger = new LoggerI(_initData.properties->getProperty("Ice.ProgramName"));
+ }
+
+ const_cast<TraceLevelsPtr&>(_traceLevels) = new TraceLevels(_initData.properties);
+
+ const_cast<DefaultsAndOverridesPtr&>(_defaultsAndOverrides) = new DefaultsAndOverrides(_initData.properties);
+
+ {
+ static const int defaultMessageSizeMax = 1024;
+ Int num = _initData.properties->getPropertyAsIntWithDefault("Ice.MessageSizeMax", defaultMessageSizeMax);
+ if(num < 1)
+ {
+ const_cast<size_t&>(_messageSizeMax) = defaultMessageSizeMax * 1024; // Ignore non-sensical values.
+ }
+ else if(static_cast<size_t>(num) > (size_t)(0x7fffffff / 1024))
+ {
+ const_cast<size_t&>(_messageSizeMax) = static_cast<size_t>(0x7fffffff);
+ }
+ else
+ {
+ // Property is in kilobytes, _messageSizeMax in bytes.
+ const_cast<size_t&>(_messageSizeMax) = static_cast<size_t>(num) * 1024;
+ }
+ }
#ifndef ICEE_PURE_BLOCKING_CLIENT
- {
- Int stackSize = _initData.properties->getPropertyAsInt("Ice.ThreadPerConnection.StackSize");
- if(stackSize < 0)
- {
- stackSize = 0;
- }
- const_cast<size_t&>(_threadPerConnectionStackSize) = static_cast<size_t>(stackSize);
- }
+ {
+ Int stackSize = _initData.properties->getPropertyAsInt("Ice.ThreadPerConnection.StackSize");
+ if(stackSize < 0)
+ {
+ stackSize = 0;
+ }
+ const_cast<size_t&>(_threadPerConnectionStackSize) = static_cast<size_t>(stackSize);
+ }
#endif
#ifdef ICEE_HAS_ROUTER
- _routerManager = new RouterManager;
+ _routerManager = new RouterManager;
#endif
#ifdef ICEE_HAS_LOCATOR
- _locatorManager = new LocatorManager;
+ _locatorManager = new LocatorManager;
#endif
- _referenceFactory = new ReferenceFactory(this, communicator);
+ _referenceFactory = new ReferenceFactory(this, communicator);
- _proxyFactory = new ProxyFactory(this);
+ _proxyFactory = new ProxyFactory(this);
_endpointFactory = new EndpointFactory(this);
- _outgoingConnectionFactory = new OutgoingConnectionFactory(this);
+ _outgoingConnectionFactory = new OutgoingConnectionFactory(this);
#ifndef ICEE_PURE_CLIENT
- _objectAdapterFactory = new ObjectAdapterFactory(this, communicator);
+ _objectAdapterFactory = new ObjectAdapterFactory(this, communicator);
#endif
#ifdef ICEE_HAS_WSTRING
@@ -521,17 +521,17 @@ IceInternal::Instance::Instance(const CommunicatorPtr& communicator, const Initi
}
#endif
- __setNoDelete(false);
+ __setNoDelete(false);
}
catch(...)
{
- {
- IceUtil::StaticMutex::Lock sync(staticMutex);
- --instanceCount;
- }
- destroy();
- __setNoDelete(false);
- throw;
+ {
+ IceUtil::StaticMutex::Lock sync(staticMutex);
+ --instanceCount;
+ }
+ destroy();
+ __setNoDelete(false);
+ throw;
}
}
@@ -556,15 +556,15 @@ IceInternal::Instance::~Instance()
if(--instanceCount == 0)
{
#ifdef _WIN32
- WSACleanup();
+ WSACleanup();
#endif
-
+
#ifndef _WIN32
- struct sigaction action;
- action.sa_handler = SIG_DFL;
- sigemptyset(&action.sa_mask);
- action.sa_flags = 0;
- sigaction(SIGPIPE, &action, 0);
+ struct sigaction action;
+ action.sa_handler = SIG_DFL;
+ sigemptyset(&action.sa_mask);
+ action.sa_flags = 0;
+ sigaction(SIGPIPE, &action, 0);
#endif
}
}
@@ -580,16 +580,16 @@ IceInternal::Instance::finishSetup(int& argc, char* argv[])
#ifdef ICEE_HAS_ROUTER
if(!_defaultsAndOverrides->defaultRouter.empty())
{
- _referenceFactory->setDefaultRouter(
- RouterPrx::uncheckedCast(_proxyFactory->stringToProxy(_defaultsAndOverrides->defaultRouter)));
+ _referenceFactory->setDefaultRouter(
+ RouterPrx::uncheckedCast(_proxyFactory->stringToProxy(_defaultsAndOverrides->defaultRouter)));
}
#endif
#ifdef ICEE_HAS_LOCATOR
if(!_defaultsAndOverrides->defaultLocator.empty())
{
- _referenceFactory->setDefaultLocator(
- LocatorPrx::uncheckedCast(_proxyFactory->stringToProxy(_defaultsAndOverrides->defaultLocator)));
+ _referenceFactory->setDefaultLocator(
+ LocatorPrx::uncheckedCast(_proxyFactory->stringToProxy(_defaultsAndOverrides->defaultLocator)));
}
#endif
@@ -600,26 +600,26 @@ IceInternal::Instance::finishSetup(int& argc, char* argv[])
bool printProcessId = false;
if(!printProcessIdDone && _initData.properties->getPropertyAsInt("Ice.PrintProcessId") > 0)
{
- //
- // Safe double-check locking (no dependent variable!)
- //
- IceUtil::StaticMutex::Lock sync(staticMutex);
- printProcessId = !printProcessIdDone;
-
- //
- // We anticipate: we want to print it once, and we don't care when.
- //
- printProcessIdDone = true;
+ //
+ // Safe double-check locking (no dependent variable!)
+ //
+ IceUtil::StaticMutex::Lock sync(staticMutex);
+ printProcessId = !printProcessIdDone;
+
+ //
+ // We anticipate: we want to print it once, and we don't care when.
+ //
+ printProcessIdDone = true;
}
if(printProcessId)
{
#ifdef _WIN32
- printf("%d\n", _getpid());
+ printf("%d\n", _getpid());
#else
- printf("%d\n", getpid());
+ printf("%d\n", getpid());
#endif
- fflush(stdout);
+ fflush(stdout);
}
#endif
}
@@ -628,30 +628,30 @@ void
IceInternal::Instance::destroy()
{
{
- IceUtil::RecMutex::Lock sync(*this);
-
- //
- // If the _state is not StateActive then the instance is
- // either being destroyed, or has already been destroyed.
- //
- if(_state != StateActive)
- {
- return;
- }
-
- //
- // We cannot set state to StateDestroyed otherwise instance
- // methods called during the destroy process (such as
- // outgoingConnectionFactory() from
- // ObjectAdapterI::deactivate() will cause an exception.
- //
- _state = StateDestroyInProgress;
+ IceUtil::RecMutex::Lock sync(*this);
+
+ //
+ // If the _state is not StateActive then the instance is
+ // either being destroyed, or has already been destroyed.
+ //
+ if(_state != StateActive)
+ {
+ return;
+ }
+
+ //
+ // We cannot set state to StateDestroyed otherwise instance
+ // methods called during the destroy process (such as
+ // outgoingConnectionFactory() from
+ // ObjectAdapterI::deactivate() will cause an exception.
+ //
+ _state = StateDestroyInProgress;
}
#ifndef ICEE_PURE_CLIENT
if(_objectAdapterFactory)
{
- _objectAdapterFactory->shutdown();
+ _objectAdapterFactory->shutdown();
}
if(_outgoingConnectionFactory)
@@ -677,46 +677,46 @@ IceInternal::Instance::destroy()
#endif
{
- IceUtil::RecMutex::Lock sync(*this);
+ IceUtil::RecMutex::Lock sync(*this);
#ifndef ICEE_PURE_CLIENT
- _objectAdapterFactory = 0;
-#endif
- _outgoingConnectionFactory = 0;
-
- if(_referenceFactory)
- {
- _referenceFactory->destroy();
- _referenceFactory = 0;
- }
-
- // No destroy function defined.
- // _proxyFactory->destroy();
- _proxyFactory = 0;
-
+ _objectAdapterFactory = 0;
+#endif
+ _outgoingConnectionFactory = 0;
+
+ if(_referenceFactory)
+ {
+ _referenceFactory->destroy();
+ _referenceFactory = 0;
+ }
+
+ // No destroy function defined.
+ // _proxyFactory->destroy();
+ _proxyFactory = 0;
+
#ifdef ICEE_HAS_ROUTER
- if(_routerManager)
- {
- _routerManager->destroy();
- _routerManager = 0;
- }
+ if(_routerManager)
+ {
+ _routerManager->destroy();
+ _routerManager = 0;
+ }
#endif
#ifdef ICEE_HAS_LOCATOR
- if(_locatorManager)
- {
- _locatorManager->destroy();
- _locatorManager = 0;
- }
+ if(_locatorManager)
+ {
+ _locatorManager->destroy();
+ _locatorManager = 0;
+ }
#endif
- if(_endpointFactory)
- {
- _endpointFactory->destroy();
- _endpointFactory = 0;
- }
+ if(_endpointFactory)
+ {
+ _endpointFactory->destroy();
+ _endpointFactory = 0;
+ }
- _state = StateDestroyed;
+ _state = StateDestroyed;
}
}
diff --git a/cppe/src/IceE/Instance.h b/cppe/src/IceE/Instance.h
index 7c6c58efd20..9d844e0266a 100644
--- a/cppe/src/IceE/Instance.h
+++ b/cppe/src/IceE/Instance.h
@@ -78,9 +78,9 @@ private:
enum State
{
- StateActive,
- StateDestroyInProgress,
- StateDestroyed
+ StateActive,
+ StateDestroyInProgress,
+ StateDestroyed
};
State _state;
Ice::InitializationData _initData; // Immutable, not reset by destroy().
diff --git a/cppe/src/IceE/LocalException.cpp b/cppe/src/IceE/LocalException.cpp
index c785547149c..d35cf32c2a8 100644
--- a/cppe/src/IceE/LocalException.cpp
+++ b/cppe/src/IceE/LocalException.cpp
@@ -1502,13 +1502,13 @@ Ice::MemoryLimitException::ice_throw() const
void
Ice::throwMemoryLimitException(const char* file, int line)
{
- throw MemoryLimitException(file, line);
+ throw MemoryLimitException(file, line);
}
void
Ice::throwUnmarshalOutOfBoundsException(const char* file, int line)
{
- throw MarshalException(file, line, "out of bounds during unmarshaling");
+ throw MarshalException(file, line, "out of bounds during unmarshaling");
}
void
@@ -1644,8 +1644,8 @@ Ice::UnknownException::toString() const
out += ":\nunknown exception";
if(!unknown.empty())
{
- out += ":\n";
- out += unknown;
+ out += ":\n";
+ out += unknown;
}
return out;
}
@@ -1657,8 +1657,8 @@ Ice::UnknownLocalException::toString() const
out += ":\nunknown local exception";
if(!unknown.empty())
{
- out += ":\n";
- out += unknown;
+ out += ":\n";
+ out += unknown;
}
return out;
}
@@ -1670,8 +1670,8 @@ Ice::UnknownUserException::toString() const
out += ":\nunknown user exception";
if(!unknown.empty())
{
- out += ":\n";
- out += unknown;
+ out += ":\n";
+ out += unknown;
}
return out;
}
@@ -1814,7 +1814,7 @@ Ice::SyscallException::toString() const
if(error != 0)
{
out += ":\nsyscall exception: ";
- out += errorToString(error);
+ out += errorToString(error);
}
return out;
}
@@ -1842,9 +1842,9 @@ Ice::FileException::toString() const
{
- out += "\npath: ";
+ out += "\npath: ";
- out += path;
+ out += path;
}
@@ -1877,11 +1877,11 @@ Ice::ConnectionLostException::toString() const
out += ":\nconnection lost: ";
if(error == 0)
{
- out += "recv() returned zero";
+ out += "recv() returned zero";
}
else
{
- out += errorToString(error);
+ out += errorToString(error);
}
return out;
}
@@ -1928,11 +1928,11 @@ Ice::ProtocolException::toString() const
out += ":\nprotocol error: ";
if(!reason.empty())
{
- out += reason;
+ out += reason;
}
else
{
- out += "unknown protocol exception";
+ out += "unknown protocol exception";
}
return out;
}
@@ -1973,8 +1973,8 @@ Ice::MarshalException::toString() const
out += ":\nprotocol error: error during marshaling or unmarshaling";
if(!reason.empty())
{
- out += ":\n";
- out += reason;
+ out += ":\n";
+ out += reason;
}
return out;
}
diff --git a/cppe/src/IceE/LocatorInfo.cpp b/cppe/src/IceE/LocatorInfo.cpp
index 7dc7f5aa836..5158cb5b510 100644
--- a/cppe/src/IceE/LocatorInfo.cpp
+++ b/cppe/src/IceE/LocatorInfo.cpp
@@ -53,7 +53,7 @@ IceInternal::LocatorManager::get(const LocatorPrx& loc)
{
if(!loc)
{
- return 0;
+ return 0;
}
LocatorPrx locator = LocatorPrx::uncheckedCast(loc->ice_locator(0)); // The locator can't be located.
@@ -68,38 +68,38 @@ IceInternal::LocatorManager::get(const LocatorPrx& loc)
if(_tableHint != _table.end())
{
- if(_tableHint->first == locator)
- {
- p = _tableHint;
- }
+ if(_tableHint->first == locator)
+ {
+ p = _tableHint;
+ }
}
if(p == _table.end())
{
- p = _table.find(locator);
+ p = _table.find(locator);
}
if(p == _table.end())
{
- //
- // Rely on locator identity for the adapter table. We want to
- // have only one table per locator (not one per locator
- // proxy).
- //
- map<Identity, LocatorTablePtr>::iterator t = _locatorTables.find(locator->ice_getIdentity());
- if(t == _locatorTables.end())
- {
- t = _locatorTables.insert(_locatorTables.begin(),
- pair<const Identity, LocatorTablePtr>(locator->ice_getIdentity(),
- new LocatorTable()));
- }
-
- _tableHint = _table.insert(_tableHint,
- pair<const LocatorPrx, LocatorInfoPtr>(locator, new LocatorInfo(locator, t->second)));
+ //
+ // Rely on locator identity for the adapter table. We want to
+ // have only one table per locator (not one per locator
+ // proxy).
+ //
+ map<Identity, LocatorTablePtr>::iterator t = _locatorTables.find(locator->ice_getIdentity());
+ if(t == _locatorTables.end())
+ {
+ t = _locatorTables.insert(_locatorTables.begin(),
+ pair<const Identity, LocatorTablePtr>(locator->ice_getIdentity(),
+ new LocatorTable()));
+ }
+
+ _tableHint = _table.insert(_tableHint,
+ pair<const LocatorPrx, LocatorInfoPtr>(locator, new LocatorInfo(locator, t->second)));
}
else
{
- _tableHint = p;
+ _tableHint = p;
}
return _tableHint->second;
@@ -112,10 +112,10 @@ IceInternal::LocatorTable::LocatorTable()
void
IceInternal::LocatorTable::clear()
{
- IceUtil::Mutex::Lock sync(*this);
+ IceUtil::Mutex::Lock sync(*this);
- _adapterEndpointsMap.clear();
- _objectMap.clear();
+ _adapterEndpointsMap.clear();
+ _objectMap.clear();
}
bool
@@ -127,12 +127,12 @@ IceInternal::LocatorTable::getAdapterEndpoints(const string& adapter, vector<End
if(p != _adapterEndpointsMap.end())
{
- endpoints = p->second;
- return true;
+ endpoints = p->second;
+ return true;
}
else
{
- return false;
+ return false;
}
}
@@ -152,7 +152,7 @@ IceInternal::LocatorTable::removeAdapterEndpoints(const string& adapter)
map<string, vector<EndpointPtr> >::iterator p = _adapterEndpointsMap.find(adapter);
if(p == _adapterEndpointsMap.end())
{
- return vector<EndpointPtr>();
+ return vector<EndpointPtr>();
}
vector<EndpointPtr> endpoints = p->second;
@@ -171,12 +171,12 @@ IceInternal::LocatorTable::getProxy(const Identity& id, ObjectPrx& proxy) const
if(p != _objectMap.end())
{
- proxy = p->second;
- return true;
+ proxy = p->second;
+ return true;
}
else
{
- return false;
+ return false;
}
}
@@ -195,7 +195,7 @@ IceInternal::LocatorTable::removeProxy(const Identity& id)
map<Identity, ObjectPrx>::iterator p = _objectMap.find(id);
if(p == _objectMap.end())
{
- return 0;
+ return 0;
}
ObjectPrx proxy = p->second;
@@ -254,12 +254,12 @@ IceInternal::LocatorInfo::getLocatorRegistry()
if(!_locatorRegistry) // Lazy initialization.
{
- _locatorRegistry = _locator->getRegistry();
+ _locatorRegistry = _locator->getRegistry();
- //
- // The locator registry can't be located.
- //
- _locatorRegistry = LocatorRegistryPrx::uncheckedCast(_locatorRegistry->ice_locator(0));
+ //
+ // The locator registry can't be located.
+ //
+ _locatorRegistry = LocatorRegistryPrx::uncheckedCast(_locatorRegistry->ice_locator(0));
}
return _locatorRegistry;
@@ -274,11 +274,11 @@ IceInternal::LocatorInfo::getEndpoints(const IndirectReferencePtr& ref, bool& ca
try
{
- if(!ref->getAdapterId().empty())
- {
- if(!_table->getAdapterEndpoints(ref->getAdapterId(), endpoints))
- {
- cached = false;
+ if(!ref->getAdapterId().empty())
+ {
+ if(!_table->getAdapterEndpoints(ref->getAdapterId(), endpoints))
+ {
+ cached = false;
if(ref->getInstance()->traceLevels()->location >= 1)
{
@@ -287,20 +287,20 @@ IceInternal::LocatorInfo::getEndpoints(const IndirectReferencePtr& ref, bool& ca
out << "searching for adapter by id" << "\n";
out << "adapter = " << ref->getAdapterId();
}
-
- object = _locator->findAdapterById(ref->getAdapterId());
- if(object)
- {
- endpoints = object->__reference()->getEndpoints();
- _table->addAdapterEndpoints(ref->getAdapterId(), endpoints);
- }
- }
- }
- else
- {
- bool objectCached = true;
- if(!_table->getProxy(ref->getIdentity(), object))
- {
+
+ object = _locator->findAdapterById(ref->getAdapterId());
+ if(object)
+ {
+ endpoints = object->__reference()->getEndpoints();
+ _table->addAdapterEndpoints(ref->getAdapterId(), endpoints);
+ }
+ }
+ }
+ else
+ {
+ bool objectCached = true;
+ if(!_table->getProxy(ref->getIdentity(), object))
+ {
if(ref->getInstance()->traceLevels()->location >= 1)
{
@@ -310,37 +310,37 @@ IceInternal::LocatorInfo::getEndpoints(const IndirectReferencePtr& ref, bool& ca
out << "object = " << ref->getInstance()->identityToString(ref->getIdentity());
}
- objectCached = false;
- object = _locator->findObjectById(ref->getIdentity());
- }
-
- bool endpointsCached = true;
- if(object)
- {
- DirectReferencePtr odr = DirectReferencePtr::dynamicCast(object->__reference());
- if(odr)
- {
- endpointsCached = false;
- endpoints = odr->getEndpoints();
- }
- else
- {
- IndirectReferencePtr oir = IndirectReferencePtr::dynamicCast(object->__reference());
- assert(oir);
- if(!oir->getAdapterId().empty())
- {
- endpoints = getEndpoints(oir, endpointsCached);
- }
- }
- }
-
- if(!objectCached && !endpoints.empty())
- {
- _table->addProxy(ref->getIdentity(), object);
- }
-
- cached = objectCached || endpointsCached;
- }
+ objectCached = false;
+ object = _locator->findObjectById(ref->getIdentity());
+ }
+
+ bool endpointsCached = true;
+ if(object)
+ {
+ DirectReferencePtr odr = DirectReferencePtr::dynamicCast(object->__reference());
+ if(odr)
+ {
+ endpointsCached = false;
+ endpoints = odr->getEndpoints();
+ }
+ else
+ {
+ IndirectReferencePtr oir = IndirectReferencePtr::dynamicCast(object->__reference());
+ assert(oir);
+ if(!oir->getAdapterId().empty())
+ {
+ endpoints = getEndpoints(oir, endpointsCached);
+ }
+ }
+ }
+
+ if(!objectCached && !endpoints.empty())
+ {
+ _table->addProxy(ref->getIdentity(), object);
+ }
+
+ cached = objectCached || endpointsCached;
+ }
}
catch(const AdapterNotFoundException&)
{
@@ -352,10 +352,10 @@ IceInternal::LocatorInfo::getEndpoints(const IndirectReferencePtr& ref, bool& ca
out << "adapter = " << ref->getAdapterId();
}
- NotRegisteredException ex(__FILE__, __LINE__);
- ex.kindOfObject = "object adapter";
- ex.id = ref->getAdapterId();
- throw ex;
+ NotRegisteredException ex(__FILE__, __LINE__);
+ ex.kindOfObject = "object adapter";
+ ex.id = ref->getAdapterId();
+ throw ex;
}
catch(const ObjectNotFoundException&)
{
@@ -367,32 +367,32 @@ IceInternal::LocatorInfo::getEndpoints(const IndirectReferencePtr& ref, bool& ca
out << "object = " << ref->getInstance()->identityToString(ref->getIdentity());
}
- NotRegisteredException ex(__FILE__, __LINE__);
- ex.kindOfObject = "object";
- ex.id = ref->getInstance()->identityToString(ref->getIdentity());
- throw ex;
+ NotRegisteredException ex(__FILE__, __LINE__);
+ ex.kindOfObject = "object";
+ ex.id = ref->getInstance()->identityToString(ref->getIdentity());
+ throw ex;
}
catch(const NotRegisteredException&)
{
- throw;
+ throw;
}
catch(const LocalException& ex)
{
- if(ref->getInstance()->traceLevels()->location >= 1)
- {
- Trace out(ref->getInstance()->initializationData().logger, ref->getInstance()->traceLevels()->locationCat);
- out << "couldn't contact the locator to retrieve adapter endpoints\n";
- if(!ref)
- {
- out << "object = " << ref->getInstance()->identityToString(ref->getIdentity()) << "\n";
- }
- else
- {
- out << "adapter = " << ref->getAdapterId() << "\n";
- }
- out << "reason = " << ex.toString();
- }
- throw;
+ if(ref->getInstance()->traceLevels()->location >= 1)
+ {
+ Trace out(ref->getInstance()->initializationData().logger, ref->getInstance()->traceLevels()->locationCat);
+ out << "couldn't contact the locator to retrieve adapter endpoints\n";
+ if(!ref)
+ {
+ out << "object = " << ref->getInstance()->identityToString(ref->getIdentity()) << "\n";
+ }
+ else
+ {
+ out << "adapter = " << ref->getAdapterId() << "\n";
+ }
+ out << "reason = " << ex.toString();
+ }
+ throw;
}
if(ref->getInstance()->traceLevels()->location >= 1)
@@ -433,25 +433,25 @@ IceInternal::LocatorInfo::clearObjectCache(const IndirectReferencePtr& ref)
{
if(ref->getAdapterId().empty())
{
- ObjectPrx object = _table->removeProxy(ref->getIdentity());
- if(object)
- {
- IndirectReferencePtr oir = IndirectReferencePtr::dynamicCast(object->__reference());
- if(oir)
- {
- if(!oir->getAdapterId().empty())
- {
- clearCache(oir);
- }
- }
- else
- {
- if(ref->getInstance()->traceLevels()->location >= 2)
- {
- trace("removed endpoints from locator table", ref, object->__reference()->getEndpoints());
- }
- }
- }
+ ObjectPrx object = _table->removeProxy(ref->getIdentity());
+ if(object)
+ {
+ IndirectReferencePtr oir = IndirectReferencePtr::dynamicCast(object->__reference());
+ if(oir)
+ {
+ if(!oir->getAdapterId().empty())
+ {
+ clearCache(oir);
+ }
+ }
+ else
+ {
+ if(ref->getInstance()->traceLevels()->location >= 2)
+ {
+ trace("removed endpoints from locator table", ref, object->__reference()->getEndpoints());
+ }
+ }
+ }
}
}
@@ -460,51 +460,51 @@ IceInternal::LocatorInfo::clearCache(const IndirectReferencePtr& ref)
{
if(!ref->getAdapterId().empty())
{
- vector<EndpointPtr> endpoints = _table->removeAdapterEndpoints(ref->getAdapterId());
+ vector<EndpointPtr> endpoints = _table->removeAdapterEndpoints(ref->getAdapterId());
- if(!endpoints.empty() && ref->getInstance()->traceLevels()->location >= 2)
- {
- trace("removed endpoints from locator table", ref, endpoints);
- }
+ if(!endpoints.empty() && ref->getInstance()->traceLevels()->location >= 2)
+ {
+ trace("removed endpoints from locator table", ref, endpoints);
+ }
}
else
{
- ObjectPrx object = _table->removeProxy(ref->getIdentity());
- if(object)
- {
- IndirectReferencePtr oir = IndirectReferencePtr::dynamicCast(object->__reference());
- if(oir)
- {
- if(!oir->getAdapterId().empty())
- {
- clearCache(oir);
- }
- }
- else
- {
- if(ref->getInstance()->traceLevels()->location >= 2)
- {
- trace("removed endpoints from locator table", ref, object->__reference()->getEndpoints());
- }
- }
- }
+ ObjectPrx object = _table->removeProxy(ref->getIdentity());
+ if(object)
+ {
+ IndirectReferencePtr oir = IndirectReferencePtr::dynamicCast(object->__reference());
+ if(oir)
+ {
+ if(!oir->getAdapterId().empty())
+ {
+ clearCache(oir);
+ }
+ }
+ else
+ {
+ if(ref->getInstance()->traceLevels()->location >= 2)
+ {
+ trace("removed endpoints from locator table", ref, object->__reference()->getEndpoints());
+ }
+ }
+ }
}
}
void
IceInternal::LocatorInfo::trace(const string& msg,
- const IndirectReferencePtr& ref,
- const vector<EndpointPtr>& endpoints)
+ const IndirectReferencePtr& ref,
+ const vector<EndpointPtr>& endpoints)
{
Trace out(ref->getInstance()->initializationData().logger, ref->getInstance()->traceLevels()->locationCat);
out << msg << "\n";
if(!ref->getAdapterId().empty())
{
- out << "adapter = " << ref->getAdapterId() << "\n";
+ out << "adapter = " << ref->getAdapterId() << "\n";
}
else
{
- out << "object = " << ref->getInstance()->identityToString(ref->getIdentity()) << "\n";
+ out << "object = " << ref->getInstance()->identityToString(ref->getIdentity()) << "\n";
}
const char* sep = endpoints.size() > 1 ? ":" : "";
diff --git a/cppe/src/IceE/LoggerI.cpp b/cppe/src/IceE/LoggerI.cpp
index f0ad2390f0d..ac09b256e03 100644
--- a/cppe/src/IceE/LoggerI.cpp
+++ b/cppe/src/IceE/LoggerI.cpp
@@ -20,7 +20,7 @@ Ice::LoggerI::LoggerI(const string& prefix)
{
if(!prefix.empty())
{
- _prefix = prefix + ": ";
+ _prefix = prefix + ": ";
}
}
@@ -45,8 +45,8 @@ Ice::LoggerI::trace(const string& category, const string& message)
string::size_type idx = 0;
while((idx = s.find("\n", idx)) != string::npos)
{
- s.insert(idx + 1, " ");
- ++idx;
+ s.insert(idx + 1, " ");
+ ++idx;
}
IceUtil::StaticMutex::Lock sync(globalMutex);
diff --git a/cppe/src/IceE/LoggerUtil.cpp b/cppe/src/IceE/LoggerUtil.cpp
index 0f59e4374ad..2dabf999fce 100644
--- a/cppe/src/IceE/LoggerUtil.cpp
+++ b/cppe/src/IceE/LoggerUtil.cpp
@@ -29,7 +29,7 @@ Ice::Print::flush()
{
if(!_str.empty())
{
- _logger->print(_str);
+ _logger->print(_str);
}
_str = "";;
}
@@ -55,7 +55,7 @@ Ice::Warning::flush()
{
if(!_str.empty())
{
- _logger->warning(_str);
+ _logger->warning(_str);
}
_str = "";
}
@@ -81,7 +81,7 @@ Ice::Error::flush()
{
if(!_str.empty())
{
- _logger->error(_str);
+ _logger->error(_str);
}
_str = "";
}
@@ -108,7 +108,7 @@ Ice::Trace::flush()
{
if(!_str.empty())
{
- _logger->trace(_category, _str);
+ _logger->trace(_category, _str);
}
_str = "";
}
diff --git a/cppe/src/IceE/Network.cpp b/cppe/src/IceE/Network.cpp
index 10d022bce57..c06e9f99251 100644
--- a/cppe/src/IceE/Network.cpp
+++ b/cppe/src/IceE/Network.cpp
@@ -161,7 +161,7 @@ IceInternal::connectionLost()
errno == ENOTCONN ||
errno == ESHUTDOWN ||
errno == ECONNABORTED ||
- errno == EPIPE;
+ errno == EPIPE;
#endif
}
@@ -183,9 +183,9 @@ IceInternal::createSocket()
fd = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);
if(fd == INVALID_SOCKET)
{
- SocketException ex(__FILE__, __LINE__);
- ex.error = getSocketErrno();
- throw ex;
+ SocketException ex(__FILE__, __LINE__);
+ ex.error = getSocketErrno();
+ throw ex;
}
setTcpNoDelay(fd);
@@ -215,18 +215,18 @@ IceInternal::closeSocket(SOCKET fd)
int error = WSAGetLastError();
if(closesocket(fd) == SOCKET_ERROR)
{
- SocketException ex(__FILE__, __LINE__);
- ex.error = getSocketErrno();
- throw ex;
+ SocketException ex(__FILE__, __LINE__);
+ ex.error = getSocketErrno();
+ throw ex;
}
WSASetLastError(error);
#else
int error = errno;
if(close(fd) == SOCKET_ERROR)
{
- SocketException ex(__FILE__, __LINE__);
- ex.error = getSocketErrno();
- throw ex;
+ SocketException ex(__FILE__, __LINE__);
+ ex.error = getSocketErrno();
+ throw ex;
}
errno = error;
#endif
@@ -237,29 +237,29 @@ IceInternal::shutdownSocketWrite(SOCKET fd)
{
if(shutdown(fd, SHUT_WR) == SOCKET_ERROR)
{
- //
- // Ignore errors indicating that we are shutdown already.
- //
+ //
+ // Ignore errors indicating that we are shutdown already.
+ //
#if defined(_WIN32)
- int error = WSAGetLastError();
- if(error == WSAENOTCONN)
- {
- return;
- }
+ int error = WSAGetLastError();
+ if(error == WSAENOTCONN)
+ {
+ return;
+ }
#elif defined(__APPLE__)
- if(errno == ENOTCONN || errno == EINVAL)
- {
- return;
- }
+ if(errno == ENOTCONN || errno == EINVAL)
+ {
+ return;
+ }
#else
- if(errno == ENOTCONN)
- {
- return;
- }
+ if(errno == ENOTCONN)
+ {
+ return;
+ }
#endif
- SocketException ex(__FILE__, __LINE__);
- ex.error = getSocketErrno();
- throw ex;
+ SocketException ex(__FILE__, __LINE__);
+ ex.error = getSocketErrno();
+ throw ex;
}
}
@@ -268,30 +268,30 @@ IceInternal::shutdownSocketReadWrite(SOCKET fd)
{
if(shutdown(fd, SHUT_RDWR) == SOCKET_ERROR)
{
- //
- // Ignore errors indicating that we are shutdown already.
- //
+ //
+ // Ignore errors indicating that we are shutdown already.
+ //
#if defined(_WIN32)
- int error = WSAGetLastError();
- if(error == WSAENOTCONN)
- {
- return;
- }
+ int error = WSAGetLastError();
+ if(error == WSAENOTCONN)
+ {
+ return;
+ }
#elif defined(__APPLE__)
- if(errno == ENOTCONN || errno == EINVAL)
- {
- return;
- }
+ if(errno == ENOTCONN || errno == EINVAL)
+ {
+ return;
+ }
#else
- if(errno == ENOTCONN)
- {
- return;
- }
+ if(errno == ENOTCONN)
+ {
+ return;
+ }
#endif
- SocketException ex(__FILE__, __LINE__);
- ex.error = getSocketErrno();
- throw ex;
+ SocketException ex(__FILE__, __LINE__);
+ ex.error = getSocketErrno();
+ throw ex;
}
}
@@ -301,46 +301,46 @@ IceInternal::setBlock(SOCKET fd, bool block)
if(block)
{
#ifdef _WIN32
- unsigned long arg = 0;
- if(ioctlsocket(fd, FIONBIO, &arg) == SOCKET_ERROR)
+ unsigned long arg = 0;
+ if(ioctlsocket(fd, FIONBIO, &arg) == SOCKET_ERROR)
{
- closeSocketNoThrow(fd);
- SocketException ex(__FILE__, __LINE__);
- ex.error = WSAGetLastError();
- throw ex;
+ closeSocketNoThrow(fd);
+ SocketException ex(__FILE__, __LINE__);
+ ex.error = WSAGetLastError();
+ throw ex;
}
#else
- int flags = fcntl(fd, F_GETFL);
- flags &= ~O_NONBLOCK;
- if(fcntl(fd, F_SETFL, flags) == SOCKET_ERROR)
+ int flags = fcntl(fd, F_GETFL);
+ flags &= ~O_NONBLOCK;
+ if(fcntl(fd, F_SETFL, flags) == SOCKET_ERROR)
{
- closeSocketNoThrow(fd);
- SocketException ex(__FILE__, __LINE__);
- ex.error = errno;
- throw ex;
+ closeSocketNoThrow(fd);
+ SocketException ex(__FILE__, __LINE__);
+ ex.error = errno;
+ throw ex;
}
#endif
}
else
{
#ifdef _WIN32
- unsigned long arg = 1;
- if(ioctlsocket(fd, FIONBIO, &arg) == SOCKET_ERROR)
+ unsigned long arg = 1;
+ if(ioctlsocket(fd, FIONBIO, &arg) == SOCKET_ERROR)
{
- closeSocketNoThrow(fd);
- SocketException ex(__FILE__, __LINE__);
- ex.error = WSAGetLastError();
- throw ex;
+ closeSocketNoThrow(fd);
+ SocketException ex(__FILE__, __LINE__);
+ ex.error = WSAGetLastError();
+ throw ex;
}
#else
- int flags = fcntl(fd, F_GETFL);
- flags |= O_NONBLOCK;
- if(fcntl(fd, F_SETFL, flags) == SOCKET_ERROR)
+ int flags = fcntl(fd, F_GETFL);
+ flags |= O_NONBLOCK;
+ if(fcntl(fd, F_SETFL, flags) == SOCKET_ERROR)
{
- closeSocketNoThrow(fd);
- SocketException ex(__FILE__, __LINE__);
- ex.error = errno;
- throw ex;
+ closeSocketNoThrow(fd);
+ SocketException ex(__FILE__, __LINE__);
+ ex.error = errno;
+ throw ex;
}
#endif
}
@@ -361,10 +361,10 @@ IceInternal::setTimeout(SOCKET fd, bool recv, int timeout)
if(setsockopt(fd, SOL_SOCKET, recv ? SO_RCVTIMEO : SO_SNDTIMEO, (char*)&tt, (int)sizeof(int)) == SOCKET_ERROR)
#endif
{
- closeSocketNoThrow(fd);
- SocketException ex(__FILE__, __LINE__);
- ex.error = getSocketErrno();
- throw ex;
+ closeSocketNoThrow(fd);
+ SocketException ex(__FILE__, __LINE__);
+ ex.error = getSocketErrno();
+ throw ex;
}
}
#endif
@@ -375,10 +375,10 @@ IceInternal::setTcpNoDelay(SOCKET fd)
int flag = 1;
if(setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, (char*)&flag, int(sizeof(int))) == SOCKET_ERROR)
{
- closeSocketNoThrow(fd);
- SocketException ex(__FILE__, __LINE__);
- ex.error = getSocketErrno();
- throw ex;
+ closeSocketNoThrow(fd);
+ SocketException ex(__FILE__, __LINE__);
+ ex.error = getSocketErrno();
+ throw ex;
}
}
@@ -388,10 +388,10 @@ IceInternal::setKeepAlive(SOCKET fd)
int flag = 1;
if(setsockopt(fd, SOL_SOCKET, SO_KEEPALIVE, (char*)&flag, int(sizeof(int))) == SOCKET_ERROR)
{
- closeSocketNoThrow(fd);
- SocketException ex(__FILE__, __LINE__);
- ex.error = getSocketErrno();
- throw ex;
+ closeSocketNoThrow(fd);
+ SocketException ex(__FILE__, __LINE__);
+ ex.error = getSocketErrno();
+ throw ex;
}
}
@@ -467,10 +467,10 @@ IceInternal::doBind(SOCKET fd, struct sockaddr_in& addr)
{
if(bind(fd, reinterpret_cast<struct sockaddr*>(&addr), int(sizeof(addr))) == SOCKET_ERROR)
{
- closeSocketNoThrow(fd);
- SocketException ex(__FILE__, __LINE__);
- ex.error = getSocketErrno();
- throw ex;
+ closeSocketNoThrow(fd);
+ SocketException ex(__FILE__, __LINE__);
+ ex.error = getSocketErrno();
+ throw ex;
}
socklen_t len = static_cast<socklen_t>(sizeof(addr));
@@ -495,188 +495,188 @@ IceInternal::doConnect(SOCKET fd, struct sockaddr_in& addr, int timeout)
WSAEVENT event = WSACreateEvent();
if(event == 0)
{
- closeSocketNoThrow(fd);
+ closeSocketNoThrow(fd);
- SocketException ex(__FILE__, __LINE__);
- ex.error = WSAGetLastError();
- throw ex;
+ SocketException ex(__FILE__, __LINE__);
+ ex.error = WSAGetLastError();
+ throw ex;
}
if(WSAEventSelect(fd, event, FD_CONNECT) == SOCKET_ERROR)
{
- int error = WSAGetLastError();
+ int error = WSAGetLastError();
- WSACloseEvent(event);
- closeSocketNoThrow(fd);
+ WSACloseEvent(event);
+ closeSocketNoThrow(fd);
- SocketException ex(__FILE__, __LINE__);
- ex.error = error;
- throw ex;
+ SocketException ex(__FILE__, __LINE__);
+ ex.error = error;
+ throw ex;
}
#endif
repeatConnect:
if(::connect(fd, reinterpret_cast<struct sockaddr*>(&addr), int(sizeof(addr))) == SOCKET_ERROR)
{
- if(interrupted())
- {
- goto repeatConnect;
- }
-
- if(connectInProgress())
- {
- int val;
+ if(interrupted())
+ {
+ goto repeatConnect;
+ }
+
+ if(connectInProgress())
+ {
+ int val;
#ifdef _WIN32
- WSAEVENT events[1];
- events[0] = event;
- long tout = (timeout >= 0) ? timeout : WSA_INFINITE;
- DWORD rc = WSAWaitForMultipleEvents(1, events, FALSE, tout, FALSE);
- if(rc == WSA_WAIT_FAILED)
- {
- int error = WSAGetLastError();
-
- WSACloseEvent(event);
- closeSocketNoThrow(fd);
-
- SocketException ex(__FILE__, __LINE__);
- ex.error = error;
- throw ex;
- }
-
- if(rc == WSA_WAIT_TIMEOUT)
- {
- WSACloseEvent(event);
- closeSocketNoThrow(fd);
-
- assert(timeout >= 0);
- throw ConnectTimeoutException(__FILE__, __LINE__);
- }
- assert(rc == WSA_WAIT_EVENT_0);
-
- WSANETWORKEVENTS nevents;
- if(WSAEnumNetworkEvents(fd, event, &nevents) == SOCKET_ERROR)
- {
- int error = WSAGetLastError();
- WSACloseEvent(event);
- closeSocketNoThrow(fd);
-
- SocketException ex(__FILE__, __LINE__);
- ex.error = error;
- throw ex;
- }
-
- //
- // This is necessary to be able to set the socket in blocking mode.
- //
- if(WSAEventSelect(fd, event, 0) == SOCKET_ERROR)
- {
- int error = WSAGetLastError();
-
- WSACloseEvent(event);
- closeSocketNoThrow(fd);
-
- SocketException ex(__FILE__, __LINE__);
- ex.error = error;
- throw ex;
- }
-
- //
- // Now we close the event, because we're finished and
- // this code be repeated.
- //
- WSACloseEvent(event);
-
- assert(nevents.lNetworkEvents & FD_CONNECT);
- val = nevents.iErrorCode[FD_CONNECT_BIT];
+ WSAEVENT events[1];
+ events[0] = event;
+ long tout = (timeout >= 0) ? timeout : WSA_INFINITE;
+ DWORD rc = WSAWaitForMultipleEvents(1, events, FALSE, tout, FALSE);
+ if(rc == WSA_WAIT_FAILED)
+ {
+ int error = WSAGetLastError();
+
+ WSACloseEvent(event);
+ closeSocketNoThrow(fd);
+
+ SocketException ex(__FILE__, __LINE__);
+ ex.error = error;
+ throw ex;
+ }
+
+ if(rc == WSA_WAIT_TIMEOUT)
+ {
+ WSACloseEvent(event);
+ closeSocketNoThrow(fd);
+
+ assert(timeout >= 0);
+ throw ConnectTimeoutException(__FILE__, __LINE__);
+ }
+ assert(rc == WSA_WAIT_EVENT_0);
+
+ WSANETWORKEVENTS nevents;
+ if(WSAEnumNetworkEvents(fd, event, &nevents) == SOCKET_ERROR)
+ {
+ int error = WSAGetLastError();
+ WSACloseEvent(event);
+ closeSocketNoThrow(fd);
+
+ SocketException ex(__FILE__, __LINE__);
+ ex.error = error;
+ throw ex;
+ }
+
+ //
+ // This is necessary to be able to set the socket in blocking mode.
+ //
+ if(WSAEventSelect(fd, event, 0) == SOCKET_ERROR)
+ {
+ int error = WSAGetLastError();
+
+ WSACloseEvent(event);
+ closeSocketNoThrow(fd);
+
+ SocketException ex(__FILE__, __LINE__);
+ ex.error = error;
+ throw ex;
+ }
+
+ //
+ // Now we close the event, because we're finished and
+ // this code be repeated.
+ //
+ WSACloseEvent(event);
+
+ assert(nevents.lNetworkEvents & FD_CONNECT);
+ val = nevents.iErrorCode[FD_CONNECT_BIT];
#else
repeatPoll:
struct pollfd pollFd[1];
pollFd[0].fd = fd;
pollFd[0].events = POLLOUT;
int ret = ::poll(pollFd, 1, timeout);
- if(ret == 0)
- {
- closeSocketNoThrow(fd);
- throw ConnectTimeoutException(__FILE__, __LINE__);
- }
- else if(ret == SOCKET_ERROR)
- {
- if(interrupted())
- {
- goto repeatPoll;
- }
-
- SocketException ex(__FILE__, __LINE__);
- ex.error = getSocketErrno();
- throw ex;
- }
-
+ if(ret == 0)
+ {
+ closeSocketNoThrow(fd);
+ throw ConnectTimeoutException(__FILE__, __LINE__);
+ }
+ else if(ret == SOCKET_ERROR)
+ {
+ if(interrupted())
+ {
+ goto repeatPoll;
+ }
+
+ SocketException ex(__FILE__, __LINE__);
+ ex.error = getSocketErrno();
+ throw ex;
+ }
+
//
// Strange windows bug: The following call to Sleep() is
// necessary, otherwise no error is reported through
// getsockopt.
//
//Sleep(0);
- socklen_t len = static_cast<socklen_t>(sizeof(int));
- if(getsockopt(fd, SOL_SOCKET, SO_ERROR, reinterpret_cast<char*>(&val), &len) == SOCKET_ERROR)
- {
- closeSocketNoThrow(fd);
- SocketException ex(__FILE__, __LINE__);
- ex.error = getSocketErrno();
- throw ex;
- }
+ socklen_t len = static_cast<socklen_t>(sizeof(int));
+ if(getsockopt(fd, SOL_SOCKET, SO_ERROR, reinterpret_cast<char*>(&val), &len) == SOCKET_ERROR)
+ {
+ closeSocketNoThrow(fd);
+ SocketException ex(__FILE__, __LINE__);
+ ex.error = getSocketErrno();
+ throw ex;
+ }
#endif
- if(val > 0)
- {
- closeSocketNoThrow(fd);
+ if(val > 0)
+ {
+ closeSocketNoThrow(fd);
#ifdef _WIN32
- WSASetLastError(val);
+ WSASetLastError(val);
#else
- errno = val;
+ errno = val;
#endif
- if(connectionRefused())
- {
- ConnectionRefusedException ex(__FILE__, __LINE__);
- ex.error = getSocketErrno();
- throw ex;
- }
- else if(connectFailed())
- {
- ConnectFailedException ex(__FILE__, __LINE__);
- ex.error = getSocketErrno();
- throw ex;
- }
- else
- {
- SocketException ex(__FILE__, __LINE__);
- ex.error = getSocketErrno();
- throw ex;
- }
- }
-
- return;
- }
+ if(connectionRefused())
+ {
+ ConnectionRefusedException ex(__FILE__, __LINE__);
+ ex.error = getSocketErrno();
+ throw ex;
+ }
+ else if(connectFailed())
+ {
+ ConnectFailedException ex(__FILE__, __LINE__);
+ ex.error = getSocketErrno();
+ throw ex;
+ }
+ else
+ {
+ SocketException ex(__FILE__, __LINE__);
+ ex.error = getSocketErrno();
+ throw ex;
+ }
+ }
+
+ return;
+ }
- closeSocketNoThrow(fd);
- if(connectionRefused())
- {
- ConnectionRefusedException ex(__FILE__, __LINE__);
- ex.error = getSocketErrno();
- throw ex;
- }
- else if(connectFailed())
- {
- ConnectFailedException ex(__FILE__, __LINE__);
- ex.error = getSocketErrno();
- throw ex;
- }
- else
- {
- SocketException ex(__FILE__, __LINE__);
- ex.error = getSocketErrno();
- throw ex;
- }
+ closeSocketNoThrow(fd);
+ if(connectionRefused())
+ {
+ ConnectionRefusedException ex(__FILE__, __LINE__);
+ ex.error = getSocketErrno();
+ throw ex;
+ }
+ else if(connectFailed())
+ {
+ ConnectFailedException ex(__FILE__, __LINE__);
+ ex.error = getSocketErrno();
+ throw ex;
+ }
+ else
+ {
+ SocketException ex(__FILE__, __LINE__);
+ ex.error = getSocketErrno();
+ throw ex;
+ }
}
}
@@ -692,59 +692,59 @@ IceInternal::getAddress(const string& host, int port, struct sockaddr_in& addr)
{
#ifdef _WIN32
- //
- // Windows XP has getaddrinfo(), but we don't want to require XP to run IceE.
- //
-
- //
- // gethostbyname() is thread safe on Windows, with a separate hostent per thread
- //
- struct hostent* entry;
- int retry = 5;
- do
- {
- entry = gethostbyname(host.c_str());
- }
- while(entry == 0 && WSAGetLastError() == WSATRY_AGAIN && --retry >= 0);
-
- if(entry == 0)
- {
- DNSException ex(__FILE__, __LINE__);
-
- ex.error = WSAGetLastError();
- ex.host = host;
- throw ex;
- }
- memcpy(&addr.sin_addr, entry->h_addr, entry->h_length);
+ //
+ // Windows XP has getaddrinfo(), but we don't want to require XP to run IceE.
+ //
+
+ //
+ // gethostbyname() is thread safe on Windows, with a separate hostent per thread
+ //
+ struct hostent* entry;
+ int retry = 5;
+ do
+ {
+ entry = gethostbyname(host.c_str());
+ }
+ while(entry == 0 && WSAGetLastError() == WSATRY_AGAIN && --retry >= 0);
+
+ if(entry == 0)
+ {
+ DNSException ex(__FILE__, __LINE__);
+
+ ex.error = WSAGetLastError();
+ ex.host = host;
+ throw ex;
+ }
+ memcpy(&addr.sin_addr, entry->h_addr, entry->h_length);
#else
- struct addrinfo* info = 0;
- int retry = 5;
-
- struct addrinfo hints = { 0 };
- hints.ai_family = PF_INET;
-
- int rs = 0;
- do
- {
- rs = getaddrinfo(host.c_str(), 0, &hints, &info);
- }
- while(info == 0 && rs == EAI_AGAIN && --retry >= 0);
-
- if(rs != 0)
- {
- DNSException ex(__FILE__, __LINE__);
- ex.error = rs;
- ex.host = host;
- throw ex;
- }
-
- assert(info->ai_family == PF_INET);
- struct sockaddr_in* sin = reinterpret_cast<sockaddr_in*>(info->ai_addr);
-
- addr.sin_addr.s_addr = sin->sin_addr.s_addr;
- freeaddrinfo(info);
+ struct addrinfo* info = 0;
+ int retry = 5;
+
+ struct addrinfo hints = { 0 };
+ hints.ai_family = PF_INET;
+
+ int rs = 0;
+ do
+ {
+ rs = getaddrinfo(host.c_str(), 0, &hints, &info);
+ }
+ while(info == 0 && rs == EAI_AGAIN && --retry >= 0);
+
+ if(rs != 0)
+ {
+ DNSException ex(__FILE__, __LINE__);
+ ex.error = rs;
+ ex.host = host;
+ throw ex;
+ }
+
+ assert(info->ai_family == PF_INET);
+ struct sockaddr_in* sin = reinterpret_cast<sockaddr_in*>(info->ai_addr);
+
+ addr.sin_addr.s_addr = sin->sin_addr.s_addr;
+ freeaddrinfo(info);
#endif
}
@@ -765,24 +765,24 @@ IceInternal::errorToString(int error)
#ifndef _WIN32_WCE
if(error < WSABASEERR)
{
- LPVOID lpMsgBuf = 0;
- DWORD ok = FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
- FORMAT_MESSAGE_FROM_SYSTEM |
- FORMAT_MESSAGE_IGNORE_INSERTS,
- NULL,
- error,
- MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
- (LPTSTR)&lpMsgBuf,
- 0,
- NULL);
- if(ok)
- {
- LPCTSTR msg = (LPCTSTR)lpMsgBuf;
- assert(msg && strlen((const char*)msg) > 0);
- string result = (const char*)msg;
- LocalFree(lpMsgBuf);
- return result;
- }
+ LPVOID lpMsgBuf = 0;
+ DWORD ok = FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
+ FORMAT_MESSAGE_FROM_SYSTEM |
+ FORMAT_MESSAGE_IGNORE_INSERTS,
+ NULL,
+ error,
+ MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
+ (LPTSTR)&lpMsgBuf,
+ 0,
+ NULL);
+ if(ok)
+ {
+ LPCTSTR msg = (LPCTSTR)lpMsgBuf;
+ assert(msg && strlen((const char*)msg) > 0);
+ string result = (const char*)msg;
+ LocalFree(lpMsgBuf);
+ return result;
+ }
}
#endif
@@ -826,17 +826,17 @@ IceInternal::fdToString(SOCKET fd)
{
if(fd == INVALID_SOCKET)
{
- return "<closed>";
+ return "<closed>";
}
socklen_t localLen = static_cast<socklen_t>(sizeof(struct sockaddr_in));
struct sockaddr_in localAddr;
if(getsockname(fd, reinterpret_cast<struct sockaddr*>(&localAddr), &localLen) == SOCKET_ERROR)
{
- closeSocketNoThrow(fd);
- SocketException ex(__FILE__, __LINE__);
- ex.error = getSocketErrno();
- throw ex;
+ closeSocketNoThrow(fd);
+ SocketException ex(__FILE__, __LINE__);
+ ex.error = getSocketErrno();
+ throw ex;
}
bool peerNotConnected = false;
@@ -844,17 +844,17 @@ IceInternal::fdToString(SOCKET fd)
struct sockaddr_in remoteAddr;
if(getpeername(fd, reinterpret_cast<struct sockaddr*>(&remoteAddr), &remoteLen) == SOCKET_ERROR)
{
- if(notConnected())
- {
- peerNotConnected = true;
- }
- else
- {
- closeSocketNoThrow(fd);
- SocketException ex(__FILE__, __LINE__);
- ex.error = getSocketErrno();
- throw ex;
- }
+ if(notConnected())
+ {
+ peerNotConnected = true;
+ }
+ else
+ {
+ closeSocketNoThrow(fd);
+ SocketException ex(__FILE__, __LINE__);
+ ex.error = getSocketErrno();
+ throw ex;
+ }
}
string s;
@@ -862,12 +862,12 @@ IceInternal::fdToString(SOCKET fd)
s += addrToString(localAddr);
if(peerNotConnected)
{
- s += "\nremote address = <not connected>";
+ s += "\nremote address = <not connected>";
}
else
{
- s += "\nremote address = ";
- s += addrToString(remoteAddr);
+ s += "\nremote address = ";
+ s += addrToString(remoteAddr);
}
return s;
}
@@ -889,7 +889,7 @@ IceInternal::acceptInterrupted()
{
if(interrupted())
{
- return true;
+ return true;
}
#ifdef _WIN32
@@ -912,14 +912,14 @@ IceInternal::doAccept(SOCKET fd)
repeatAccept:
if((ret = ::accept(fd, 0, 0)) == INVALID_SOCKET)
{
- if(acceptInterrupted())
- {
- goto repeatAccept;
- }
-
- SocketException ex(__FILE__, __LINE__);
- ex.error = getSocketErrno();
- throw ex;
+ if(acceptInterrupted())
+ {
+ goto repeatAccept;
+ }
+
+ SocketException ex(__FILE__, __LINE__);
+ ex.error = getSocketErrno();
+ throw ex;
}
setTcpNoDelay(ret);
@@ -933,15 +933,15 @@ IceInternal::doListen(SOCKET fd, int backlog)
repeatListen:
if(::listen(fd, backlog) == SOCKET_ERROR)
{
- if(interrupted())
- {
- goto repeatListen;
- }
-
- closeSocketNoThrow(fd);
- SocketException ex(__FILE__, __LINE__);
- ex.error = getSocketErrno();
- throw ex;
+ if(interrupted())
+ {
+ goto repeatListen;
+ }
+
+ closeSocketNoThrow(fd);
+ SocketException ex(__FILE__, __LINE__);
+ ex.error = getSocketErrno();
+ throw ex;
}
}
@@ -989,7 +989,7 @@ IceInternal::getLocalHosts()
for (int i = 0; i < addrs->iAddressCount; ++i)
{
result.push_back(
- inetAddrToString(reinterpret_cast<struct sockaddr_in*>(addrs->Address[i].lpSockaddr)->sin_addr));
+ inetAddrToString(reinterpret_cast<struct sockaddr_in*>(addrs->Address[i].lpSockaddr)->sin_addr));
}
//
diff --git a/cppe/src/IceE/Object.cpp b/cppe/src/IceE/Object.cpp
index df169ea057e..025db36ba10 100644
--- a/cppe/src/IceE/Object.cpp
+++ b/cppe/src/IceE/Object.cpp
@@ -126,31 +126,31 @@ DispatchStatus
Ice::Object::__dispatch(Incoming& in, const Current& current)
{
pair<string*, string*> r =
- equal_range(__all, __all + sizeof(__all) / sizeof(string), current.operation);
+ equal_range(__all, __all + sizeof(__all) / sizeof(string), current.operation);
if(r.first == r.second)
{
- throw OperationNotExistException(__FILE__, __LINE__, current.id, current.facet, current.operation);
- }
+ throw OperationNotExistException(__FILE__, __LINE__, current.id, current.facet, current.operation);
+ }
switch(r.first - __all)
{
case 0:
{
- return ___ice_id(in, current);
+ return ___ice_id(in, current);
}
case 1:
{
- return ___ice_ids(in, current);
+ return ___ice_ids(in, current);
}
case 2:
- {
- return ___ice_isA(in, current);
- }
- case 3:
- {
- return ___ice_ping(in, current);
- }
+ {
+ return ___ice_isA(in, current);
+ }
+ case 3:
+ {
+ return ___ice_ping(in, current);
+ }
}
assert(false);
@@ -163,13 +163,13 @@ operationModeToString(OperationMode mode)
switch(mode)
{
case Normal:
- return "::Ice::Normal";
+ return "::Ice::Normal";
case Nonmutating:
- return "::Ice::Nonmutating";
+ return "::Ice::Nonmutating";
case Idempotent:
- return "::Ice::Idempotent";
+ return "::Ice::Idempotent";
}
return "???";
@@ -182,22 +182,22 @@ Ice::Object::__invalidMode(OperationMode expected, OperationMode received)
if(expected == Idempotent && received == Nonmutating)
{
- //
- // Fine: typically an old client still using the deprecated nonmutating keyword
- //
-
- //
- // Note that expected == Nonmutating and received == Idempotent is not ok:
- // the server may still use the deprecated nonmutating keyword to detect updates
- // and the client should not break this (deprecated) feature.
- //
+ //
+ // Fine: typically an old client still using the deprecated nonmutating keyword
+ //
+
+ //
+ // Note that expected == Nonmutating and received == Idempotent is not ok:
+ // the server may still use the deprecated nonmutating keyword to detect updates
+ // and the client should not break this (deprecated) feature.
+ //
}
else
{
- Ice::MarshalException ex(__FILE__, __LINE__);
- ex.reason = Ice::printfToString("unexpected operation mode. expected = %s received = %s",
- operationModeToString(expected), operationModeToString(received));
- throw ex;
+ Ice::MarshalException ex(__FILE__, __LINE__);
+ ex.reason = Ice::printfToString("unexpected operation mode. expected = %s received = %s",
+ operationModeToString(expected), operationModeToString(received));
+ throw ex;
}
}
@@ -212,10 +212,10 @@ Ice::Blobject::__dispatch(Incoming& in, const Current& current)
in.os()->writeBlob(outParams);
if(ok)
{
- return DispatchOK;
+ return DispatchOK;
}
else
{
- return DispatchUserException;
+ return DispatchUserException;
}
}
diff --git a/cppe/src/IceE/ObjectAdapter.cpp b/cppe/src/IceE/ObjectAdapter.cpp
index 2148ecc74bb..a67f4b59a71 100644
--- a/cppe/src/IceE/ObjectAdapter.cpp
+++ b/cppe/src/IceE/ObjectAdapter.cpp
@@ -67,80 +67,80 @@ Ice::ObjectAdapter::activate()
bool printAdapterReady = false;
{
- IceUtil::Monitor<IceUtil::RecMutex>::Lock sync(*this);
-
- checkForDeactivation();
-
- //
- // If the one off initializations of the adapter are already
- // done, we just need to activate the incoming connection
- // factories and we're done.
- //
- if(_activateOneOffDone)
- {
- for_each(_incomingConnectionFactories.begin(), _incomingConnectionFactories.end(),
- Ice::voidMemFun(&IncomingConnectionFactory::activate));
- return;
- }
-
- //
- // One off initializations of the adapter: update the locator
- // registry and print the "adapter ready" message. We set the
- // _waitForActivate flag to prevent deactivation from other
- // threads while these one off initializations are done.
- //
- _waitForActivate = true;
+ IceUtil::Monitor<IceUtil::RecMutex>::Lock sync(*this);
+
+ checkForDeactivation();
+
+ //
+ // If the one off initializations of the adapter are already
+ // done, we just need to activate the incoming connection
+ // factories and we're done.
+ //
+ if(_activateOneOffDone)
+ {
+ for_each(_incomingConnectionFactories.begin(), _incomingConnectionFactories.end(),
+ Ice::voidMemFun(&IncomingConnectionFactory::activate));
+ return;
+ }
+
+ //
+ // One off initializations of the adapter: update the locator
+ // registry and print the "adapter ready" message. We set the
+ // _waitForActivate flag to prevent deactivation from other
+ // threads while these one off initializations are done.
+ //
+ _waitForActivate = true;
#ifdef ICEE_HAS_LOCATOR
- locatorInfo = _locatorInfo;
+ locatorInfo = _locatorInfo;
#endif
- printAdapterReady = _instance->initializationData().properties->getPropertyAsInt("Ice.PrintAdapterReady") > 0;
+ printAdapterReady = _instance->initializationData().properties->getPropertyAsInt("Ice.PrintAdapterReady") > 0;
}
#ifdef ICEE_HAS_LOCATOR
try
{
- Ice::Identity dummy;
- dummy.name = "dummy";
- updateLocatorRegistry(locatorInfo, createDirectProxy(dummy));
+ Ice::Identity dummy;
+ dummy.name = "dummy";
+ updateLocatorRegistry(locatorInfo, createDirectProxy(dummy));
}
catch(const Ice::LocalException&)
{
- //
- // If we couldn't update the locator registry, we let the
- // exception go through and don't activate the adapter to
- // allow to user code to retry activating the adapter
- // later.
- //
- {
- IceUtil::Monitor<IceUtil::RecMutex>::Lock sync(*this);
- _waitForActivate = false;
- notifyAll();
- }
- throw;
+ //
+ // If we couldn't update the locator registry, we let the
+ // exception go through and don't activate the adapter to
+ // allow to user code to retry activating the adapter
+ // later.
+ //
+ {
+ IceUtil::Monitor<IceUtil::RecMutex>::Lock sync(*this);
+ _waitForActivate = false;
+ notifyAll();
+ }
+ throw;
}
#endif
if(printAdapterReady)
{
- printf("%s ready\n", _name.c_str());
- fflush(stdout);
+ printf("%s ready\n", _name.c_str());
+ fflush(stdout);
}
{
- IceUtil::Monitor<IceUtil::RecMutex>::Lock sync(*this);
- assert(!_deactivated); // Not possible if _waitForActivate = true;
+ IceUtil::Monitor<IceUtil::RecMutex>::Lock sync(*this);
+ assert(!_deactivated); // Not possible if _waitForActivate = true;
- //
- // Signal threads waiting for the activation.
- //
- _waitForActivate = false;
- notifyAll();
+ //
+ // Signal threads waiting for the activation.
+ //
+ _waitForActivate = false;
+ notifyAll();
- _activateOneOffDone = true;
+ _activateOneOffDone = true;
- for_each(_incomingConnectionFactories.begin(), _incomingConnectionFactories.end(),
- Ice::voidMemFun(&IncomingConnectionFactory::activate));
+ for_each(_incomingConnectionFactories.begin(), _incomingConnectionFactories.end(),
+ Ice::voidMemFun(&IncomingConnectionFactory::activate));
}
}
@@ -150,9 +150,9 @@ Ice::ObjectAdapter::hold()
IceUtil::Monitor<IceUtil::RecMutex>::Lock sync(*this);
checkForDeactivation();
-
+
for_each(_incomingConnectionFactories.begin(), _incomingConnectionFactories.end(),
- Ice::voidMemFun(&IncomingConnectionFactory::hold));
+ Ice::voidMemFun(&IncomingConnectionFactory::hold));
}
void
@@ -163,7 +163,7 @@ Ice::ObjectAdapter::waitForHold()
checkForDeactivation();
for_each(_incomingConnectionFactories.begin(), _incomingConnectionFactories.end(),
- Ice::constVoidMemFun(&IncomingConnectionFactory::waitUntilHolding));
+ Ice::constVoidMemFun(&IncomingConnectionFactory::waitUntilHolding));
}
void
@@ -176,25 +176,25 @@ Ice::ObjectAdapter::deactivate()
#endif
{
- IceUtil::Monitor<IceUtil::RecMutex>::Lock sync(*this);
-
- //
- // Ignore deactivation requests if the object adapter has already
- // been deactivated.
- //
- if(_deactivated)
- {
- return;
- }
-
- //
- // Wait for activation to complete. This is necessary to not
- // get out of order locator updates.
- //
- while(_waitForActivate)
- {
- wait();
- }
+ IceUtil::Monitor<IceUtil::RecMutex>::Lock sync(*this);
+
+ //
+ // Ignore deactivation requests if the object adapter has already
+ // been deactivated.
+ //
+ if(_deactivated)
+ {
+ return;
+ }
+
+ //
+ // Wait for activation to complete. This is necessary to not
+ // get out of order locator updates.
+ //
+ while(_waitForActivate)
+ {
+ wait();
+ }
#ifdef ICEE_HAS_ROUTER
if(_routerInfo)
@@ -212,27 +212,27 @@ Ice::ObjectAdapter::deactivate()
#endif
incomingConnectionFactories = _incomingConnectionFactories;
- outgoingConnectionFactory = _instance->outgoingConnectionFactory();
+ outgoingConnectionFactory = _instance->outgoingConnectionFactory();
#ifdef ICEE_HAS_LOCATOR
- locatorInfo = _locatorInfo;
+ locatorInfo = _locatorInfo;
#endif
- _deactivated = true;
-
- notifyAll();
+ _deactivated = true;
+
+ notifyAll();
}
#ifdef ICEE_HAS_LOCATOR
try
{
- updateLocatorRegistry(locatorInfo, 0);
+ updateLocatorRegistry(locatorInfo, 0);
}
catch(const Ice::LocalException&)
{
- //
- // We can't throw exceptions in deactivate so we ignore
- // failures to update the locator registry.
- //
+ //
+ // We can't throw exceptions in deactivate so we ignore
+ // failures to update the locator registry.
+ //
}
#endif
@@ -242,7 +242,7 @@ Ice::ObjectAdapter::deactivate()
// message.
//
for_each(incomingConnectionFactories.begin(), incomingConnectionFactories.end(),
- Ice::voidMemFun(&IncomingConnectionFactory::destroy));
+ Ice::voidMemFun(&IncomingConnectionFactory::destroy));
//
// Must be called outside the thread synchronization, because
@@ -523,8 +523,8 @@ Ice::ObjectAdapter::createReverseProxy(const Identity& ident) const
vector<IncomingConnectionFactoryPtr>::const_iterator p;
for(p = _incomingConnectionFactories.begin(); p != _incomingConnectionFactories.end(); ++p)
{
- list<ConnectionPtr> cons = (*p)->connections();
- copy(cons.begin(), cons.end(), back_inserter(connections));
+ list<ConnectionPtr> cons = (*p)->connections();
+ copy(cons.begin(), cons.end(), back_inserter(connections));
}
//
@@ -533,7 +533,7 @@ Ice::ObjectAdapter::createReverseProxy(const Identity& ident) const
//
vector<EndpointPtr> endpoints;
ReferencePtr ref = _instance->referenceFactory()->create(ident, Ice::Context(), "", ReferenceModeTwoway,
- connections);
+ connections);
return _instance->proxyFactory()->referenceToProxy(ref);
}
@@ -554,8 +554,8 @@ Ice::ObjectAdapter::flushBatchRequests()
{
vector<IncomingConnectionFactoryPtr> f;
{
- IceUtil::Monitor<IceUtil::RecMutex>::Lock sync(*this);
- f = _incomingConnectionFactories;
+ IceUtil::Monitor<IceUtil::RecMutex>::Lock sync(*this);
+ f = _incomingConnectionFactories;
}
for_each(f.begin(), f.end(), Ice::voidMemFun(&IncomingConnectionFactory::flushBatchRequests));
}
@@ -583,7 +583,7 @@ Ice::ObjectAdapter::decDirectCount()
assert(_directCount > 0);
if(--_directCount == 0)
{
- notifyAll();
+ notifyAll();
}
}
@@ -597,12 +597,12 @@ Ice::ObjectAdapter::getServantManager() const
}
Ice::ObjectAdapter::ObjectAdapter(const InstancePtr& instance, const CommunicatorPtr& communicator,
- const ObjectAdapterFactoryPtr& objectAdapterFactory,
- const string& name, const string& endpointInfo
+ const ObjectAdapterFactoryPtr& objectAdapterFactory,
+ const string& name, const string& endpointInfo
#ifdef ICEE_HAS_ROUTER
- , const RouterPrx& router
+ , const RouterPrx& router
#endif
- ) :
+ ) :
_deactivated(false),
_instance(instance),
_communicator(communicator),
@@ -670,36 +670,36 @@ Ice::ObjectAdapter::ObjectAdapter(const InstancePtr& instance, const Communicato
//
_instance->outgoingConnectionFactory()->setRouterInfo(_routerInfo);
}
- }
- else
+ }
+ else
#endif
- {
- //
- // Parse the endpoints, but don't store them in the adapter.
- // The connection factory might change it, for example, to
- // fill in the real port number.
- //
- vector<EndpointPtr> endpoints = parseEndpoints(endpointInfo);
- for(vector<EndpointPtr>::iterator p = endpoints.begin(); p != endpoints.end(); ++p)
- {
- _incomingConnectionFactories.push_back(new IncomingConnectionFactory(_instance, *p, this));
- }
- if(endpoints.empty())
- {
- TraceLevelsPtr tl = _instance->traceLevels();
- if(tl->network >= 2)
- {
- Trace out(_instance->initializationData().logger, tl->networkCat);
- out << "created adapter `" << name << "' without endpoints";
- }
- }
-
- //
- // Parse published endpoints. These are used in proxies
- // instead of the connection factory endpoints.
- //
- string endpts = _instance->initializationData().properties->getProperty(name + ".PublishedEndpoints");
- _publishedEndpoints = parseEndpoints(endpts);
+ {
+ //
+ // Parse the endpoints, but don't store them in the adapter.
+ // The connection factory might change it, for example, to
+ // fill in the real port number.
+ //
+ vector<EndpointPtr> endpoints = parseEndpoints(endpointInfo);
+ for(vector<EndpointPtr>::iterator p = endpoints.begin(); p != endpoints.end(); ++p)
+ {
+ _incomingConnectionFactories.push_back(new IncomingConnectionFactory(_instance, *p, this));
+ }
+ if(endpoints.empty())
+ {
+ TraceLevelsPtr tl = _instance->traceLevels();
+ if(tl->network >= 2)
+ {
+ Trace out(_instance->initializationData().logger, tl->networkCat);
+ out << "created adapter `" << name << "' without endpoints";
+ }
+ }
+
+ //
+ // Parse published endpoints. These are used in proxies
+ // instead of the connection factory endpoints.
+ //
+ string endpts = _instance->initializationData().properties->getProperty(name + ".PublishedEndpoints");
+ _publishedEndpoints = parseEndpoints(endpts);
if(_publishedEndpoints.empty())
{
transform(_incomingConnectionFactories.begin(), _incomingConnectionFactories.end(),
@@ -711,26 +711,26 @@ Ice::ObjectAdapter::ObjectAdapter(const InstancePtr& instance, const Communicato
//
_publishedEndpoints.erase(remove_if(_publishedEndpoints.begin(), _publishedEndpoints.end(),
not1(Ice::constMemFun(&Endpoint::publish))), _publishedEndpoints.end());
- }
+ }
#ifdef ICEE_HAS_LOCATOR
- string locator = _instance->initializationData().properties->getProperty(_name + ".Locator");
- if(!locator.empty())
- {
- setLocator(LocatorPrx::uncheckedCast(_instance->proxyFactory()->stringToProxy(locator)));
- }
- else
- {
- setLocator(_instance->referenceFactory()->getDefaultLocator());
- }
+ string locator = _instance->initializationData().properties->getProperty(_name + ".Locator");
+ if(!locator.empty())
+ {
+ setLocator(LocatorPrx::uncheckedCast(_instance->proxyFactory()->stringToProxy(locator)));
+ }
+ else
+ {
+ setLocator(_instance->referenceFactory()->getDefaultLocator());
+ }
#endif
}
catch(...)
{
- deactivate();
- waitForDeactivate();
- __setNoDelete(false);
- throw;
+ deactivate();
+ waitForDeactivate();
+ __setNoDelete(false);
+ throw;
}
__setNoDelete(false);
}
@@ -739,21 +739,21 @@ Ice::ObjectAdapter::~ObjectAdapter()
{
if(!_deactivated)
{
- Warning out(_instance->initializationData().logger);
- out << "object adapter `" << _name << "' has not been deactivated";
+ Warning out(_instance->initializationData().logger);
+ out << "object adapter `" << _name << "' has not been deactivated";
}
else if(!_destroyed)
{
- Warning out(_instance->initializationData().logger);
- out << "object adapter `" << _name << "' has not been destroyed";
+ Warning out(_instance->initializationData().logger);
+ out << "object adapter `" << _name << "' has not been destroyed";
}
else
{
- //assert(!_servantManager); // We don't clear this reference, it needs to be immutable.
- assert(!_communicator);
- assert(_incomingConnectionFactories.empty());
- assert(_directCount == 0);
- assert(!_waitForActivate);
+ //assert(!_servantManager); // We don't clear this reference, it needs to be immutable.
+ assert(!_communicator);
+ assert(_incomingConnectionFactories.empty());
+ assert(_directCount == 0);
+ assert(!_waitForActivate);
}
}
@@ -764,16 +764,16 @@ Ice::ObjectAdapter::newProxy(const Identity& ident, const string& facet) const
if(_id.empty())
{
#endif
- return newDirectProxy(ident, facet);
+ return newDirectProxy(ident, facet);
#ifdef ICEE_HAS_LOCATOR
}
else if(_replicaGroupId.empty())
{
- return newIndirectProxy(ident, facet, _id);
+ return newIndirectProxy(ident, facet, _id);
}
else
{
- return newIndirectProxy(ident, facet, _replicaGroupId);
+ return newIndirectProxy(ident, facet, _replicaGroupId);
}
#endif
}
@@ -797,10 +797,10 @@ Ice::ObjectAdapter::newDirectProxy(const Identity& ident, const string& facet) c
//
#ifdef ICEE_HAS_ROUTER
ReferencePtr ref = _instance->referenceFactory()->create(ident, Ice::Context(), facet, ReferenceModeTwoway,
- false, endpoints, 0);
+ false, endpoints, 0);
#else
ReferencePtr ref = _instance->referenceFactory()->create(ident, Ice::Context(), facet, ReferenceModeTwoway,
- false, endpoints);
+ false, endpoints);
#endif
return _instance->proxyFactory()->referenceToProxy(ref);
@@ -816,11 +816,11 @@ Ice::ObjectAdapter::newIndirectProxy(const Identity& ident, const string& facet,
#ifdef ICEE_HAS_ROUTER
ReferencePtr ref =
_instance->referenceFactory()->create(ident, Ice::Context(), facet, ReferenceModeTwoway, false, id, 0,
- _locatorInfo);
+ _locatorInfo);
#else
ReferencePtr ref =
_instance->referenceFactory()->create(ident, Ice::Context(), facet, ReferenceModeTwoway, false, id,
- _locatorInfo);
+ _locatorInfo);
#endif
//
@@ -835,9 +835,9 @@ Ice::ObjectAdapter::checkForDeactivation() const
{
if(_deactivated)
{
- ObjectAdapterDeactivatedException ex(__FILE__, __LINE__);
- ex.name = _name;
- throw ex;
+ ObjectAdapterDeactivatedException ex(__FILE__, __LINE__);
+ ex.name = _name;
+ throw ex;
}
}
@@ -864,38 +864,38 @@ Ice::ObjectAdapter::parseEndpoints(const string& str) const
vector<EndpointPtr> endpoints;
while(end < endpts.length())
{
- const string delim = " \t\n\r";
-
- beg = endpts.find_first_not_of(delim, end);
- if(beg == string::npos)
- {
- break;
- }
-
- end = endpts.find(':', beg);
- if(end == string::npos)
- {
- end = endpts.length();
- }
-
- if(end == beg)
- {
- ++end;
- continue;
- }
-
- string s = endpts.substr(beg, end - beg);
- EndpointPtr endp = _instance->endpointFactory()->create(s);
- if(endp == 0)
- {
- EndpointParseException ex(__FILE__, __LINE__);
- ex.str = s;
- throw ex;
- }
+ const string delim = " \t\n\r";
+
+ beg = endpts.find_first_not_of(delim, end);
+ if(beg == string::npos)
+ {
+ break;
+ }
+
+ end = endpts.find(':', beg);
+ if(end == string::npos)
+ {
+ end = endpts.length();
+ }
+
+ if(end == beg)
+ {
+ ++end;
+ continue;
+ }
+
+ string s = endpts.substr(beg, end - beg);
+ EndpointPtr endp = _instance->endpointFactory()->create(s);
+ if(endp == 0)
+ {
+ EndpointParseException ex(__FILE__, __LINE__);
+ ex.str = s;
+ throw ex;
+ }
vector<EndpointPtr> endps = endp->expand(true);
endpoints.insert(endpoints.end(), endps.begin(), endps.end());
- ++end;
+ ++end;
}
return endpoints;
@@ -907,7 +907,7 @@ ObjectAdapter::updateLocatorRegistry(const IceInternal::LocatorInfoPtr& locatorI
{
if(_id.empty())
{
- return; // Nothing to update.
+ return; // Nothing to update.
}
//
@@ -924,42 +924,42 @@ ObjectAdapter::updateLocatorRegistry(const IceInternal::LocatorInfoPtr& locatorI
LocatorRegistryPrx locatorRegistry = locatorInfo ? locatorInfo->getLocatorRegistry() : LocatorRegistryPrx();
if(!locatorRegistry)
{
- return;
+ return;
}
if(!_id.empty())
{
- try
- {
- if(_replicaGroupId.empty())
- {
- locatorRegistry->setAdapterDirectProxy(_id, proxy);
- }
- else
- {
- locatorRegistry->setReplicatedAdapterDirectProxy(_id, _replicaGroupId, proxy);
- }
- }
- catch(const AdapterNotFoundException&)
- {
- NotRegisteredException ex(__FILE__, __LINE__);
- ex.kindOfObject = "object adapter";
- ex.id = _id;
- throw ex;
- }
- catch(const InvalidReplicaGroupIdException&)
- {
- NotRegisteredException ex(__FILE__, __LINE__);
- ex.kindOfObject = "replica group";
- ex.id = _replicaGroupId;
- throw ex;
- }
- catch(const AdapterAlreadyActiveException&)
- {
- ObjectAdapterIdInUseException ex(__FILE__, __LINE__);
- ex.id = _id;
- throw ex;
- }
+ try
+ {
+ if(_replicaGroupId.empty())
+ {
+ locatorRegistry->setAdapterDirectProxy(_id, proxy);
+ }
+ else
+ {
+ locatorRegistry->setReplicatedAdapterDirectProxy(_id, _replicaGroupId, proxy);
+ }
+ }
+ catch(const AdapterNotFoundException&)
+ {
+ NotRegisteredException ex(__FILE__, __LINE__);
+ ex.kindOfObject = "object adapter";
+ ex.id = _id;
+ throw ex;
+ }
+ catch(const InvalidReplicaGroupIdException&)
+ {
+ NotRegisteredException ex(__FILE__, __LINE__);
+ ex.kindOfObject = "replica group";
+ ex.id = _replicaGroupId;
+ throw ex;
+ }
+ catch(const AdapterAlreadyActiveException&)
+ {
+ ObjectAdapterIdInUseException ex(__FILE__, __LINE__);
+ ex.id = _id;
+ throw ex;
+ }
}
}
#endif
diff --git a/cppe/src/IceE/ObjectAdapterFactory.cpp b/cppe/src/IceE/ObjectAdapterFactory.cpp
index b2a23adbfeb..e53feb3be0c 100644
--- a/cppe/src/IceE/ObjectAdapterFactory.cpp
+++ b/cppe/src/IceE/ObjectAdapterFactory.cpp
@@ -24,23 +24,23 @@ IceInternal::ObjectAdapterFactory::shutdown()
map<string, ObjectAdapterPtr> adapters;
{
- IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
-
- //
- // Ignore shutdown requests if the object adapter factory has
- // already been shut down.
- //
- if(!_instance)
- {
- return;
- }
-
- adapters = _adapters;
-
- _instance = 0;
- _communicator = 0;
-
- notifyAll();
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
+
+ //
+ // Ignore shutdown requests if the object adapter factory has
+ // already been shut down.
+ //
+ if(!_instance)
+ {
+ return;
+ }
+
+ adapters = _adapters;
+
+ _instance = 0;
+ _communicator = 0;
+
+ notifyAll();
}
//
@@ -48,10 +48,10 @@ IceInternal::ObjectAdapterFactory::shutdown()
// deadlocks.
//
//for_each(adapters.begin(), adapters.end(),
- //Ice::secondVoidMemFun<const string, ObjectAdapter>(&ObjectAdapter::deactivate));
+ //Ice::secondVoidMemFun<const string, ObjectAdapter>(&ObjectAdapter::deactivate));
for(map<string, ObjectAdapterPtr>::const_iterator p = adapters.begin(); p != adapters.end(); ++p)
{
- p->second->deactivate();
+ p->second->deactivate();
}
}
@@ -60,25 +60,25 @@ void
IceInternal::ObjectAdapterFactory::waitForShutdown()
{
{
- IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
-
- //
- // First we wait for the shutdown of the factory itself.
- //
- while(_instance)
- {
- wait();
- }
-
- //
- // If some other thread is currently shutting down, we wait
- // until this thread is finished.
- //
- while(_waitForShutdown)
- {
- wait();
- }
- _waitForShutdown = true;
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
+
+ //
+ // First we wait for the shutdown of the factory itself.
+ //
+ while(_instance)
+ {
+ wait();
+ }
+
+ //
+ // If some other thread is currently shutting down, we wait
+ // until this thread is finished.
+ //
+ while(_waitForShutdown)
+ {
+ wait();
+ }
+ _waitForShutdown = true;
}
//
@@ -86,17 +86,17 @@ IceInternal::ObjectAdapterFactory::waitForShutdown()
//
for(map<string, ObjectAdapterPtr>::const_iterator p = _adapters.begin(); p != _adapters.end(); ++p)
{
- p->second->waitForDeactivate();
+ p->second->waitForDeactivate();
}
{
- IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
- //
- // Signal that waiting is complete.
- //
- _waitForShutdown = false;
- notifyAll();
+ //
+ // Signal that waiting is complete.
+ //
+ _waitForShutdown = false;
+ notifyAll();
}
}
@@ -130,35 +130,35 @@ IceInternal::ObjectAdapterFactory::destroy()
//
for(map<string, ObjectAdapterPtr>::const_iterator p = adapters.begin(); p != adapters.end(); ++p)
{
- p->second->destroy();
+ p->second->destroy();
}
}
ObjectAdapterPtr
IceInternal::ObjectAdapterFactory::createObjectAdapter(const string& name, const string& endpoints
#ifdef ICEE_HAS_ROUTER
- , const RouterPrx& router
+ , const RouterPrx& router
#endif
- )
+ )
{
IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
if(!_instance)
{
- throw ObjectAdapterDeactivatedException(__FILE__, __LINE__);
+ throw ObjectAdapterDeactivatedException(__FILE__, __LINE__);
}
map<string, ObjectAdapterPtr>::iterator p = _adapters.find(name);
if(p != _adapters.end())
{
- throw AlreadyRegisteredException(__FILE__, __LINE__, "object adapter", name);
+ throw AlreadyRegisteredException(__FILE__, __LINE__, "object adapter", name);
}
ObjectAdapterPtr adapter = new ObjectAdapter(_instance, _communicator, this, name, endpoints
#ifdef ICEE_HAS_ROUTER
- , router
+ , router
#endif
- );
+ );
_adapters.insert(make_pair(name, adapter));
return adapter;
}
@@ -182,7 +182,7 @@ struct FlushAdapter
{
void operator() (ObjectAdapterPtr p)
{
- p->flushBatchRequests();
+ p->flushBatchRequests();
}
};
@@ -193,18 +193,18 @@ IceInternal::ObjectAdapterFactory::flushBatchRequests() const
{
list<ObjectAdapterPtr> a;
{
- IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
- for(map<string, ObjectAdapterPtr>::const_iterator p = _adapters.begin(); p != _adapters.end(); ++p)
- {
- a.push_back(p->second);
- }
+ for(map<string, ObjectAdapterPtr>::const_iterator p = _adapters.begin(); p != _adapters.end(); ++p)
+ {
+ a.push_back(p->second);
+ }
}
for_each(a.begin(), a.end(), FlushAdapter());
}
IceInternal::ObjectAdapterFactory::ObjectAdapterFactory(const InstancePtr& instance,
- const CommunicatorPtr& communicator) :
+ const CommunicatorPtr& communicator) :
_instance(instance),
_communicator(communicator),
_waitForShutdown(false)
diff --git a/cppe/src/IceE/ObjectAdapterFactory.h b/cppe/src/IceE/ObjectAdapterFactory.h
index 8bf700c5d84..5bf7be7bc6b 100644
--- a/cppe/src/IceE/ObjectAdapterFactory.h
+++ b/cppe/src/IceE/ObjectAdapterFactory.h
@@ -36,9 +36,9 @@ public:
::Ice::ObjectAdapterPtr createObjectAdapter(const std::string&, const std::string&
#ifdef ICEE_HAS_ROUTER
- , const ::Ice::RouterPrx&
+ , const ::Ice::RouterPrx&
#endif
- );
+ );
void removeObjectAdapter(const std::string&);
void flushBatchRequests() const;
diff --git a/cppe/src/IceE/Outgoing.cpp b/cppe/src/IceE/Outgoing.cpp
index 2bf572dfab2..19b7d9a07ee 100644
--- a/cppe/src/IceE/Outgoing.cpp
+++ b/cppe/src/IceE/Outgoing.cpp
@@ -45,7 +45,7 @@ IceInternal::LocalExceptionWrapper::retry() const
}
IceInternal::Outgoing::Outgoing(Connection* connection, Reference* ref, const string& operation,
- OperationMode mode, const Context* context) :
+ OperationMode mode, const Context* context) :
_connection(connection),
_reference(ref),
_state(StateUnsent),
@@ -58,26 +58,26 @@ IceInternal::Outgoing::Outgoing(Connection* connection, Reference* ref, const st
{
switch(_reference->getMode())
{
- case ReferenceModeTwoway:
- case ReferenceModeOneway:
- {
- _stream.writeBlob(requestHdr, sizeof(requestHdr));
- break;
- }
+ case ReferenceModeTwoway:
+ case ReferenceModeOneway:
+ {
+ _stream.writeBlob(requestHdr, sizeof(requestHdr));
+ break;
+ }
- case ReferenceModeBatchOneway:
+ case ReferenceModeBatchOneway:
#ifdef ICEE_HAS_BATCH
- {
- _connection->prepareBatchRequest(&_stream);
- break;
- }
+ {
+ _connection->prepareBatchRequest(&_stream);
+ break;
+ }
#endif
- case ReferenceModeDatagram:
- case ReferenceModeBatchDatagram:
- {
- assert(false);
- break;
- }
+ case ReferenceModeDatagram:
+ case ReferenceModeBatchDatagram:
+ {
+ assert(false);
+ break;
+ }
}
// _reference->getIdentity().__write(&_stream);
@@ -91,12 +91,12 @@ IceInternal::Outgoing::Outgoing(Connection* connection, Reference* ref, const st
//
if(_reference->getFacet().empty())
{
- _stream.writeSize(0);
+ _stream.writeSize(0);
}
else
{
- _stream.writeSize(1);
- _stream.write(_reference->getFacet());
+ _stream.writeSize(1);
+ _stream.write(_reference->getFacet());
}
_stream.write(operation, false);
@@ -112,8 +112,8 @@ IceInternal::Outgoing::Outgoing(Connection* connection, Reference* ref, const st
Context::const_iterator p;
for(p = context->begin(); p != context->end(); ++p)
{
- _stream.write(p->first);
- _stream.write(p->second);
+ _stream.write(p->first);
+ _stream.write(p->second);
}
//
@@ -134,86 +134,86 @@ IceInternal::Outgoing::invoke()
switch(_reference->getMode())
{
- case ReferenceModeTwoway:
- {
- //
- // We let all exceptions raised by sending directly
- // propagate to the caller, because they can be retried
- // without violating "at-most-once". In case of such
- // exceptions, the connection object does not call back on
- // this object, so we don't need to lock the mutex, keep
- // track of state, or save exceptions.
- //
- _connection->sendRequest(&_stream, this);
+ case ReferenceModeTwoway:
+ {
+ //
+ // We let all exceptions raised by sending directly
+ // propagate to the caller, because they can be retried
+ // without violating "at-most-once". In case of such
+ // exceptions, the connection object does not call back on
+ // this object, so we don't need to lock the mutex, keep
+ // track of state, or save exceptions.
+ //
+ _connection->sendRequest(&_stream, this);
- if(_exception.get())
- {
- //
- // A CloseConnectionException indicates graceful
- // server shutdown, and is therefore always repeatable
- // without violating "at-most-once". That's because by
- // sending a close connection message, the server
- // guarantees that all outstanding requests can safely
- // be repeated.
- //
- // An ObjectNotExistException can always be retried as
- // well without violating "at-most-once".
- //
- if(dynamic_cast<CloseConnectionException*>(_exception.get()) ||
- dynamic_cast<ObjectNotExistException*>(_exception.get()))
- {
- _exception->ice_throw();
- }
-
- //
- // Throw the exception wrapped in a LocalExceptionWrapper, to
- // indicate that the request cannot be resent without
- // potentially violating the "at-most-once" principle.
- //
- throw LocalExceptionWrapper(*_exception.get(), false);
- }
-
- if(_state == StateUserException)
- {
- return false;
- }
+ if(_exception.get())
+ {
+ //
+ // A CloseConnectionException indicates graceful
+ // server shutdown, and is therefore always repeatable
+ // without violating "at-most-once". That's because by
+ // sending a close connection message, the server
+ // guarantees that all outstanding requests can safely
+ // be repeated.
+ //
+ // An ObjectNotExistException can always be retried as
+ // well without violating "at-most-once".
+ //
+ if(dynamic_cast<CloseConnectionException*>(_exception.get()) ||
+ dynamic_cast<ObjectNotExistException*>(_exception.get()))
+ {
+ _exception->ice_throw();
+ }
+
+ //
+ // Throw the exception wrapped in a LocalExceptionWrapper, to
+ // indicate that the request cannot be resent without
+ // potentially violating the "at-most-once" principle.
+ //
+ throw LocalExceptionWrapper(*_exception.get(), false);
+ }
+
+ if(_state == StateUserException)
+ {
+ return false;
+ }
- assert(_state == StateOK);
- break;
- }
-
- case ReferenceModeOneway:
- {
- //
- // For oneway requests, the connection object
- // never calls back on this object. Therefore we don't
- // need to lock the mutex or save exceptions. We simply
- // let all exceptions from sending propagate to the
- // caller, because such exceptions can be retried without
- // violating "at-most-once".
- //
- _connection->sendRequest(&_stream, 0);
- break;
- }
+ assert(_state == StateOK);
+ break;
+ }
+
+ case ReferenceModeOneway:
+ {
+ //
+ // For oneway requests, the connection object
+ // never calls back on this object. Therefore we don't
+ // need to lock the mutex or save exceptions. We simply
+ // let all exceptions from sending propagate to the
+ // caller, because such exceptions can be retried without
+ // violating "at-most-once".
+ //
+ _connection->sendRequest(&_stream, 0);
+ break;
+ }
- case ReferenceModeBatchOneway:
+ case ReferenceModeBatchOneway:
#ifdef ICEE_HAS_BATCH
- {
- //
- // For batch oneways, the same rules as for
- // regular oneways (see comment above)
- // apply.
- //
- _connection->finishBatchRequest(&_stream);
- break;
- }
+ {
+ //
+ // For batch oneways, the same rules as for
+ // regular oneways (see comment above)
+ // apply.
+ //
+ _connection->finishBatchRequest(&_stream);
+ break;
+ }
#endif
- case ReferenceModeDatagram:
- case ReferenceModeBatchDatagram:
- {
- assert(false);
- return false;
- }
+ case ReferenceModeDatagram:
+ case ReferenceModeBatchDatagram:
+ {
+ assert(false);
+ return false;
+ }
}
return true;
@@ -232,14 +232,14 @@ IceInternal::Outgoing::abort(const LocalException& ex)
#ifdef ICEE_HAS_BATCH
if(_reference->getMode() == ReferenceModeBatchOneway)
{
- _connection->abortBatchRequest();
-
- //
- // If we abort a batch requests, we cannot retry, because not
- // only the batch request that caused the problem will be
- // aborted, but all other requests in the batch as well.
- //
- throw LocalExceptionWrapper(ex, false);
+ _connection->abortBatchRequest();
+
+ //
+ // If we abort a batch requests, we cannot retry, because not
+ // only the batch request that caused the problem will be
+ // aborted, but all other requests in the batch as well.
+ //
+ throw LocalExceptionWrapper(ex, false);
}
#endif
@@ -257,7 +257,7 @@ IceInternal::Outgoing::finished(BasicStream& is)
//
if(&is != &_stream)
{
- _stream.swap(is);
+ _stream.swap(is);
}
Byte replyStatus;
@@ -265,153 +265,153 @@ IceInternal::Outgoing::finished(BasicStream& is)
switch(replyStatus)
{
- case replyOK:
- {
- //
- // Input and output parameters are always sent in an
- // encapsulation, which makes it possible to forward
- // oneway requests as blobs.
- //
- _stream.startReadEncaps();
- _state = StateOK; // The state must be set last, in case there is an exception.
- break;
- }
-
- case replyUserException:
- {
- //
- // Input and output parameters are always sent in an
- // encapsulation, which makes it possible to forward
- // oneway requests as blobs.
- //
- _stream.startReadEncaps();
- _state = StateUserException; // The state must be set last, in case there is an exception.
- break;
- }
-
- case replyObjectNotExist:
- case replyFacetNotExist:
- case replyOperationNotExist:
- {
- //
- // Don't read the exception members directly into the
- // exception. Otherwise if reading fails and raises an
- // exception, you will have a memory leak.
- //
- Identity ident;
- ident.__read(&_stream);
+ case replyOK:
+ {
+ //
+ // Input and output parameters are always sent in an
+ // encapsulation, which makes it possible to forward
+ // oneway requests as blobs.
+ //
+ _stream.startReadEncaps();
+ _state = StateOK; // The state must be set last, in case there is an exception.
+ break;
+ }
+
+ case replyUserException:
+ {
+ //
+ // Input and output parameters are always sent in an
+ // encapsulation, which makes it possible to forward
+ // oneway requests as blobs.
+ //
+ _stream.startReadEncaps();
+ _state = StateUserException; // The state must be set last, in case there is an exception.
+ break;
+ }
+
+ case replyObjectNotExist:
+ case replyFacetNotExist:
+ case replyOperationNotExist:
+ {
+ //
+ // Don't read the exception members directly into the
+ // exception. Otherwise if reading fails and raises an
+ // exception, you will have a memory leak.
+ //
+ Identity ident;
+ ident.__read(&_stream);
- //
- // For compatibility with the old FacetPath.
- //
- vector<string> facetPath;
- _stream.read(facetPath);
- string facet;
- if(!facetPath.empty())
- {
- if(facetPath.size() > 1)
- {
- throw MarshalException(__FILE__, __LINE__);
- }
- facet.swap(facetPath[0]);
- }
+ //
+ // For compatibility with the old FacetPath.
+ //
+ vector<string> facetPath;
+ _stream.read(facetPath);
+ string facet;
+ if(!facetPath.empty())
+ {
+ if(facetPath.size() > 1)
+ {
+ throw MarshalException(__FILE__, __LINE__);
+ }
+ facet.swap(facetPath[0]);
+ }
- string operation;
- _stream.read(operation, false);
-
- RequestFailedException* ex;
- switch(replyStatus)
- {
- case replyObjectNotExist:
- {
- ex = new ObjectNotExistException(__FILE__, __LINE__);
- break;
- }
-
- case replyFacetNotExist:
- {
- ex = new FacetNotExistException(__FILE__, __LINE__);
- break;
- }
-
- case replyOperationNotExist:
- {
- ex = new OperationNotExistException(__FILE__, __LINE__);
- break;
- }
-
- default:
- {
- ex = 0; // To keep the compiler from complaining.
- assert(false);
- break;
- }
- }
-
- ex->id = ident;
- ex->facet = facet;
- ex->operation = operation;
- _exception.reset(ex);
+ string operation;
+ _stream.read(operation, false);
+
+ RequestFailedException* ex;
+ switch(replyStatus)
+ {
+ case replyObjectNotExist:
+ {
+ ex = new ObjectNotExistException(__FILE__, __LINE__);
+ break;
+ }
+
+ case replyFacetNotExist:
+ {
+ ex = new FacetNotExistException(__FILE__, __LINE__);
+ break;
+ }
+
+ case replyOperationNotExist:
+ {
+ ex = new OperationNotExistException(__FILE__, __LINE__);
+ break;
+ }
+
+ default:
+ {
+ ex = 0; // To keep the compiler from complaining.
+ assert(false);
+ break;
+ }
+ }
+
+ ex->id = ident;
+ ex->facet = facet;
+ ex->operation = operation;
+ _exception.reset(ex);
- _state = StateLocalException; // The state must be set last, in case there is an exception.
- break;
- }
-
- case replyUnknownException:
- case replyUnknownLocalException:
- case replyUnknownUserException:
- {
- //
- // Don't read the exception members directly into the
- // exception. Otherwise if reading fails and raises an
- // exception, you will have a memory leak.
- //
- string unknown;
- _stream.read(unknown, false);
-
- UnknownException* ex;
- switch(replyStatus)
- {
- case replyUnknownException:
- {
- ex = new UnknownException(__FILE__, __LINE__);
- break;
- }
-
- case replyUnknownLocalException:
- {
- ex = new UnknownLocalException(__FILE__, __LINE__);
- break;
- }
-
- case replyUnknownUserException:
- {
- ex = new UnknownUserException(__FILE__, __LINE__);
- break;
- }
-
- default:
- {
- ex = 0; // To keep the compiler from complaining.
- assert(false);
- break;
- }
- }
-
- ex->unknown = unknown;
- _exception.reset(ex);
+ _state = StateLocalException; // The state must be set last, in case there is an exception.
+ break;
+ }
+
+ case replyUnknownException:
+ case replyUnknownLocalException:
+ case replyUnknownUserException:
+ {
+ //
+ // Don't read the exception members directly into the
+ // exception. Otherwise if reading fails and raises an
+ // exception, you will have a memory leak.
+ //
+ string unknown;
+ _stream.read(unknown, false);
+
+ UnknownException* ex;
+ switch(replyStatus)
+ {
+ case replyUnknownException:
+ {
+ ex = new UnknownException(__FILE__, __LINE__);
+ break;
+ }
+
+ case replyUnknownLocalException:
+ {
+ ex = new UnknownLocalException(__FILE__, __LINE__);
+ break;
+ }
+
+ case replyUnknownUserException:
+ {
+ ex = new UnknownUserException(__FILE__, __LINE__);
+ break;
+ }
+
+ default:
+ {
+ ex = 0; // To keep the compiler from complaining.
+ assert(false);
+ break;
+ }
+ }
+
+ ex->unknown = unknown;
+ _exception.reset(ex);
- _state = StateLocalException; // The state must be set last, in case there is an exception.
- break;
- }
-
- default:
- {
- //_exception.reset(new UnknownReplyStatusException(__FILE__, __LINE__));
- _exception.reset(new ProtocolException(__FILE__, __LINE__, "unknown reply status"));
- _state = StateLocalException;
- break;
- }
+ _state = StateLocalException; // The state must be set last, in case there is an exception.
+ break;
+ }
+
+ default:
+ {
+ //_exception.reset(new UnknownReplyStatusException(__FILE__, __LINE__));
+ _exception.reset(new ProtocolException(__FILE__, __LINE__, "unknown reply status"));
+ _state = StateLocalException;
+ break;
+ }
}
}
diff --git a/cppe/src/IceE/OutgoingConnectionFactory.cpp b/cppe/src/IceE/OutgoingConnectionFactory.cpp
index 5c86c452c77..79b3696c73c 100644
--- a/cppe/src/IceE/OutgoingConnectionFactory.cpp
+++ b/cppe/src/IceE/OutgoingConnectionFactory.cpp
@@ -36,18 +36,18 @@ IceInternal::OutgoingConnectionFactory::destroy()
if(_destroyed)
{
- return;
+ return;
}
#ifdef _STLP_BEGIN_NAMESPACE
// voidbind2nd is an STLport extension for broken compilers in IceE/Functional.h
for_each(_connections.begin(), _connections.end(),
- voidbind2nd(Ice::secondVoidMemFun1<EndpointPtr, Connection, Connection::DestructionReason>
- (&Connection::destroy), Connection::CommunicatorDestroyed));
+ voidbind2nd(Ice::secondVoidMemFun1<EndpointPtr, Connection, Connection::DestructionReason>
+ (&Connection::destroy), Connection::CommunicatorDestroyed));
#else
for_each(_connections.begin(), _connections.end(),
- bind2nd(Ice::secondVoidMemFun1<const EndpointPtr, Connection, Connection::DestructionReason>
- (&Connection::destroy), Connection::CommunicatorDestroyed));
+ bind2nd(Ice::secondVoidMemFun1<const EndpointPtr, Connection, Connection::DestructionReason>
+ (&Connection::destroy), Connection::CommunicatorDestroyed));
#endif
_destroyed = true;
@@ -60,27 +60,27 @@ IceInternal::OutgoingConnectionFactory::waitUntilFinished()
multimap<EndpointPtr, ConnectionPtr> connections;
{
- IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
-
- //
- // First we wait until the factory is destroyed. We also wait
- // until there are no pending connections anymore. Only then
- // we can be sure the _connections contains all connections.
- //
- while(!_destroyed || !_pending.empty())
- {
- wait();
- }
-
- //
- // We want to wait until all connections are finished outside the
- // thread synchronization.
- //
- connections.swap(_connections);
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
+
+ //
+ // First we wait until the factory is destroyed. We also wait
+ // until there are no pending connections anymore. Only then
+ // we can be sure the _connections contains all connections.
+ //
+ while(!_destroyed || !_pending.empty())
+ {
+ wait();
+ }
+
+ //
+ // We want to wait until all connections are finished outside the
+ // thread synchronization.
+ //
+ connections.swap(_connections);
}
for_each(connections.begin(), connections.end(),
- Ice::secondVoidMemFun<const EndpointPtr, Connection>(&Connection::waitUntilFinished));
+ Ice::secondVoidMemFun<const EndpointPtr, Connection>(&Connection::waitUntilFinished));
}
ConnectionPtr
@@ -90,130 +90,130 @@ IceInternal::OutgoingConnectionFactory::create(const vector<EndpointPtr>& endpts
vector<EndpointPtr> endpoints = endpts;
{
- IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
-
- if(_destroyed)
- {
- throw CommunicatorDestroyedException(__FILE__, __LINE__);
- }
-
- //
- // Reap connections for which destruction has completed.
- //
- std::multimap<EndpointPtr, ConnectionPtr>::iterator p = _connections.begin();
- while(p != _connections.end())
- {
- if(p->second->isFinished())
- {
- _connections.erase(p++);
- }
- else
- {
- ++p;
- }
- }
-
- //
- // Modify endpoints with overrides.
- //
- vector<EndpointPtr>::iterator q;
- for(q = endpoints.begin(); q != endpoints.end(); ++q)
- {
- if(_instance->defaultsAndOverrides()->overrideTimeout)
- {
- *q = (*q)->timeout(_instance->defaultsAndOverrides()->overrideTimeoutValue);
- }
- }
-
- //
- // Search for existing connections.
- //
- vector<EndpointPtr>::const_iterator r;
- for(q = endpoints.begin(), r = endpts.begin(); q != endpoints.end(); ++q, ++r)
- {
- pair<multimap<EndpointPtr, ConnectionPtr>::iterator,
- multimap<EndpointPtr, ConnectionPtr>::iterator> pr = _connections.equal_range(*q);
-
- while(pr.first != pr.second)
- {
- //
- // Don't return connections for which destruction has
- // been initiated.
- //
- if(!pr.first->second->isDestroyed())
- {
- return pr.first->second;
- }
-
- ++pr.first;
- }
- }
-
- //
- // If some other thread is currently trying to establish a
- // connection to any of our endpoints, we wait until this
- // thread is finished.
- //
- bool searchAgain = false;
- while(!_destroyed)
- {
- for(q = endpoints.begin(); q != endpoints.end(); ++q)
- {
- if(_pending.find(*q) != _pending.end())
- {
- break;
- }
- }
-
- if(q == endpoints.end())
- {
- break;
- }
-
- searchAgain = true;
-
- wait();
- }
-
- if(_destroyed)
- {
- throw CommunicatorDestroyedException(__FILE__, __LINE__);
- }
-
- //
- // Search for existing connections again if we waited above,
- // as new connections might have been added in the meantime.
- //
- if(searchAgain)
- {
- for(q = endpoints.begin(), r = endpts.begin(); q != endpoints.end(); ++q, ++r)
- {
- pair<multimap<EndpointPtr, ConnectionPtr>::iterator,
- multimap<EndpointPtr, ConnectionPtr>::iterator> pr = _connections.equal_range(*q);
-
- while(pr.first != pr.second)
- {
- //
- // Don't return connections for which destruction has
- // been initiated.
- //
- if(!pr.first->second->isDestroyed())
- {
- return pr.first->second;
- }
-
- ++pr.first;
- }
- }
- }
-
- //
- // No connection to any of our endpoints exists yet, so we
- // will try to create one. To avoid that other threads try to
- // create connections to the same endpoints, we add our
- // endpoints to _pending.
- //
- _pending.insert(endpoints.begin(), endpoints.end());
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
+
+ if(_destroyed)
+ {
+ throw CommunicatorDestroyedException(__FILE__, __LINE__);
+ }
+
+ //
+ // Reap connections for which destruction has completed.
+ //
+ std::multimap<EndpointPtr, ConnectionPtr>::iterator p = _connections.begin();
+ while(p != _connections.end())
+ {
+ if(p->second->isFinished())
+ {
+ _connections.erase(p++);
+ }
+ else
+ {
+ ++p;
+ }
+ }
+
+ //
+ // Modify endpoints with overrides.
+ //
+ vector<EndpointPtr>::iterator q;
+ for(q = endpoints.begin(); q != endpoints.end(); ++q)
+ {
+ if(_instance->defaultsAndOverrides()->overrideTimeout)
+ {
+ *q = (*q)->timeout(_instance->defaultsAndOverrides()->overrideTimeoutValue);
+ }
+ }
+
+ //
+ // Search for existing connections.
+ //
+ vector<EndpointPtr>::const_iterator r;
+ for(q = endpoints.begin(), r = endpts.begin(); q != endpoints.end(); ++q, ++r)
+ {
+ pair<multimap<EndpointPtr, ConnectionPtr>::iterator,
+ multimap<EndpointPtr, ConnectionPtr>::iterator> pr = _connections.equal_range(*q);
+
+ while(pr.first != pr.second)
+ {
+ //
+ // Don't return connections for which destruction has
+ // been initiated.
+ //
+ if(!pr.first->second->isDestroyed())
+ {
+ return pr.first->second;
+ }
+
+ ++pr.first;
+ }
+ }
+
+ //
+ // If some other thread is currently trying to establish a
+ // connection to any of our endpoints, we wait until this
+ // thread is finished.
+ //
+ bool searchAgain = false;
+ while(!_destroyed)
+ {
+ for(q = endpoints.begin(); q != endpoints.end(); ++q)
+ {
+ if(_pending.find(*q) != _pending.end())
+ {
+ break;
+ }
+ }
+
+ if(q == endpoints.end())
+ {
+ break;
+ }
+
+ searchAgain = true;
+
+ wait();
+ }
+
+ if(_destroyed)
+ {
+ throw CommunicatorDestroyedException(__FILE__, __LINE__);
+ }
+
+ //
+ // Search for existing connections again if we waited above,
+ // as new connections might have been added in the meantime.
+ //
+ if(searchAgain)
+ {
+ for(q = endpoints.begin(), r = endpts.begin(); q != endpoints.end(); ++q, ++r)
+ {
+ pair<multimap<EndpointPtr, ConnectionPtr>::iterator,
+ multimap<EndpointPtr, ConnectionPtr>::iterator> pr = _connections.equal_range(*q);
+
+ while(pr.first != pr.second)
+ {
+ //
+ // Don't return connections for which destruction has
+ // been initiated.
+ //
+ if(!pr.first->second->isDestroyed())
+ {
+ return pr.first->second;
+ }
+
+ ++pr.first;
+ }
+ }
+ }
+
+ //
+ // No connection to any of our endpoints exists yet, so we
+ // will try to create one. To avoid that other threads try to
+ // create connections to the same endpoints, we add our
+ // endpoints to _pending.
+ //
+ _pending.insert(endpoints.begin(), endpoints.end());
}
ConnectionPtr connection;
@@ -223,104 +223,104 @@ IceInternal::OutgoingConnectionFactory::create(const vector<EndpointPtr>& endpts
vector<EndpointPtr>::const_iterator r;
for(q = endpoints.begin(), r = endpts.begin(); q != endpoints.end(); ++q, ++r)
{
- EndpointPtr endpoint = *q;
-
- try
- {
- ConnectorPtr connector = endpoint->connector();
- assert(connector);
-
- Int timeout;
- if(_instance->defaultsAndOverrides()->overrideConnectTimeout)
- {
- timeout = _instance->defaultsAndOverrides()->overrideConnectTimeoutValue;
- }
- // It is not necessary to check for overrideTimeout,
- // the endpoint has already been modified with this
- // override, if set.
- else
- {
- timeout = endpoint->timeout();
- }
-
- TransceiverPtr transceiver = connector->connect(timeout);
- assert(transceiver);
+ EndpointPtr endpoint = *q;
+
+ try
+ {
+ ConnectorPtr connector = endpoint->connector();
+ assert(connector);
+
+ Int timeout;
+ if(_instance->defaultsAndOverrides()->overrideConnectTimeout)
+ {
+ timeout = _instance->defaultsAndOverrides()->overrideConnectTimeoutValue;
+ }
+ // It is not necessary to check for overrideTimeout,
+ // the endpoint has already been modified with this
+ // override, if set.
+ else
+ {
+ timeout = endpoint->timeout();
+ }
+
+ TransceiverPtr transceiver = connector->connect(timeout);
+ assert(transceiver);
#ifdef ICEE_PURE_CLIENT
- connection = new Connection(_instance, transceiver, endpoint);
+ connection = new Connection(_instance, transceiver, endpoint);
#else
- connection = new Connection(_instance, transceiver, endpoint, 0);
+ connection = new Connection(_instance, transceiver, endpoint, 0);
#endif
- //
- // Wait for the connection to be validated by the
- // connection thread. Once the connection has been
- // validated it will be activated also.
- //
- connection->waitForValidation();
- break;
- }
- catch(const LocalException& ex)
- {
- exception.reset(dynamic_cast<LocalException*>(ex.ice_clone()));
-
- //
- // If a connection object was constructed, then validate()
- // must have raised the exception.
- //
- if(connection)
- {
- connection->waitUntilFinished(); // We must call waitUntilFinished() for cleanup.
- connection = 0;
- }
- }
-
- TraceLevelsPtr traceLevels = _instance->traceLevels();
- if(traceLevels->retry >= 2)
- {
- Trace out(_instance->initializationData().logger, traceLevels->retryCat);
-
- out << "connection to endpoint failed";
- if(q + 1 != endpoints.end())
- {
- out << ", trying next endpoint\n";
- }
- else
- {
- out << " and no more endpoints to try\n";
- }
- out << (*exception.get()).toString();
- }
+ //
+ // Wait for the connection to be validated by the
+ // connection thread. Once the connection has been
+ // validated it will be activated also.
+ //
+ connection->waitForValidation();
+ break;
+ }
+ catch(const LocalException& ex)
+ {
+ exception.reset(dynamic_cast<LocalException*>(ex.ice_clone()));
+
+ //
+ // If a connection object was constructed, then validate()
+ // must have raised the exception.
+ //
+ if(connection)
+ {
+ connection->waitUntilFinished(); // We must call waitUntilFinished() for cleanup.
+ connection = 0;
+ }
+ }
+
+ TraceLevelsPtr traceLevels = _instance->traceLevels();
+ if(traceLevels->retry >= 2)
+ {
+ Trace out(_instance->initializationData().logger, traceLevels->retryCat);
+
+ out << "connection to endpoint failed";
+ if(q + 1 != endpoints.end())
+ {
+ out << ", trying next endpoint\n";
+ }
+ else
+ {
+ out << " and no more endpoints to try\n";
+ }
+ out << (*exception.get()).toString();
+ }
}
{
- IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
-
- //
- // Signal other threads that we are done with trying to
- // establish connections to our endpoints.
- //
- for(q = endpoints.begin(); q != endpoints.end(); ++q)
- {
- _pending.erase(*q);
- }
- notifyAll();
-
- if(!connection)
- {
- assert(exception.get());
- exception->ice_throw();
- }
- else
- {
- _connections.insert(_connections.end(),
- pair<const EndpointPtr, ConnectionPtr>(connection->endpoint(), connection));
-
- if(_destroyed)
- {
- connection->destroy(Connection::CommunicatorDestroyed);
- throw CommunicatorDestroyedException(__FILE__, __LINE__);
- }
- }
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
+
+ //
+ // Signal other threads that we are done with trying to
+ // establish connections to our endpoints.
+ //
+ for(q = endpoints.begin(); q != endpoints.end(); ++q)
+ {
+ _pending.erase(*q);
+ }
+ notifyAll();
+
+ if(!connection)
+ {
+ assert(exception.get());
+ exception->ice_throw();
+ }
+ else
+ {
+ _connections.insert(_connections.end(),
+ pair<const EndpointPtr, ConnectionPtr>(connection->endpoint(), connection));
+
+ if(_destroyed)
+ {
+ connection->destroy(Connection::CommunicatorDestroyed);
+ throw CommunicatorDestroyedException(__FILE__, __LINE__);
+ }
+ }
}
assert(connection);
@@ -336,7 +336,7 @@ IceInternal::OutgoingConnectionFactory::setRouterInfo(const RouterInfoPtr& route
if(_destroyed)
{
- throw CommunicatorDestroyedException(__FILE__, __LINE__);
+ throw CommunicatorDestroyedException(__FILE__, __LINE__);
}
assert(routerInfo);
@@ -353,34 +353,34 @@ IceInternal::OutgoingConnectionFactory::setRouterInfo(const RouterInfoPtr& route
vector<EndpointPtr>::const_iterator p;
for(p = endpoints.begin(); p != endpoints.end(); ++p)
{
- EndpointPtr endpoint = *p;
+ EndpointPtr endpoint = *p;
- //
- // Modify endpoints with overrides.
- //
- if(_instance->defaultsAndOverrides()->overrideTimeout)
- {
- endpoint = endpoint->timeout(_instance->defaultsAndOverrides()->overrideTimeoutValue);
- }
+ //
+ // Modify endpoints with overrides.
+ //
+ if(_instance->defaultsAndOverrides()->overrideTimeout)
+ {
+ endpoint = endpoint->timeout(_instance->defaultsAndOverrides()->overrideTimeoutValue);
+ }
#ifndef ICEE_PURE_CLIENT
- pair<multimap<EndpointPtr, ConnectionPtr>::iterator,
- multimap<EndpointPtr, ConnectionPtr>::iterator> pr = _connections.equal_range(endpoint);
-
- while(pr.first != pr.second)
- {
- try
- {
- pr.first->second->setAdapter(adapter);
- }
- catch(const Ice::LocalException&)
- {
- //
- // Ignore, the connection is being closed or closed.
- //
- }
- ++pr.first;
- }
+ pair<multimap<EndpointPtr, ConnectionPtr>::iterator,
+ multimap<EndpointPtr, ConnectionPtr>::iterator> pr = _connections.equal_range(endpoint);
+
+ while(pr.first != pr.second)
+ {
+ try
+ {
+ pr.first->second->setAdapter(adapter);
+ }
+ catch(const Ice::LocalException&)
+ {
+ //
+ // Ignore, the connection is being closed or closed.
+ //
+ }
+ ++pr.first;
+ }
#endif
}
}
@@ -394,26 +394,26 @@ IceInternal::OutgoingConnectionFactory::flushBatchRequests()
list<ConnectionPtr> c;
{
- IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
-
- for(std::multimap<EndpointPtr, ConnectionPtr>::const_iterator p = _connections.begin();
- p != _connections.end();
- ++p)
- {
- c.push_back(p->second);
- }
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
+
+ for(std::multimap<EndpointPtr, ConnectionPtr>::const_iterator p = _connections.begin();
+ p != _connections.end();
+ ++p)
+ {
+ c.push_back(p->second);
+ }
}
for(list<ConnectionPtr>::const_iterator p = c.begin(); p != c.end(); ++p)
{
- try
- {
- (*p)->flushBatchRequests();
- }
- catch(const LocalException&)
- {
- // Ignore.
- }
+ try
+ {
+ (*p)->flushBatchRequests();
+ }
+ catch(const LocalException&)
+ {
+ // Ignore.
+ }
}
}
#endif
@@ -439,24 +439,24 @@ IceInternal::OutgoingConnectionFactory::removeAdapter(const ObjectAdapterPtr& ad
if(_destroyed)
{
- return;
+ return;
}
for(multimap<EndpointPtr, ConnectionPtr>::const_iterator p = _connections.begin(); p != _connections.end(); ++p)
{
- if(p->second->getAdapter() == adapter)
- {
- try
- {
- p->second->setAdapter(0);
- }
- catch(const Ice::LocalException&)
- {
- //
- // Ignore, the connection is being closed or closed.
- //
- }
- }
+ if(p->second->getAdapter() == adapter)
+ {
+ try
+ {
+ p->second->setAdapter(0);
+ }
+ catch(const Ice::LocalException&)
+ {
+ //
+ // Ignore, the connection is being closed or closed.
+ //
+ }
+ }
}
}
diff --git a/cppe/src/IceE/Properties.cpp b/cppe/src/IceE/Properties.cpp
index 58e439b7046..c9058e2a932 100644
--- a/cppe/src/IceE/Properties.cpp
+++ b/cppe/src/IceE/Properties.cpp
@@ -27,11 +27,11 @@ Ice::Properties::getProperty(const string& key)
map<string, string>::const_iterator p = _properties.find(key);
if(p != _properties.end())
{
- return p->second;
+ return p->second;
}
else
{
- return string();
+ return string();
}
}
@@ -43,11 +43,11 @@ Ice::Properties::getPropertyWithDefault(const string& key, const string& value)
map<string, string>::const_iterator p = _properties.find(key);
if(p != _properties.end())
{
- return p->second;
+ return p->second;
}
else
{
- return value;
+ return value;
}
}
@@ -65,7 +65,7 @@ Ice::Properties::getPropertyAsIntWithDefault(const string& key, Int value)
map<string, string>::const_iterator p = _properties.find(key);
if(p != _properties.end())
{
- value = atoi(p->second.c_str());
+ value = atoi(p->second.c_str());
}
return value;
@@ -94,7 +94,7 @@ Ice::Properties::setProperty(const string& key, const string& value)
{
if(key.empty())
{
- return;
+ return;
}
IceUtil::Mutex::Lock sync(*this);
@@ -104,11 +104,11 @@ Ice::Properties::setProperty(const string& key, const string& value)
//
if(!value.empty())
{
- _properties[key] = value;
+ _properties[key] = value;
}
else
{
- _properties.erase(key);
+ _properties.erase(key);
}
}
@@ -122,7 +122,7 @@ Ice::Properties::getCommandLineOptions()
map<string, string>::const_iterator p;
for(p = _properties.begin(); p != _properties.end(); ++p)
{
- result.push_back("--" + p->first + "=" + p->second);
+ result.push_back("--" + p->first + "=" + p->second);
}
return result;
}
@@ -133,7 +133,7 @@ Ice::Properties::parseCommandLineOptions(const string& prefix, const StringSeq&
string pfx = prefix;
if(!pfx.empty() && pfx[pfx.size() - 1] != '.')
{
- pfx += '.';
+ pfx += '.';
}
pfx = "--" + pfx;
@@ -176,7 +176,7 @@ Ice::Properties::load(const std::string& file)
if(!in)
{
FileException ex(__FILE__, __LINE__);
- ex.path = file;
+ ex.path = file;
ex.error = getSystemErrno();
throw ex;
}
@@ -184,7 +184,7 @@ Ice::Properties::load(const std::string& file)
char line[1024];
while(fgets(line, 1024, in) != NULL)
{
- parseLine(line
+ parseLine(line
#ifdef ICEE_HAS_WSTRING
, _converter
#endif
@@ -226,7 +226,7 @@ Ice::Properties::Properties(StringSeq& args, const PropertiesPtr& defaults
{
if(defaults != 0)
{
- _properties = defaults->getPropertiesForPrefix("");
+ _properties = defaults->getPropertiesForPrefix("");
}
StringSeq::iterator q = args.begin();
@@ -239,7 +239,7 @@ Ice::Properties::Properties(StringSeq& args, const PropertiesPtr& defaults
//
string name = *q;
replace(name.begin(), name.end(), '\\', '/');
- setProperty("Ice.ProgramName", name);
+ setProperty("Ice.ProgramName", name);
}
StringSeq tmp;
@@ -258,27 +258,27 @@ Ice::Properties::Properties(StringSeq& args, const PropertiesPtr& defaults
, 0
#endif
);
- loadConfigFiles = true;
+ loadConfigFiles = true;
}
else
{
- tmp.push_back(s);
+ tmp.push_back(s);
}
- ++q;
+ ++q;
}
args = tmp;
if(!loadConfigFiles)
{
- //
- // If Ice.Config is not set, load from ICE_CONFIG (if set)
- //
- loadConfigFiles = (_properties.find("Ice.Config") == _properties.end());
+ //
+ // If Ice.Config is not set, load from ICE_CONFIG (if set)
+ //
+ loadConfigFiles = (_properties.find("Ice.Config") == _properties.end());
}
if(loadConfigFiles)
{
- loadConfig();
+ loadConfig();
}
args = parseIceCommandLineOptions(args);
@@ -335,7 +335,11 @@ Ice::Properties::parseLine(const string& line
}
string key = IceUtil::trim(s.substr(0, split));
- string value = IceUtil::trim(s.substr(split + 1, s.length() - split - 1));
+ string value;
+ if(split < s.length() - 2)
+ {
+ value = IceUtil::trim(s.substr(split + 1, s.length() - split - 1));
+ }
#ifdef ICEE_HAS_WSTRING
if(converter)
diff --git a/cppe/src/IceE/Protocol.cpp b/cppe/src/IceE/Protocol.cpp
index 12bfd645fb8..309614511ce 100644
--- a/cppe/src/IceE/Protocol.cpp
+++ b/cppe/src/IceE/Protocol.cpp
@@ -12,7 +12,7 @@
namespace IceInternal
{
-const Ice::Byte magic[] = { 0x49, 0x63, 0x65, 0x50 }; // 'I', 'c', 'e', 'P'
+const Ice::Byte magic[] = { 0x49, 0x63, 0x65, 0x50 }; // 'I', 'c', 'e', 'P'
const Ice::Byte requestHdr[] =
{
diff --git a/cppe/src/IceE/Proxy.cpp b/cppe/src/IceE/Proxy.cpp
index 6ba2127a000..af83c170b36 100644
--- a/cppe/src/IceE/Proxy.cpp
+++ b/cppe/src/IceE/Proxy.cpp
@@ -36,8 +36,8 @@ Ice::__write(::IceInternal::BasicStream* __os, const ::Ice::Context& v, ::Ice::_
::Ice::Context::const_iterator p;
for(p = v.begin(); p != v.end(); ++p)
{
- __os->write(p->first);
- __os->write(p->second);
+ __os->write(p->first);
+ __os->write(p->second);
}
}
@@ -48,10 +48,10 @@ Ice::__read(::IceInternal::BasicStream* __is, ::Ice::Context& v, ::Ice::__U__Con
__is->readSize(sz);
while(sz--)
{
- ::std::pair<const ::std::string, ::std::string> pair;
- __is->read(const_cast< ::std::string&>(pair.first));
- ::Ice::Context::iterator __i = v.insert(v.end(), pair);
- __is->read(__i->second);
+ ::std::pair<const ::std::string, ::std::string> pair;
+ __is->read(const_cast< ::std::string&>(pair.first));
+ ::Ice::Context::iterator __i = v.insert(v.end(), pair);
+ __is->read(__i->second);
}
}
@@ -68,23 +68,23 @@ IceInternal::checkedCastImpl(const ObjectPrx& b, const string& f, const string&
if(b)
{
- ObjectPrx bb = b->ice_facet(f);
- try
- {
- if(bb->ice_isA(typeId))
- {
- return bb;
- }
+ ObjectPrx bb = b->ice_facet(f);
+ try
+ {
+ if(bb->ice_isA(typeId))
+ {
+ return bb;
+ }
#ifndef NDEBUG
- else
- {
- assert(typeId != "::Ice::Object");
- }
+ else
+ {
+ assert(typeId != "::Ice::Object");
+ }
#endif
- }
- catch(const FacetNotExistException&)
- {
- }
+ }
+ catch(const FacetNotExistException&)
+ {
+ }
}
return 0;
}
@@ -102,23 +102,23 @@ IceInternal::checkedCastImpl(const ObjectPrx& b, const string& f, const string&
if(b)
{
- ObjectPrx bb = b->ice_facet(f);
- try
- {
- if(bb->ice_isA(typeId, ctx))
- {
- return bb;
- }
+ ObjectPrx bb = b->ice_facet(f);
+ try
+ {
+ if(bb->ice_isA(typeId, ctx))
+ {
+ return bb;
+ }
#ifndef NDEBUG
- else
- {
- assert(typeId != "::Ice::Object");
- }
+ else
+ {
+ assert(typeId != "::Ice::Object");
+ }
#endif
- }
- catch(const FacetNotExistException&)
- {
- }
+ }
+ catch(const FacetNotExistException&)
+ {
+ }
}
return 0;
}
@@ -160,11 +160,11 @@ IceProxy::Ice::Object::ice_isA(const string& __id, const Context* __context)
while(true)
{
ConnectionPtr __connection;
- try
- {
- __checkTwowayOnly("ice_isA");
- static const string __operation("ice_isA");
- __connection = ice_getConnection();
+ try
+ {
+ __checkTwowayOnly("ice_isA");
+ static const string __operation("ice_isA");
+ __connection = ice_getConnection();
Outgoing __og(__connection.get(), _reference.get(), __operation, ::Ice::Nonmutating, __context);
BasicStream* __stream = __og.stream();
try
@@ -181,14 +181,14 @@ IceProxy::Ice::Object::ice_isA(const string& __id, const Context* __context)
{
if(!__ok)
{
- try
- {
+ try
+ {
__stream->throwException();
- }
- catch(const ::Ice::UserException& __ex)
- {
- throw ::Ice::UnknownUserException(__FILE__, __LINE__, __ex.ice_name());
- }
+ }
+ catch(const ::Ice::UserException& __ex)
+ {
+ throw ::Ice::UnknownUserException(__FILE__, __LINE__, __ex.ice_name());
+ }
}
__stream->read(__ret);
}
@@ -203,20 +203,20 @@ IceProxy::Ice::Object::ice_isA(const string& __id, const Context* __context)
}
#endif
return __ret;
- }
- catch(const LocalExceptionWrapper& __ex)
- {
- __handleExceptionWrapperRelaxed(__connection, __ex, __cnt);
- }
- catch(const LocalException& __ex)
- {
- __handleException(__connection, __ex, __cnt);
- }
+ }
+ catch(const LocalExceptionWrapper& __ex)
+ {
+ __handleExceptionWrapperRelaxed(__connection, __ex, __cnt);
+ }
+ catch(const LocalException& __ex)
+ {
+ __handleException(__connection, __ex, __cnt);
+ }
#if defined(_MSC_VER) && defined(_M_ARM) // ARM bug.
- catch(...)
- {
- throw;
- }
+ catch(...)
+ {
+ throw;
+ }
#endif
}
}
@@ -228,10 +228,10 @@ IceProxy::Ice::Object::ice_ping(const Context* __context)
while(true)
{
ConnectionPtr __connection;
- try
- {
+ try
+ {
static const string __operation("ice_ping");
- __connection = ice_getConnection();
+ __connection = ice_getConnection();
Outgoing __og(__connection.get(), _reference.get(), __operation, ::Ice::Nonmutating, __context);
bool __ok = __og.invoke();
try
@@ -239,14 +239,14 @@ IceProxy::Ice::Object::ice_ping(const Context* __context)
BasicStream* __is = __og.stream();
if(!__ok)
{
- try
- {
+ try
+ {
__is->throwException();
- }
- catch(const ::Ice::UserException& __ex)
- {
- throw ::Ice::UnknownUserException(__FILE__, __LINE__, __ex.ice_name());
- }
+ }
+ catch(const ::Ice::UserException& __ex)
+ {
+ throw ::Ice::UnknownUserException(__FILE__, __LINE__, __ex.ice_name());
+ }
}
}
catch(const ::Ice::LocalException& __ex)
@@ -259,21 +259,21 @@ IceProxy::Ice::Object::ice_ping(const Context* __context)
throw;
}
#endif
- return;
- }
- catch(const LocalExceptionWrapper& __ex)
- {
- __handleExceptionWrapperRelaxed(__connection, __ex, __cnt);
- }
- catch(const LocalException& __ex)
- {
- __handleException(__connection, __ex, __cnt);
- }
+ return;
+ }
+ catch(const LocalExceptionWrapper& __ex)
+ {
+ __handleExceptionWrapperRelaxed(__connection, __ex, __cnt);
+ }
+ catch(const LocalException& __ex)
+ {
+ __handleException(__connection, __ex, __cnt);
+ }
#if defined(_MSC_VER) && defined(_M_ARM) // ARM bug.
- catch(...)
- {
- throw;
- }
+ catch(...)
+ {
+ throw;
+ }
#endif
}
}
@@ -285,11 +285,11 @@ IceProxy::Ice::Object::ice_ids(const Context* __context)
while(true)
{
ConnectionPtr __connection;
- try
- {
- __checkTwowayOnly("ice_ids");
+ try
+ {
+ __checkTwowayOnly("ice_ids");
static const string __operation("ice_ids");
- __connection = ice_getConnection();
+ __connection = ice_getConnection();
Outgoing __og(__connection.get(), _reference.get(), __operation, ::Ice::Nonmutating, __context);
vector<string> __ret;
bool __ok = __og.invoke();
@@ -298,14 +298,14 @@ IceProxy::Ice::Object::ice_ids(const Context* __context)
BasicStream* __is = __og.stream();
if(!__ok)
{
- try
- {
+ try
+ {
__is->throwException();
- }
- catch(const ::Ice::UserException& __ex)
- {
- throw ::Ice::UnknownUserException(__FILE__, __LINE__, __ex.ice_name());
- }
+ }
+ catch(const ::Ice::UserException& __ex)
+ {
+ throw ::Ice::UnknownUserException(__FILE__, __LINE__, __ex.ice_name());
+ }
}
__is->read(__ret, false);
}
@@ -320,20 +320,20 @@ IceProxy::Ice::Object::ice_ids(const Context* __context)
}
#endif
return __ret;
- }
- catch(const LocalExceptionWrapper& __ex)
- {
- __handleExceptionWrapperRelaxed(__connection, __ex, __cnt);
- }
- catch(const LocalException& __ex)
- {
- __handleException(__connection, __ex, __cnt);
- }
+ }
+ catch(const LocalExceptionWrapper& __ex)
+ {
+ __handleExceptionWrapperRelaxed(__connection, __ex, __cnt);
+ }
+ catch(const LocalException& __ex)
+ {
+ __handleException(__connection, __ex, __cnt);
+ }
#if defined(_MSC_VER) && defined(_M_ARM) // ARM bug.
- catch(...)
- {
- throw;
- }
+ catch(...)
+ {
+ throw;
+ }
#endif
}
}
@@ -345,11 +345,11 @@ IceProxy::Ice::Object::ice_id(const Context* __context)
while(true)
{
ConnectionPtr __connection;
- try
- {
- __checkTwowayOnly("ice_id");
+ try
+ {
+ __checkTwowayOnly("ice_id");
static const string __operation("ice_id");
- __connection = ice_getConnection();
+ __connection = ice_getConnection();
Outgoing __og(__connection.get(), _reference.get(), __operation, ::Ice::Nonmutating, __context);
string __ret;
bool __ok = __og.invoke();
@@ -358,14 +358,14 @@ IceProxy::Ice::Object::ice_id(const Context* __context)
BasicStream* __is = __og.stream();
if(!__ok)
{
- try
- {
+ try
+ {
__is->throwException();
- }
- catch(const ::Ice::UserException& __ex)
- {
- throw ::Ice::UnknownUserException(__FILE__, __LINE__, __ex.ice_name());
- }
+ }
+ catch(const ::Ice::UserException& __ex)
+ {
+ throw ::Ice::UnknownUserException(__FILE__, __LINE__, __ex.ice_name());
+ }
}
__is->read(__ret, false);
}
@@ -380,20 +380,20 @@ IceProxy::Ice::Object::ice_id(const Context* __context)
}
#endif
return __ret;
- }
- catch(const LocalExceptionWrapper& __ex)
- {
- __handleExceptionWrapperRelaxed(__connection, __ex, __cnt);
- }
- catch(const LocalException& __ex)
- {
- __handleException(__connection, __ex, __cnt);
- }
+ }
+ catch(const LocalExceptionWrapper& __ex)
+ {
+ __handleExceptionWrapperRelaxed(__connection, __ex, __cnt);
+ }
+ catch(const LocalException& __ex)
+ {
+ __handleException(__connection, __ex, __cnt);
+ }
#if defined(_MSC_VER) && defined(_M_ARM) // ARM bug.
- catch(...)
- {
- throw;
- }
+ catch(...)
+ {
+ throw;
+ }
#endif
}
}
@@ -427,13 +427,13 @@ IceProxy::Ice::Object::ice_identity(const Identity& newIdentity) const
}
if(newIdentity == _reference->getIdentity())
{
- return ObjectPrx(const_cast< ::IceProxy::Ice::Object*>(this));
+ return ObjectPrx(const_cast< ::IceProxy::Ice::Object*>(this));
}
else
{
- ObjectPrx proxy(new ::IceProxy::Ice::Object());
- proxy->setup(_reference->changeIdentity(newIdentity));
- return proxy;
+ ObjectPrx proxy(new ::IceProxy::Ice::Object());
+ proxy->setup(_reference->changeIdentity(newIdentity));
+ return proxy;
}
}
@@ -448,13 +448,13 @@ IceProxy::Ice::Object::ice_facet(const string& newFacet) const
{
if(newFacet == _reference->getFacet())
{
- return ObjectPrx(const_cast< ::IceProxy::Ice::Object*>(this));
+ return ObjectPrx(const_cast< ::IceProxy::Ice::Object*>(this));
}
else
{
- ObjectPrx proxy(new ::IceProxy::Ice::Object());
- proxy->setup(_reference->changeFacet(newFacet));
- return proxy;
+ ObjectPrx proxy(new ::IceProxy::Ice::Object());
+ proxy->setup(_reference->changeFacet(newFacet));
+ return proxy;
}
}
@@ -473,13 +473,13 @@ IceProxy::Ice::Object::ice_router(const RouterPrx& router) const
ReferencePtr ref = _reference->changeRouter(router);
if(ref == _reference)
{
- return ObjectPrx(const_cast< ::IceProxy::Ice::Object*>(this));
+ return ObjectPrx(const_cast< ::IceProxy::Ice::Object*>(this));
}
else
{
- ObjectPrx proxy(new ::IceProxy::Ice::Object());
- proxy->setup(ref);
- return proxy;
+ ObjectPrx proxy(new ::IceProxy::Ice::Object());
+ proxy->setup(ref);
+ return proxy;
}
}
@@ -499,13 +499,13 @@ IceProxy::Ice::Object::ice_adapterId(const string& adapterId) const
ReferencePtr ref = _reference->changeAdapterId(adapterId);
if(ref == _reference)
{
- return ObjectPrx(const_cast< ::IceProxy::Ice::Object*>(this));
+ return ObjectPrx(const_cast< ::IceProxy::Ice::Object*>(this));
}
else
{
- ObjectPrx proxy(new ::IceProxy::Ice::Object());
- proxy->setup(ref);
- return proxy;
+ ObjectPrx proxy(new ::IceProxy::Ice::Object());
+ proxy->setup(ref);
+ return proxy;
}
}
@@ -522,13 +522,13 @@ IceProxy::Ice::Object::ice_locator(const LocatorPrx& locator) const
ReferencePtr ref = _reference->changeLocator(locator);
if(ref == _reference)
{
- return ObjectPrx(const_cast< ::IceProxy::Ice::Object*>(this));
+ return ObjectPrx(const_cast< ::IceProxy::Ice::Object*>(this));
}
else
{
- ObjectPrx proxy(new ::IceProxy::Ice::Object());
- proxy->setup(ref);
- return proxy;
+ ObjectPrx proxy(new ::IceProxy::Ice::Object());
+ proxy->setup(ref);
+ return proxy;
}
}
@@ -561,13 +561,13 @@ IceProxy::Ice::Object::ice_timeout(int t) const
ReferencePtr ref = _reference->changeTimeout(t);
if(ref == _reference)
{
- return ObjectPrx(const_cast< ::IceProxy::Ice::Object*>(this));
+ return ObjectPrx(const_cast< ::IceProxy::Ice::Object*>(this));
}
else
{
- ObjectPrx proxy(new ::IceProxy::Ice::Object());
- proxy->setup(ref);
- return proxy;
+ ObjectPrx proxy(new ::IceProxy::Ice::Object());
+ proxy->setup(ref);
+ return proxy;
}
}
@@ -610,10 +610,10 @@ IceProxy::Ice::Object::__copyFrom(const ObjectPrx& from)
ConnectionPtr con;
{
- ::IceUtil::Mutex::Lock sync(*from.get());
+ ::IceUtil::Mutex::Lock sync(*from.get());
- ref = from->_reference;
- con = from->_connection;
+ ref = from->_reference;
+ con = from->_connection;
}
//
@@ -645,13 +645,13 @@ IceProxy::Ice::Object::__handleException(const ConnectionPtr& connection, const
ProxyFactoryPtr proxyFactory = _reference->getInstance()->proxyFactory();
if(proxyFactory)
{
- proxyFactory->checkRetryAfterException(ex, _reference, cnt);
+ proxyFactory->checkRetryAfterException(ex, _reference, cnt);
}
else
{
- //
- // The communicator is already destroyed, so we cannot retry.
- //
+ //
+ // The communicator is already destroyed, so we cannot retry.
+ //
ex.ice_throw();
}
}
@@ -703,8 +703,8 @@ IceProxy::Ice::Object::__checkTwowayOnly(const char* name) const
if(!ice_isTwoway())
{
TwowayOnlyException ex(__FILE__, __LINE__);
- ex.operation = name;
- throw ex;
+ ex.operation = name;
+ throw ex;
}
}
@@ -719,13 +719,13 @@ IceProxy::Ice::Object::changeMode(ReferenceMode newMode) const
{
if(_reference->getMode() == newMode)
{
- return ObjectPrx(const_cast< ::IceProxy::Ice::Object*>(this));
+ return ObjectPrx(const_cast< ::IceProxy::Ice::Object*>(this));
}
else
{
- ObjectPrx proxy(new ::IceProxy::Ice::Object());
- proxy->setup(_reference->changeMode(newMode));
- return proxy;
+ ObjectPrx proxy(new ::IceProxy::Ice::Object());
+ proxy->setup(_reference->changeMode(newMode));
+ return proxy;
}
}
@@ -734,19 +734,19 @@ Ice::proxyIdentityLess(const ObjectPrx& lhs, const ObjectPrx& rhs)
{
if(!lhs && !rhs)
{
- return false;
+ return false;
}
else if(!lhs && rhs)
{
- return true;
+ return true;
}
else if(lhs && !rhs)
{
- return false;
+ return false;
}
else
{
- return lhs->ice_getIdentity() < rhs->ice_getIdentity();
+ return lhs->ice_getIdentity() < rhs->ice_getIdentity();
}
}
@@ -755,19 +755,19 @@ Ice::proxyIdentityEqual(const ObjectPrx& lhs, const ObjectPrx& rhs)
{
if(!lhs && !rhs)
{
- return true;
+ return true;
}
else if(!lhs && rhs)
{
- return false;
+ return false;
}
else if(lhs && !rhs)
{
- return false;
+ return false;
}
else
{
- return lhs->ice_getIdentity() == rhs->ice_getIdentity();
+ return lhs->ice_getIdentity() == rhs->ice_getIdentity();
}
}
@@ -776,43 +776,43 @@ Ice::proxyIdentityAndFacetLess(const ObjectPrx& lhs, const ObjectPrx& rhs)
{
if(!lhs && !rhs)
{
- return false;
+ return false;
}
else if(!lhs && rhs)
{
- return true;
+ return true;
}
else if(lhs && !rhs)
{
- return false;
+ return false;
}
else
{
- Identity lhsIdentity = lhs->ice_getIdentity();
- Identity rhsIdentity = rhs->ice_getIdentity();
-
- if(lhsIdentity < rhsIdentity)
- {
- return true;
- }
- else if(rhsIdentity < lhsIdentity)
- {
- return false;
- }
-
- string lhsFacet = lhs->ice_getFacet();
- string rhsFacet = rhs->ice_getFacet();
-
- if(lhsFacet < rhsFacet)
- {
- return true;
- }
- else if(rhsFacet < lhsFacet)
- {
- return false;
- }
-
- return false;
+ Identity lhsIdentity = lhs->ice_getIdentity();
+ Identity rhsIdentity = rhs->ice_getIdentity();
+
+ if(lhsIdentity < rhsIdentity)
+ {
+ return true;
+ }
+ else if(rhsIdentity < lhsIdentity)
+ {
+ return false;
+ }
+
+ string lhsFacet = lhs->ice_getFacet();
+ string rhsFacet = rhs->ice_getFacet();
+
+ if(lhsFacet < rhsFacet)
+ {
+ return true;
+ }
+ else if(rhsFacet < lhsFacet)
+ {
+ return false;
+ }
+
+ return false;
}
}
@@ -821,32 +821,32 @@ Ice::proxyIdentityAndFacetEqual(const ObjectPrx& lhs, const ObjectPrx& rhs)
{
if(!lhs && !rhs)
{
- return true;
+ return true;
}
else if(!lhs && rhs)
{
- return false;
+ return false;
}
else if(lhs && !rhs)
{
- return false;
+ return false;
}
else
{
- Identity lhsIdentity = lhs->ice_getIdentity();
- Identity rhsIdentity = rhs->ice_getIdentity();
-
- if(lhsIdentity == rhsIdentity)
- {
- string lhsFacet = lhs->ice_getFacet();
- string rhsFacet = rhs->ice_getFacet();
-
- if(lhsFacet == rhsFacet)
- {
- return true;
- }
- }
-
- return false;
+ Identity lhsIdentity = lhs->ice_getIdentity();
+ Identity rhsIdentity = rhs->ice_getIdentity();
+
+ if(lhsIdentity == rhsIdentity)
+ {
+ string lhsFacet = lhs->ice_getFacet();
+ string rhsFacet = rhs->ice_getFacet();
+
+ if(lhsFacet == rhsFacet)
+ {
+ return true;
+ }
+ }
+
+ return false;
}
}
diff --git a/cppe/src/IceE/ProxyFactory.cpp b/cppe/src/IceE/ProxyFactory.cpp
index 564f40ec857..3ca7b7a2d23 100644
--- a/cppe/src/IceE/ProxyFactory.cpp
+++ b/cppe/src/IceE/ProxyFactory.cpp
@@ -39,11 +39,11 @@ IceInternal::ProxyFactory::proxyToString(const ObjectPrx& proxy) const
{
if(proxy)
{
- return proxy->__reference()->toString();
+ return proxy->__reference()->toString();
}
else
{
- return "";
+ return "";
}
}
@@ -69,13 +69,13 @@ IceInternal::ProxyFactory::proxyToStream(const ObjectPrx& proxy, BasicStream* s)
{
if(proxy)
{
- proxy->__reference()->getIdentity().__write(s);
- proxy->__reference()->streamWrite(s);
+ proxy->__reference()->getIdentity().__write(s);
+ proxy->__reference()->streamWrite(s);
}
else
{
- Identity ident;
- ident.__write(s);
+ Identity ident;
+ ident.__write(s);
}
}
@@ -105,15 +105,15 @@ IceInternal::ProxyFactory::checkRetryAfterException(const LocalException& ex, co
if(one)
{
#ifdef ICEE_HAS_LOCATOR
- LocatorInfoPtr li = ref->getLocatorInfo();
- if(li)
- {
- //
- // We retry ObjectNotExistException if the reference is indirect.
- //
- li->clearObjectCache(IndirectReferencePtr::dynamicCast(ref));
- }
- else
+ LocatorInfoPtr li = ref->getLocatorInfo();
+ if(li)
+ {
+ //
+ // We retry ObjectNotExistException if the reference is indirect.
+ //
+ li->clearObjectCache(IndirectReferencePtr::dynamicCast(ref));
+ }
+ else
#endif
#ifdef ICEE_HAS_ROUTER
if(ref->getRouterInfo() && one->operation == "ice_add_proxy")
@@ -133,14 +133,14 @@ IceInternal::ProxyFactory::checkRetryAfterException(const LocalException& ex, co
}
return; // We must always retry, so we don't look at the retry count.
}
- else
+ else
#endif
- {
- //
- // For all other cases, we don't retry ObjectNotExistException
- //
- ex.ice_throw();
- }
+ {
+ //
+ // For all other cases, we don't retry ObjectNotExistException
+ //
+ ex.ice_throw();
+ }
}
else
#endif
@@ -150,7 +150,7 @@ IceInternal::ProxyFactory::checkRetryAfterException(const LocalException& ex, co
// We don't retry other *NotExistException, which are all
// derived from RequestFailedException.
//
- ex.ice_throw();
+ ex.ice_throw();
}
//
@@ -177,7 +177,7 @@ IceInternal::ProxyFactory::checkRetryAfterException(const LocalException& ex, co
//
if(dynamic_cast<const MarshalException*>(&ex))
{
- ex.ice_throw();
+ ex.ice_throw();
}
++cnt;
@@ -225,41 +225,41 @@ IceInternal::ProxyFactory::ProxyFactory(const InstancePtr& instance) :
while(true)
{
- const string delim = " \t";
+ const string delim = " \t";
- beg = str.find_first_not_of(delim, end);
- if(beg == string::npos)
- {
- if(_retryIntervals.empty())
- {
- _retryIntervals.push_back(0);
- }
- break;
- }
+ beg = str.find_first_not_of(delim, end);
+ if(beg == string::npos)
+ {
+ if(_retryIntervals.empty())
+ {
+ _retryIntervals.push_back(0);
+ }
+ break;
+ }
- end = str.find_first_of(delim, beg);
- if(end == string::npos)
- {
- end = str.length();
- }
-
- if(beg == end)
- {
- break;
- }
+ end = str.find_first_of(delim, beg);
+ if(end == string::npos)
+ {
+ end = str.length();
+ }
+
+ if(beg == end)
+ {
+ break;
+ }
- string value = str.substr(beg, end - beg);
- int v = atoi(value.c_str());
+ string value = str.substr(beg, end - beg);
+ int v = atoi(value.c_str());
- //
- // If -1 is the first value, no retry and wait intervals.
- //
- if(v == -1 && _retryIntervals.empty())
- {
- break;
- }
+ //
+ // If -1 is the first value, no retry and wait intervals.
+ //
+ if(v == -1 && _retryIntervals.empty())
+ {
+ break;
+ }
- _retryIntervals.push_back(v > 0 ? v : 0);
+ _retryIntervals.push_back(v > 0 ? v : 0);
}
}
diff --git a/cppe/src/IceE/RecMutex.cpp b/cppe/src/IceE/RecMutex.cpp
index 28528f31c4e..bf526d2b8a4 100644
--- a/cppe/src/IceE/RecMutex.cpp
+++ b/cppe/src/IceE/RecMutex.cpp
@@ -34,7 +34,7 @@ IceUtil::RecMutex::lock() const
EnterCriticalSection(&_mutex);
if(++_count > 1)
{
- LeaveCriticalSection(&_mutex);
+ LeaveCriticalSection(&_mutex);
}
}
@@ -43,11 +43,11 @@ IceUtil::RecMutex::tryLock() const
{
if(!TryEnterCriticalSection(&_mutex))
{
- return false;
+ return false;
}
if(++_count > 1)
{
- LeaveCriticalSection(&_mutex);
+ LeaveCriticalSection(&_mutex);
}
return true;
}
@@ -57,7 +57,7 @@ IceUtil::RecMutex::unlock() const
{
if(--_count == 0)
{
- LeaveCriticalSection(&_mutex);
+ LeaveCriticalSection(&_mutex);
}
}
@@ -84,7 +84,7 @@ IceUtil::RecMutex::RecMutex() :
_mutex = CreateMutex(0, false, 0);
if(_mutex == 0)
{
- throw ThreadSyscallException(__FILE__, __LINE__, GetLastError());
+ throw ThreadSyscallException(__FILE__, __LINE__, GetLastError());
}
}
@@ -94,7 +94,7 @@ IceUtil::RecMutex::~RecMutex()
BOOL rc = CloseHandle(_mutex);
if(rc == 0)
{
- throw ThreadSyscallException(__FILE__, __LINE__, GetLastError());
+ throw ThreadSyscallException(__FILE__, __LINE__, GetLastError());
}
}
@@ -104,23 +104,23 @@ IceUtil::RecMutex::lock() const
DWORD rc = WaitForSingleObject(_mutex, INFINITE);
if(rc != WAIT_OBJECT_0)
{
- if(rc == WAIT_FAILED)
- {
- throw ThreadSyscallException(__FILE__, __LINE__, GetLastError());
- }
- else
- {
- throw ThreadSyscallException(__FILE__, __LINE__, 0);
- }
+ if(rc == WAIT_FAILED)
+ {
+ throw ThreadSyscallException(__FILE__, __LINE__, GetLastError());
+ }
+ else
+ {
+ throw ThreadSyscallException(__FILE__, __LINE__, 0);
+ }
}
if(++_count > 1)
{
- BOOL rc2 = ReleaseMutex(_mutex);
- if(rc2 == 0)
- {
- throw ThreadSyscallException(__FILE__, __LINE__, GetLastError());
- }
+ BOOL rc2 = ReleaseMutex(_mutex);
+ if(rc2 == 0)
+ {
+ throw ThreadSyscallException(__FILE__, __LINE__, GetLastError());
+ }
}
}
@@ -130,15 +130,15 @@ IceUtil::RecMutex::tryLock() const
DWORD rc = WaitForSingleObject(_mutex, 0);
if(rc != WAIT_OBJECT_0)
{
- return false;
+ return false;
}
if(++_count > 1)
{
- BOOL rc2 = ReleaseMutex(_mutex);
- if(rc2 == 0)
- {
- throw ThreadSyscallException(__FILE__, __LINE__, GetLastError());
- }
+ BOOL rc2 = ReleaseMutex(_mutex);
+ if(rc2 == 0)
+ {
+ throw ThreadSyscallException(__FILE__, __LINE__, GetLastError());
+ }
}
return true;
}
@@ -148,11 +148,11 @@ IceUtil::RecMutex::unlock() const
{
if(--_count == 0)
{
- BOOL rc = ReleaseMutex(_mutex);
- if(rc == 0)
- {
- throw ThreadSyscallException(__FILE__, __LINE__, GetLastError());
- }
+ BOOL rc = ReleaseMutex(_mutex);
+ if(rc == 0)
+ {
+ throw ThreadSyscallException(__FILE__, __LINE__, GetLastError());
+ }
}
}
@@ -164,7 +164,7 @@ IceUtil::RecMutex::unlock(LockState& state) const
BOOL rc = ReleaseMutex(_mutex);
if(rc == 0)
{
- throw ThreadSyscallException(__FILE__, __LINE__, GetLastError());
+ throw ThreadSyscallException(__FILE__, __LINE__, GetLastError());
}
}
@@ -174,14 +174,14 @@ IceUtil::RecMutex::lock(LockState& state) const
DWORD rc = WaitForSingleObject(_mutex, INFINITE);
if(rc != WAIT_OBJECT_0)
{
- if(rc == WAIT_FAILED)
- {
- throw ThreadSyscallException(__FILE__, __LINE__, GetLastError());
- }
- else
- {
- throw ThreadSyscallException(__FILE__, __LINE__, 0);
- }
+ if(rc == WAIT_FAILED)
+ {
+ throw ThreadSyscallException(__FILE__, __LINE__, GetLastError());
+ }
+ else
+ {
+ throw ThreadSyscallException(__FILE__, __LINE__, 0);
+ }
}
_count = state.count;
@@ -203,19 +203,19 @@ IceUtil::RecMutex::RecMutex() :
rc = pthread_mutexattr_init(&attr);
if(rc != 0)
{
- throw ThreadSyscallException(__FILE__, __LINE__, rc);
+ throw ThreadSyscallException(__FILE__, __LINE__, rc);
}
rc = pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
if(rc != 0)
{
- throw ThreadSyscallException(__FILE__, __LINE__, rc);
+ throw ThreadSyscallException(__FILE__, __LINE__, rc);
}
#endif
rc = pthread_mutex_init(&_mutex, &attr);
if(rc != 0)
{
- throw ThreadSyscallException(__FILE__, __LINE__, rc);
+ throw ThreadSyscallException(__FILE__, __LINE__, rc);
}
#if defined(__linux) && !defined(__USE_UNIX98)
@@ -224,7 +224,7 @@ IceUtil::RecMutex::RecMutex() :
rc = pthread_mutexattr_destroy(&attr);
if(rc != 0)
{
- throw ThreadSyscallException(__FILE__, __LINE__, rc);
+ throw ThreadSyscallException(__FILE__, __LINE__, rc);
}
#endif
}
@@ -243,12 +243,12 @@ IceUtil::RecMutex::lock() const
int rc = pthread_mutex_lock(&_mutex);
if(rc != 0)
{
- throw ThreadSyscallException(__FILE__, __LINE__, rc);
+ throw ThreadSyscallException(__FILE__, __LINE__, rc);
}
if(++_count > 1)
{
- rc = pthread_mutex_unlock(&_mutex);
- assert(rc == 0);
+ rc = pthread_mutex_unlock(&_mutex);
+ assert(rc == 0);
}
}
@@ -259,18 +259,18 @@ IceUtil::RecMutex::tryLock() const
bool result = (rc == 0);
if(!result)
{
- if(rc != EBUSY)
- {
- throw ThreadSyscallException(__FILE__, __LINE__, rc);
- }
+ if(rc != EBUSY)
+ {
+ throw ThreadSyscallException(__FILE__, __LINE__, rc);
+ }
}
else if(++_count > 1)
{
- rc = pthread_mutex_unlock(&_mutex);
- if(rc != 0)
- {
- throw ThreadSyscallException(__FILE__, __LINE__, rc);
- }
+ rc = pthread_mutex_unlock(&_mutex);
+ if(rc != 0)
+ {
+ throw ThreadSyscallException(__FILE__, __LINE__, rc);
+ }
}
return result;
}
@@ -280,9 +280,9 @@ IceUtil::RecMutex::unlock() const
{
if(--_count == 0)
{
- int rc = 0; // Prevent warnings when NDEBUG is defined.
- rc = pthread_mutex_unlock(&_mutex);
- assert(rc == 0);
+ int rc = 0; // Prevent warnings when NDEBUG is defined.
+ rc = pthread_mutex_unlock(&_mutex);
+ assert(rc == 0);
}
}
diff --git a/cppe/src/IceE/Reference.cpp b/cppe/src/IceE/Reference.cpp
index 1b10d06a667..1d780684b61 100644
--- a/cppe/src/IceE/Reference.cpp
+++ b/cppe/src/IceE/Reference.cpp
@@ -78,7 +78,7 @@ IceInternal::Reference::changeMode(ReferenceMode newMode) const
{
if(newMode == _mode)
{
- return ReferencePtr(const_cast<Reference*>(this));
+ return ReferencePtr(const_cast<Reference*>(this));
}
ReferencePtr r = _instance->referenceFactory()->copy(this);
r->_mode = newMode;
@@ -90,7 +90,7 @@ IceInternal::Reference::changeSecure(bool newSecure) const
{
if(newSecure == _secure)
{
- return ReferencePtr(const_cast<Reference*>(this));
+ return ReferencePtr(const_cast<Reference*>(this));
}
ReferencePtr r = _instance->referenceFactory()->copy(this);
r->_secure = newSecure;
@@ -102,7 +102,7 @@ IceInternal::Reference::changeIdentity(const Identity& newIdentity) const
{
if(newIdentity == _identity)
{
- return ReferencePtr(const_cast<Reference*>(this));
+ return ReferencePtr(const_cast<Reference*>(this));
}
ReferencePtr r = _instance->referenceFactory()->copy(this);
r->_identity = newIdentity;
@@ -114,7 +114,7 @@ IceInternal::Reference::changeFacet(const string& newFacet) const
{
if(newFacet == _facet)
{
- return ReferencePtr(const_cast<Reference*>(this));
+ return ReferencePtr(const_cast<Reference*>(this));
}
ReferencePtr r = _instance->referenceFactory()->copy(this);
r->_facet = newFacet;
@@ -126,7 +126,7 @@ IceInternal::Reference::changeTimeout(int newTimeout) const
{
if(_overrideTimeout && newTimeout == _timeout)
{
- return ReferencePtr(const_cast<Reference*>(this));
+ return ReferencePtr(const_cast<Reference*>(this));
}
ReferencePtr r = getInstance()->referenceFactory()->copy(this);
r->_timeout = newTimeout;
@@ -161,19 +161,19 @@ Reference::hash() const
for(q = _context.begin(); q != _context.end(); ++q)
{
- for(p = q->first.begin(); p != q->first.end(); ++p)
- {
- h = 5 * h + *p;
- }
- for(p = q->second.begin(); p != q->second.end(); ++p)
- {
- h = 5 * h + *p;
- }
+ for(p = q->first.begin(); p != q->first.end(); ++p)
+ {
+ h = 5 * h + *p;
+ }
+ for(p = q->second.begin(); p != q->second.end(); ++p)
+ {
+ h = 5 * h + *p;
+ }
}
for(p = _facet.begin(); p != _facet.end(); ++p)
{
- h = 5 * h + *p;
+ h = 5 * h + *p;
}
h = 5 * h + static_cast<Int>(getSecure());
@@ -197,11 +197,11 @@ IceInternal::Reference::streamWrite(BasicStream* s) const
//
if(_facet.empty())
{
- s->write(static_cast<string*>(0), static_cast<string*>(0));
+ s->write(static_cast<string*>(0), static_cast<string*>(0));
}
else
{
- s->write(&_facet, &_facet + 1);
+ s->write(&_facet, &_facet + 1);
}
s->write(static_cast<Byte>(_mode));
@@ -225,7 +225,7 @@ IceInternal::Reference::toString() const
if(id.find_first_of(" :@") != string::npos)
{
s += "\"";
- s += id;
+ s += id;
s += "\"";
}
else
@@ -237,11 +237,11 @@ IceInternal::Reference::toString() const
{
s += " -f ";
- //
- // If the encoded facet string contains characters which
- // the reference parser uses as separators, then we enclose
- // the facet string in quotes.
- //
+ //
+ // If the encoded facet string contains characters which
+ // the reference parser uses as separators, then we enclose
+ // the facet string in quotes.
+ //
string fs = _facet;
#ifdef ICEE_HAS_WSTRING
if(_instance->initializationData().stringConverter)
@@ -252,55 +252,55 @@ IceInternal::Reference::toString() const
fs = string(reinterpret_cast<const char*>(buffer.getBuffer()), last - buffer.getBuffer());
}
#endif
- fs = IceUtil::escapeString(fs, "");
- if(fs.find_first_of(" :@") != string::npos)
- {
+ fs = IceUtil::escapeString(fs, "");
+ if(fs.find_first_of(" :@") != string::npos)
+ {
s += "\"";
- s += fs;
+ s += fs;
s += "\"";
- }
- else
- {
- s += fs;
- }
+ }
+ else
+ {
+ s += fs;
+ }
}
switch(_mode)
{
- case ReferenceModeTwoway:
- {
- s += " -t";
- break;
- }
-
- case ReferenceModeOneway:
- {
- s += " -o";
- break;
- }
-
- case ReferenceModeBatchOneway:
- {
- s += " -O";
- break;
- }
-
- case ReferenceModeDatagram:
- {
- s += " -d";
- break;
- }
-
- case ReferenceModeBatchDatagram:
- {
- s += " -D";
- break;
- }
+ case ReferenceModeTwoway:
+ {
+ s += " -t";
+ break;
+ }
+
+ case ReferenceModeOneway:
+ {
+ s += " -o";
+ break;
+ }
+
+ case ReferenceModeBatchOneway:
+ {
+ s += " -O";
+ break;
+ }
+
+ case ReferenceModeDatagram:
+ {
+ s += " -d";
+ break;
+ }
+
+ case ReferenceModeBatchDatagram:
+ {
+ s += " -D";
+ break;
+ }
}
if(getSecure())
{
- s += " -s";
+ s += " -s";
}
return s;
@@ -317,37 +317,37 @@ IceInternal::Reference::operator==(const Reference& r) const
if(getType() != r.getType())
{
- return false;
+ return false;
}
if(_mode != r._mode)
{
- return false;
+ return false;
}
if(_secure != r._secure)
{
- return false;
+ return false;
}
if(_identity != r._identity)
{
- return false;
+ return false;
}
if(_context != r._context)
{
- return false;
+ return false;
}
if(_facet != r._facet)
{
- return false;
+ return false;
}
if(_overrideTimeout != r._overrideTimeout || _overrideTimeout && _timeout != r._timeout)
{
- return false;
+ return false;
}
return true;
@@ -362,83 +362,83 @@ IceInternal::Reference::operator<(const Reference& r) const
if(_mode < r._mode)
{
- return true;
+ return true;
}
else if(r._mode < _mode)
{
- return false;
+ return false;
}
if(!_secure && r._secure)
{
- return true;
+ return true;
}
else if(r._secure < _secure)
{
- return false;
+ return false;
}
if(_identity < r._identity)
{
- return true;
+ return true;
}
else if(r._identity < _identity)
{
- return false;
+ return false;
}
if(_context < r._context)
{
- return true;
+ return true;
}
else if(r._context < _context)
{
- return false;
+ return false;
}
if(_facet < r._facet)
{
- return true;
+ return true;
}
else if(r._facet < _facet)
{
- return false;
+ return false;
}
if(!_overrideTimeout && r._overrideTimeout)
{
- return true;
+ return true;
}
else if(r._overrideTimeout < _overrideTimeout)
{
- return false;
+ return false;
}
else if(_overrideTimeout)
{
- if(_timeout < r._timeout)
- {
- return true;
- }
- else if(r._timeout < _timeout)
- {
- return false;
- }
+ if(_timeout < r._timeout)
+ {
+ return true;
+ }
+ else if(r._timeout < _timeout)
+ {
+ return false;
+ }
}
if(getType() < r.getType())
{
- return true;
+ return true;
}
else if(r.getType() < getType())
{
- return false;
+ return false;
}
return false;
}
IceInternal::Reference::Reference(const InstancePtr& inst, const CommunicatorPtr& com, const Identity& ident,
- const Context& context, const string& fs, ReferenceMode md, bool sec) :
+ const Context& context, const string& fs, ReferenceMode md, bool sec) :
_hashInitialized(false),
_instance(inst),
_communicator(com),
@@ -474,18 +474,18 @@ IceInternal::Reference::applyOverrides(vector<EndpointPtr>& endpts) const
//
for(vector<EndpointPtr>::iterator p = endpts.begin(); p != endpts.end(); ++p)
{
- if(_overrideTimeout)
- {
- *p = (*p)->timeout(_timeout);
- }
+ if(_overrideTimeout)
+ {
+ *p = (*p)->timeout(_timeout);
+ }
}
}
IceUtil::Shared* IceInternal::upCast(IceInternal::FixedReference* p) { return p; }
IceInternal::FixedReference::FixedReference(const InstancePtr& inst, const CommunicatorPtr& com, const Identity& ident,
- const Context& context, const string& fs, ReferenceMode md,
- const vector<ConnectionPtr>& fixedConns) :
+ const Context& context, const string& fs, ReferenceMode md,
+ const vector<ConnectionPtr>& fixedConns) :
Reference(inst, com, ident, context, fs, md, false),
_fixedConnections(fixedConns)
{
@@ -594,9 +594,9 @@ IceInternal::FixedReference::getConnection() const
#ifndef ICEE_HAS_BATCH
case ReferenceModeBatchDatagram:
case ReferenceModeBatchOneway:
- {
- throw FeatureNotSupportedException(__FILE__, __LINE__, "batch proxy mode");
- }
+ {
+ throw FeatureNotSupportedException(__FILE__, __LINE__, "batch proxy mode");
+ }
#endif
}
@@ -619,28 +619,28 @@ IceInternal::FixedReference::getConnection() const
vector<ConnectionPtr> secureConnections;
while(p != connections.end())
{
- if((*p)->endpoint()->secure())
- {
- secureConnections.push_back(*p);
- p = connections.erase(p);
- }
- else
- {
- ++p;
- }
+ if((*p)->endpoint()->secure())
+ {
+ secureConnections.push_back(*p);
+ p = connections.erase(p);
+ }
+ else
+ {
+ ++p;
+ }
}
if(getSecure())
{
- connections.swap(secureConnections);
+ connections.swap(secureConnections);
}
else
{
- connections.insert(connections.end(), secureConnections.begin(), secureConnections.end());
+ connections.insert(connections.end(), secureConnections.begin(), secureConnections.end());
}
if(connections.empty())
{
- throw NoEndpointException(__FILE__, __LINE__); // No stringified representation for fixed proxies.
+ throw NoEndpointException(__FILE__, __LINE__); // No stringified representation for fixed proxies.
}
ConnectionPtr connection = connections[0];
@@ -680,7 +680,7 @@ IceInternal::FixedReference::operator<(const Reference& r) const
{
const FixedReference* rhs = dynamic_cast<const FixedReference*>(&r);
assert(rhs);
- return _fixedConnections < rhs->_fixedConnections;
+ return _fixedConnections < rhs->_fixedConnections;
}
return false;
}
@@ -706,10 +706,10 @@ IceInternal::RoutableReference::getRoutedEndpoints() const
if(_routerInfo)
{
//
- // If we route, we send everything to the router's client
- // proxy endpoints.
- //
- return _routerInfo->getClientEndpoints();
+ // If we route, we send everything to the router's client
+ // proxy endpoints.
+ //
+ return _routerInfo->getClientEndpoints();
}
return vector<EndpointPtr>();
}
@@ -720,7 +720,7 @@ IceInternal::RoutableReference::changeRouter(const RouterPrx& newRouter) const
RouterInfoPtr newRouterInfo = getInstance()->routerManager()->get(newRouter);
if(newRouterInfo == _routerInfo)
{
- return RoutableReferencePtr(const_cast<RoutableReference*>(this));
+ return RoutableReferencePtr(const_cast<RoutableReference*>(this));
}
RoutableReferencePtr r = RoutableReferencePtr::dynamicCast(getInstance()->referenceFactory()->copy(this));
r->_routerInfo = newRouterInfo;
@@ -763,14 +763,14 @@ IceInternal::RoutableReference::operator<(const Reference& r) const
{
const RoutableReference* rhs = dynamic_cast<const RoutableReference*>(&r);
assert(rhs);
- return _routerInfo < rhs->_routerInfo;
+ return _routerInfo < rhs->_routerInfo;
}
return false;
}
IceInternal::RoutableReference::RoutableReference(const InstancePtr& inst, const CommunicatorPtr& com,
- const Identity& ident, const Context& context, const string& fs,
- ReferenceMode md, bool sec, const RouterInfoPtr& rtrInfo) :
+ const Identity& ident, const Context& context, const string& fs,
+ ReferenceMode md, bool sec, const RouterInfoPtr& rtrInfo) :
Reference(inst, com, ident, context, fs, md, sec), _routerInfo(rtrInfo)
{
}
@@ -786,9 +786,9 @@ IceUtil::Shared* IceInternal::upCast(IceInternal::DirectReference* p) { return p
#ifdef ICEE_HAS_ROUTER
IceInternal::DirectReference::DirectReference(const InstancePtr& inst, const CommunicatorPtr& com,
- const Identity& ident, const Context& context, const string& fs, ReferenceMode md,
- bool sec, const vector<EndpointPtr>& endpts,
- const RouterInfoPtr& rtrInfo) :
+ const Identity& ident, const Context& context, const string& fs, ReferenceMode md,
+ bool sec, const vector<EndpointPtr>& endpts,
+ const RouterInfoPtr& rtrInfo) :
RoutableReference(inst, com, ident, context, fs, md, sec, rtrInfo),
_endpoints(endpts)
@@ -796,8 +796,8 @@ IceInternal::DirectReference::DirectReference(const InstancePtr& inst, const Com
}
#else
IceInternal::DirectReference::DirectReference(const InstancePtr& inst, const CommunicatorPtr& com,
- const Identity& ident, const Context& context, const string& fs, ReferenceMode md,
- bool sec, const vector<EndpointPtr>& endpts) :
+ const Identity& ident, const Context& context, const string& fs, ReferenceMode md,
+ bool sec, const vector<EndpointPtr>& endpts) :
Reference(inst, com, ident, context, fs, md, sec),
_endpoints(endpts)
{
@@ -834,7 +834,7 @@ DirectReference::changeAdapterId(const string& newAdapterId) const
return getInstance()->referenceFactory()->create(getIdentity(), *getContext(), getFacet(), getMode(),
getSecure(), newAdapterId,
#ifdef ICEE_HAS_ROUTER
- getRouterInfo(),
+ getRouterInfo(),
#endif
locatorInfo);
}
@@ -858,12 +858,12 @@ IceInternal::DirectReference::changeTimeout(int newTimeout) const
DirectReferencePtr r = DirectReferencePtr::dynamicCast(Parent::changeTimeout(newTimeout));
if(r.get() != this) // Also override the timeout on the endpoints if it was updated.
{
- vector<EndpointPtr> newEndpoints;
- for(vector<EndpointPtr>::const_iterator p = _endpoints.begin(); p != _endpoints.end(); ++p)
- {
- newEndpoints.push_back((*p)->timeout(newTimeout));
- }
- r->_endpoints = newEndpoints;
+ vector<EndpointPtr> newEndpoints;
+ for(vector<EndpointPtr>::const_iterator p = _endpoints.begin(); p != _endpoints.end(); ++p)
+ {
+ newEndpoints.push_back((*p)->timeout(newTimeout));
+ }
+ r->_endpoints = newEndpoints;
}
return r;
}
@@ -877,14 +877,14 @@ IceInternal::DirectReference::streamWrite(BasicStream* s) const
s->writeSize(sz);
if(sz)
{
- for(vector<EndpointPtr>::const_iterator p = _endpoints.begin(); p != _endpoints.end(); ++p)
- {
- (*p)->streamWrite(s);
- }
+ for(vector<EndpointPtr>::const_iterator p = _endpoints.begin(); p != _endpoints.end(); ++p)
+ {
+ (*p)->streamWrite(s);
+ }
}
else
{
- s->write(string("")); // Adapter id.
+ s->write(string("")); // Adapter id.
}
}
@@ -896,12 +896,12 @@ IceInternal::DirectReference::toString() const
vector<EndpointPtr>::const_iterator p;
for(p = _endpoints.begin(); p != _endpoints.end(); ++p)
{
- string endp = (*p)->toString();
- if(!endp.empty())
- {
- result.append(":");
- result.append(endp);
- }
+ string endp = (*p)->toString();
+ if(!endp.empty())
+ {
+ result.append(":");
+ result.append(endp);
+ }
}
return result;
}
@@ -915,7 +915,7 @@ IceInternal::DirectReference::getConnection() const
if(endpts.empty())
{
- endpts = _endpoints; // Endpoint overrides are already applied on these endpoints.
+ endpts = _endpoints; // Endpoint overrides are already applied on these endpoints.
}
#else
vector<EndpointPtr> endpts = _endpoints;
@@ -975,8 +975,8 @@ IceInternal::DirectReference::operator<(const Reference& r) const
if(Parent::operator==(r))
{
const DirectReference* rhs = dynamic_cast<const DirectReference*>(&r);
- assert(rhs);
- return _endpoints < rhs->_endpoints;
+ assert(rhs);
+ return _endpoints < rhs->_endpoints;
}
return false;
}
@@ -998,9 +998,9 @@ IceUtil::Shared* IceInternal::upCast(IceInternal::IndirectReference* p) { return
#ifdef ICEE_HAS_ROUTER
IceInternal::IndirectReference::IndirectReference(const InstancePtr& inst, const CommunicatorPtr& com,
- const Identity& ident, const Context& context, const string& fs,
- ReferenceMode md, bool sec, const string& adptid,
- const RouterInfoPtr& rtrInfo, const LocatorInfoPtr& locInfo) :
+ const Identity& ident, const Context& context, const string& fs,
+ ReferenceMode md, bool sec, const string& adptid,
+ const RouterInfoPtr& rtrInfo, const LocatorInfoPtr& locInfo) :
RoutableReference(inst, com, ident, context, fs, md, sec, rtrInfo),
_adapterId(adptid),
_locatorInfo(locInfo)
@@ -1008,9 +1008,9 @@ IceInternal::IndirectReference::IndirectReference(const InstancePtr& inst, const
}
#else
IceInternal::IndirectReference::IndirectReference(const InstancePtr& inst, const CommunicatorPtr& com,
- const Identity& ident, const Context& context, const string& fs,
- ReferenceMode md, bool sec, const string& adptid,
- const LocatorInfoPtr& locInfo) :
+ const Identity& ident, const Context& context, const string& fs,
+ ReferenceMode md, bool sec, const string& adptid,
+ const LocatorInfoPtr& locInfo) :
Reference(inst, com, ident, context, fs, md, sec),
_adapterId(adptid),
_locatorInfo(locInfo)
@@ -1054,7 +1054,7 @@ IceInternal::IndirectReference::changeLocator(const LocatorPrx& newLocator) cons
LocatorInfoPtr newLocatorInfo = getInstance()->locatorManager()->get(newLocator);
if(newLocatorInfo == _locatorInfo)
{
- return IndirectReferencePtr(const_cast<IndirectReference*>(this));
+ return IndirectReferencePtr(const_cast<IndirectReference*>(this));
}
IndirectReferencePtr r = IndirectReferencePtr::dynamicCast(getInstance()->referenceFactory()->copy(this));
r->_locatorInfo = newLocatorInfo;
@@ -1098,13 +1098,13 @@ IceInternal::IndirectReference::toString() const
a = IceUtil::escapeString(a, "");
if(a.find_first_of(" ") != string::npos)
{
- result.append("\"");
- result.append(a);
- result.append("\"");
+ result.append("\"");
+ result.append(a);
+ result.append("\"");
}
else
{
- result.append(_adapterId);
+ result.append(_adapterId);
}
return result;
}
@@ -1117,58 +1117,58 @@ IceInternal::IndirectReference::getConnection() const
while(true)
{
#ifdef ICEE_HAS_ROUTER
- vector<EndpointPtr> endpts = Parent::getRoutedEndpoints();
+ vector<EndpointPtr> endpts = Parent::getRoutedEndpoints();
#else
- vector<EndpointPtr> endpts;
+ vector<EndpointPtr> endpts;
#endif
- bool cached = false;
- if(endpts.empty() && _locatorInfo)
- {
- const IndirectReferencePtr self = const_cast<IndirectReference*>(this);
- endpts = _locatorInfo->getEndpoints(self, cached);
- }
-
- applyOverrides(endpts);
-
- vector<EndpointPtr> filteredEndpoints = filterEndpoints(endpts, getMode(), getSecure());
- if(filteredEndpoints.empty())
- {
- throw NoEndpointException(__FILE__, __LINE__, toString());
- }
-
- try
- {
- OutgoingConnectionFactoryPtr factory = getInstance()->outgoingConnectionFactory();
- connection = factory->create(filteredEndpoints);
- assert(connection);
- }
- catch(const LocalException& ex)
- {
+ bool cached = false;
+ if(endpts.empty() && _locatorInfo)
+ {
+ const IndirectReferencePtr self = const_cast<IndirectReference*>(this);
+ endpts = _locatorInfo->getEndpoints(self, cached);
+ }
+
+ applyOverrides(endpts);
+
+ vector<EndpointPtr> filteredEndpoints = filterEndpoints(endpts, getMode(), getSecure());
+ if(filteredEndpoints.empty())
+ {
+ throw NoEndpointException(__FILE__, __LINE__, toString());
+ }
+
+ try
+ {
+ OutgoingConnectionFactoryPtr factory = getInstance()->outgoingConnectionFactory();
+ connection = factory->create(filteredEndpoints);
+ assert(connection);
+ }
+ catch(const LocalException& ex)
+ {
#ifdef ICEE_HAS_ROUTER
- if(!getRouterInfo())
+ if(!getRouterInfo())
#endif
- {
- assert(_locatorInfo);
- const IndirectReferencePtr self = const_cast<IndirectReference*>(this);
- _locatorInfo->clearCache(self);
-
- if(cached)
- {
- TraceLevelsPtr traceLevels = getInstance()->traceLevels();
- if(traceLevels->retry >= 2)
- {
- Trace out(getInstance()->initializationData().logger, traceLevels->retryCat);
- out << "connection to cached endpoints failed\n"
- << "removing endpoints from cache and trying one more time\n" << ex.toString();
- }
- continue;
- }
- }
-
- throw;
- }
-
- break;
+ {
+ assert(_locatorInfo);
+ const IndirectReferencePtr self = const_cast<IndirectReference*>(this);
+ _locatorInfo->clearCache(self);
+
+ if(cached)
+ {
+ TraceLevelsPtr traceLevels = getInstance()->traceLevels();
+ if(traceLevels->retry >= 2)
+ {
+ Trace out(getInstance()->initializationData().logger, traceLevels->retryCat);
+ out << "connection to cached endpoints failed\n"
+ << "removing endpoints from cache and trying one more time\n" << ex.toString();
+ }
+ continue;
+ }
+ }
+
+ throw;
+ }
+
+ break;
}
#if defined(ICEE_HAS_ROUTER) && !defined(ICEE_PURE_CLIENT)
@@ -1238,16 +1238,16 @@ IceInternal::IndirectReference::operator<(const Reference& r) const
if(Parent::operator==(r))
{
const IndirectReference* rhs = dynamic_cast<const IndirectReference*>(&r);
- assert(rhs);
- if(_adapterId < rhs->_adapterId)
- {
- return true;
- }
- else if(rhs->_adapterId < _adapterId)
- {
- return false;
- }
- return _locatorInfo < rhs->_locatorInfo;
+ assert(rhs);
+ if(_adapterId < rhs->_adapterId)
+ {
+ return true;
+ }
+ else if(rhs->_adapterId < _adapterId)
+ {
+ return false;
+ }
+ return _locatorInfo < rhs->_locatorInfo;
}
return false;
}
@@ -1305,18 +1305,18 @@ IceInternal::filterEndpoints(const vector<EndpointPtr>& allEndpoints, ReferenceM
//
// Filter out non-datagram endpoints.
//
- endpoints.erase(remove_if(endpoints.begin(), endpoints.end(),
- not1(Ice::constMemFun(&Endpoint::datagram))),
- endpoints.end());
+ endpoints.erase(remove_if(endpoints.begin(), endpoints.end(),
+ not1(Ice::constMemFun(&Endpoint::datagram))),
+ endpoints.end());
break;
}
#ifndef ICEE_HAS_BATCH
case ReferenceModeBatchDatagram:
case ReferenceModeBatchOneway:
- {
- throw FeatureNotSupportedException(__FILE__, __LINE__, "batch proxy mode");
- }
+ {
+ throw FeatureNotSupportedException(__FILE__, __LINE__, "batch proxy mode");
+ }
#endif
}
@@ -1339,23 +1339,23 @@ IceInternal::filterEndpoints(const vector<EndpointPtr>& allEndpoints, ReferenceM
vector<EndpointPtr> secureEndpoints;
while(p != endpoints.end())
{
- if((*p)->secure())
- {
- secureEndpoints.push_back(*p);
- p = endpoints.erase(p);
- }
- else
- {
- ++p;
- }
+ if((*p)->secure())
+ {
+ secureEndpoints.push_back(*p);
+ p = endpoints.erase(p);
+ }
+ else
+ {
+ ++p;
+ }
}
if(sec)
{
- endpoints.swap(secureEndpoints);
+ endpoints.swap(secureEndpoints);
}
else
{
- endpoints.insert(endpoints.end(), secureEndpoints.begin(), secureEndpoints.end());
+ endpoints.insert(endpoints.end(), secureEndpoints.begin(), secureEndpoints.end());
}
return endpoints;
diff --git a/cppe/src/IceE/Reference.h b/cppe/src/IceE/Reference.h
index 443799e6582..933c4ac4330 100644
--- a/cppe/src/IceE/Reference.h
+++ b/cppe/src/IceE/Reference.h
@@ -38,9 +38,9 @@ public:
enum Type
{
- TypeDirect,
- TypeIndirect,
- TypeFixed
+ TypeDirect,
+ TypeIndirect,
+ TypeFixed
};
//
@@ -49,12 +49,12 @@ public:
//
// enum Mode
// {
-// ModeTwoway,
-// ModeOneway,
-// ModeBatchOneway,
-// ModeDatagram,
-// ModeBatchDatagram,
-// ModeLast = ModeBatchDatagram
+// ModeTwoway,
+// ModeOneway,
+// ModeBatchOneway,
+// ModeDatagram,
+// ModeBatchDatagram,
+// ModeLast = ModeBatchDatagram
// };
ReferenceMode getMode() const { return _mode; }
@@ -122,7 +122,7 @@ public:
protected:
Reference(const InstancePtr&, const Ice::CommunicatorPtr&, const Ice::Identity&, const Ice::Context&,
- const std::string&, ReferenceMode, bool);
+ const std::string&, ReferenceMode, bool);
Reference(const Reference&);
void applyOverrides(std::vector<EndpointPtr>&) const;
@@ -158,7 +158,7 @@ class FixedReference : public Reference
public:
FixedReference(const InstancePtr&, const Ice::CommunicatorPtr&, const Ice::Identity&, const Ice::Context&,
- const std::string&, ReferenceMode, const std::vector<Ice::ConnectionPtr>&);
+ const std::string&, ReferenceMode, const std::vector<Ice::ConnectionPtr>&);
virtual Type getType() const;
virtual std::vector<EndpointPtr> getEndpoints() const;
@@ -214,7 +214,7 @@ public:
protected:
RoutableReference(const InstancePtr&, const Ice::CommunicatorPtr&, const Ice::Identity&, const Ice::Context&,
- const std::string&, ReferenceMode, bool, const RouterInfoPtr&);
+ const std::string&, ReferenceMode, bool, const RouterInfoPtr&);
RoutableReference(const RoutableReference&);
@@ -234,11 +234,11 @@ class DirectReference :
public:
DirectReference(const InstancePtr&, const Ice::CommunicatorPtr&, const Ice::Identity&, const Ice::Context&,
- const std::string&, ReferenceMode, bool, const std::vector<EndpointPtr>&
+ const std::string&, ReferenceMode, bool, const std::vector<EndpointPtr>&
#ifdef ICEE_HAS_ROUTER
- , const RouterInfoPtr&
+ , const RouterInfoPtr&
#endif
- );
+ );
virtual Type getType() const;
virtual std::vector<EndpointPtr> getEndpoints() const;
@@ -286,11 +286,11 @@ class IndirectReference :
public:
IndirectReference(const InstancePtr&, const Ice::CommunicatorPtr&, const Ice::Identity&, const Ice::Context&,
- const std::string&, ReferenceMode, bool, const std::string&
+ const std::string&, ReferenceMode, bool, const std::string&
#ifdef ICEE_HAS_ROUTER
- , const RouterInfoPtr&
+ , const RouterInfoPtr&
#endif
- , const LocatorInfoPtr&);
+ , const LocatorInfoPtr&);
virtual LocatorInfoPtr getLocatorInfo() const { return _locatorInfo; }
diff --git a/cppe/src/IceE/ReferenceFactory.cpp b/cppe/src/IceE/ReferenceFactory.cpp
index 9667390915a..1820be6c1a1 100644
--- a/cppe/src/IceE/ReferenceFactory.cpp
+++ b/cppe/src/IceE/ReferenceFactory.cpp
@@ -39,7 +39,7 @@ IceInternal::ReferenceFactory::copy(const Reference* r) const
if(!_instance)
{
- throw CommunicatorDestroyedException(__FILE__, __LINE__);
+ throw CommunicatorDestroyedException(__FILE__, __LINE__);
}
const Ice::Identity& ident = r->getIdentity();
@@ -53,21 +53,21 @@ IceInternal::ReferenceFactory::copy(const Reference* r) const
ReferencePtr
IceInternal::ReferenceFactory::create(const Identity& ident,
- const Context& context,
- const string& facet,
- ReferenceMode mode,
- bool secure,
- const vector<EndpointPtr>& endpoints
+ const Context& context,
+ const string& facet,
+ ReferenceMode mode,
+ bool secure,
+ const vector<EndpointPtr>& endpoints
#ifdef ICEE_HAS_ROUTER
- , const RouterInfoPtr& routerInfo
+ , const RouterInfoPtr& routerInfo
#endif
- )
+ )
{
Mutex::Lock sync(*this);
if(!_instance)
{
- throw CommunicatorDestroyedException(__FILE__, __LINE__);
+ throw CommunicatorDestroyedException(__FILE__, __LINE__);
}
if(ident.name.empty() && ident.category.empty())
@@ -89,21 +89,21 @@ IceInternal::ReferenceFactory::create(const Identity& ident,
ReferencePtr
IceInternal::ReferenceFactory::create(const Identity& ident,
- const Context& context,
- const string& facet,
- ReferenceMode mode,
- bool secure,
- const string& adapterId
+ const Context& context,
+ const string& facet,
+ ReferenceMode mode,
+ bool secure,
+ const string& adapterId
#ifdef ICEE_HAS_ROUTER
- , const RouterInfoPtr& routerInfo
+ , const RouterInfoPtr& routerInfo
#endif
- , const LocatorInfoPtr& locatorInfo)
+ , const LocatorInfoPtr& locatorInfo)
{
Mutex::Lock sync(*this);
if(!_instance)
{
- throw CommunicatorDestroyedException(__FILE__, __LINE__);
+ throw CommunicatorDestroyedException(__FILE__, __LINE__);
}
if(ident.name.empty() && ident.category.empty())
@@ -116,7 +116,7 @@ IceInternal::ReferenceFactory::create(const Identity& ident,
//
#ifdef ICEE_HAS_ROUTER
return new IndirectReference(_instance, _communicator, ident, context, facet, mode, secure, adapterId, routerInfo,
- locatorInfo);
+ locatorInfo);
#else
return new IndirectReference(_instance, _communicator, ident, context, facet, mode, secure, adapterId, locatorInfo);
#endif
@@ -126,16 +126,16 @@ IceInternal::ReferenceFactory::create(const Identity& ident,
ReferencePtr
IceInternal::ReferenceFactory::create(const Identity& ident,
- const Context& context,
- const string& facet,
- ReferenceMode mode,
- const vector<Ice::ConnectionPtr>& fixedConnections)
+ const Context& context,
+ const string& facet,
+ ReferenceMode mode,
+ const vector<Ice::ConnectionPtr>& fixedConnections)
{
Mutex::Lock sync(*this);
if(!_instance)
{
- throw CommunicatorDestroyedException(__FILE__, __LINE__);
+ throw CommunicatorDestroyedException(__FILE__, __LINE__);
}
if(ident.name.empty() && ident.category.empty())
@@ -166,7 +166,7 @@ IceInternal::ReferenceFactory::create(const string& str)
beg = s.find_first_not_of(delim, end);
if(beg == string::npos)
{
- throw ProxyParseException(__FILE__, __LINE__, str);
+ throw ProxyParseException(__FILE__, __LINE__, str);
}
//
@@ -177,7 +177,7 @@ IceInternal::ReferenceFactory::create(const string& str)
end = IceUtil::checkQuote(s, beg);
if(end == string::npos)
{
- throw ProxyParseException(__FILE__, __LINE__, str);
+ throw ProxyParseException(__FILE__, __LINE__, str);
}
else if(end == 0)
{
@@ -197,7 +197,7 @@ IceInternal::ReferenceFactory::create(const string& str)
if(beg == end)
{
- throw ProxyParseException(__FILE__, __LINE__, str);
+ throw ProxyParseException(__FILE__, __LINE__, str);
}
//
@@ -238,50 +238,50 @@ IceInternal::ReferenceFactory::create(const string& str)
while(true)
{
- beg = s.find_first_not_of(delim, end);
- if(beg == string::npos)
- {
- break;
- }
+ beg = s.find_first_not_of(delim, end);
+ if(beg == string::npos)
+ {
+ break;
+ }
if(s[beg] == ':' || s[beg] == '@')
{
break;
}
- end = s.find_first_of(delim + ":@", beg);
- if(end == string::npos)
- {
- end = s.length();
- }
-
- if(beg == end)
- {
- break;
- }
-
- string option = s.substr(beg, end - beg);
- if(option.length() != 2 || option[0] != '-')
- {
+ end = s.find_first_of(delim + ":@", beg);
+ if(end == string::npos)
+ {
+ end = s.length();
+ }
+
+ if(beg == end)
+ {
+ break;
+ }
+
+ string option = s.substr(beg, end - beg);
+ if(option.length() != 2 || option[0] != '-')
+ {
throw ProxyParseException(__FILE__, __LINE__, str);
- }
+ }
//
// Check for the presence of an option argument. The
// argument may be enclosed in single or double
// quotation marks.
//
- string argument;
- string::size_type argumentBeg = s.find_first_not_of(delim, end);
- if(argumentBeg != string::npos)
- {
+ string argument;
+ string::size_type argumentBeg = s.find_first_not_of(delim, end);
+ if(argumentBeg != string::npos)
+ {
if(s[argumentBeg] != '@' && s[argumentBeg] != ':' && s[argumentBeg] != '-')
{
beg = argumentBeg;
end = IceUtil::checkQuote(s, beg);
if(end == string::npos)
{
- throw ProxyParseException(__FILE__, __LINE__, str);
+ throw ProxyParseException(__FILE__, __LINE__, str);
}
else if(end == 0)
{
@@ -298,26 +298,26 @@ IceInternal::ReferenceFactory::create(const string& str)
argument = s.substr(beg, end - beg);
end++; // Skip trailing quote
}
- }
- }
-
- //
- // If any new options are added here,
- // IceInternal::Reference::toString() and its derived classes must be updated as well.
- //
- switch(option[1])
- {
- case 'f':
- {
- if(argument.empty())
- {
- throw ProxyParseException(__FILE__, __LINE__, str);
- }
-
- if(!IceUtil::unescapeString(argument, 0, argument.size(), facet))
- {
- throw ProxyParseException(__FILE__, __LINE__, str);
- }
+ }
+ }
+
+ //
+ // If any new options are added here,
+ // IceInternal::Reference::toString() and its derived classes must be updated as well.
+ //
+ switch(option[1])
+ {
+ case 'f':
+ {
+ if(argument.empty())
+ {
+ throw ProxyParseException(__FILE__, __LINE__, str);
+ }
+
+ if(!IceUtil::unescapeString(argument, 0, argument.size(), facet))
+ {
+ throw ProxyParseException(__FILE__, __LINE__, str);
+ }
#ifdef ICEE_HAS_WSTRING
if(_instance->initializationData().stringConverter)
{
@@ -328,74 +328,74 @@ IceInternal::ReferenceFactory::create(const string& str)
facet = tmpFacet;
}
#endif
- break;
- }
-
- case 't':
- {
- if(!argument.empty())
- {
- throw ProxyParseException(__FILE__, __LINE__, str);
- }
- mode = ReferenceModeTwoway;
- break;
- }
-
- case 'o':
- {
- if(!argument.empty())
- {
- throw ProxyParseException(__FILE__, __LINE__, str);
- }
- mode = ReferenceModeOneway;
- break;
- }
-
- case 'O':
- {
- if(!argument.empty())
- {
- throw ProxyParseException(__FILE__, __LINE__, str);
- }
- mode = ReferenceModeBatchOneway;
- break;
- }
-
- case 'd':
- {
- if(!argument.empty())
- {
- throw ProxyParseException(__FILE__, __LINE__, str);
- }
- mode = ReferenceModeDatagram;
- break;
- }
-
- case 'D':
- {
- if(!argument.empty())
- {
- throw ProxyParseException(__FILE__, __LINE__, str);
- }
- mode = ReferenceModeBatchDatagram;
- break;
- }
-
- case 's':
- {
- if(!argument.empty())
- {
- throw ProxyParseException(__FILE__, __LINE__, str);
- }
- secure = true;
- break;
- }
-
- default:
- {
- throw ProxyParseException(__FILE__, __LINE__, str);
- }
- }
+ break;
+ }
+
+ case 't':
+ {
+ if(!argument.empty())
+ {
+ throw ProxyParseException(__FILE__, __LINE__, str);
+ }
+ mode = ReferenceModeTwoway;
+ break;
+ }
+
+ case 'o':
+ {
+ if(!argument.empty())
+ {
+ throw ProxyParseException(__FILE__, __LINE__, str);
+ }
+ mode = ReferenceModeOneway;
+ break;
+ }
+
+ case 'O':
+ {
+ if(!argument.empty())
+ {
+ throw ProxyParseException(__FILE__, __LINE__, str);
+ }
+ mode = ReferenceModeBatchOneway;
+ break;
+ }
+
+ case 'd':
+ {
+ if(!argument.empty())
+ {
+ throw ProxyParseException(__FILE__, __LINE__, str);
+ }
+ mode = ReferenceModeDatagram;
+ break;
+ }
+
+ case 'D':
+ {
+ if(!argument.empty())
+ {
+ throw ProxyParseException(__FILE__, __LINE__, str);
+ }
+ mode = ReferenceModeBatchDatagram;
+ break;
+ }
+
+ case 's':
+ {
+ if(!argument.empty())
+ {
+ throw ProxyParseException(__FILE__, __LINE__, str);
+ }
+ secure = true;
+ break;
+ }
+
+ default:
+ {
+ throw ProxyParseException(__FILE__, __LINE__, str);
+ }
+ }
}
#ifdef ICEE_HAS_ROUTER
@@ -409,111 +409,111 @@ IceInternal::ReferenceFactory::create(const string& str)
{
#ifdef ICEE_HAS_LOCATOR
# ifdef ICEE_HAS_ROUTER
- return create(ident, Ice::Context(), facet, mode, secure, "", routerInfo, locatorInfo);
+ return create(ident, Ice::Context(), facet, mode, secure, "", routerInfo, locatorInfo);
# else
- return create(ident, Ice::Context(), facet, mode, secure, "", locatorInfo);
+ return create(ident, Ice::Context(), facet, mode, secure, "", locatorInfo);
# endif
-#else
+#else
throw FeatureNotSupportedException(__FILE__, __LINE__,
- "indirect proxy `" + str + "' (no locator support built-in)");
+ "indirect proxy `" + str + "' (no locator support built-in)");
#endif
}
vector<EndpointPtr> endpoints;
switch(s[beg])
{
- case ':':
- {
- vector<string> unknownEndpoints;
- end = beg;
-
- while(end < s.length() && s[end] == ':')
- {
- beg = end + 1;
-
- end = s.find(':', beg);
- if(end == string::npos)
- {
- end = s.length();
- }
-
- string es = s.substr(beg, end - beg);
- EndpointPtr endp = _instance->endpointFactory()->create(es);
- if(endp != 0)
- {
- vector<EndpointPtr> endps = endp->expand(false);
- endpoints.insert(endpoints.end(), endps.begin(), endps.end());
- }
- else
- {
- unknownEndpoints.push_back(es);
- }
- }
- if(endpoints.size() == 0)
- {
- throw EndpointParseException(__FILE__, __LINE__, unknownEndpoints.front());
- }
- else if(unknownEndpoints.size() != 0 &&
- _instance->initializationData().properties->getPropertyAsIntWithDefault(
- "Ice.Warn.Endpoints", 1) > 0)
- {
- Warning out(_instance->initializationData().logger);
- out << "Proxy contains unknown endpoints:";
- for(unsigned int idx = 0; idx < unknownEndpoints.size(); ++idx)
- {
- out << " `" << unknownEndpoints[idx] << "'";
- }
- }
+ case ':':
+ {
+ vector<string> unknownEndpoints;
+ end = beg;
+
+ while(end < s.length() && s[end] == ':')
+ {
+ beg = end + 1;
+
+ end = s.find(':', beg);
+ if(end == string::npos)
+ {
+ end = s.length();
+ }
+
+ string es = s.substr(beg, end - beg);
+ EndpointPtr endp = _instance->endpointFactory()->create(es);
+ if(endp != 0)
+ {
+ vector<EndpointPtr> endps = endp->expand(false);
+ endpoints.insert(endpoints.end(), endps.begin(), endps.end());
+ }
+ else
+ {
+ unknownEndpoints.push_back(es);
+ }
+ }
+ if(endpoints.size() == 0)
+ {
+ throw EndpointParseException(__FILE__, __LINE__, unknownEndpoints.front());
+ }
+ else if(unknownEndpoints.size() != 0 &&
+ _instance->initializationData().properties->getPropertyAsIntWithDefault(
+ "Ice.Warn.Endpoints", 1) > 0)
+ {
+ Warning out(_instance->initializationData().logger);
+ out << "Proxy contains unknown endpoints:";
+ for(unsigned int idx = 0; idx < unknownEndpoints.size(); ++idx)
+ {
+ out << " `" << unknownEndpoints[idx] << "'";
+ }
+ }
#ifdef ICEE_HAS_ROUTER
- return create(ident, Ice::Context(), facet, mode, secure, endpoints, routerInfo);
+ return create(ident, Ice::Context(), facet, mode, secure, endpoints, routerInfo);
#else
- return create(ident, Ice::Context(), facet, mode, secure, endpoints);
+ return create(ident, Ice::Context(), facet, mode, secure, endpoints);
#endif
- break;
- }
+ break;
+ }
- case '@':
- {
+ case '@':
+ {
#ifdef ICEE_HAS_LOCATOR
- beg = s.find_first_not_of(delim, beg + 1);
- if(beg == string::npos)
- {
- throw ProxyParseException(__FILE__, __LINE__, str);
- }
+ beg = s.find_first_not_of(delim, beg + 1);
+ if(beg == string::npos)
+ {
+ throw ProxyParseException(__FILE__, __LINE__, str);
+ }
string adapterstr;
- end = IceUtil::checkQuote(s, beg);
- if(end == string::npos)
- {
- throw ProxyParseException(__FILE__, __LINE__, str);
- }
- else if(end == 0)
- {
- end = s.find_first_of(delim, beg);
- if(end == string::npos)
- {
- end = s.size();
- }
+ end = IceUtil::checkQuote(s, beg);
+ if(end == string::npos)
+ {
+ throw ProxyParseException(__FILE__, __LINE__, str);
+ }
+ else if(end == 0)
+ {
+ end = s.find_first_of(delim, beg);
+ if(end == string::npos)
+ {
+ end = s.size();
+ }
adapterstr = s.substr(beg, end - beg);
- }
- else
- {
- beg++; // Skip leading quote
+ }
+ else
+ {
+ beg++; // Skip leading quote
adapterstr = s.substr(beg, end - beg);
end++; // Skip trailing quote.
- }
+ }
// Check for trailing whitespace.
if(end != string::npos && s.find_first_not_of(delim, end) != string::npos)
{
- throw ProxyParseException(__FILE__, __LINE__, str);
+ throw ProxyParseException(__FILE__, __LINE__, str);
}
- if(!IceUtil::unescapeString(adapterstr, 0, adapterstr.size(), adapter) || adapter.size() == 0)
- {
- throw ProxyParseException(__FILE__, __LINE__, str);
- }
+ if(!IceUtil::unescapeString(adapterstr, 0, adapterstr.size(), adapter) || adapter.size() == 0)
+ {
+ throw ProxyParseException(__FILE__, __LINE__, str);
+ }
#ifdef ICEE_HAS_WSTRING
if(_instance->initializationData().stringConverter)
{
@@ -526,21 +526,21 @@ IceInternal::ReferenceFactory::create(const string& str)
#endif
#ifdef ICEE_HAS_ROUTER
- return create(ident, Ice::Context(), facet, mode, secure, adapter, routerInfo, locatorInfo);
+ return create(ident, Ice::Context(), facet, mode, secure, adapter, routerInfo, locatorInfo);
#else
- return create(ident, Ice::Context(), facet, mode, secure, adapter, locatorInfo);
+ return create(ident, Ice::Context(), facet, mode, secure, adapter, locatorInfo);
#endif
#else
throw FeatureNotSupportedException(__FILE__, __LINE__,
- "indirect proxy `" + str + "' (no locator support built-in)");
+ "indirect proxy `" + str + "' (no locator support built-in)");
#endif
- break;
- }
+ break;
+ }
- default:
- {
- throw ProxyParseException(__FILE__, __LINE__, str);
- }
+ default:
+ {
+ throw ProxyParseException(__FILE__, __LINE__, str);
+ }
}
return 0; // Unreachable, fixes compiler warning.
@@ -603,7 +603,7 @@ IceInternal::ReferenceFactory::create(const Identity& ident, BasicStream* s)
if(ident.name.empty() && ident.category.empty())
{
- return 0;
+ return 0;
}
//
@@ -614,11 +614,11 @@ IceInternal::ReferenceFactory::create(const Identity& ident, BasicStream* s)
string facet;
if(!facetPath.empty())
{
- if(facetPath.size() > 1)
- {
- throwProxyUnmarshalException(__FILE__, __LINE__);
- }
- facet.swap(facetPath[0]);
+ if(facetPath.size() > 1)
+ {
+ throwProxyUnmarshalException(__FILE__, __LINE__);
+ }
+ facet.swap(facetPath[0]);
}
Byte modeAsByte;
@@ -626,7 +626,7 @@ IceInternal::ReferenceFactory::create(const Identity& ident, BasicStream* s)
ReferenceMode mode = static_cast<ReferenceMode>(modeAsByte);
if(mode < 0 || mode > ReferenceModeLast)
{
- throwProxyUnmarshalException(__FILE__, __LINE__);
+ throwProxyUnmarshalException(__FILE__, __LINE__);
}
vector<EndpointPtr> endpoints;
@@ -644,30 +644,30 @@ IceInternal::ReferenceFactory::create(const Identity& ident, BasicStream* s)
if(sz > 0)
{
- endpoints.reserve(sz);
- while(sz--)
- {
- EndpointPtr endpoint = _instance->endpointFactory()->read(s);
- endpoints.push_back(endpoint);
- }
+ endpoints.reserve(sz);
+ while(sz--)
+ {
+ EndpointPtr endpoint = _instance->endpointFactory()->read(s);
+ endpoints.push_back(endpoint);
+ }
#ifdef ICEE_HAS_ROUTER
- return create(ident, Ice::Context(), facet, mode, secure, endpoints, routerInfo);
+ return create(ident, Ice::Context(), facet, mode, secure, endpoints, routerInfo);
#else
- return create(ident, Ice::Context(), facet, mode, secure, endpoints);
+ return create(ident, Ice::Context(), facet, mode, secure, endpoints);
#endif
}
else
{
#ifdef ICEE_HAS_LOCATOR
- LocatorInfoPtr locatorInfo = _instance->locatorManager()->get(getDefaultLocator());
- s->read(adapterId);
+ LocatorInfoPtr locatorInfo = _instance->locatorManager()->get(getDefaultLocator());
+ s->read(adapterId);
# ifdef ICEE_HAS_ROUTER
- return create(ident, Ice::Context(), facet, mode, secure, adapterId, routerInfo, locatorInfo);
+ return create(ident, Ice::Context(), facet, mode, secure, adapterId, routerInfo, locatorInfo);
# else
- return create(ident, Ice::Context(), facet, mode, secure, adapterId, locatorInfo);
+ return create(ident, Ice::Context(), facet, mode, secure, adapterId, locatorInfo);
# endif
#else
- throwProxyUnmarshalException(__FILE__, __LINE__);
+ throwProxyUnmarshalException(__FILE__, __LINE__);
return 0; // Unreachable, fixes compiler warning.
#endif
}
@@ -710,7 +710,7 @@ IceInternal::ReferenceFactory::getDefaultLocator() const
#endif
IceInternal::ReferenceFactory::ReferenceFactory(const InstancePtr& instance,
- const CommunicatorPtr& communicator) :
+ const CommunicatorPtr& communicator) :
_instance(instance),
_communicator(communicator)
{
@@ -723,7 +723,7 @@ IceInternal::ReferenceFactory::destroy()
if(!_instance)
{
- throw CommunicatorDestroyedException(__FILE__, __LINE__);
+ throw CommunicatorDestroyedException(__FILE__, __LINE__);
}
_instance = 0;
diff --git a/cppe/src/IceE/ReferenceFactory.h b/cppe/src/IceE/ReferenceFactory.h
index 4127e453deb..d3f1ce82b3d 100644
--- a/cppe/src/IceE/ReferenceFactory.h
+++ b/cppe/src/IceE/ReferenceFactory.h
@@ -34,19 +34,19 @@ public:
ReferencePtr create(const ::Ice::Identity&, const Ice::Context&, const ::std::string&, ReferenceMode, bool,
const ::std::vector<EndpointPtr>&
#ifdef ICEE_HAS_ROUTER
- , const RouterInfoPtr&
+ , const RouterInfoPtr&
#endif
- );
+ );
//
// Create an indirect reference.
//
#ifdef ICEE_HAS_LOCATOR
ReferencePtr create(const ::Ice::Identity&, const Ice::Context&, const ::std::string&, ReferenceMode, bool,
- const ::std::string&
+ const ::std::string&
#ifdef ICEE_HAS_ROUTER
- , const RouterInfoPtr&
+ , const RouterInfoPtr&
#endif
- , const LocatorInfoPtr&);
+ , const LocatorInfoPtr&);
#endif
//
// Create a fixed reference.
diff --git a/cppe/src/IceE/RouterInfo.cpp b/cppe/src/IceE/RouterInfo.cpp
index 508c93387e6..c96d1ff2acb 100644
--- a/cppe/src/IceE/RouterInfo.cpp
+++ b/cppe/src/IceE/RouterInfo.cpp
@@ -46,7 +46,7 @@ IceInternal::RouterManager::get(const RouterPrx& rtr)
{
if(!rtr)
{
- return 0;
+ return 0;
}
RouterPrx router = RouterPrx::uncheckedCast(rtr->ice_router(0)); // The router cannot be routed.
@@ -57,24 +57,24 @@ IceInternal::RouterManager::get(const RouterPrx& rtr)
if(_tableHint != _table.end())
{
- if(_tableHint->first == router)
- {
- p = _tableHint;
- }
+ if(_tableHint->first == router)
+ {
+ p = _tableHint;
+ }
}
if(p == _table.end())
{
- p = _table.find(router);
+ p = _table.find(router);
}
if(p == _table.end())
{
- _tableHint = _table.insert(_tableHint, pair<const RouterPrx, RouterInfoPtr>(router, new RouterInfo(router)));
+ _tableHint = _table.insert(_tableHint, pair<const RouterPrx, RouterInfoPtr>(router, new RouterInfo(router)));
}
else
{
- _tableHint = p;
+ _tableHint = p;
}
return _tableHint->second;
@@ -86,26 +86,26 @@ IceInternal::RouterManager::erase(const RouterPrx& rtr)
RouterInfoPtr info;
if(rtr)
{
- RouterPrx router = RouterPrx::uncheckedCast(rtr->ice_router(0)); // The router cannot be routed.
- IceUtil::Mutex::Lock sync(*this);
-
- map<RouterPrx, RouterInfoPtr>::iterator p = _table.end();
- if(_tableHint != _table.end() && _tableHint->first == router)
- {
- p = _tableHint;
- _tableHint = _table.end();
- }
-
- if(p == _table.end())
- {
- p = _table.find(router);
- }
-
- if(p != _table.end())
- {
- info = p->second;
- _table.erase(p);
- }
+ RouterPrx router = RouterPrx::uncheckedCast(rtr->ice_router(0)); // The router cannot be routed.
+ IceUtil::Mutex::Lock sync(*this);
+
+ map<RouterPrx, RouterInfoPtr>::iterator p = _table.end();
+ if(_tableHint != _table.end() && _tableHint->first == router)
+ {
+ p = _tableHint;
+ _tableHint = _table.end();
+ }
+
+ if(p == _table.end())
+ {
+ p = _table.find(router);
+ }
+
+ if(p != _table.end())
+ {
+ info = p->second;
+ _table.erase(p);
+ }
}
return info;
@@ -164,24 +164,24 @@ IceInternal::RouterInfo::getClientEndpoints()
if(_clientEndpoints.size() == 0) // Lazy initialization.
{
- ObjectPrx clientProxy = _router->getClientProxy();
- if(!clientProxy)
- {
+ ObjectPrx clientProxy = _router->getClientProxy();
+ if(!clientProxy)
+ {
//
// If getClientProxy() return nil, use router endpoints.
//
_clientEndpoints = _router->__reference()->getEndpoints();
- }
+ }
else
{
- clientProxy = clientProxy->ice_router(0); // The client proxy cannot be routed.
+ clientProxy = clientProxy->ice_router(0); // The client proxy cannot be routed.
- //
- // In order to avoid creating a new connection to the router,
- // we must use the same timeout as the already existing
- // connection.
- //
- clientProxy = clientProxy->ice_timeout(_router->ice_getConnection()->timeout());
+ //
+ // In order to avoid creating a new connection to the router,
+ // we must use the same timeout as the already existing
+ // connection.
+ //
+ clientProxy = clientProxy->ice_timeout(_router->ice_getConnection()->timeout());
_clientEndpoints = clientProxy->__reference()->getEndpoints();
}
@@ -197,13 +197,13 @@ IceInternal::RouterInfo::getServerEndpoints()
if(_serverEndpoints.size() == 0) // Lazy initialization.
{
- ObjectPrx serverProxy = _router->getServerProxy();
- if(!serverProxy)
- {
- throw NoEndpointException(__FILE__, __LINE__);
- }
+ ObjectPrx serverProxy = _router->getServerProxy();
+ if(!serverProxy)
+ {
+ throw NoEndpointException(__FILE__, __LINE__);
+ }
- serverProxy = serverProxy->ice_router(0); // The server proxy cannot be routed.
+ serverProxy = serverProxy->ice_router(0); // The server proxy cannot be routed.
_serverEndpoints = serverProxy->__reference()->getEndpoints();
}
diff --git a/cppe/src/IceE/ServantManager.cpp b/cppe/src/IceE/ServantManager.cpp
index 98a233cc77e..4eacee31ea7 100644
--- a/cppe/src/IceE/ServantManager.cpp
+++ b/cppe/src/IceE/ServantManager.cpp
@@ -29,26 +29,26 @@ IceInternal::ServantManager::addServant(const ObjectPtr& object, const Identity&
if(p == _servantMapMap.end() || p->first != ident)
{
- p = _servantMapMap.find(ident);
+ p = _servantMapMap.find(ident);
}
if(p == _servantMapMap.end())
{
- p = _servantMapMap.insert(_servantMapMapHint, pair<const Identity, FacetMap>(ident, FacetMap()));
+ p = _servantMapMap.insert(_servantMapMapHint, pair<const Identity, FacetMap>(ident, FacetMap()));
}
else
{
- if(p->second.find(facet) != p->second.end())
- {
- AlreadyRegisteredException ex(__FILE__, __LINE__);
- ex.kindOfObject = "servant";
- ex.id = _instance->identityToString(ident);
- if(!facet.empty())
- {
- ex.id += " -f " + IceUtil::escapeString(facet, "");
- }
- throw ex;
- }
+ if(p->second.find(facet) != p->second.end())
+ {
+ AlreadyRegisteredException ex(__FILE__, __LINE__);
+ ex.kindOfObject = "servant";
+ ex.id = _instance->identityToString(ident);
+ if(!facet.empty())
+ {
+ ex.id += " -f " + IceUtil::escapeString(facet, "");
+ }
+ throw ex;
+ }
}
_servantMapMapHint = p;
@@ -75,19 +75,19 @@ IceInternal::ServantManager::removeServant(const Identity& ident, const string&
if(p == _servantMapMap.end() || p->first != ident)
{
- p = _servantMapMap.find(ident);
+ p = _servantMapMap.find(ident);
}
if(p == _servantMapMap.end() || (q = p->second.find(facet)) == p->second.end())
{
- NotRegisteredException ex(__FILE__, __LINE__);
- ex.kindOfObject = "servant";
- ex.id = _instance->identityToString(ident);
- if(!facet.empty())
- {
- ex.id += " -f " + IceUtil::escapeString(facet, "");
- }
- throw ex;
+ NotRegisteredException ex(__FILE__, __LINE__);
+ ex.kindOfObject = "servant";
+ ex.id = _instance->identityToString(ident);
+ if(!facet.empty())
+ {
+ ex.id += " -f " + IceUtil::escapeString(facet, "");
+ }
+ throw ex;
}
servant = q->second;
@@ -95,15 +95,15 @@ IceInternal::ServantManager::removeServant(const Identity& ident, const string&
if(p->second.empty())
{
- if(p == _servantMapMapHint)
- {
- _servantMapMap.erase(p++);
- _servantMapMapHint = p;
- }
- else
- {
- _servantMapMap.erase(p);
- }
+ if(p == _servantMapMapHint)
+ {
+ _servantMapMap.erase(p++);
+ _servantMapMapHint = p;
+ }
+ else
+ {
+ _servantMapMap.erase(p);
+ }
}
return servant;
}
@@ -119,27 +119,27 @@ IceInternal::ServantManager::removeAllFacets(const Identity& ident)
if(p == _servantMapMap.end() || p->first != ident)
{
- p = _servantMapMap.find(ident);
+ p = _servantMapMap.find(ident);
}
if(p == _servantMapMap.end())
{
- NotRegisteredException ex(__FILE__, __LINE__);
- ex.kindOfObject = "servant";
- ex.id = _instance->identityToString(ident);
- throw ex;
+ NotRegisteredException ex(__FILE__, __LINE__);
+ ex.kindOfObject = "servant";
+ ex.id = _instance->identityToString(ident);
+ throw ex;
}
FacetMap result = p->second;
if(p == _servantMapMapHint)
{
- _servantMapMap.erase(p++);
- _servantMapMapHint = p;
+ _servantMapMap.erase(p++);
+ _servantMapMapHint = p;
}
else
{
- _servantMapMap.erase(p);
+ _servantMapMap.erase(p);
}
return result;
@@ -155,7 +155,7 @@ IceInternal::ServantManager::findServant(const Identity& ident, const string& fa
// requests from bidir connections. This method might be called if
// requests are received over the bidir connection after the
// adapter was deactivated.
- //
+ //
//assert(_instance); // Must not be called after destruction.
ServantMapMap::iterator p = _servantMapMapHint;
@@ -165,17 +165,17 @@ IceInternal::ServantManager::findServant(const Identity& ident, const string& fa
if(p == servantMapMap.end() || p->first != ident)
{
- p = servantMapMap.find(ident);
+ p = servantMapMap.find(ident);
}
if(p == servantMapMap.end() || (q = p->second.find(facet)) == p->second.end())
{
- return 0;
+ return 0;
}
else
{
- _servantMapMapHint = p;
- return q->second;
+ _servantMapMapHint = p;
+ return q->second;
}
}
@@ -192,17 +192,17 @@ IceInternal::ServantManager::findAllFacets(const Identity& ident) const
if(p == servantMapMap.end() || p->first != ident)
{
- p = servantMapMap.find(ident);
+ p = servantMapMap.find(ident);
}
if(p == servantMapMap.end())
{
- return FacetMap();
+ return FacetMap();
}
else
{
- _servantMapMapHint = p;
- return p->second;
+ _servantMapMapHint = p;
+ return p->second;
}
}
@@ -216,7 +216,7 @@ IceInternal::ServantManager::hasServant(const Identity& ident) const
// requests from bidir connections. This method might be called if
// requests are received over the bidir connection after the
// adapter was deactivated.
- //
+ //
//assert(_instance); // Must not be called after destruction.
ServantMapMap::iterator p = _servantMapMapHint;
@@ -224,18 +224,18 @@ IceInternal::ServantManager::hasServant(const Identity& ident) const
if(p == servantMapMap.end() || p->first != ident)
{
- p = servantMapMap.find(ident);
+ p = servantMapMap.find(ident);
}
if(p == servantMapMap.end())
{
- return false;
+ return false;
}
else
{
- _servantMapMapHint = p;
- assert(!p->second.empty());
- return true;
+ _servantMapMapHint = p;
+ assert(!p->second.empty());
+ return true;
}
}
@@ -262,14 +262,14 @@ IceInternal::ServantManager::destroy()
ServantMapMap servantMapMap;
{
- IceUtil::Mutex::Lock sync(*this);
-
- assert(_instance); // Must not be called after destruction.
-
- servantMapMap.swap(_servantMapMap);
- _servantMapMapHint = _servantMapMap.end();
-
- _instance = 0;
+ IceUtil::Mutex::Lock sync(*this);
+
+ assert(_instance); // Must not be called after destruction.
+
+ servantMapMap.swap(_servantMapMap);
+ _servantMapMapHint = _servantMapMap.end();
+
+ _instance = 0;
}
//
diff --git a/cppe/src/IceE/StaticMutex.cpp b/cppe/src/IceE/StaticMutex.cpp
index 6e51c9b132a..26ea365d03b 100644
--- a/cppe/src/IceE/StaticMutex.cpp
+++ b/cppe/src/IceE/StaticMutex.cpp
@@ -17,7 +17,7 @@ void IceUtil::StaticMutex::initialize() const
//
CRITICAL_SECTION* newCriticalSection = new CRITICAL_SECTION;
InitializeCriticalSection(newCriticalSection);
-
+
//
// Then assign it to _mutex
// Note that Windows performs a full memory barrier before the assignment;
@@ -25,11 +25,11 @@ void IceUtil::StaticMutex::initialize() const
//
if(InterlockedCompareExchangePointer(reinterpret_cast<void**>(&_mutex), newCriticalSection, 0) != 0)
{
- //
- // Another thread was doing the same thing
- //
- DeleteCriticalSection(newCriticalSection);
- delete newCriticalSection;
+ //
+ // Another thread was doing the same thing
+ //
+ DeleteCriticalSection(newCriticalSection);
+ delete newCriticalSection;
}
//
diff --git a/cppe/src/IceE/StringConverter.cpp b/cppe/src/IceE/StringConverter.cpp
index 837773b8e03..adf1c6d319a 100644
--- a/cppe/src/IceE/StringConverter.cpp
+++ b/cppe/src/IceE/StringConverter.cpp
@@ -23,8 +23,8 @@ namespace Ice
Byte*
UnicodeWstringConverter::toUTF8(const wchar_t* sourceStart,
- const wchar_t* sourceEnd,
- UTF8Buffer& buffer) const
+ const wchar_t* sourceEnd,
+ UTF8Buffer& buffer) const
{
//
// The "chunk size" is the maximum of the number of characters in the
@@ -38,51 +38,51 @@ UnicodeWstringConverter::toUTF8(const wchar_t* sourceStart,
ConversionResult result;
while((result =
- convertUTFWstringToUTF8(sourceStart, sourceEnd,
- targetStart, targetEnd, lenientConversion))
- == targetExhausted)
+ convertUTFWstringToUTF8(sourceStart, sourceEnd,
+ targetStart, targetEnd, lenientConversion))
+ == targetExhausted)
{
- targetStart = buffer.getMoreBytes(chunkSize, targetStart);
- targetEnd = targetStart + chunkSize;
+ targetStart = buffer.getMoreBytes(chunkSize, targetStart);
+ targetEnd = targetStart + chunkSize;
}
-
+
switch(result)
{
- case conversionOK:
- break;
- case sourceExhausted:
- throw StringConversionException(__FILE__, __LINE__, "wide string source exhausted");
- case sourceIllegal:
- throw StringConversionException(__FILE__, __LINE__, "wide string source illegal");
- default:
- {
- assert(0);
- throw StringConversionException(__FILE__, __LINE__);
- }
+ case conversionOK:
+ break;
+ case sourceExhausted:
+ throw StringConversionException(__FILE__, __LINE__, "wide string source exhausted");
+ case sourceIllegal:
+ throw StringConversionException(__FILE__, __LINE__, "wide string source illegal");
+ default:
+ {
+ assert(0);
+ throw StringConversionException(__FILE__, __LINE__);
+ }
}
return targetStart;
}
void
UnicodeWstringConverter::fromUTF8(const Byte* sourceStart, const Byte* sourceEnd,
- wstring& target) const
+ wstring& target) const
{
ConversionResult result =
- convertUTF8ToUTFWstring(sourceStart, sourceEnd, target, lenientConversion);
+ convertUTF8ToUTFWstring(sourceStart, sourceEnd, target, lenientConversion);
switch(result)
- {
- case conversionOK:
- break;
- case sourceExhausted:
- throw StringConversionException(__FILE__, __LINE__, "UTF-8 string source exhausted");
- case sourceIllegal:
- throw StringConversionException(__FILE__, __LINE__, "UTF-8 string source illegal");
- default:
- {
- assert(0);
- throw StringConversionException(__FILE__, __LINE__);
- }
+ {
+ case conversionOK:
+ break;
+ case sourceExhausted:
+ throw StringConversionException(__FILE__, __LINE__, "UTF-8 string source exhausted");
+ case sourceIllegal:
+ throw StringConversionException(__FILE__, __LINE__, "UTF-8 string source illegal");
+ default:
+ {
+ assert(0);
+ throw StringConversionException(__FILE__, __LINE__);
+ }
}
}
diff --git a/cppe/src/IceE/StringUtil.cpp b/cppe/src/IceE/StringUtil.cpp
index c728e3151a2..7cce1177fd6 100644
--- a/cppe/src/IceE/StringUtil.cpp
+++ b/cppe/src/IceE/StringUtil.cpp
@@ -42,86 +42,86 @@ encodeChar(string::value_type b, string& s, const string& special)
{
switch(b)
{
- case '\\':
- {
- s.append("\\\\");
- break;
- }
-
- case '\'':
- {
- s.append("\\'");
- break;
- }
-
- case '"':
- {
- s.append("\\\"");
- break;
- }
-
- case '\b':
- {
- s.append("\\b");
- break;
- }
-
- case '\f':
- {
- s.append("\\f");
- break;
- }
-
- case '\n':
- {
- s.append("\\n");
- break;
- }
-
- case '\r':
- {
- s.append("\\r");
- break;
- }
-
- case '\t':
- {
- s.append("\\t");
- break;
- }
-
- default:
- {
- unsigned char i = static_cast<unsigned char>(b);
- if(!(i >= 32 && i <= 126))
- {
- s.push_back('\\');
- string octal = toOctalString(i);
- //
- // Add leading zeroes so that we avoid problems during
- // decoding. For example, consider the escaped string
- // \0013 (i.e., a character with value 1 followed by the
- // character '3'). If the leading zeroes were omitted, the
- // result would be incorrectly interpreted as a single
- // character with value 11.
- //
- for(string::size_type j = octal.size(); j < 3; j++)
- {
- s.push_back('0');
- }
- s.append(octal);
- }
- else if(special.find(b) != string::npos)
- {
- s.push_back('\\');
- s.push_back(b);
- }
- else
- {
- s.push_back(b);
- }
- break;
- }
+ case '\\':
+ {
+ s.append("\\\\");
+ break;
+ }
+
+ case '\'':
+ {
+ s.append("\\'");
+ break;
+ }
+
+ case '"':
+ {
+ s.append("\\\"");
+ break;
+ }
+
+ case '\b':
+ {
+ s.append("\\b");
+ break;
+ }
+
+ case '\f':
+ {
+ s.append("\\f");
+ break;
+ }
+
+ case '\n':
+ {
+ s.append("\\n");
+ break;
+ }
+
+ case '\r':
+ {
+ s.append("\\r");
+ break;
+ }
+
+ case '\t':
+ {
+ s.append("\\t");
+ break;
+ }
+
+ default:
+ {
+ unsigned char i = static_cast<unsigned char>(b);
+ if(!(i >= 32 && i <= 126))
+ {
+ s.push_back('\\');
+ string octal = toOctalString(i);
+ //
+ // Add leading zeroes so that we avoid problems during
+ // decoding. For example, consider the escaped string
+ // \0013 (i.e., a character with value 1 followed by the
+ // character '3'). If the leading zeroes were omitted, the
+ // result would be incorrectly interpreted as a single
+ // character with value 11.
+ //
+ for(string::size_type j = octal.size(); j < 3; j++)
+ {
+ s.push_back('0');
+ }
+ s.append(octal);
+ }
+ else if(special.find(b) != string::npos)
+ {
+ s.push_back('\\');
+ s.push_back(b);
+ }
+ else
+ {
+ s.push_back(b);
+ }
+ break;
+ }
}
}
@@ -136,16 +136,16 @@ IceUtil::escapeString(const string& s, const string& special)
string::size_type i;
for(i = 0; i < special.size(); ++i)
{
- if(static_cast<unsigned char>(special[i]) < 32 || static_cast<unsigned char>(special[i]) > 126)
- {
- throw IllegalArgumentException(__FILE__, __LINE__, "special characters must be in ASCII range 32-126");
- }
+ if(static_cast<unsigned char>(special[i]) < 32 || static_cast<unsigned char>(special[i]) > 126)
+ {
+ throw IllegalArgumentException(__FILE__, __LINE__, "special characters must be in ASCII range 32-126");
+ }
}
string result;
for(i = 0; i < s.size(); ++i)
{
- encodeChar(s[i], result, special);
+ encodeChar(s[i], result, special);
}
return result;
@@ -178,86 +178,86 @@ decodeChar(const string& s, string::size_type start, string::size_type end, stri
if(s[start] != '\\')
{
- c = checkChar(s[start++]);
+ c = checkChar(s[start++]);
}
else
{
- if(start + 1 == end)
- {
- throw IllegalArgumentException(__FILE__, __LINE__, "trailing backslash in argument");
- }
- switch(s[++start])
- {
- case '\\':
- case '\'':
- case '"':
- {
- c = s[start++];
- break;
- }
- case 'b':
- {
- ++start;
- c = '\b';
- break;
- }
- case 'f':
- {
- ++start;
- c = '\f';
- break;
- }
- case 'n':
- {
- ++start;
- c = '\n';
- break;
- }
- case 'r':
- {
- ++start;
- c = '\r';
- break;
- }
- case 't':
- {
- ++start;
- c = '\t';
- break;
- }
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- {
- int oct = 0;
- for(int j = 0; j < 3 && start < end; ++j)
- {
- int charVal = s[start++] - '0';
- if(charVal < 0 || charVal > 7)
- {
- --start;
- break;
- }
- oct = oct * 8 + charVal;
- }
- if(oct > 255)
- {
- throw IllegalArgumentException(__FILE__, __LINE__, "octal value out of range");
- }
- c = (char)oct;
- break;
- }
- default:
- {
- c = checkChar(s[start++]);
- break;
- }
- }
+ if(start + 1 == end)
+ {
+ throw IllegalArgumentException(__FILE__, __LINE__, "trailing backslash in argument");
+ }
+ switch(s[++start])
+ {
+ case '\\':
+ case '\'':
+ case '"':
+ {
+ c = s[start++];
+ break;
+ }
+ case 'b':
+ {
+ ++start;
+ c = '\b';
+ break;
+ }
+ case 'f':
+ {
+ ++start;
+ c = '\f';
+ break;
+ }
+ case 'n':
+ {
+ ++start;
+ c = '\n';
+ break;
+ }
+ case 'r':
+ {
+ ++start;
+ c = '\r';
+ break;
+ }
+ case 't':
+ {
+ ++start;
+ c = '\t';
+ break;
+ }
+ case '0':
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ {
+ int oct = 0;
+ for(int j = 0; j < 3 && start < end; ++j)
+ {
+ int charVal = s[start++] - '0';
+ if(charVal < 0 || charVal > 7)
+ {
+ --start;
+ break;
+ }
+ oct = oct * 8 + charVal;
+ }
+ if(oct > 255)
+ {
+ throw IllegalArgumentException(__FILE__, __LINE__, "octal value out of range");
+ }
+ c = (char)oct;
+ break;
+ }
+ default:
+ {
+ c = checkChar(s[start++]);
+ break;
+ }
+ }
}
nextStart = start;
return c;
@@ -271,7 +271,7 @@ static void decodeString(const string& s, string::size_type start, string::size_
{
while(start < end)
{
- sb.push_back(decodeChar(s, start, end, start));
+ sb.push_back(decodeChar(s, start, end, start));
}
}
@@ -291,20 +291,20 @@ IceUtil::unescapeString(const string& s, string::size_type start, string::size_t
}
if(start > end)
{
- throw IllegalArgumentException(__FILE__, __LINE__, "start offset must <= end offset");
+ throw IllegalArgumentException(__FILE__, __LINE__, "start offset must <= end offset");
}
result.reserve(end - start);
try
{
- result.clear();
- decodeString(s, start, end, result);
- return true;
+ result.clear();
+ decodeString(s, start, end, result);
+ return true;
}
catch(...)
{
- return false;
+ return false;
}
}
@@ -373,29 +373,29 @@ IceUtil::match(const string& s, const string& pat, bool matchPeriod)
do
{
if(pat[patIndex] == '*')
- {
- //
- // Don't allow matching x..y against x.*.y if requested -- star matches non-empty sequence only.
- //
- if(!matchPeriod && s[sIndex] == '.')
- {
- return false;
- }
- while(sIndex < s.size() && (matchPeriod || s[sIndex] != '.'))
- {
- ++sIndex;
- }
- patIndex++;
- }
- else
- {
- if(pat[patIndex] != s[sIndex])
- {
- return false;
- }
- ++sIndex;
- ++patIndex;
- }
+ {
+ //
+ // Don't allow matching x..y against x.*.y if requested -- star matches non-empty sequence only.
+ //
+ if(!matchPeriod && s[sIndex] == '.')
+ {
+ return false;
+ }
+ while(sIndex < s.size() && (matchPeriod || s[sIndex] != '.'))
+ {
+ ++sIndex;
+ }
+ patIndex++;
+ }
+ else
+ {
+ if(pat[patIndex] != s[sIndex])
+ {
+ return false;
+ }
+ ++sIndex;
+ ++patIndex;
+ }
}
while(sIndex < s.size() && patIndex < pat.size());
diff --git a/cppe/src/IceE/Thread.cpp b/cppe/src/IceE/Thread.cpp
index 1b195cd44b7..c3ca404c47b 100644
--- a/cppe/src/IceE/Thread.cpp
+++ b/cppe/src/IceE/Thread.cpp
@@ -44,13 +44,13 @@ IceUtil::ThreadControl::join()
{
if(_handle == 0)
{
- throw BadThreadControlException(__FILE__, __LINE__);
+ throw BadThreadControlException(__FILE__, __LINE__);
}
int rc = WaitForSingleObject(_handle, INFINITE);
if(rc != WAIT_OBJECT_0)
{
- throw ThreadSyscallException(__FILE__, __LINE__, GetLastError());
+ throw ThreadSyscallException(__FILE__, __LINE__, GetLastError());
}
detach();
@@ -61,12 +61,12 @@ IceUtil::ThreadControl::detach()
{
if(_handle == 0)
{
- throw BadThreadControlException(__FILE__, __LINE__);
+ throw BadThreadControlException(__FILE__, __LINE__);
}
if(CloseHandle(_handle) == 0)
{
- throw ThreadSyscallException(__FILE__, __LINE__, GetLastError());
+ throw ThreadSyscallException(__FILE__, __LINE__, GetLastError());
}
}
@@ -120,7 +120,7 @@ WINAPI startHook(void* arg)
try
{
- IceUtil::Thread* rawThread = static_cast<IceUtil::Thread*>(arg);
+ IceUtil::Thread* rawThread = static_cast<IceUtil::Thread*>(arg);
//
// Initialize the random number generator in each thread.
@@ -128,25 +128,25 @@ WINAPI startHook(void* arg)
unsigned int seed = static_cast<unsigned int>(IceUtil::Time::now().toMicroSeconds());
srand(seed);
- //
- // Ensure that the thread doesn't go away until run() has
- // completed.
- //
- thread = rawThread;
-
- //
- // See the comment in IceUtil::Thread::start() for details.
- //
- rawThread->__decRef();
- thread->run();
+ //
+ // Ensure that the thread doesn't go away until run() has
+ // completed.
+ //
+ thread = rawThread;
+
+ //
+ // See the comment in IceUtil::Thread::start() for details.
+ //
+ rawThread->__decRef();
+ thread->run();
}
catch(const IceUtil::Exception& e)
{
- fprintf(stderr, "IceUtil::Thread::run(): uncaught exception: %s\n", e.toString().c_str());
+ fprintf(stderr, "IceUtil::Thread::run(): uncaught exception: %s\n", e.toString().c_str());
}
catch(...)
{
- fprintf(stderr, "IceUtil::Thread::run(): uncaught exception\n");
+ fprintf(stderr, "IceUtil::Thread::run(): uncaught exception\n");
}
thread->_done();
@@ -169,7 +169,7 @@ IceUtil::Thread::start(size_t stackSize)
if(_started)
{
- throw ThreadStartedException(__FILE__, __LINE__);
+ throw ThreadStartedException(__FILE__, __LINE__);
}
//
@@ -185,26 +185,26 @@ IceUtil::Thread::start(size_t stackSize)
#ifdef _WIN32_WCE
_handle = CreateThread(0, stackSize,
- startHook, this, 0, &_id);
+ startHook, this, 0, &_id);
#else
unsigned int id;
_handle =
- reinterpret_cast<HANDLE>(
- _beginthreadex(0,
- static_cast<unsigned int>(stackSize),
- startHook, this, 0, &id));
+ reinterpret_cast<HANDLE>(
+ _beginthreadex(0,
+ static_cast<unsigned int>(stackSize),
+ startHook, this, 0, &id));
_id = id;
#endif
if(_handle == 0)
{
- __decRef();
- throw ThreadSyscallException(__FILE__, __LINE__, GetLastError());
+ __decRef();
+ throw ThreadSyscallException(__FILE__, __LINE__, GetLastError());
}
_started = true;
_running = true;
-
+
return ThreadControl(_handle, _id);
}
@@ -214,7 +214,7 @@ IceUtil::Thread::getThreadControl() const
IceUtil::Mutex::Lock lock(_stateMutex);
if(!_started)
{
- throw ThreadNotStartedException(__FILE__, __LINE__);
+ throw ThreadNotStartedException(__FILE__, __LINE__);
}
return ThreadControl(_handle, _id);
}
@@ -283,14 +283,14 @@ IceUtil::ThreadControl::join()
{
if(!_detachable)
{
- throw BadThreadControlException(__FILE__, __LINE__);
+ throw BadThreadControlException(__FILE__, __LINE__);
}
void* ignore = 0;
int rc = pthread_join(_thread, &ignore);
if(rc != 0)
{
- throw ThreadSyscallException(__FILE__, __LINE__, rc);
+ throw ThreadSyscallException(__FILE__, __LINE__, rc);
}
}
@@ -299,13 +299,13 @@ IceUtil::ThreadControl::detach()
{
if(!_detachable)
{
- throw BadThreadControlException(__FILE__, __LINE__);
+ throw BadThreadControlException(__FILE__, __LINE__);
}
int rc = pthread_detach(_thread);
if(rc != 0)
{
- throw ThreadSyscallException(__FILE__, __LINE__, rc);
+ throw ThreadSyscallException(__FILE__, __LINE__, rc);
}
}
@@ -354,23 +354,23 @@ startHook(void* arg)
try
{
- IceUtil::Thread* rawThread = static_cast<IceUtil::Thread*>(arg);
+ IceUtil::Thread* rawThread = static_cast<IceUtil::Thread*>(arg);
- thread = rawThread;
+ thread = rawThread;
- //
- // See the comment in IceUtil::Thread::start() for details.
- //
- rawThread->__decRef();
- thread->run();
+ //
+ // See the comment in IceUtil::Thread::start() for details.
+ //
+ rawThread->__decRef();
+ thread->run();
}
catch(const IceUtil::Exception& e)
{
- fprintf(stderr, "IceUtil::Thread::run(): uncaught exception: %s\n", e.toString().c_str());
+ fprintf(stderr, "IceUtil::Thread::run(): uncaught exception: %s\n", e.toString().c_str());
}
catch(...)
{
- fprintf(stderr, "IceUtil::Thread::run(): uncaught exception\n");
+ fprintf(stderr, "IceUtil::Thread::run(): uncaught exception\n");
}
thread->_done();
@@ -390,7 +390,7 @@ IceUtil::Thread::start(size_t stackSize)
if(_started)
{
- throw ThreadStartedException(__FILE__, __LINE__);
+ throw ThreadStartedException(__FILE__, __LINE__);
}
//
@@ -406,34 +406,34 @@ IceUtil::Thread::start(size_t stackSize)
if(stackSize > 0)
{
- pthread_attr_t attr;
- int rc = pthread_attr_init(&attr);
- if(rc != 0)
- {
- __decRef();
- throw ThreadSyscallException(__FILE__, __LINE__, rc);
- }
- rc = pthread_attr_setstacksize(&attr, stackSize);
- if(rc != 0)
- {
- __decRef();
- throw ThreadSyscallException(__FILE__, __LINE__, rc);
- }
- rc = pthread_create(&_thread, &attr, startHook, this);
- if(rc != 0)
- {
- __decRef();
- throw ThreadSyscallException(__FILE__, __LINE__, rc);
- }
+ pthread_attr_t attr;
+ int rc = pthread_attr_init(&attr);
+ if(rc != 0)
+ {
+ __decRef();
+ throw ThreadSyscallException(__FILE__, __LINE__, rc);
+ }
+ rc = pthread_attr_setstacksize(&attr, stackSize);
+ if(rc != 0)
+ {
+ __decRef();
+ throw ThreadSyscallException(__FILE__, __LINE__, rc);
+ }
+ rc = pthread_create(&_thread, &attr, startHook, this);
+ if(rc != 0)
+ {
+ __decRef();
+ throw ThreadSyscallException(__FILE__, __LINE__, rc);
+ }
}
else
{
- int rc = pthread_create(&_thread, 0, startHook, this);
- if(rc != 0)
- {
- __decRef();
- throw ThreadSyscallException(__FILE__, __LINE__, rc);
- }
+ int rc = pthread_create(&_thread, 0, startHook, this);
+ if(rc != 0)
+ {
+ __decRef();
+ throw ThreadSyscallException(__FILE__, __LINE__, rc);
+ }
}
_started = true;
@@ -448,7 +448,7 @@ IceUtil::Thread::getThreadControl() const
IceUtil::Mutex::Lock lock(_stateMutex);
if(!_started)
{
- throw ThreadNotStartedException(__FILE__, __LINE__);
+ throw ThreadNotStartedException(__FILE__, __LINE__);
}
return ThreadControl(_thread);
}
diff --git a/cppe/src/IceE/ThreadException.cpp b/cppe/src/IceE/ThreadException.cpp
index 0cde7200156..1915f7f6431 100644
--- a/cppe/src/IceE/ThreadException.cpp
+++ b/cppe/src/IceE/ThreadException.cpp
@@ -32,33 +32,33 @@ IceUtil::ThreadSyscallException::toString() const
string out = Exception::toString();
if(_error != 0)
{
- out += ":\nthread syscall exception: ";
+ out += ":\nthread syscall exception: ";
#ifdef _WIN32_WCE
- out += Ice::printfToString("thread error: %d", _error);
+ out += Ice::printfToString("thread error: %d", _error);
#elif defined(_WIN32)
- LPVOID lpMsgBuf = 0;
- DWORD ok = FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
- FORMAT_MESSAGE_FROM_SYSTEM |
- FORMAT_MESSAGE_IGNORE_INSERTS,
- NULL,
- _error,
- MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
- (LPTSTR)&lpMsgBuf,
- 0,
- NULL);
-
- if(ok)
- {
- LPCTSTR msg = (LPCTSTR)lpMsgBuf;
- assert(msg && strlen((char*)msg) > 0);
- out += reinterpret_cast<const char*>(msg);
- LocalFree(lpMsgBuf);
- }
- else
- {
- out += "unknown thread error: ";
- out += Ice::printfToString("error=%d", _error);
- }
+ LPVOID lpMsgBuf = 0;
+ DWORD ok = FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
+ FORMAT_MESSAGE_FROM_SYSTEM |
+ FORMAT_MESSAGE_IGNORE_INSERTS,
+ NULL,
+ _error,
+ MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
+ (LPTSTR)&lpMsgBuf,
+ 0,
+ NULL);
+
+ if(ok)
+ {
+ LPCTSTR msg = (LPCTSTR)lpMsgBuf;
+ assert(msg && strlen((char*)msg) > 0);
+ out += reinterpret_cast<const char*>(msg);
+ LocalFree(lpMsgBuf);
+ }
+ else
+ {
+ out += "unknown thread error: ";
+ out += Ice::printfToString("error=%d", _error);
+ }
#else
out += strerror(_error);
#endif
diff --git a/cppe/src/IceE/TraceUtil.cpp b/cppe/src/IceE/TraceUtil.cpp
index fe5f9e2b68f..f0267bdf595 100644
--- a/cppe/src/IceE/TraceUtil.cpp
+++ b/cppe/src/IceE/TraceUtil.cpp
@@ -55,29 +55,29 @@ printRequestHeader(string& s, BasicStream& stream)
s += Ice::printfToString("\nmode = %d ", static_cast<int>(mode));
switch(mode)
{
- case Normal:
- {
- s += "(normal)";
- break;
- }
-
- case Nonmutating:
- {
- s += "(nonmutating)";
- break;
- }
-
- case Idempotent:
- {
- s += "(idempotent)";
- break;
- }
-
- default:
- {
- s += "(unknown)";
- break;
- }
+ case Normal:
+ {
+ s += "(normal)";
+ break;
+ }
+
+ case Nonmutating:
+ {
+ s += "(nonmutating)";
+ break;
+ }
+
+ case Idempotent:
+ {
+ s += "(idempotent)";
+ break;
+ }
+
+ default:
+ {
+ s += "(unknown)";
+ break;
+ }
}
Int sz;
@@ -85,16 +85,16 @@ printRequestHeader(string& s, BasicStream& stream)
s += "\ncontext = ";
while(sz--)
{
- pair<string, string> pair;
- stream.read(pair.first);
- stream.read(pair.second);
- s += pair.first;
- s += "/";
- s += pair.second;
- if(sz)
- {
- s += ", ";
- }
+ pair<string, string> pair;
+ stream.read(pair.first);
+ stream.read(pair.second);
+ s += pair.first;
+ s += "/";
+ s += pair.second;
+ if(sz)
+ {
+ s += ", ";
+ }
}
}
@@ -102,7 +102,7 @@ static void
printHeader(string& s, BasicStream& stream)
{
Byte magicNumber;
- stream.read(magicNumber); // Don't bother printing the magic number
+ stream.read(magicNumber); // Don't bother printing the magic number
stream.read(magicNumber);
stream.read(magicNumber);
stream.read(magicNumber);
@@ -127,41 +127,41 @@ printHeader(string& s, BasicStream& stream)
switch(type)
{
- case requestMsg:
- {
- s += "(request)";
- break;
- }
-
- case requestBatchMsg:
- {
- s += "(batch request)";
- break;
- }
-
- case replyMsg:
- {
- s += "(reply)";
- break;
- }
-
- case closeConnectionMsg:
- {
- s += "(close connection)";
- break;
- }
-
- case validateConnectionMsg:
- {
- s += "(validate connection)";
- break;
- }
-
- default:
- {
- s += "(unknown)";
- break;
- }
+ case requestMsg:
+ {
+ s += "(request)";
+ break;
+ }
+
+ case requestBatchMsg:
+ {
+ s += "(batch request)";
+ break;
+ }
+
+ case replyMsg:
+ {
+ s += "(reply)";
+ break;
+ }
+
+ case closeConnectionMsg:
+ {
+ s += "(close connection)";
+ break;
+ }
+
+ case validateConnectionMsg:
+ {
+ s += "(validate connection)";
+ break;
+ }
+
+ default:
+ {
+ s += "(unknown)";
+ break;
+ }
}
Byte compress;
@@ -170,29 +170,29 @@ printHeader(string& s, BasicStream& stream)
switch(compress)
{
- case 0:
- {
- s += "(not compressed; do not compress response, if any)";
- break;
- }
-
- case 1:
- {
- s += "(not compressed; compress response, if any)";
- break;
- }
-
- case 2:
- {
- s += "(compressed; compress response, if any)";
- break;
- }
-
- default:
- {
- s += "(unknown)";
- break;
- }
+ case 0:
+ {
+ s += "(not compressed; do not compress response, if any)";
+ break;
+ }
+
+ case 1:
+ {
+ s += "(not compressed; compress response, if any)";
+ break;
+ }
+
+ case 2:
+ {
+ s += "(compressed; compress response, if any)";
+ break;
+ }
+
+ default:
+ {
+ s += "(unknown)";
+ break;
+ }
}
Int size;
@@ -202,7 +202,7 @@ printHeader(string& s, BasicStream& stream)
void
IceInternal::traceHeader(const char* heading, const BasicStream& str, const LoggerPtr& logger,
- const TraceLevelsPtr& tl)
+ const TraceLevelsPtr& tl)
{
BasicStream& stream = const_cast<BasicStream&>(str);
BasicStream::Container::iterator p = stream.i;
@@ -217,7 +217,7 @@ IceInternal::traceHeader(const char* heading, const BasicStream& str, const Logg
void
IceInternal::traceRequest(const char* heading, const BasicStream& str, const LoggerPtr& logger,
- const TraceLevelsPtr& tl)
+ const TraceLevelsPtr& tl)
{
BasicStream& stream = const_cast<BasicStream&>(str);
BasicStream::Container::iterator p = stream.i;
@@ -231,7 +231,7 @@ IceInternal::traceRequest(const char* heading, const BasicStream& str, const Log
s += Ice::printfToString("\nrequest id = %d", requestId);
if(requestId == 0)
{
- s += " (oneway)";
+ s += " (oneway)";
}
printRequestHeader(s, stream);
@@ -243,7 +243,7 @@ IceInternal::traceRequest(const char* heading, const BasicStream& str, const Log
#ifdef ICEE_HAS_BATCH
void
IceInternal::traceBatchRequest(const char* heading, const BasicStream& str, const LoggerPtr& logger,
- const TraceLevelsPtr& tl)
+ const TraceLevelsPtr& tl)
{
BasicStream& stream = const_cast<BasicStream&>(str);
BasicStream::Container::iterator p = stream.i;
@@ -258,9 +258,9 @@ IceInternal::traceBatchRequest(const char* heading, const BasicStream& str, cons
for(int i = 0; i < batchRequestNum; ++i)
{
- s += Ice::printfToString("\nrequest #%d:", i);
- printRequestHeader(s, stream);
- stream.skipEncaps();
+ s += Ice::printfToString("\nrequest #%d:", i);
+ printRequestHeader(s, stream);
+ stream.skipEncaps();
}
logger->trace(tl->protocolCat, s);
@@ -270,7 +270,7 @@ IceInternal::traceBatchRequest(const char* heading, const BasicStream& str, cons
void
IceInternal::traceReply(const char* heading, const BasicStream& str, const LoggerPtr& logger,
- const TraceLevelsPtr& tl)
+ const TraceLevelsPtr& tl)
{
BasicStream& stream = const_cast<BasicStream&>(str);
BasicStream::Container::iterator p = stream.i;
@@ -290,93 +290,93 @@ IceInternal::traceReply(const char* heading, const BasicStream& str, const Logge
{
case replyOK:
{
- s += "(ok)";
- break;
+ s += "(ok)";
+ break;
}
case replyUserException:
{
- s += "(user exception)";
- break;
+ s += "(user exception)";
+ break;
}
case replyObjectNotExist:
case replyFacetNotExist:
case replyOperationNotExist:
{
- switch(replyStatus)
- {
- case replyObjectNotExist:
- {
- s += "(object not exist)";
- break;
- }
-
- case replyFacetNotExist:
- {
- s += "(facet not exist)";
- break;
- }
-
- case replyOperationNotExist:
- {
- s += "(operation not exist)";
- break;
- }
-
- default:
- {
- assert(false);
- break;
- }
- }
-
- printIdentityFacetOperation(s, stream);
- break;
+ switch(replyStatus)
+ {
+ case replyObjectNotExist:
+ {
+ s += "(object not exist)";
+ break;
+ }
+
+ case replyFacetNotExist:
+ {
+ s += "(facet not exist)";
+ break;
+ }
+
+ case replyOperationNotExist:
+ {
+ s += "(operation not exist)";
+ break;
+ }
+
+ default:
+ {
+ assert(false);
+ break;
+ }
+ }
+
+ printIdentityFacetOperation(s, stream);
+ break;
}
case replyUnknownException:
case replyUnknownLocalException:
case replyUnknownUserException:
{
- switch(replyStatus)
- {
- case replyUnknownException:
- {
- s += "(unknown exception)";
- break;
- }
-
- case replyUnknownLocalException:
- {
- s += "(unknown local exception)";
- break;
- }
-
- case replyUnknownUserException:
- {
- s += "(unknown user exception)";
- break;
- }
-
- default:
- {
- assert(false);
- break;
- }
- }
-
- string unknown;
- stream.read(unknown);
- s += "\nunknown = ";
- s += unknown;
- break;
+ switch(replyStatus)
+ {
+ case replyUnknownException:
+ {
+ s += "(unknown exception)";
+ break;
+ }
+
+ case replyUnknownLocalException:
+ {
+ s += "(unknown local exception)";
+ break;
+ }
+
+ case replyUnknownUserException:
+ {
+ s += "(unknown user exception)";
+ break;
+ }
+
+ default:
+ {
+ assert(false);
+ break;
+ }
+ }
+
+ string unknown;
+ stream.read(unknown);
+ s += "\nunknown = ";
+ s += unknown;
+ break;
}
default:
{
- s += "(unknown)";
- break;
+ s += "(unknown)";
+ break;
}
}
diff --git a/cppe/src/IceE/Transceiver.h b/cppe/src/IceE/Transceiver.h
index 36a7ecaa8bf..a3cbbaafdec 100644
--- a/cppe/src/IceE/Transceiver.h
+++ b/cppe/src/IceE/Transceiver.h
@@ -45,12 +45,12 @@ public:
void write(Buffer& buf)
{
- writeWithTimeout(buf, _writeTimeout);
+ writeWithTimeout(buf, _writeTimeout);
}
void read(Buffer& buf)
{
- readWithTimeout(buf, _readTimeout);
+ readWithTimeout(buf, _readTimeout);
}
std::string type() const;
diff --git a/cppe/src/IceE/UUID.cpp b/cppe/src/IceE/UUID.cpp
index de7fba90512..d3847e581cd 100644
--- a/cppe/src/IceE/UUID.cpp
+++ b/cppe/src/IceE/UUID.cpp
@@ -42,11 +42,11 @@ inline void halfByteToHex(unsigned char hb, char*& hexBuffer)
{
if(hb < 10)
{
- *hexBuffer++ = '0' + hb;
+ *hexBuffer++ = '0' + hb;
}
else
{
- *hexBuffer++ = 'A' + (hb - 10);
+ *hexBuffer++ = 'A' + (hb - 10);
}
}
@@ -54,8 +54,8 @@ inline void bytesToHex(unsigned char* bytes, size_t len, char*& hexBuffer)
{
for(size_t i = 0; i < len; i++)
{
- halfByteToHex((bytes[i] & 0xF0) >> 4, hexBuffer);
- halfByteToHex((bytes[i] & 0x0F), hexBuffer);
+ halfByteToHex((bytes[i] & 0xF0) >> 4, hexBuffer);
+ halfByteToHex((bytes[i] & 0x0F), hexBuffer);
}
}
@@ -84,12 +84,12 @@ public:
~UUIDCleanup()
{
- IceUtil::StaticMutex::Lock lock(staticMutex);
- if(cryptProv != 0)
- {
- CryptReleaseContext(cryptProv, 0);
- cryptProv = 0;
- }
+ IceUtil::StaticMutex::Lock lock(staticMutex);
+ if(cryptProv != 0)
+ {
+ CryptReleaseContext(cryptProv, 0);
+ cryptProv = 0;
+ }
}
};
@@ -125,12 +125,12 @@ public:
~UUIDCleanup()
{
- IceUtil::StaticMutex::Lock lock(staticMutex);
- if(fd != -1)
- {
- close(fd);
- fd = -1;
- }
+ IceUtil::StaticMutex::Lock lock(staticMutex);
+ if(fd != -1)
+ {
+ close(fd);
+ fd = -1;
+ }
}
};
static UUIDCleanup uuidCleanup;
@@ -179,12 +179,12 @@ IceUtil::generateUUID()
struct UUID
{
- unsigned char timeLow[4];
- unsigned char timeMid[2];
- unsigned char timeHighAndVersion[2];
- unsigned char clockSeqHiAndReserved;
- unsigned char clockSeqLow;
- unsigned char node[6];
+ unsigned char timeLow[4];
+ unsigned char timeMid[2];
+ unsigned char timeHighAndVersion[2];
+ unsigned char clockSeqHiAndReserved;
+ unsigned char clockSeqLow;
+ unsigned char node[6];
};
UUID uuid;
@@ -199,74 +199,74 @@ IceUtil::generateUUID()
HCRYPTPROV localProv;
{
- IceUtil::StaticMutex::Lock lock(staticMutex);
- if(cryptProv == 0)
- {
- if(!CryptAcquireContext(&cryptProv, 0, 0, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT))
- {
- throw UUIDGenerationException(__FILE__, __LINE__);
- }
- }
- localProv = cryptProv;
+ IceUtil::StaticMutex::Lock lock(staticMutex);
+ if(cryptProv == 0)
+ {
+ if(!CryptAcquireContext(&cryptProv, 0, 0, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT))
+ {
+ throw UUIDGenerationException(__FILE__, __LINE__);
+ }
+ }
+ localProv = cryptProv;
}
memset(buffer, 0, 16);
if(!CryptGenRandom(localProv, 16, (unsigned char*)buffer))
{
- throw UUIDGenerationException(__FILE__, __LINE__);
+ throw UUIDGenerationException(__FILE__, __LINE__);
}
#else
{
- //
- // Serialize access to /dev/urandom; see comment above.
- //
- IceUtil::StaticMutex::Lock lock(staticMutex);
- if(fd == -1)
- {
- fd = open("/dev/urandom", O_RDONLY);
- if (fd == -1)
- {
- assert(0);
- throw UUIDGenerationException(__FILE__, __LINE__);
- }
-
- //
- // Initialize myPid as well
- //
- pid_t pid = getpid();
- myPid[0] = (pid >> 8) & 0x7F;
- myPid[1] = pid & 0xFF;
- }
-
-
- //
- // Limit the number of attempts to 20 reads to avoid
- // a potential "for ever" loop
- //
- while(reads <= 20 && index != sizeof(UUID))
- {
- ssize_t bytesRead = read(fd, buffer + index, sizeof(UUID) - index);
-
- if(bytesRead == -1 && errno != EINTR)
- {
- int err = errno;
- fprintf(stderr, "Reading /dev/urandom returned %s\n", strerror(err));
- assert(0);
- throw UUIDGenerationException(__FILE__, __LINE__);
- }
- else
- {
- index += bytesRead;
- reads++;
- }
- }
+ //
+ // Serialize access to /dev/urandom; see comment above.
+ //
+ IceUtil::StaticMutex::Lock lock(staticMutex);
+ if(fd == -1)
+ {
+ fd = open("/dev/urandom", O_RDONLY);
+ if (fd == -1)
+ {
+ assert(0);
+ throw UUIDGenerationException(__FILE__, __LINE__);
+ }
+
+ //
+ // Initialize myPid as well
+ //
+ pid_t pid = getpid();
+ myPid[0] = (pid >> 8) & 0x7F;
+ myPid[1] = pid & 0xFF;
+ }
+
+
+ //
+ // Limit the number of attempts to 20 reads to avoid
+ // a potential "for ever" loop
+ //
+ while(reads <= 20 && index != sizeof(UUID))
+ {
+ ssize_t bytesRead = read(fd, buffer + index, sizeof(UUID) - index);
+
+ if(bytesRead == -1 && errno != EINTR)
+ {
+ int err = errno;
+ fprintf(stderr, "Reading /dev/urandom returned %s\n", strerror(err));
+ assert(0);
+ throw UUIDGenerationException(__FILE__, __LINE__);
+ }
+ else
+ {
+ index += bytesRead;
+ reads++;
+ }
+ }
}
-
+
if (index != sizeof(UUID))
{
- assert(0);
- throw UUIDGenerationException(__FILE__, __LINE__);
+ assert(0);
+ throw UUIDGenerationException(__FILE__, __LINE__);
}
//
diff --git a/cppe/src/IceE/Unicode.cpp b/cppe/src/IceE/Unicode.cpp
index c1a17286041..facd380e1a3 100644
--- a/cppe/src/IceE/Unicode.cpp
+++ b/cppe/src/IceE/Unicode.cpp
@@ -27,35 +27,35 @@ template<size_t wcharSize>
struct WstringHelper
{
static ConversionResult toUTF8(
- const wchar_t*& sourceStart, const wchar_t* sourceEnd,
- Byte*& targetStart, Byte* targetEnd, ConversionFlags flags);
+ const wchar_t*& sourceStart, const wchar_t* sourceEnd,
+ Byte*& targetStart, Byte* targetEnd, ConversionFlags flags);
static ConversionResult fromUTF8(
- const Byte*& sourceStart, const Byte* sourceEnd,
- wchar_t*& targetStart, wchar_t* targetEnd, ConversionFlags flags);
+ const Byte*& sourceStart, const Byte* sourceEnd,
+ wchar_t*& targetStart, wchar_t* targetEnd, ConversionFlags flags);
};
template<>
struct WstringHelper<2>
{
static ConversionResult toUTF8(
- const wchar_t*& sourceStart, const wchar_t* sourceEnd,
- Byte*& targetStart, Byte* targetEnd, ConversionFlags flags)
+ const wchar_t*& sourceStart, const wchar_t* sourceEnd,
+ Byte*& targetStart, Byte* targetEnd, ConversionFlags flags)
{
- return ConvertUTF16toUTF8(
- reinterpret_cast<const UTF16**>(&sourceStart),
- reinterpret_cast<const UTF16*>(sourceEnd),
- &targetStart, targetEnd, flags);
+ return ConvertUTF16toUTF8(
+ reinterpret_cast<const UTF16**>(&sourceStart),
+ reinterpret_cast<const UTF16*>(sourceEnd),
+ &targetStart, targetEnd, flags);
}
static ConversionResult fromUTF8(
- const Byte*& sourceStart, const Byte* sourceEnd,
- wchar_t*& targetStart, wchar_t* targetEnd, ConversionFlags flags)
+ const Byte*& sourceStart, const Byte* sourceEnd,
+ wchar_t*& targetStart, wchar_t* targetEnd, ConversionFlags flags)
{
- return ConvertUTF8toUTF16(
- &sourceStart, sourceEnd,
- reinterpret_cast<UTF16**>(&targetStart),
- reinterpret_cast<UTF16*>(targetEnd), flags);
+ return ConvertUTF8toUTF16(
+ &sourceStart, sourceEnd,
+ reinterpret_cast<UTF16**>(&targetStart),
+ reinterpret_cast<UTF16*>(targetEnd), flags);
}
};
@@ -63,23 +63,23 @@ template<>
struct WstringHelper<4>
{
static ConversionResult toUTF8(
- const wchar_t*& sourceStart, const wchar_t* sourceEnd,
- Byte*& targetStart, Byte* targetEnd, ConversionFlags flags)
+ const wchar_t*& sourceStart, const wchar_t* sourceEnd,
+ Byte*& targetStart, Byte* targetEnd, ConversionFlags flags)
{
- return ConvertUTF32toUTF8(
- reinterpret_cast<const UTF32**>(&sourceStart),
- reinterpret_cast<const UTF32*>(sourceEnd),
- &targetStart, targetEnd, flags);
+ return ConvertUTF32toUTF8(
+ reinterpret_cast<const UTF32**>(&sourceStart),
+ reinterpret_cast<const UTF32*>(sourceEnd),
+ &targetStart, targetEnd, flags);
}
static ConversionResult fromUTF8(
- const Byte*& sourceStart, const Byte* sourceEnd,
- wchar_t*& targetStart, wchar_t* targetEnd, ConversionFlags flags)
+ const Byte*& sourceStart, const Byte* sourceEnd,
+ wchar_t*& targetStart, wchar_t* targetEnd, ConversionFlags flags)
{
- return ConvertUTF8toUTF32(
- &sourceStart, sourceEnd,
- reinterpret_cast<UTF32**>(&targetStart),
- reinterpret_cast<UTF32*>(targetEnd), flags);
+ return ConvertUTF8toUTF32(
+ &sourceStart, sourceEnd,
+ reinterpret_cast<UTF32**>(&targetStart),
+ reinterpret_cast<UTF32*>(targetEnd), flags);
}
};
}
@@ -94,7 +94,7 @@ IceUtil::convertUTFWstringToUTF8(
Byte*& targetStart, Byte* targetEnd, ConversionFlags flags)
{
return WstringHelper<sizeof(wchar_t)>::toUTF8(
- sourceStart, sourceEnd, targetStart, targetEnd, flags);
+ sourceStart, sourceEnd, targetStart, targetEnd, flags);
}
ConversionResult
@@ -103,12 +103,12 @@ IceUtil::convertUTF8ToUTFWstring(
wchar_t*& targetStart, wchar_t* targetEnd, ConversionFlags flags)
{
return WstringHelper<sizeof(wchar_t)>::fromUTF8(
- sourceStart, sourceEnd, targetStart, targetEnd, flags);
+ sourceStart, sourceEnd, targetStart, targetEnd, flags);
}
ConversionResult
IceUtil::convertUTF8ToUTFWstring(const Byte*& sourceStart, const Byte* sourceEnd,
- std::wstring& target, ConversionFlags flags)
+ std::wstring& target, ConversionFlags flags)
{
//
// Could be reimplemented without this temporary wchar_t buffer
@@ -119,13 +119,13 @@ IceUtil::convertUTF8ToUTFWstring(const Byte*& sourceStart, const Byte* sourceEnd
wchar_t* targetEnd = targetStart + size;
ConversionResult result =
- convertUTF8ToUTFWstring(sourceStart, sourceEnd, targetStart,
- targetEnd, flags);
+ convertUTF8ToUTFWstring(sourceStart, sourceEnd, targetStart,
+ targetEnd, flags);
if(result == conversionOK)
{
- std::wstring s(outBuf, static_cast<size_t>(targetStart - outBuf));
- s.swap(target);
+ std::wstring s(outBuf, static_cast<size_t>(targetStart - outBuf));
+ s.swap(target);
}
delete[] outBuf;
return result;
@@ -139,7 +139,7 @@ IceUtil::convertUTF8ToUTFWstring(const Byte*& sourceStart, const Byte* sourceEnd
const char* IceUtil::UTFConversionException::_name = "IceUtil::UTFConversionException";
IceUtil::UTFConversionException::UTFConversionException(const char* file, int line,
- ConversionResult cr):
+ ConversionResult cr):
Exception(file, line),
_conversionResult(cr)
{}
@@ -156,18 +156,18 @@ IceUtil::UTFConversionException::toString() const
string str = Exception::toString();
switch(_conversionResult)
{
- case sourceExhausted:
- str += ": source exhausted";
- break;
- case targetExhausted:
- str += ": target exhausted";
- break;
- case sourceIllegal:
- str += ": illegal source";
- break;
- default:
- assert(0);
- break;
+ case sourceExhausted:
+ str += ": source exhausted";
+ break;
+ case targetExhausted:
+ str += ": target exhausted";
+ break;
+ case sourceIllegal:
+ str += ": illegal source";
+ break;
+ default:
+ assert(0);
+ break;
};
return str;
}
@@ -205,18 +205,18 @@ IceUtil::wstringToString(const wstring& wstr)
const wchar_t* sourceStart = wstr.data();
ConversionResult cr =
- convertUTFWstringToUTF8(
- sourceStart, sourceStart + wstr.size(),
- targetStart, targetEnd, lenientConversion);
-
+ convertUTFWstringToUTF8(
+ sourceStart, sourceStart + wstr.size(),
+ targetStart, targetEnd, lenientConversion);
+
if(cr != conversionOK)
{
- delete[] outBuf;
- throw UTFConversionException(__FILE__, __LINE__, cr);
+ delete[] outBuf;
+ throw UTFConversionException(__FILE__, __LINE__, cr);
}
string s(reinterpret_cast<char*>(outBuf),
- static_cast<size_t>(targetStart - outBuf));
+ static_cast<size_t>(targetStart - outBuf));
s.swap(target);
delete[] outBuf;
return target;
@@ -229,12 +229,12 @@ IceUtil::stringToWstring(const string& str)
const Byte* sourceStart = reinterpret_cast<const Byte*>(str.data());
ConversionResult cr
- = convertUTF8ToUTFWstring(sourceStart, sourceStart + str.size(),
- result, lenientConversion);
+ = convertUTF8ToUTFWstring(sourceStart, sourceStart + str.size(),
+ result, lenientConversion);
if(cr != conversionOK)
{
- throw UTFConversionException(__FILE__, __LINE__, cr);
+ throw UTFConversionException(__FILE__, __LINE__, cr);
}
return result;
}
diff --git a/cppe/src/IceE/UnknownEndpoint.cpp b/cppe/src/IceE/UnknownEndpoint.cpp
index dee2bd5004f..3792a012c16 100644
--- a/cppe/src/IceE/UnknownEndpoint.cpp
+++ b/cppe/src/IceE/UnknownEndpoint.cpp
@@ -114,12 +114,12 @@ IceInternal::UnknownEndpoint::operator==(const Endpoint& r) const
const UnknownEndpoint* p = dynamic_cast<const UnknownEndpoint*>(&r);
if(!p)
{
- return false;
+ return false;
}
if(this == p)
{
- return true;
+ return true;
}
if(_type != p->_type)
@@ -129,7 +129,7 @@ IceInternal::UnknownEndpoint::operator==(const Endpoint& r) const
if(_rawBytes != p->_rawBytes)
{
- return false;
+ return false;
}
return true;
@@ -152,25 +152,25 @@ IceInternal::UnknownEndpoint::operator<(const Endpoint& r) const
if(this == p)
{
- return false;
+ return false;
}
if(_type < p->_type)
{
- return true;
+ return true;
}
else if(p->_type < _type)
{
- return false;
+ return false;
}
if(_rawBytes < p->_rawBytes)
{
- return true;
+ return true;
}
else if(p->_rawBytes < _rawBytes)
{
- return false;
+ return false;
}
return false;
diff --git a/cppe/src/TcpTransport/Acceptor.cpp b/cppe/src/TcpTransport/Acceptor.cpp
index 28f2b74b43a..477eb7b7adb 100644
--- a/cppe/src/TcpTransport/Acceptor.cpp
+++ b/cppe/src/TcpTransport/Acceptor.cpp
@@ -32,8 +32,8 @@ IceInternal::Acceptor::close()
{
if(_traceLevels->network >= 1)
{
- Trace out(_logger, _traceLevels->networkCat);
- out << "stopping to accept tcp connections at " << toString();
+ Trace out(_logger, _traceLevels->networkCat);
+ out << "stopping to accept tcp connections at " << toString();
}
SOCKET fd = _fd;
@@ -46,18 +46,18 @@ IceInternal::Acceptor::listen()
{
try
{
- doListen(_fd, _backlog);
+ doListen(_fd, _backlog);
}
catch(...)
{
- _fd = INVALID_SOCKET;
- throw;
+ _fd = INVALID_SOCKET;
+ throw;
}
if(_traceLevels->network >= 1)
{
- Trace out(_logger, _traceLevels->networkCat);
- out << "accepting tcp connections at " << toString();
+ Trace out(_logger, _traceLevels->networkCat);
+ out << "accepting tcp connections at " << toString();
}
}
@@ -72,8 +72,8 @@ IceInternal::Acceptor::accept()
if(_traceLevels->network >= 1)
{
- Trace out(_logger, _traceLevels->networkCat);
- out << "accepted tcp connection\n" << fdToString(fd);
+ Trace out(_logger, _traceLevels->networkCat);
+ out << "accepted tcp connection\n" << fdToString(fd);
}
return new Transceiver(_instance, fd);
@@ -113,8 +113,8 @@ IceInternal::Acceptor::Acceptor(const InstancePtr& instance, const string& host,
try
{
- _fd = createSocket();
- getAddress(host, port, _addr);
+ _fd = createSocket();
+ getAddress(host, port, _addr);
setTcpBufSize(_fd, _instance->initializationData().properties, _logger);
#ifndef _WIN32
//
@@ -131,17 +131,17 @@ IceInternal::Acceptor::Acceptor(const InstancePtr& instance, const string& host,
//
setReuseAddress(_fd, true);
#endif
- if(_traceLevels->network >= 2)
- {
- Trace out(_logger, _traceLevels->networkCat);
- out << "attempting to bind to tcp socket " << toString();
- }
- doBind(_fd, _addr);
+ if(_traceLevels->network >= 2)
+ {
+ Trace out(_logger, _traceLevels->networkCat);
+ out << "attempting to bind to tcp socket " << toString();
+ }
+ doBind(_fd, _addr);
}
catch(...)
{
- _fd = INVALID_SOCKET;
- throw;
+ _fd = INVALID_SOCKET;
+ throw;
}
}
diff --git a/cppe/src/TcpTransport/Connector.cpp b/cppe/src/TcpTransport/Connector.cpp
index 98d3b95a364..52209fcda50 100644
--- a/cppe/src/TcpTransport/Connector.cpp
+++ b/cppe/src/TcpTransport/Connector.cpp
@@ -26,8 +26,8 @@ Connector::connect(int timeout)
{
if(_traceLevels->network >= 2)
{
- Trace out(_logger, _traceLevels->networkCat);
- out << "trying to establish tcp connection to " << toString();
+ Trace out(_logger, _traceLevels->networkCat);
+ out << "trying to establish tcp connection to " << toString();
}
SOCKET fd = createSocket();
@@ -40,8 +40,8 @@ Connector::connect(int timeout)
if(_traceLevels->network >= 1)
{
- Trace out(_logger, _traceLevels->networkCat);
- out << "tcp connection established\n" << fdToString(fd);
+ Trace out(_logger, _traceLevels->networkCat);
+ out << "tcp connection established\n" << fdToString(fd);
}
return new Transceiver(_instance, fd);
diff --git a/cppe/src/TcpTransport/EndpointFactory.cpp b/cppe/src/TcpTransport/EndpointFactory.cpp
index 7ac68524733..c6207020d38 100644
--- a/cppe/src/TcpTransport/EndpointFactory.cpp
+++ b/cppe/src/TcpTransport/EndpointFactory.cpp
@@ -51,7 +51,7 @@ IceInternal::EndpointFactory::create(const std::string& str) const
if(protocol == "default" || protocol == "tcp")
{
- return new TcpEndpoint(_instance, str.substr(end));
+ return new TcpEndpoint(_instance, str.substr(end));
}
return 0;
diff --git a/cppe/src/TcpTransport/TcpEndpoint.cpp b/cppe/src/TcpTransport/TcpEndpoint.cpp
index 93e4a9efdca..88adf42bf94 100644
--- a/cppe/src/TcpTransport/TcpEndpoint.cpp
+++ b/cppe/src/TcpTransport/TcpEndpoint.cpp
@@ -46,90 +46,90 @@ IceInternal::TcpEndpoint::TcpEndpoint(const InstancePtr& instance, const string&
while(true)
{
- beg = str.find_first_not_of(delim, end);
- if(beg == string::npos)
- {
- break;
- }
-
- end = str.find_first_of(delim, beg);
- if(end == string::npos)
- {
- end = str.length();
- }
-
- string option = str.substr(beg, end - beg);
- if(option.length() != 2 || option[0] != '-')
- {
- EndpointParseException ex(__FILE__, __LINE__);
- ex.str = "tcp " + str;
- throw ex;
- }
-
- string argument;
- string::size_type argumentBeg = str.find_first_not_of(delim, end);
- if(argumentBeg != string::npos && str[argumentBeg] != '-')
- {
- beg = argumentBeg;
- end = str.find_first_of(delim, beg);
- if(end == string::npos)
- {
- end = str.length();
- }
- argument = str.substr(beg, end - beg);
- }
-
- switch(option[1])
- {
- case 'h':
- {
- if(argument.empty())
- {
- EndpointParseException ex(__FILE__, __LINE__);
- ex.str = "tcp " + str;
- throw ex;
- }
- const_cast<string&>(_host) = argument;
- break;
- }
-
- case 'p':
- {
- const_cast<Int&>(_port) = atoi(argument.c_str());
- if(_port <= 0 || _port > 65535)
- {
- EndpointParseException ex(__FILE__, __LINE__);
- ex.str = "tcp " + str;
- throw ex;
- }
- break;
- }
-
- case 't':
- {
- const_cast<Int&>(_timeout) = atoi(argument.c_str());
- if(_timeout == 0)
- {
- EndpointParseException ex(__FILE__, __LINE__);
- ex.str = "tcp " + str;
- throw ex;
- }
- break;
- }
-
- case 'z':
- {
- // Ignore compression flag.
- break;
- }
-
- default:
- {
- EndpointParseException ex(__FILE__, __LINE__);
- ex.str = "tcp " + str;
- throw ex;
- }
- }
+ beg = str.find_first_not_of(delim, end);
+ if(beg == string::npos)
+ {
+ break;
+ }
+
+ end = str.find_first_of(delim, beg);
+ if(end == string::npos)
+ {
+ end = str.length();
+ }
+
+ string option = str.substr(beg, end - beg);
+ if(option.length() != 2 || option[0] != '-')
+ {
+ EndpointParseException ex(__FILE__, __LINE__);
+ ex.str = "tcp " + str;
+ throw ex;
+ }
+
+ string argument;
+ string::size_type argumentBeg = str.find_first_not_of(delim, end);
+ if(argumentBeg != string::npos && str[argumentBeg] != '-')
+ {
+ beg = argumentBeg;
+ end = str.find_first_of(delim, beg);
+ if(end == string::npos)
+ {
+ end = str.length();
+ }
+ argument = str.substr(beg, end - beg);
+ }
+
+ switch(option[1])
+ {
+ case 'h':
+ {
+ if(argument.empty())
+ {
+ EndpointParseException ex(__FILE__, __LINE__);
+ ex.str = "tcp " + str;
+ throw ex;
+ }
+ const_cast<string&>(_host) = argument;
+ break;
+ }
+
+ case 'p':
+ {
+ const_cast<Int&>(_port) = atoi(argument.c_str());
+ if(_port <= 0 || _port > 65535)
+ {
+ EndpointParseException ex(__FILE__, __LINE__);
+ ex.str = "tcp " + str;
+ throw ex;
+ }
+ break;
+ }
+
+ case 't':
+ {
+ const_cast<Int&>(_timeout) = atoi(argument.c_str());
+ if(_timeout == 0)
+ {
+ EndpointParseException ex(__FILE__, __LINE__);
+ ex.str = "tcp " + str;
+ throw ex;
+ }
+ break;
+ }
+
+ case 'z':
+ {
+ // Ignore compression flag.
+ break;
+ }
+
+ default:
+ {
+ EndpointParseException ex(__FILE__, __LINE__);
+ ex.str = "tcp " + str;
+ throw ex;
+ }
+ }
}
}
@@ -194,11 +194,11 @@ IceInternal::TcpEndpoint::timeout(Int timeout) const
{
if(timeout == _timeout)
{
- return const_cast<TcpEndpoint*>(this);
+ return const_cast<TcpEndpoint*>(this);
}
else
{
- return new TcpEndpoint(_instance, _host, _port, timeout, _publish);
+ return new TcpEndpoint(_instance, _host, _port, timeout, _publish);
}
}
@@ -232,42 +232,42 @@ IceInternal::TcpEndpoint::operator==(const Endpoint& r) const
const TcpEndpoint* p = dynamic_cast<const TcpEndpoint*>(&r);
if(!p)
{
- return false;
+ return false;
}
if(this == p)
{
- return true;
+ return true;
}
if(_port != p->_port)
{
- return false;
+ return false;
}
if(_timeout != p->_timeout)
{
- return false;
+ return false;
}
if(_host != p->_host)
{
- //
- // We do the most time-consuming part of the comparison last.
- //
- struct sockaddr_in laddr;
- struct sockaddr_in raddr;
- try
- {
- getAddress(_host, _port, laddr);
- getAddress(p->_host, p->_port, raddr);
- }
- catch(const DNSException&)
- {
- return false;
- }
-
- return compareAddress(laddr, raddr);
+ //
+ // We do the most time-consuming part of the comparison last.
+ //
+ struct sockaddr_in laddr;
+ struct sockaddr_in raddr;
+ try
+ {
+ getAddress(_host, _port, laddr);
+ getAddress(p->_host, p->_port, raddr);
+ }
+ catch(const DNSException&)
+ {
+ return false;
+ }
+
+ return compareAddress(laddr, raddr);
}
return true;
@@ -285,63 +285,63 @@ IceInternal::TcpEndpoint::operator<(const Endpoint& r) const
const TcpEndpoint* p = dynamic_cast<const TcpEndpoint*>(&r);
if(!p)
{
- return type() < r.type();
+ return type() < r.type();
}
if(this == p)
{
- return false;
+ return false;
}
if(_port < p->_port)
{
- return true;
+ return true;
}
else if(p->_port < _port)
{
- return false;
+ return false;
}
if(_timeout < p->_timeout)
{
- return true;
+ return true;
}
else if(p->_timeout < _timeout)
{
- return false;
+ return false;
}
if(_host != p->_host)
{
- //
- // We do the most time-consuming part of the comparison last.
- //
- struct sockaddr_in laddr;
- try
- {
- getAddress(_host, _port, laddr);
- }
- catch(const DNSException&)
- {
- }
-
- struct sockaddr_in raddr;
- try
- {
- getAddress(p->_host, p->_port, raddr);
- }
- catch(const DNSException&)
- {
- }
-
- if(laddr.sin_addr.s_addr < raddr.sin_addr.s_addr)
- {
- return true;
- }
- else if(raddr.sin_addr.s_addr < laddr.sin_addr.s_addr)
- {
- return false;
- }
+ //
+ // We do the most time-consuming part of the comparison last.
+ //
+ struct sockaddr_in laddr;
+ try
+ {
+ getAddress(_host, _port, laddr);
+ }
+ catch(const DNSException&)
+ {
+ }
+
+ struct sockaddr_in raddr;
+ try
+ {
+ getAddress(p->_host, p->_port, raddr);
+ }
+ catch(const DNSException&)
+ {
+ }
+
+ if(laddr.sin_addr.s_addr < raddr.sin_addr.s_addr)
+ {
+ return true;
+ }
+ else if(raddr.sin_addr.s_addr < laddr.sin_addr.s_addr)
+ {
+ return false;
+ }
}
return false;
@@ -355,14 +355,14 @@ IceInternal::TcpEndpoint::expand(bool server) const
const_cast<string&>(_host) = _instance->defaultsAndOverrides()->defaultHost;
if(_host.empty())
{
- if(server)
- {
+ if(server)
+ {
const_cast<string&>(_host) = "0.0.0.0";
- }
- else
- {
+ }
+ else
+ {
const_cast<string&>(_host) = "127.0.0.1";
- }
+ }
}
}
else if(_host == "*")
diff --git a/cppe/src/TcpTransport/Transceiver.cpp b/cppe/src/TcpTransport/Transceiver.cpp
index 6ab0d9b06c8..fa31d1cdd29 100644
--- a/cppe/src/TcpTransport/Transceiver.cpp
+++ b/cppe/src/TcpTransport/Transceiver.cpp
@@ -48,8 +48,8 @@ IceInternal::Transceiver::close()
{
if(_traceLevels->network >= 1)
{
- Trace out(_logger, _traceLevels->networkCat);
- out << "closing tcp connection\n" << toString();
+ Trace out(_logger, _traceLevels->networkCat);
+ out << "closing tcp connection\n" << toString();
}
#ifdef ICEE_USE_SELECT_OR_POLL_FOR_TIMEOUTS
@@ -67,13 +67,13 @@ IceInternal::Transceiver::close()
assert(_fd != INVALID_SOCKET);
try
{
- closeSocket(_fd);
- _fd = INVALID_SOCKET;
+ closeSocket(_fd);
+ _fd = INVALID_SOCKET;
}
catch(const SocketException&)
{
- _fd = INVALID_SOCKET;
- throw;
+ _fd = INVALID_SOCKET;
+ throw;
}
}
@@ -82,8 +82,8 @@ IceInternal::Transceiver::shutdownWrite()
{
if(_traceLevels->network >= 2)
{
- Trace out(_logger, _traceLevels->networkCat);
- out << "shutting down tcp connection for writing\n" << toString();
+ Trace out(_logger, _traceLevels->networkCat);
+ out << "shutting down tcp connection for writing\n" << toString();
}
assert(_fd != INVALID_SOCKET);
@@ -95,8 +95,8 @@ IceInternal::Transceiver::shutdownReadWrite()
{
if(_traceLevels->network >= 2)
{
- Trace out(_logger, _traceLevels->networkCat);
- out << "shutting down tcp connection for reading and writing\n" << toString();
+ Trace out(_logger, _traceLevels->networkCat);
+ out << "shutting down tcp connection for reading and writing\n" << toString();
}
assert(_fd != INVALID_SOCKET);
@@ -115,113 +115,113 @@ IceInternal::Transceiver::writeWithTimeout(Buffer& buf, int timeout)
//
if(packetSize > _maxPacketSize)
{
- packetSize = _maxPacketSize;
+ packetSize = _maxPacketSize;
}
#endif
#ifndef ICEE_USE_SELECT_OR_POLL_FOR_TIMEOUTS
if(timeout > 0 && timeout != _writeTimeout)
{
- setTimeout(_fd, false, timeout);
+ setTimeout(_fd, false, timeout);
}
try
- {
+ {
#endif
- while(buf.i != buf.b.end())
- {
- repeatSend:
- assert(_fd != INVALID_SOCKET);
- ssize_t ret = ::send(_fd, reinterpret_cast<const char*>(&*buf.i), packetSize, 0);
-
- if(ret == 0)
- {
- ConnectionLostException ex(__FILE__, __LINE__);
- ex.error = 0;
- throw ex;
- }
-
- if(ret == SOCKET_ERROR)
- {
- if(interrupted())
- {
- goto repeatSend;
- }
-
- if(noBuffers() && packetSize > 1024)
- {
- packetSize /= 2;
- goto repeatSend;
- }
-
+ while(buf.i != buf.b.end())
+ {
+ repeatSend:
+ assert(_fd != INVALID_SOCKET);
+ ssize_t ret = ::send(_fd, reinterpret_cast<const char*>(&*buf.i), packetSize, 0);
+
+ if(ret == 0)
+ {
+ ConnectionLostException ex(__FILE__, __LINE__);
+ ex.error = 0;
+ throw ex;
+ }
+
+ if(ret == SOCKET_ERROR)
+ {
+ if(interrupted())
+ {
+ goto repeatSend;
+ }
+
+ if(noBuffers() && packetSize > 1024)
+ {
+ packetSize /= 2;
+ goto repeatSend;
+ }
+
#ifndef ICEE_USE_SELECT_OR_POLL_FOR_TIMEOUTS
- if(timedout())
- {
- throw TimeoutException(__FILE__, __LINE__);
- }
+ if(timedout())
+ {
+ throw TimeoutException(__FILE__, __LINE__);
+ }
#else
- if(wouldBlock())
- {
- doSelect(false, timeout > 0 ? timeout : _writeTimeout);
- continue;
- }
+ if(wouldBlock())
+ {
+ doSelect(false, timeout > 0 ? timeout : _writeTimeout);
+ continue;
+ }
#endif
- if(connectionLost())
- {
- ConnectionLostException ex(__FILE__, __LINE__);
- ex.error = getSocketErrno();
- throw ex;
- }
- else
- {
- SocketException ex(__FILE__, __LINE__);
- ex.error = getSocketErrno();
- throw ex;
- }
- }
-
- if(_traceLevels->network >= 3)
- {
- Trace out(_logger, _traceLevels->networkCat);
- out << Ice::printfToString("sent %d of %d", ret, packetSize) << " bytes via tcp\n" << toString();
- }
-
- buf.i += ret;
-
- if(packetSize > buf.b.end() - buf.i)
- {
- packetSize = static_cast<Buffer::Container::difference_type>(buf.b.end() - buf.i);
- }
- }
+ if(connectionLost())
+ {
+ ConnectionLostException ex(__FILE__, __LINE__);
+ ex.error = getSocketErrno();
+ throw ex;
+ }
+ else
+ {
+ SocketException ex(__FILE__, __LINE__);
+ ex.error = getSocketErrno();
+ throw ex;
+ }
+ }
+
+ if(_traceLevels->network >= 3)
+ {
+ Trace out(_logger, _traceLevels->networkCat);
+ out << Ice::printfToString("sent %d of %d", ret, packetSize) << " bytes via tcp\n" << toString();
+ }
+
+ buf.i += ret;
+
+ if(packetSize > buf.b.end() - buf.i)
+ {
+ packetSize = static_cast<Buffer::Container::difference_type>(buf.b.end() - buf.i);
+ }
+ }
#ifndef ICEE_USE_SELECT_OR_POLL_FOR_TIMEOUTS
}
catch(const Ice::LocalException&)
{
- if(timeout > 0 && timeout != _writeTimeout)
- {
- try
- {
- setTimeout(_fd, false, _writeTimeout);
- }
- catch(const Ice::LocalException&)
- {
- // IGNORE
- }
- }
- throw;
+ if(timeout > 0 && timeout != _writeTimeout)
+ {
+ try
+ {
+ setTimeout(_fd, false, _writeTimeout);
+ }
+ catch(const Ice::LocalException&)
+ {
+ // IGNORE
+ }
+ }
+ throw;
}
if(timeout > 0 && timeout != _writeTimeout)
{
- try
- {
- setTimeout(_fd, false, _writeTimeout);
- }
- catch(const Ice::LocalException&)
- {
- // IGNORE
- }
+ try
+ {
+ setTimeout(_fd, false, _writeTimeout);
+ }
+ catch(const Ice::LocalException&)
+ {
+ // IGNORE
+ }
}
#endif
}
@@ -232,129 +232,129 @@ IceInternal::Transceiver::readWithTimeout(Buffer& buf, int timeout)
assert(timeout != 0);
Buffer::Container::difference_type packetSize =
- static_cast<Buffer::Container::difference_type>(buf.b.end() - buf.i);
+ static_cast<Buffer::Container::difference_type>(buf.b.end() - buf.i);
#ifndef ICEE_USE_SELECT_OR_POLL_FOR_TIMEOUTS
if(timeout > 0 && timeout != _readTimeout)
{
- setTimeout(_fd, true, timeout);
+ setTimeout(_fd, true, timeout);
}
try
{
#endif
- while(buf.i != buf.b.end())
- {
- repeatRead:
- assert(_fd != INVALID_SOCKET);
- ssize_t ret = ::recv(_fd, reinterpret_cast<char*>(&*buf.i), packetSize, 0);
-
- if(ret == 0)
- {
- //
- // If the connection is lost when reading data, we shut
- // down the write end of the socket. This helps to unblock
- // threads that are stuck in send() or select() while
- // sending data. Note: I don't really understand why
- // send() or select() sometimes don't detect a connection
- // loss. Therefore this helper to make them detect it.
- //
- //assert(_fd != INVALID_SOCKET);
- //shutdownSocketReadWrite(_fd);
-
- ConnectionLostException ex(__FILE__, __LINE__);
- ex.error = 0;
- throw ex;
- }
-
- if(ret == SOCKET_ERROR)
- {
- if(interrupted())
- {
- goto repeatRead;
- }
-
- if(noBuffers() && packetSize > 1024)
- {
- packetSize /= 2;
- goto repeatRead;
- }
-
+ while(buf.i != buf.b.end())
+ {
+ repeatRead:
+ assert(_fd != INVALID_SOCKET);
+ ssize_t ret = ::recv(_fd, reinterpret_cast<char*>(&*buf.i), packetSize, 0);
+
+ if(ret == 0)
+ {
+ //
+ // If the connection is lost when reading data, we shut
+ // down the write end of the socket. This helps to unblock
+ // threads that are stuck in send() or select() while
+ // sending data. Note: I don't really understand why
+ // send() or select() sometimes don't detect a connection
+ // loss. Therefore this helper to make them detect it.
+ //
+ //assert(_fd != INVALID_SOCKET);
+ //shutdownSocketReadWrite(_fd);
+
+ ConnectionLostException ex(__FILE__, __LINE__);
+ ex.error = 0;
+ throw ex;
+ }
+
+ if(ret == SOCKET_ERROR)
+ {
+ if(interrupted())
+ {
+ goto repeatRead;
+ }
+
+ if(noBuffers() && packetSize > 1024)
+ {
+ packetSize /= 2;
+ goto repeatRead;
+ }
+
#ifndef ICEE_USE_SELECT_OR_POLL_FOR_TIMEOUTS
- if(timedout())
- {
- throw TimeoutException(__FILE__, __LINE__);
- }
+ if(timedout())
+ {
+ throw TimeoutException(__FILE__, __LINE__);
+ }
#else
- if(wouldBlock())
- {
- doSelect(true, timeout > 0 ? timeout : _readTimeout);
- continue;
- }
+ if(wouldBlock())
+ {
+ doSelect(true, timeout > 0 ? timeout : _readTimeout);
+ continue;
+ }
#endif
-
- if(connectionLost())
- {
- //
- // See the commment above about shutting down the
- // socket if the connection is lost while reading
- // data.
- //
- //assert(_fd != INVALID_SOCKET);
- //shutdownSocketReadWrite(_fd);
-
- ConnectionLostException ex(__FILE__, __LINE__);
- ex.error = getSocketErrno();
- throw ex;
- }
- else
- {
- SocketException ex(__FILE__, __LINE__);
- ex.error = getSocketErrno();
- throw ex;
- }
- }
-
- if(_traceLevels->network >= 3)
- {
- Trace out(_logger, _traceLevels->networkCat);
- out << Ice::printfToString("received %d of %d", ret, packetSize) << " bytes via tcp\n" << toString();
- }
-
- buf.i += ret;
-
- if(packetSize > buf.b.end() - buf.i)
- {
- packetSize = static_cast<Buffer::Container::difference_type>(buf.b.end() - buf.i);
- }
- }
+
+ if(connectionLost())
+ {
+ //
+ // See the commment above about shutting down the
+ // socket if the connection is lost while reading
+ // data.
+ //
+ //assert(_fd != INVALID_SOCKET);
+ //shutdownSocketReadWrite(_fd);
+
+ ConnectionLostException ex(__FILE__, __LINE__);
+ ex.error = getSocketErrno();
+ throw ex;
+ }
+ else
+ {
+ SocketException ex(__FILE__, __LINE__);
+ ex.error = getSocketErrno();
+ throw ex;
+ }
+ }
+
+ if(_traceLevels->network >= 3)
+ {
+ Trace out(_logger, _traceLevels->networkCat);
+ out << Ice::printfToString("received %d of %d", ret, packetSize) << " bytes via tcp\n" << toString();
+ }
+
+ buf.i += ret;
+
+ if(packetSize > buf.b.end() - buf.i)
+ {
+ packetSize = static_cast<Buffer::Container::difference_type>(buf.b.end() - buf.i);
+ }
+ }
#ifndef ICEE_USE_SELECT_OR_POLL_FOR_TIMEOUTS
}
catch(const Ice::LocalException&)
{
- if(timeout > 0 && timeout != _readTimeout)
- {
- try
- {
- setTimeout(_fd, true, _readTimeout);
- }
- catch(const Ice::LocalException&)
- {
- // IGNORE
- }
- }
- throw;
+ if(timeout > 0 && timeout != _readTimeout)
+ {
+ try
+ {
+ setTimeout(_fd, true, _readTimeout);
+ }
+ catch(const Ice::LocalException&)
+ {
+ // IGNORE
+ }
+ }
+ throw;
}
if(timeout > 0 && timeout != _readTimeout)
{
- try
- {
- setTimeout(_fd, true, _readTimeout);
- }
- catch(const Ice::LocalException&)
- {
- // IGNORE
- }
+ try
+ {
+ setTimeout(_fd, true, _readTimeout);
+ }
+ catch(const Ice::LocalException&)
+ {
+ // IGNORE
+ }
}
#endif
}
@@ -386,24 +386,24 @@ IceInternal::Transceiver::Transceiver(const InstancePtr& instance, SOCKET fd) :
_writeEvent = WSACreateEvent();
if(_event == 0 || _readEvent == 0 || _writeEvent == 0)
{
- int error = WSAGetLastError();
- if(_event != 0)
- {
- WSACloseEvent(_event);
- }
- if(_readEvent != 0)
- {
- WSACloseEvent(_readEvent);
- }
- if(_writeEvent != 0)
- {
- WSACloseEvent(_writeEvent);
- }
- closeSocket(_fd);
-
- SocketException ex(__FILE__, __LINE__);
- ex.error = error;
- throw ex;
+ int error = WSAGetLastError();
+ if(_event != 0)
+ {
+ WSACloseEvent(_event);
+ }
+ if(_readEvent != 0)
+ {
+ WSACloseEvent(_readEvent);
+ }
+ if(_writeEvent != 0)
+ {
+ WSACloseEvent(_writeEvent);
+ }
+ closeSocket(_fd);
+
+ SocketException ex(__FILE__, __LINE__);
+ ex.error = error;
+ throw ex;
}
//
@@ -411,16 +411,16 @@ IceInternal::Transceiver::Transceiver(const InstancePtr& instance, SOCKET fd) :
//
if(WSAEventSelect(_fd, _event, FD_READ|FD_WRITE|FD_CLOSE) == SOCKET_ERROR)
{
- int error = WSAGetLastError();
+ int error = WSAGetLastError();
- WSACloseEvent(_event);
- WSACloseEvent(_readEvent);
- WSACloseEvent(_writeEvent);
- closeSocket(_fd);
+ WSACloseEvent(_event);
+ WSACloseEvent(_readEvent);
+ WSACloseEvent(_writeEvent);
+ closeSocket(_fd);
- SocketException ex(__FILE__, __LINE__);
- ex.error = error;
- throw ex;
+ SocketException ex(__FILE__, __LINE__);
+ ex.error = error;
+ throw ex;
}
#else
FD_ZERO(&_wFdSet);
@@ -461,151 +461,151 @@ IceInternal::Transceiver::doSelect(bool read, int timeout)
while(true)
{
#ifdef _WIN32
- //
- // This code is basically the same as the code in
- // ::send above. Check that for detailed comments.
- //
- WSAEVENT events[2];
- events[0] = _event;
- events[1] = read ? _readEvent : _writeEvent;
- long tout = (timeout >= 0) ? timeout : WSA_INFINITE;
- DWORD rc = WSAWaitForMultipleEvents(2, events, FALSE, tout, FALSE);
- if(rc == WSA_WAIT_FAILED)
- {
- SocketException ex(__FILE__, __LINE__);
- ex.error = WSAGetLastError();
- throw ex;
- }
- if(rc == WSA_WAIT_TIMEOUT)
- {
- assert(timeout >= 0);
- throw TimeoutException(__FILE__, __LINE__);
- }
-
- if(rc == WSA_WAIT_EVENT_0)
- {
- WSANETWORKEVENTS nevents;
- if(WSAEnumNetworkEvents(_fd, _event, &nevents) == SOCKET_ERROR)
- {
- SocketException ex(__FILE__, __LINE__);
- ex.error = WSAGetLastError();
- throw ex;
- }
-
- //
- // If we're selecting for reading and have consumed a WRITE
- // event, set the _writeEvent event. Otherwise, if we're
- // selecting for writing have consumed a READ event, set the
- // _readEvent event.
- //
- if(read && nevents.lNetworkEvents & FD_WRITE)
- {
- WSASetEvent(_writeEvent);
- }
- else if(!read && nevents.lNetworkEvents & FD_READ)
- {
- WSASetEvent(_readEvent);
- }
-
-
- //
- // This checks for an error on the fd (this would
- // be same as recv itself returning an error). In
- // the event of an error we set the error code,
- // and repeat the error handling.
- //
- if(read && nevents.lNetworkEvents & FD_READ && nevents.iErrorCode[FD_READ_BIT] != 0)
- {
- WSASetLastError(nevents.iErrorCode[FD_READ_BIT]);
- }
- else if(!read && nevents.lNetworkEvents & FD_WRITE && nevents.iErrorCode[FD_WRITE_BIT] != 0)
- {
- WSASetLastError(nevents.iErrorCode[FD_WRITE_BIT]);
- }
- else if(nevents.lNetworkEvents & FD_CLOSE && nevents.iErrorCode[FD_CLOSE_BIT] != 0)
- {
- WSASetLastError(nevents.iErrorCode[FD_CLOSE_BIT]);
- }
- else
- {
- return; // No errors: we're done.
- }
-
- if(interrupted())
- {
- continue;
- }
-
- if(connectionLost())
- {
- //
- // See the commment above about shutting down the
- // socket if the connection is lost while reading
- // data.
- //
- //assert(_fd != INVALID_SOCKET);
- //shutdownSocketReadWrite(_fd);
-
- ConnectionLostException ex(__FILE__, __LINE__);
- ex.error = getSocketErrno();
- throw ex;
- }
- else
- {
- SocketException ex(__FILE__, __LINE__);
- ex.error = getSocketErrno();
- throw ex;
- }
- }
- else
- {
- //
- // Otherwise the _readEvent or _writeEvent is set, reset it.
- //
- if(read)
- {
- WSAResetEvent(_readEvent);
- }
- else
- {
- WSAResetEvent(_writeEvent);
- }
- return;
- }
+ //
+ // This code is basically the same as the code in
+ // ::send above. Check that for detailed comments.
+ //
+ WSAEVENT events[2];
+ events[0] = _event;
+ events[1] = read ? _readEvent : _writeEvent;
+ long tout = (timeout >= 0) ? timeout : WSA_INFINITE;
+ DWORD rc = WSAWaitForMultipleEvents(2, events, FALSE, tout, FALSE);
+ if(rc == WSA_WAIT_FAILED)
+ {
+ SocketException ex(__FILE__, __LINE__);
+ ex.error = WSAGetLastError();
+ throw ex;
+ }
+ if(rc == WSA_WAIT_TIMEOUT)
+ {
+ assert(timeout >= 0);
+ throw TimeoutException(__FILE__, __LINE__);
+ }
+
+ if(rc == WSA_WAIT_EVENT_0)
+ {
+ WSANETWORKEVENTS nevents;
+ if(WSAEnumNetworkEvents(_fd, _event, &nevents) == SOCKET_ERROR)
+ {
+ SocketException ex(__FILE__, __LINE__);
+ ex.error = WSAGetLastError();
+ throw ex;
+ }
+
+ //
+ // If we're selecting for reading and have consumed a WRITE
+ // event, set the _writeEvent event. Otherwise, if we're
+ // selecting for writing have consumed a READ event, set the
+ // _readEvent event.
+ //
+ if(read && nevents.lNetworkEvents & FD_WRITE)
+ {
+ WSASetEvent(_writeEvent);
+ }
+ else if(!read && nevents.lNetworkEvents & FD_READ)
+ {
+ WSASetEvent(_readEvent);
+ }
+
+
+ //
+ // This checks for an error on the fd (this would
+ // be same as recv itself returning an error). In
+ // the event of an error we set the error code,
+ // and repeat the error handling.
+ //
+ if(read && nevents.lNetworkEvents & FD_READ && nevents.iErrorCode[FD_READ_BIT] != 0)
+ {
+ WSASetLastError(nevents.iErrorCode[FD_READ_BIT]);
+ }
+ else if(!read && nevents.lNetworkEvents & FD_WRITE && nevents.iErrorCode[FD_WRITE_BIT] != 0)
+ {
+ WSASetLastError(nevents.iErrorCode[FD_WRITE_BIT]);
+ }
+ else if(nevents.lNetworkEvents & FD_CLOSE && nevents.iErrorCode[FD_CLOSE_BIT] != 0)
+ {
+ WSASetLastError(nevents.iErrorCode[FD_CLOSE_BIT]);
+ }
+ else
+ {
+ return; // No errors: we're done.
+ }
+
+ if(interrupted())
+ {
+ continue;
+ }
+
+ if(connectionLost())
+ {
+ //
+ // See the commment above about shutting down the
+ // socket if the connection is lost while reading
+ // data.
+ //
+ //assert(_fd != INVALID_SOCKET);
+ //shutdownSocketReadWrite(_fd);
+
+ ConnectionLostException ex(__FILE__, __LINE__);
+ ex.error = getSocketErrno();
+ throw ex;
+ }
+ else
+ {
+ SocketException ex(__FILE__, __LINE__);
+ ex.error = getSocketErrno();
+ throw ex;
+ }
+ }
+ else
+ {
+ //
+ // Otherwise the _readEvent or _writeEvent is set, reset it.
+ //
+ if(read)
+ {
+ WSAResetEvent(_readEvent);
+ }
+ else
+ {
+ WSAResetEvent(_writeEvent);
+ }
+ return;
+ }
#else
- int rs;
- assert(_fd != INVALID_SOCKET);
- if(read)
- {
- FD_SET(_fd, &_rFdSet);
- }
- else
- {
- FD_SET(_fd, &_wFdSet);
- }
-
+ int rs;
+ assert(_fd != INVALID_SOCKET);
+ if(read)
+ {
+ FD_SET(_fd, &_rFdSet);
+ }
+ else
+ {
+ FD_SET(_fd, &_wFdSet);
+ }
+
struct pollfd pollFd[1];
pollFd[0].fd = _fd;
pollFd[0].events = read ? POLLIN : POLLOUT;
rs = ::poll(pollFd, 1, timeout);
- if(rs == SOCKET_ERROR)
- {
- if(interrupted())
- {
- continue;
- }
-
- SocketException ex(__FILE__, __LINE__);
- ex.error = getSocketErrno();
- throw ex;
- }
-
- if(rs == 0)
- {
- throw TimeoutException(__FILE__, __LINE__);
- }
-
- return;
+ if(rs == SOCKET_ERROR)
+ {
+ if(interrupted())
+ {
+ continue;
+ }
+
+ SocketException ex(__FILE__, __LINE__);
+ ex.error = getSocketErrno();
+ throw ex;
+ }
+
+ if(rs == 0)
+ {
+ throw TimeoutException(__FILE__, __LINE__);
+ }
+
+ return;
#endif
}
}
diff --git a/cppe/test/Common/TestCommon.cpp b/cppe/test/Common/TestCommon.cpp
index c3988919070..1986f42b3d6 100644
--- a/cppe/test/Common/TestCommon.cpp
+++ b/cppe/test/Common/TestCommon.cpp
@@ -29,53 +29,53 @@ public:
virtual void
print(const string& message)
{
- IceUtil::StaticMutex::Lock sync(globalMutex);
- tprintf("%s\n", message.c_str());
+ IceUtil::StaticMutex::Lock sync(globalMutex);
+ tprintf("%s\n", message.c_str());
}
virtual void
trace(const string& category, const string& message)
{
- IceUtil::StaticMutex::Lock sync(globalMutex);
- string s = "[ ";
- {
- char buf[1024];
+ IceUtil::StaticMutex::Lock sync(globalMutex);
+ string s = "[ ";
+ {
+ char buf[1024];
#ifdef _WIN32
- sprintf(buf, "%ld", GetTickCount());
+ sprintf(buf, "%ld", GetTickCount());
#else
- sprintf(buf, "%lu", (long)IceUtil::Time::now().toMilliSeconds());
+ sprintf(buf, "%lu", (long)IceUtil::Time::now().toMilliSeconds());
#endif
- s += buf;
- }
- s += ' ';
-
- if(!category.empty())
- {
- s += category + ": ";
- }
- s += message + " ]";
-
- string::size_type idx = 0;
- while((idx = s.find("\n", idx)) != string::npos)
- {
- s.insert(idx + 1, " ");
- ++idx;
- }
- tprintf("%s\n", s.c_str());
+ s += buf;
+ }
+ s += ' ';
+
+ if(!category.empty())
+ {
+ s += category + ": ";
+ }
+ s += message + " ]";
+
+ string::size_type idx = 0;
+ while((idx = s.find("\n", idx)) != string::npos)
+ {
+ s.insert(idx + 1, " ");
+ ++idx;
+ }
+ tprintf("%s\n", s.c_str());
}
virtual void
warning(const string& message)
{
- IceUtil::StaticMutex::Lock sync(globalMutex);
- tprintf("warning: %s\n", message.c_str());
+ IceUtil::StaticMutex::Lock sync(globalMutex);
+ tprintf("warning: %s\n", message.c_str());
}
virtual void
error(const string& message)
{
- IceUtil::StaticMutex::Lock sync(globalMutex);
- tprintf("error: %s\n", message.c_str());
+ IceUtil::StaticMutex::Lock sync(globalMutex);
+ tprintf("error: %s\n", message.c_str());
}
};
@@ -86,7 +86,7 @@ static bool appTerminated= false;
const TCHAR windowClassName[] = L"Test Driver";
-#define IDC_MAIN_EDIT 101
+#define IDC_MAIN_EDIT 101
class TestSuiteFailed
{
@@ -110,9 +110,9 @@ tprintf(const char* fmt, ...)
if(_tprintfp)
{
- fwrite(buf, strlen(buf), 1, _tprintfp);
- fflush(_tprintfp);
- return;
+ fwrite(buf, strlen(buf), 1, _tprintfp);
+ fflush(_tprintfp);
+ return;
}
char* start = buf;
@@ -120,49 +120,49 @@ tprintf(const char* fmt, ...)
char* curr = start;
while(curr < end)
{
- bool nl = false;
- while(curr < end && *curr != '\n')
- {
- // Not designed to handle \r
- assert(*curr != '\r');
- ++curr;
- }
- if(*curr == '\n')
- {
- nl = true;
- }
- *curr = '\0';
- static TCHAR nlStr[] = L"\r\n";
-
- //
- // If the thread is not the main thread we have to post a message
- // to the main thread to do the EM_REPLACESEL. Calling SendMessage
- // from a thread other than main is not permitted.
- //
- if(IceUtil::ThreadControl() != mainThread)
- {
- wchar_t* wtext = new wchar_t[sizeof(wchar_t) * (curr - start)+1];
- mbstowcs(wtext, start, (curr - start) + 1);
- ::PostMessage(mainWnd, WM_USER, (WPARAM)FALSE, (LPARAM)wtext);
- if(nl)
- {
- wchar_t* wtext = new wchar_t[sizeof(nlStr)];
- wcscpy(wtext, nlStr);
- ::PostMessage(mainWnd, WM_USER, (WPARAM)FALSE, (LPARAM)wtext);
- }
- }
- else
- {
- TCHAR wtext[1024];
- mbstowcs(wtext, start, (curr - start) + 1);
- ::SendMessage(hEdit, EM_REPLACESEL, (WPARAM)FALSE, (LPARAM)wtext);
- if(nl)
- {
- ::SendMessage(hEdit, EM_REPLACESEL, (WPARAM)FALSE, (LPARAM)nlStr);
- }
- }
- ++curr;
- start = curr;
+ bool nl = false;
+ while(curr < end && *curr != '\n')
+ {
+ // Not designed to handle \r
+ assert(*curr != '\r');
+ ++curr;
+ }
+ if(*curr == '\n')
+ {
+ nl = true;
+ }
+ *curr = '\0';
+ static TCHAR nlStr[] = L"\r\n";
+
+ //
+ // If the thread is not the main thread we have to post a message
+ // to the main thread to do the EM_REPLACESEL. Calling SendMessage
+ // from a thread other than main is not permitted.
+ //
+ if(IceUtil::ThreadControl() != mainThread)
+ {
+ wchar_t* wtext = new wchar_t[sizeof(wchar_t) * (curr - start)+1];
+ mbstowcs(wtext, start, (curr - start) + 1);
+ ::PostMessage(mainWnd, WM_USER, (WPARAM)FALSE, (LPARAM)wtext);
+ if(nl)
+ {
+ wchar_t* wtext = new wchar_t[sizeof(nlStr)];
+ wcscpy(wtext, nlStr);
+ ::PostMessage(mainWnd, WM_USER, (WPARAM)FALSE, (LPARAM)wtext);
+ }
+ }
+ else
+ {
+ TCHAR wtext[1024];
+ mbstowcs(wtext, start, (curr - start) + 1);
+ ::SendMessage(hEdit, EM_REPLACESEL, (WPARAM)FALSE, (LPARAM)wtext);
+ if(nl)
+ {
+ ::SendMessage(hEdit, EM_REPLACESEL, (WPARAM)FALSE, (LPARAM)nlStr);
+ }
+ }
+ ++curr;
+ start = curr;
}
//
@@ -170,12 +170,12 @@ tprintf(const char* fmt, ...)
//
if(IceUtil::ThreadControl() == mainThread)
{
- MSG Msg;
- while(PeekMessage(&Msg, NULL, 0, 0, PM_REMOVE))
- {
- TranslateMessage(&Msg);
- DispatchMessage(&Msg);
- }
+ MSG Msg;
+ while(PeekMessage(&Msg, NULL, 0, 0, PM_REMOVE))
+ {
+ TranslateMessage(&Msg);
+ DispatchMessage(&Msg);
+ }
}
}
@@ -186,50 +186,50 @@ WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
case WM_USER:
{
- // tprint from a thread other than main. lParam holds a pointer to the text.
- ::SendMessage(hEdit, EM_REPLACESEL, (WPARAM)wParam, (LPARAM)lParam);
- wchar_t* text = (wchar_t*)lParam;
- delete[] text;
+ // tprint from a thread other than main. lParam holds a pointer to the text.
+ ::SendMessage(hEdit, EM_REPLACESEL, (WPARAM)wParam, (LPARAM)lParam);
+ wchar_t* text = (wchar_t*)lParam;
+ delete[] text;
}
break;
case WM_CREATE:
{
- RECT rcClient;
- GetClientRect(hWnd, &rcClient);
- hEdit = CreateWindowEx(WS_EX_CLIENTEDGE, L"EDIT", L"",
- WS_CHILD | WS_VISIBLE | WS_VSCROLL | ES_MULTILINE,
- 0, 0, rcClient.right - rcClient.left, rcClient.bottom - rcClient.top,
- hWnd, (HMENU)IDC_MAIN_EDIT, GetModuleHandle(NULL), NULL);
- assert(hEdit != NULL);
+ RECT rcClient;
+ GetClientRect(hWnd, &rcClient);
+ hEdit = CreateWindowEx(WS_EX_CLIENTEDGE, L"EDIT", L"",
+ WS_CHILD | WS_VISIBLE | WS_VSCROLL | ES_MULTILINE,
+ 0, 0, rcClient.right - rcClient.left, rcClient.bottom - rcClient.top,
+ hWnd, (HMENU)IDC_MAIN_EDIT, GetModuleHandle(NULL), NULL);
+ assert(hEdit != NULL);
}
break;
case WM_SIZE:
{
- RECT rcClient;
- GetClientRect(hWnd, &rcClient);
- SetWindowPos(hEdit, NULL, 0, 0, rcClient.right, rcClient.bottom, SWP_NOZORDER);
+ RECT rcClient;
+ GetClientRect(hWnd, &rcClient);
+ SetWindowPos(hEdit, NULL, 0, 0, rcClient.right, rcClient.bottom, SWP_NOZORDER);
}
break;
case WM_CLOSE:
{
- DestroyWindow(hWnd);
- break;
+ DestroyWindow(hWnd);
+ break;
}
case WM_QUIT:
case WM_DESTROY:
{
- PostQuitMessage(0);
- IceUtil::StaticMutex::Lock sync(terminatedMutex);
- appTerminated = true;
- break;
+ PostQuitMessage(0);
+ IceUtil::StaticMutex::Lock sync(terminatedMutex);
+ appTerminated = true;
+ break;
}
default:
- return DefWindowProc(hWnd, msg, wParam, lParam);
+ return DefWindowProc(hWnd, msg, wParam, lParam);
}
return 0;
}
@@ -239,33 +239,33 @@ TestApplication::main(HINSTANCE hInstance)
{
WNDCLASS wc;
- wc.style = CS_HREDRAW|CS_VREDRAW;
- wc.lpfnWndProc = (WNDPROC)WndProc;
- wc.cbClsExtra = 0;
- wc.cbWndExtra = 0;
- wc.hInstance = hInstance;
- wc.hIcon = LoadIcon(NULL, 0);
- wc.hCursor = 0;
- wc.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH);
+ wc.style = CS_HREDRAW|CS_VREDRAW;
+ wc.lpfnWndProc = (WNDPROC)WndProc;
+ wc.cbClsExtra = 0;
+ wc.cbWndExtra = 0;
+ wc.hInstance = hInstance;
+ wc.hIcon = LoadIcon(NULL, 0);
+ wc.hCursor = 0;
+ wc.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH);
wc.lpszMenuName = NULL;
wc.lpszClassName = windowClassName;
if(!RegisterClass(&wc))
{
- MessageBox(NULL, L"Window Registration Failed!", L"Error!", MB_ICONEXCLAMATION | MB_OK);
- return 0;
+ MessageBox(NULL, L"Window Registration Failed!", L"Error!", MB_ICONEXCLAMATION | MB_OK);
+ return 0;
}
wchar_t wName[1024] = L"Test";
if(_name.size() > 0)
{
- int len = _name.size();
- if(len > 1023)
- {
- len = 1023;
- }
+ int len = _name.size();
+ if(len > 1023)
+ {
+ len = 1023;
+ }
mbstowcs(wName, _name.c_str(), len);
- wName[len] = L'\0';
+ wName[len] = L'\0';
}
RECT rect;
@@ -273,20 +273,20 @@ TestApplication::main(HINSTANCE hInstance)
int width = rect.right - rect.left;
if(width > 320)
{
- width = 320;
+ width = 320;
}
int height = rect.bottom - rect.top;
if(height > 200)
{
- height = 200;
+ height = 200;
}
mainWnd = CreateWindow(windowClassName, wName, WS_VISIBLE|WS_OVERLAPPED|WS_SYSMENU|WS_SIZEBOX,
- CW_USEDEFAULT, CW_USEDEFAULT, width, height,
- NULL, NULL, hInstance, NULL);
+ CW_USEDEFAULT, CW_USEDEFAULT, width, height,
+ NULL, NULL, hInstance, NULL);
if(mainWnd == NULL)
{
- MessageBox(NULL, L"Window Creation Failed!", L"Error!", MB_ICONEXCLAMATION | MB_OK);
- return 0;
+ MessageBox(NULL, L"Window Creation Failed!", L"Error!", MB_ICONEXCLAMATION | MB_OK);
+ return 0;
}
ShowWindow(mainWnd, SW_SHOW);
@@ -295,59 +295,59 @@ TestApplication::main(HINSTANCE hInstance)
try
{
- extern int __argc;
- extern char **__argv;
- status = run(__argc, __argv);
+ extern int __argc;
+ extern char **__argv;
+ status = run(__argc, __argv);
}
catch(const TestSuiteFailed&)
{
- tprintf("test failed\n");
+ tprintf("test failed\n");
}
catch(const Exception& ex)
{
- tprintf("%s\n", ex.toString().c_str());
- status = EXIT_FAILURE;
+ tprintf("%s\n", ex.toString().c_str());
+ status = EXIT_FAILURE;
}
catch(const std::exception& ex)
{
- tprintf("std::exception: %s\n", ex.what());
- status = EXIT_FAILURE;
+ tprintf("std::exception: %s\n", ex.what());
+ status = EXIT_FAILURE;
}
catch(const string& msg)
{
- tprintf("std::string: %s\n", msg.c_str());
- status = EXIT_FAILURE;
+ tprintf("std::string: %s\n", msg.c_str());
+ status = EXIT_FAILURE;
}
catch(const char* msg)
{
- tprintf("const char*: %s\n", msg);
- status = EXIT_FAILURE;
+ tprintf("const char*: %s\n", msg);
+ status = EXIT_FAILURE;
}
catch(...)
{
- tprintf("unknown exception\n");
- status = EXIT_FAILURE;
+ tprintf("unknown exception\n");
+ status = EXIT_FAILURE;
}
MSG Msg;
while(GetMessage(&Msg, NULL, 0, 0) > 0)
{
- TranslateMessage(&Msg);
- DispatchMessage(&Msg);
+ TranslateMessage(&Msg);
+ DispatchMessage(&Msg);
}
if(_communicator)
{
- try
- {
- _communicator->destroy();
- }
- catch(const Exception& ex)
- {
- tprintf("communicator::destroy() failed: %s\n", ex.toString().c_str());
- status = EXIT_FAILURE;
- }
- _communicator = 0;
+ try
+ {
+ _communicator->destroy();
+ }
+ catch(const Exception& ex)
+ {
+ tprintf("communicator::destroy() failed: %s\n", ex.toString().c_str());
+ status = EXIT_FAILURE;
+ }
+ _communicator = 0;
}
return status;
@@ -366,18 +366,18 @@ TestApplication::loadConfig(const PropertiesPtr& properties)
HANDLE h = FindFirstFile(L"config", &data);
if(h == INVALID_HANDLE_VALUE)
{
- config = "config.txt";
- HANDLE h = FindFirstFile(L"config.txt", &data);
- if(h == INVALID_HANDLE_VALUE)
- {
- return;
- }
+ config = "config.txt";
+ HANDLE h = FindFirstFile(L"config.txt", &data);
+ if(h == INVALID_HANDLE_VALUE)
+ {
+ return;
+ }
}
FindClose(h);
try
{
- properties->load(config);
+ properties->load(config);
}
catch(const FileException&)
{
@@ -407,45 +407,45 @@ TestApplication::main(int ac, char* av[])
int status;
try
{
- status = run(ac, av);
+ status = run(ac, av);
}
catch(const Exception& ex)
{
- tprintf("%s\n", ex.toString().c_str());
- status = EXIT_FAILURE;
+ tprintf("%s\n", ex.toString().c_str());
+ status = EXIT_FAILURE;
}
catch(const std::exception& ex)
{
- tprintf("std::exception: %s\n", ex.what());
- status = EXIT_FAILURE;
+ tprintf("std::exception: %s\n", ex.what());
+ status = EXIT_FAILURE;
}
catch(const string& msg)
{
- tprintf("std::string: %s\n", msg.c_str());
- status = EXIT_FAILURE;
+ tprintf("std::string: %s\n", msg.c_str());
+ status = EXIT_FAILURE;
}
catch(const char* msg)
{
- tprintf("const char*: %s\n", msg);
- status = EXIT_FAILURE;
+ tprintf("const char*: %s\n", msg);
+ status = EXIT_FAILURE;
}
catch(...)
{
- tprintf("unknown exception\n");
- status = EXIT_FAILURE;
+ tprintf("unknown exception\n");
+ status = EXIT_FAILURE;
}
if(_communicator)
{
- try
- {
- _communicator->destroy();
- }
- catch(const Exception& ex)
- {
- tprintf("communicator::destroy() failed: %s\n", ex.toString().c_str());
- status = EXIT_FAILURE;
- }
- _communicator = 0;
+ try
+ {
+ _communicator->destroy();
+ }
+ catch(const Exception& ex)
+ {
+ tprintf("communicator::destroy() failed: %s\n", ex.toString().c_str());
+ status = EXIT_FAILURE;
+ }
+ _communicator = 0;
}
return status;
@@ -456,17 +456,17 @@ TestApplication::loadConfig(const PropertiesPtr& properties)
{
try
{
- properties->load("config");
+ properties->load("config");
}
catch(const FileException&)
{
- try
- {
- properties->load("config.txt");
- }
- catch(const FileException&)
- {
- }
+ try
+ {
+ properties->load("config.txt");
+ }
+ catch(const FileException&)
+ {
+ }
}
}
@@ -490,7 +490,7 @@ TestApplication::setCommunicator(const CommunicatorPtr& communicator)
#ifdef _WIN32_WCE
if(communicator->getProperties()->getPropertyWithDefault("LogToFile", "0") != "0")
{
- _tprintfp = fopen(("log-" + _name + ".txt").c_str(), "w");
+ _tprintfp = fopen(("log-" + _name + ".txt").c_str(), "w");
}
#endif
diff --git a/cppe/test/IceE/adapterDeactivation/AllTests.cpp b/cppe/test/IceE/adapterDeactivation/AllTests.cpp
index 6a79adc8808..757d6a8b4f9 100644
--- a/cppe/test/IceE/adapterDeactivation/AllTests.cpp
+++ b/cppe/test/IceE/adapterDeactivation/AllTests.cpp
@@ -37,7 +37,7 @@ allTests(const CommunicatorPtr& communicator)
try
{
communicator->createObjectAdapterWithEndpoints("TransientTestAdapter", "default -p 9998");
- test(false);
+ test(false);
}
catch(const AlreadyRegisteredException&)
{
@@ -59,12 +59,12 @@ allTests(const CommunicatorPtr& communicator)
printf("testing whether server is gone...");
try
{
- obj->ice_ping();
- test(false);
+ obj->ice_ping();
+ test(false);
}
catch(const LocalException&)
{
- printf("ok\n");
+ printf("ok\n");
}
return obj;
diff --git a/cppe/test/IceE/adapterDeactivation/Client.cpp b/cppe/test/IceE/adapterDeactivation/Client.cpp
index 26ac34eb9ea..d9fe3d3a7bd 100644
--- a/cppe/test/IceE/adapterDeactivation/Client.cpp
+++ b/cppe/test/IceE/adapterDeactivation/Client.cpp
@@ -27,10 +27,10 @@ public:
virtual int
run(int argc, char* argv[])
{
- Ice::InitializationData initData;
+ Ice::InitializationData initData;
initData.properties = Ice::createProperties();
- loadConfig(initData.properties);
- initData.logger = getLogger();
+ loadConfig(initData.properties);
+ initData.logger = getLogger();
setCommunicator(Ice::initialize(argc, argv, initData));
TestIntfPrx allTests(const CommunicatorPtr&);
diff --git a/cppe/test/IceE/adapterDeactivation/Collocated.cpp b/cppe/test/IceE/adapterDeactivation/Collocated.cpp
index 4f250056786..3d7ea8af838 100644
--- a/cppe/test/IceE/adapterDeactivation/Collocated.cpp
+++ b/cppe/test/IceE/adapterDeactivation/Collocated.cpp
@@ -29,10 +29,10 @@ public:
{
Ice::InitializationData initData;
initData.properties = Ice::createProperties();
- initData.properties->setProperty("TestAdapter.Endpoints", "default -p 12010 -t 10000");
+ initData.properties->setProperty("TestAdapter.Endpoints", "default -p 12010 -t 10000");
loadConfig(initData.properties);
- initData.logger = getLogger();
+ initData.logger = getLogger();
setCommunicator(Ice::initialize(argc, argv, initData));
Ice::ObjectAdapterPtr adapter = communicator()->createObjectAdapter("TestAdapter");
diff --git a/cppe/test/IceE/adapterDeactivation/Server.cpp b/cppe/test/IceE/adapterDeactivation/Server.cpp
index 1d9966a9584..e5157db546e 100644
--- a/cppe/test/IceE/adapterDeactivation/Server.cpp
+++ b/cppe/test/IceE/adapterDeactivation/Server.cpp
@@ -32,7 +32,7 @@ public:
initData.properties->setProperty("TestAdapter.Endpoints", "default -p 12010 -t 10000");
loadConfig(initData.properties);
- initData.logger = getLogger();
+ initData.logger = getLogger();
setCommunicator(Ice::initialize(argc, argv, initData));
Ice::ObjectAdapterPtr adapter = communicator()->createObjectAdapter("TestAdapter");
diff --git a/cppe/test/IceE/adapterDeactivation/TestI.cpp b/cppe/test/IceE/adapterDeactivation/TestI.cpp
index e75be7a8bb2..31b08d7ba6f 100644
--- a/cppe/test/IceE/adapterDeactivation/TestI.cpp
+++ b/cppe/test/IceE/adapterDeactivation/TestI.cpp
@@ -19,7 +19,7 @@ TestI::transient(const Current& current)
CommunicatorPtr communicator = current.adapter->getCommunicator();
ObjectAdapterPtr adapter =
- communicator->createObjectAdapterWithEndpoints("TransientTestAdapter", "default -p 9999");
+ communicator->createObjectAdapterWithEndpoints("TransientTestAdapter", "default -p 9999");
adapter->activate();
adapter->deactivate();
adapter->waitForDeactivate();
diff --git a/cppe/test/IceE/custom/AllTests.cpp b/cppe/test/IceE/custom/AllTests.cpp
index 813749e7c8e..24394e1b86d 100644
--- a/cppe/test/IceE/custom/AllTests.cpp
+++ b/cppe/test/IceE/custom/AllTests.cpp
@@ -20,7 +20,7 @@ allTests(const Ice::CommunicatorPtr& communicator)
{
tprintf("testing stringToProxy... ");
string ref = communicator->getProperties()->getPropertyWithDefault(
- "Custom.Proxy", "test:default -p 12010 -t 10000");
+ "Custom.Proxy", "test:default -p 12010 -t 10000");
Ice::ObjectPrx base = communicator->stringToProxy(ref);
test(base);
tprintf("ok\n");
@@ -35,428 +35,428 @@ allTests(const Ice::CommunicatorPtr& communicator)
{
Test::BoolSeq in(5);
- in[0] = false;
- in[1] = true;
- in[2] = true;
- in[3] = false;
- in[4] = true;
- bool inArray[5];
- for(int i = 0; i < 5; ++i)
- {
- inArray[i] = in[i];
- }
- pair<const bool*, const bool*> inPair(inArray, inArray + 5);
-
- Test::BoolSeq out;
- Test::BoolSeq ret = t->opBoolArray(inPair, out);
- test(out == in);
- test(ret == in);
+ in[0] = false;
+ in[1] = true;
+ in[2] = true;
+ in[3] = false;
+ in[4] = true;
+ bool inArray[5];
+ for(int i = 0; i < 5; ++i)
+ {
+ inArray[i] = in[i];
+ }
+ pair<const bool*, const bool*> inPair(inArray, inArray + 5);
+
+ Test::BoolSeq out;
+ Test::BoolSeq ret = t->opBoolArray(inPair, out);
+ test(out == in);
+ test(ret == in);
}
{
Test::ByteList in;
- Ice::Byte inArray[5];
- inArray[0] = '1';
- in.push_back(inArray[0]);
- inArray[1] = '2';
- in.push_back(inArray[1]);
- inArray[2] = '3';
- in.push_back(inArray[2]);
- inArray[3] = '4';
- in.push_back(inArray[3]);
- inArray[4] = '5';
- in.push_back(inArray[4]);
- pair<const Ice::Byte*, const Ice::Byte*> inPair(inArray, inArray + 5);
-
- Test::ByteList out;
- Test::ByteList ret = t->opByteArray(inPair, out);
- test(out == in);
- test(ret == in);
+ Ice::Byte inArray[5];
+ inArray[0] = '1';
+ in.push_back(inArray[0]);
+ inArray[1] = '2';
+ in.push_back(inArray[1]);
+ inArray[2] = '3';
+ in.push_back(inArray[2]);
+ inArray[3] = '4';
+ in.push_back(inArray[3]);
+ inArray[4] = '5';
+ in.push_back(inArray[4]);
+ pair<const Ice::Byte*, const Ice::Byte*> inPair(inArray, inArray + 5);
+
+ Test::ByteList out;
+ Test::ByteList ret = t->opByteArray(inPair, out);
+ test(out == in);
+ test(ret == in);
}
{
Test::VariableList in;
- Test::Variable inArray[5];
- inArray[0].s = "These";
- in.push_back(inArray[0]);
- inArray[1].s = "are";
- in.push_back(inArray[1]);
- inArray[2].s = "five";
- in.push_back(inArray[2]);
- inArray[3].s = "short";
- in.push_back(inArray[3]);
- inArray[4].s = "strings.";
- in.push_back(inArray[4]);
- pair<const Test::Variable*, const Test::Variable*> inPair(inArray, inArray + 5);
-
- Test::VariableList out;
- Test::VariableList ret = t->opVariableArray(inPair, out);
- test(out == in);
- test(ret == in);
+ Test::Variable inArray[5];
+ inArray[0].s = "These";
+ in.push_back(inArray[0]);
+ inArray[1].s = "are";
+ in.push_back(inArray[1]);
+ inArray[2].s = "five";
+ in.push_back(inArray[2]);
+ inArray[3].s = "short";
+ in.push_back(inArray[3]);
+ inArray[4].s = "strings.";
+ in.push_back(inArray[4]);
+ pair<const Test::Variable*, const Test::Variable*> inPair(inArray, inArray + 5);
+
+ Test::VariableList out;
+ Test::VariableList ret = t->opVariableArray(inPair, out);
+ test(out == in);
+ test(ret == in);
}
{
Test::BoolSeq in(5);
- in[0] = false;
- in[1] = true;
- in[2] = true;
- in[3] = false;
- in[4] = true;
- pair<Test::BoolSeq::const_iterator, Test::BoolSeq::const_iterator> inPair(in.begin(), in.end());
-
- Test::BoolSeq out;
- Test::BoolSeq ret = t->opBoolRange(inPair, out);
- test(out == in);
- test(ret == in);
+ in[0] = false;
+ in[1] = true;
+ in[2] = true;
+ in[3] = false;
+ in[4] = true;
+ pair<Test::BoolSeq::const_iterator, Test::BoolSeq::const_iterator> inPair(in.begin(), in.end());
+
+ Test::BoolSeq out;
+ Test::BoolSeq ret = t->opBoolRange(inPair, out);
+ test(out == in);
+ test(ret == in);
}
{
Test::ByteList in;
- in.push_back('1');
- in.push_back('2');
- in.push_back('3');
- in.push_back('4');
- in.push_back('5');
- pair<Test::ByteList::const_iterator, Test::ByteList::const_iterator> inPair(in.begin(), in.end());
-
- Test::ByteList out;
- Test::ByteList ret = t->opByteRange(inPair, out);
- test(out == in);
- test(ret == in);
+ in.push_back('1');
+ in.push_back('2');
+ in.push_back('3');
+ in.push_back('4');
+ in.push_back('5');
+ pair<Test::ByteList::const_iterator, Test::ByteList::const_iterator> inPair(in.begin(), in.end());
+
+ Test::ByteList out;
+ Test::ByteList ret = t->opByteRange(inPair, out);
+ test(out == in);
+ test(ret == in);
}
{
Test::VariableList in;
- Test::Variable v;
- v.s = "These";
- in.push_back(v);
- v.s = "are";
- in.push_back(v);
- v.s = "five";
- in.push_back(v);
- v.s = "short";
- in.push_back(v);
- v.s = "strings.";
- in.push_back(v);
- pair<Test::VariableList::const_iterator, Test::VariableList::const_iterator> inPair(in.begin(), in.end());
-
- Test::VariableList out;
- Test::VariableList ret = t->opVariableRange(inPair, out);
- test(out == in);
- test(ret == in);
+ Test::Variable v;
+ v.s = "These";
+ in.push_back(v);
+ v.s = "are";
+ in.push_back(v);
+ v.s = "five";
+ in.push_back(v);
+ v.s = "short";
+ in.push_back(v);
+ v.s = "strings.";
+ in.push_back(v);
+ pair<Test::VariableList::const_iterator, Test::VariableList::const_iterator> inPair(in.begin(), in.end());
+
+ Test::VariableList out;
+ Test::VariableList ret = t->opVariableRange(inPair, out);
+ test(out == in);
+ test(ret == in);
}
{
Test::BoolSeq in(5);
- in[0] = false;
- in[1] = true;
- in[2] = true;
- in[3] = false;
- in[4] = true;
- bool inArray[5];
- for(int i = 0; i < 5; ++i)
- {
- inArray[i] = in[i];
- }
- pair<const bool*, const bool*> inPair(inArray, inArray + 5);
-
- Test::BoolSeq out;
- Test::BoolSeq ret = t->opBoolRangeType(inPair, out);
- test(out == in);
- test(ret == in);
+ in[0] = false;
+ in[1] = true;
+ in[2] = true;
+ in[3] = false;
+ in[4] = true;
+ bool inArray[5];
+ for(int i = 0; i < 5; ++i)
+ {
+ inArray[i] = in[i];
+ }
+ pair<const bool*, const bool*> inPair(inArray, inArray + 5);
+
+ Test::BoolSeq out;
+ Test::BoolSeq ret = t->opBoolRangeType(inPair, out);
+ test(out == in);
+ test(ret == in);
}
{
Test::ByteList in;
- in.push_back('1');
- in.push_back('2');
- in.push_back('3');
- in.push_back('4');
- in.push_back('5');
- pair<Test::ByteList::const_iterator, Test::ByteList::const_iterator> inPair(in.begin(), in.end());
-
- Test::ByteList out;
- Test::ByteList ret = t->opByteRangeType(inPair, out);
- test(out == in);
- test(ret == in);
+ in.push_back('1');
+ in.push_back('2');
+ in.push_back('3');
+ in.push_back('4');
+ in.push_back('5');
+ pair<Test::ByteList::const_iterator, Test::ByteList::const_iterator> inPair(in.begin(), in.end());
+
+ Test::ByteList out;
+ Test::ByteList ret = t->opByteRangeType(inPair, out);
+ test(out == in);
+ test(ret == in);
}
{
Test::VariableList in;
- deque<Test::Variable> inSeq;
- Test::Variable v;
- v.s = "These";
- in.push_back(v);
- inSeq.push_back(v);
- v.s = "are";
- in.push_back(v);
- inSeq.push_back(v);
- v.s = "five";
- in.push_back(v);
- inSeq.push_back(v);
- v.s = "short";
- in.push_back(v);
- inSeq.push_back(v);
- v.s = "strings.";
- in.push_back(v);
- inSeq.push_back(v);
- pair<deque<Test::Variable>::const_iterator, deque<Test::Variable>::const_iterator>
- inPair(inSeq.begin(), inSeq.end());
-
- Test::VariableList out;
- Test::VariableList ret = t->opVariableRangeType(inPair, out);
- test(out == in);
- test(ret == in);
+ deque<Test::Variable> inSeq;
+ Test::Variable v;
+ v.s = "These";
+ in.push_back(v);
+ inSeq.push_back(v);
+ v.s = "are";
+ in.push_back(v);
+ inSeq.push_back(v);
+ v.s = "five";
+ in.push_back(v);
+ inSeq.push_back(v);
+ v.s = "short";
+ in.push_back(v);
+ inSeq.push_back(v);
+ v.s = "strings.";
+ in.push_back(v);
+ inSeq.push_back(v);
+ pair<deque<Test::Variable>::const_iterator, deque<Test::Variable>::const_iterator>
+ inPair(inSeq.begin(), inSeq.end());
+
+ Test::VariableList out;
+ Test::VariableList ret = t->opVariableRangeType(inPair, out);
+ test(out == in);
+ test(ret == in);
}
{
deque<bool> in(5);
- in[0] = false;
- in[1] = true;
- in[2] = true;
- in[3] = false;
- in[4] = true;
-
- deque<bool> out;
- deque<bool> ret = t->opBoolSeq(in, out);
- test(out == in);
- test(ret == in);
+ in[0] = false;
+ in[1] = true;
+ in[2] = true;
+ in[3] = false;
+ in[4] = true;
+
+ deque<bool> out;
+ deque<bool> ret = t->opBoolSeq(in, out);
+ test(out == in);
+ test(ret == in);
}
{
list<bool> in;
- in.push_back(false);
- in.push_back(true);
- in.push_back(true);
- in.push_back(false);
- in.push_back(true);
-
- list<bool> out;
- list<bool> ret = t->opBoolList(in, out);
- test(out == in);
- test(ret == in);
+ in.push_back(false);
+ in.push_back(true);
+ in.push_back(true);
+ in.push_back(false);
+ in.push_back(true);
+
+ list<bool> out;
+ list<bool> ret = t->opBoolList(in, out);
+ test(out == in);
+ test(ret == in);
}
{
deque< ::Ice::Byte> in(5);
- in[0] = '1';
- in[1] = '2';
- in[2] = '3';
- in[3] = '4';
- in[4] = '5';
-
- deque< ::Ice::Byte> out;
- deque< ::Ice::Byte> ret = t->opByteSeq(in, out);
- test(out == in);
- test(ret == in);
+ in[0] = '1';
+ in[1] = '2';
+ in[2] = '3';
+ in[3] = '4';
+ in[4] = '5';
+
+ deque< ::Ice::Byte> out;
+ deque< ::Ice::Byte> ret = t->opByteSeq(in, out);
+ test(out == in);
+ test(ret == in);
}
{
list< ::Ice::Byte> in;
- in.push_back('1');
- in.push_back('2');
- in.push_back('3');
- in.push_back('4');
- in.push_back('5');
-
- list< ::Ice::Byte> out;
- list< ::Ice::Byte> ret = t->opByteList(in, out);
- test(out == in);
- test(ret == in);
+ in.push_back('1');
+ in.push_back('2');
+ in.push_back('3');
+ in.push_back('4');
+ in.push_back('5');
+
+ list< ::Ice::Byte> out;
+ list< ::Ice::Byte> ret = t->opByteList(in, out);
+ test(out == in);
+ test(ret == in);
}
{
MyByteSeq in(5);
- int i = 0;
- for(MyByteSeq::iterator p = in.begin(); p != in.end(); ++p)
- {
- *p = '1' + i++;
- }
-
- MyByteSeq out;
- MyByteSeq ret = t->opMyByteSeq(in, out);
- test(out == in);
- test(ret == in);
+ int i = 0;
+ for(MyByteSeq::iterator p = in.begin(); p != in.end(); ++p)
+ {
+ *p = '1' + i++;
+ }
+
+ MyByteSeq out;
+ MyByteSeq ret = t->opMyByteSeq(in, out);
+ test(out == in);
+ test(ret == in);
}
{
deque<string> in(5);
- in[0] = "These";
- in[1] = "are";
- in[2] = "five";
- in[3] = "short";
- in[4] = "strings.";
-
- deque<string> out;
- deque<string> ret = t->opStringSeq(in, out);
- test(out == in);
- test(ret == in);
+ in[0] = "These";
+ in[1] = "are";
+ in[2] = "five";
+ in[3] = "short";
+ in[4] = "strings.";
+
+ deque<string> out;
+ deque<string> ret = t->opStringSeq(in, out);
+ test(out == in);
+ test(ret == in);
}
{
list<string> in;
- in.push_back("These");
- in.push_back("are");
- in.push_back("five");
- in.push_back("short");
- in.push_back("strings.");
-
- list<string> out;
- list<string> ret = t->opStringList(in, out);
- test(out == in);
- test(ret == in);
+ in.push_back("These");
+ in.push_back("are");
+ in.push_back("five");
+ in.push_back("short");
+ in.push_back("strings.");
+
+ list<string> out;
+ list<string> ret = t->opStringList(in, out);
+ test(out == in);
+ test(ret == in);
}
{
deque<Test::Fixed> in(5);
- in[0].s = 1;
- in[1].s = 2;
- in[2].s = 3;
- in[3].s = 4;
- in[4].s = 5;
-
- deque<Test::Fixed> out;
- deque<Test::Fixed> ret = t->opFixedSeq(in, out);
- test(out == in);
- test(ret == in);
+ in[0].s = 1;
+ in[1].s = 2;
+ in[2].s = 3;
+ in[3].s = 4;
+ in[4].s = 5;
+
+ deque<Test::Fixed> out;
+ deque<Test::Fixed> ret = t->opFixedSeq(in, out);
+ test(out == in);
+ test(ret == in);
}
{
list<Test::Fixed> in(5);
- short num = 1;
- for(list<Test::Fixed>::iterator p = in.begin(); p != in.end(); ++p)
- {
- (*p).s = num++;
- }
-
- list<Test::Fixed> out;
- list<Test::Fixed> ret = t->opFixedList(in, out);
- test(out == in);
- test(ret == in);
+ short num = 1;
+ for(list<Test::Fixed>::iterator p = in.begin(); p != in.end(); ++p)
+ {
+ (*p).s = num++;
+ }
+
+ list<Test::Fixed> out;
+ list<Test::Fixed> ret = t->opFixedList(in, out);
+ test(out == in);
+ test(ret == in);
}
{
deque<Test::Variable> in(5);
- in[0].s = "These";
- in[1].s = "are";
- in[2].s = "five";
- in[3].s = "short";
- in[4].s = "strings.";
-
- deque<Test::Variable> out;
- deque<Test::Variable> ret = t->opVariableSeq(in, out);
- test(out == in);
- test(ret == in);
+ in[0].s = "These";
+ in[1].s = "are";
+ in[2].s = "five";
+ in[3].s = "short";
+ in[4].s = "strings.";
+
+ deque<Test::Variable> out;
+ deque<Test::Variable> ret = t->opVariableSeq(in, out);
+ test(out == in);
+ test(ret == in);
}
{
list<Test::Variable> in;
- Test::Variable v;
- v.s = "These";
- in.push_back(v);
- v.s = "are";
- in.push_back(v);
- v.s = "five";
- in.push_back(v);
- v.s = "short";
- in.push_back(v);
- v.s = "strings.";
- in.push_back(v);
-
- list<Test::Variable> out;
- list<Test::Variable> ret = t->opVariableList(in, out);
- test(out == in);
- test(ret == in);
+ Test::Variable v;
+ v.s = "These";
+ in.push_back(v);
+ v.s = "are";
+ in.push_back(v);
+ v.s = "five";
+ in.push_back(v);
+ v.s = "short";
+ in.push_back(v);
+ v.s = "strings.";
+ in.push_back(v);
+
+ list<Test::Variable> out;
+ list<Test::Variable> ret = t->opVariableList(in, out);
+ test(out == in);
+ test(ret == in);
}
{
deque<Test::StringStringDict> in(5);
- in[0]["A"] = "a";
- in[1]["B"] = "b";
- in[2]["C"] = "c";
- in[3]["D"] = "d";
- in[4]["E"] = "e";
-
- deque<Test::StringStringDict> out;
- deque<Test::StringStringDict> ret = t->opStringStringDictSeq(in, out);
- test(out == in);
- test(ret == in);
+ in[0]["A"] = "a";
+ in[1]["B"] = "b";
+ in[2]["C"] = "c";
+ in[3]["D"] = "d";
+ in[4]["E"] = "e";
+
+ deque<Test::StringStringDict> out;
+ deque<Test::StringStringDict> ret = t->opStringStringDictSeq(in, out);
+ test(out == in);
+ test(ret == in);
}
{
list<Test::StringStringDict> in;
- Test::StringStringDict ssd;
- ssd["A"] = "a";
- in.push_back(ssd);
- ssd["B"] = "b";
- in.push_back(ssd);
- ssd["C"] = "c";
- in.push_back(ssd);
- ssd["D"] = "d";
- in.push_back(ssd);
- ssd["E"] = "e";
- in.push_back(ssd);
-
- list<Test::StringStringDict> out;
- list<Test::StringStringDict> ret = t->opStringStringDictList(in, out);
- test(out == in);
- test(ret == in);
+ Test::StringStringDict ssd;
+ ssd["A"] = "a";
+ in.push_back(ssd);
+ ssd["B"] = "b";
+ in.push_back(ssd);
+ ssd["C"] = "c";
+ in.push_back(ssd);
+ ssd["D"] = "d";
+ in.push_back(ssd);
+ ssd["E"] = "e";
+ in.push_back(ssd);
+
+ list<Test::StringStringDict> out;
+ list<Test::StringStringDict> ret = t->opStringStringDictList(in, out);
+ test(out == in);
+ test(ret == in);
}
{
deque<Test::E> in(5);
- in[0] = Test::E1;
- in[1] = Test::E2;
- in[2] = Test::E3;
- in[3] = Test::E1;
- in[4] = Test::E3;
-
- deque<Test::E> out;
- deque<Test::E> ret = t->opESeq(in, out);
- test(out == in);
- test(ret == in);
+ in[0] = Test::E1;
+ in[1] = Test::E2;
+ in[2] = Test::E3;
+ in[3] = Test::E1;
+ in[4] = Test::E3;
+
+ deque<Test::E> out;
+ deque<Test::E> ret = t->opESeq(in, out);
+ test(out == in);
+ test(ret == in);
}
{
list<Test::E> in;
- in.push_back(Test::E1);
- in.push_back(Test::E2);
- in.push_back(Test::E3);
- in.push_back(Test::E1);
- in.push_back(Test::E3);
-
- list<Test::E> out;
- list<Test::E> ret = t->opEList(in, out);
- test(out == in);
- test(ret == in);
+ in.push_back(Test::E1);
+ in.push_back(Test::E2);
+ in.push_back(Test::E3);
+ in.push_back(Test::E1);
+ in.push_back(Test::E3);
+
+ list<Test::E> out;
+ list<Test::E> ret = t->opEList(in, out);
+ test(out == in);
+ test(ret == in);
}
{
deque<Test::CPrx> in(5);
- in[0] = Test::CPrx::uncheckedCast(communicator->stringToProxy("C1:default -p 12010 -t 10000"));
- in[1] = Test::CPrx::uncheckedCast(communicator->stringToProxy("C2:default -p 12010 -t 10001"));
- in[2] = Test::CPrx::uncheckedCast(communicator->stringToProxy("C3:default -p 12010 -t 10002"));
- in[3] = Test::CPrx::uncheckedCast(communicator->stringToProxy("C4:default -p 12010 -t 10003"));
- in[4] = Test::CPrx::uncheckedCast(communicator->stringToProxy("C5:default -p 12010 -t 10004"));
-
- deque<Test::CPrx> out;
- deque<Test::CPrx> ret = t->opCPrxSeq(in, out);
- test(out == in);
- test(ret == in);
+ in[0] = Test::CPrx::uncheckedCast(communicator->stringToProxy("C1:default -p 12010 -t 10000"));
+ in[1] = Test::CPrx::uncheckedCast(communicator->stringToProxy("C2:default -p 12010 -t 10001"));
+ in[2] = Test::CPrx::uncheckedCast(communicator->stringToProxy("C3:default -p 12010 -t 10002"));
+ in[3] = Test::CPrx::uncheckedCast(communicator->stringToProxy("C4:default -p 12010 -t 10003"));
+ in[4] = Test::CPrx::uncheckedCast(communicator->stringToProxy("C5:default -p 12010 -t 10004"));
+
+ deque<Test::CPrx> out;
+ deque<Test::CPrx> ret = t->opCPrxSeq(in, out);
+ test(out == in);
+ test(ret == in);
}
{
list<Test::CPrx> in;
- in.push_back(Test::CPrx::uncheckedCast(communicator->stringToProxy("C1:default -p 12010 -t 10000")));
- in.push_back(Test::CPrx::uncheckedCast(communicator->stringToProxy("C2:default -p 12010 -t 10001")));
- in.push_back(Test::CPrx::uncheckedCast(communicator->stringToProxy("C3:default -p 12010 -t 10002")));
- in.push_back(Test::CPrx::uncheckedCast(communicator->stringToProxy("C4:default -p 12010 -t 10003")));
- in.push_back(Test::CPrx::uncheckedCast(communicator->stringToProxy("C5:default -p 12010 -t 10004")));
-
- list<Test::CPrx> out;
- list<Test::CPrx> ret = t->opCPrxList(in, out);
- test(out == in);
- test(ret == in);
+ in.push_back(Test::CPrx::uncheckedCast(communicator->stringToProxy("C1:default -p 12010 -t 10000")));
+ in.push_back(Test::CPrx::uncheckedCast(communicator->stringToProxy("C2:default -p 12010 -t 10001")));
+ in.push_back(Test::CPrx::uncheckedCast(communicator->stringToProxy("C3:default -p 12010 -t 10002")));
+ in.push_back(Test::CPrx::uncheckedCast(communicator->stringToProxy("C4:default -p 12010 -t 10003")));
+ in.push_back(Test::CPrx::uncheckedCast(communicator->stringToProxy("C5:default -p 12010 -t 10004")));
+
+ list<Test::CPrx> out;
+ list<Test::CPrx> ret = t->opCPrxList(in, out);
+ test(out == in);
+ test(ret == in);
}
tprintf("ok\n");
diff --git a/cppe/test/IceE/custom/Client.cpp b/cppe/test/IceE/custom/Client.cpp
index cc2e0e9ca97..cf26bbd15eb 100644
--- a/cppe/test/IceE/custom/Client.cpp
+++ b/cppe/test/IceE/custom/Client.cpp
@@ -28,15 +28,15 @@ public:
run(int argc, char* argv[])
{
Ice::InitializationData initData;
- initData.properties = Ice::createProperties();
+ initData.properties = Ice::createProperties();
#ifdef ICEE_HAS_WSTRING
initData.stringConverter = new Test::StringConverterI();
initData.wstringConverter = new Test::WstringConverterI();
#endif
- loadConfig(initData.properties);
- initData.logger = getLogger();
- setCommunicator(Ice::initialize(argc, argv, initData));
+ loadConfig(initData.properties);
+ initData.logger = getLogger();
+ setCommunicator(Ice::initialize(argc, argv, initData));
Test::TestIntfPrx allTests(const Ice::CommunicatorPtr&);
Test::TestIntfPrx test = allTests(communicator());
diff --git a/cppe/test/IceE/custom/Collocated.cpp b/cppe/test/IceE/custom/Collocated.cpp
index 80ce3d19e08..59a5193fd4a 100644
--- a/cppe/test/IceE/custom/Collocated.cpp
+++ b/cppe/test/IceE/custom/Collocated.cpp
@@ -28,21 +28,21 @@ public:
run(int argc, char* argv[])
{
Ice::InitializationData initData;
- initData.properties = Ice::createProperties();
+ initData.properties = Ice::createProperties();
- initData.properties->setProperty("TestAdapter.Endpoints", "default -p 12010 -t 10000");
- //initData.properties->setProperty("Ice.Trace.Network", "5");
- //initData.properties->setProperty("Ice.Trace.Protocol", "5");
+ initData.properties->setProperty("TestAdapter.Endpoints", "default -p 12010 -t 10000");
+ //initData.properties->setProperty("Ice.Trace.Network", "5");
+ //initData.properties->setProperty("Ice.Trace.Protocol", "5");
- loadConfig(initData.properties);
- initData.logger = getLogger();
- setCommunicator(Ice::initialize(argc, argv, initData));
+ loadConfig(initData.properties);
+ initData.logger = getLogger();
+ setCommunicator(Ice::initialize(argc, argv, initData));
Ice::ObjectAdapterPtr adapter = communicator()->createObjectAdapter("TestAdapter");
adapter->add(new TestIntfI(communicator()), communicator()->stringToIdentity("test"));
#ifdef ICEE_HAS_WSTRING
- adapter->add(new Test1::WstringClassI, communicator()->stringToIdentity("wstring1"));
- adapter->add(new Test2::WstringClassI, communicator()->stringToIdentity("wstring2"));
+ adapter->add(new Test1::WstringClassI, communicator()->stringToIdentity("wstring1"));
+ adapter->add(new Test2::WstringClassI, communicator()->stringToIdentity("wstring2"));
#endif
adapter->activate();
diff --git a/cppe/test/IceE/custom/MyByteSeq.cpp b/cppe/test/IceE/custom/MyByteSeq.cpp
index 8a24df1026b..d8d346879d9 100644
--- a/cppe/test/IceE/custom/MyByteSeq.cpp
+++ b/cppe/test/IceE/custom/MyByteSeq.cpp
@@ -32,7 +32,7 @@ MyByteSeq::MyByteSeq(const MyByteSeq& seq)
if(_size != 0)
{
_data = (Ice::Byte*)malloc(_size);
- memcpy(_data, seq._data, _size);
+ memcpy(_data, seq._data, _size);
}
else
{
@@ -83,13 +83,13 @@ MyByteSeq::operator=(const MyByteSeq& rhs)
if(_data != 0)
{
free(_data);
- _data = 0;
+ _data = 0;
}
_size = rhs._size;
if(_size != 0)
{
_data = (Ice::Byte*)malloc(_size);
- memcpy(_data, rhs._data, _size);
+ memcpy(_data, rhs._data, _size);
}
}
diff --git a/cppe/test/IceE/custom/Server.cpp b/cppe/test/IceE/custom/Server.cpp
index 30e7fb7bcb4..7c6c556880a 100644
--- a/cppe/test/IceE/custom/Server.cpp
+++ b/cppe/test/IceE/custom/Server.cpp
@@ -29,27 +29,27 @@ public:
run(int argc, char* argv[])
{
Ice::InitializationData initData;
- initData.properties = Ice::createProperties();
+ initData.properties = Ice::createProperties();
#ifdef ICEE_HAS_WSTRING
initData.stringConverter = new Test::StringConverterI();
initData.wstringConverter = new Test::WstringConverterI();
#endif
- initData.properties->setProperty("TestAdapter.Endpoints", "default -p 12010 -t 10000");
- //initData.properties->setProperty("Ice.Trace.Network", "5");
- //initData.properties->setProperty("Ice.Trace.Protocol", "5");
+ initData.properties->setProperty("TestAdapter.Endpoints", "default -p 12010 -t 10000");
+ //initData.properties->setProperty("Ice.Trace.Network", "5");
+ //initData.properties->setProperty("Ice.Trace.Protocol", "5");
- loadConfig(initData.properties);
- initData.logger = getLogger();
- setCommunicator(Ice::initialize(argc, argv, initData));
-
+ loadConfig(initData.properties);
+ initData.logger = getLogger();
+ setCommunicator(Ice::initialize(argc, argv, initData));
+
Ice::ObjectAdapterPtr adapter = communicator()->createObjectAdapter("TestAdapter");
adapter->add(new TestIntfI(communicator()), communicator()->stringToIdentity("test"));
#ifdef ICEE_HAS_WSTRING
- adapter->add(new Test1::WstringClassI, communicator()->stringToIdentity("wstring1"));
- adapter->add(new Test2::WstringClassI, communicator()->stringToIdentity("wstring2"));
+ adapter->add(new Test1::WstringClassI, communicator()->stringToIdentity("wstring1"));
+ adapter->add(new Test2::WstringClassI, communicator()->stringToIdentity("wstring2"));
#endif
- adapter->activate();
+ adapter->activate();
#ifndef _WIN32_WCE
communicator()->waitForShutdown();
diff --git a/cppe/test/IceE/custom/StringConverterI.cpp b/cppe/test/IceE/custom/StringConverterI.cpp
index 52357b5d9c8..e606044ed70 100644
--- a/cppe/test/IceE/custom/StringConverterI.cpp
+++ b/cppe/test/IceE/custom/StringConverterI.cpp
@@ -34,7 +34,7 @@ Test::StringConverterI::toUTF8(const char* sourceStart, const char* sourceEnd, I
void
Test::StringConverterI::fromUTF8(const Ice::Byte* sourceStart, const Ice::Byte* sourceEnd,
- string& target) const
+ string& target) const
{
size_t size = static_cast<size_t>(sourceEnd - sourceStart);
target.resize(size);
@@ -67,7 +67,7 @@ Test::WstringConverterI::toUTF8(const wchar_t* sourceStart, const wchar_t* sourc
void
Test::WstringConverterI::fromUTF8(const Ice::Byte* sourceStart, const Ice::Byte* sourceEnd,
- wstring& target) const
+ wstring& target) const
{
size_t size = static_cast<size_t>(sourceEnd - sourceStart);
string s;
diff --git a/cppe/test/IceE/custom/StringConverterI.h b/cppe/test/IceE/custom/StringConverterI.h
index c264ce5e5fc..1981729dc7f 100644
--- a/cppe/test/IceE/custom/StringConverterI.h
+++ b/cppe/test/IceE/custom/StringConverterI.h
@@ -30,7 +30,7 @@ public:
virtual Ice::Byte* toUTF8(const char*, const char*, Ice::UTF8Buffer&) const;
virtual void fromUTF8(const Ice::Byte* sourceStart, const Ice::Byte* sourceEnd,
- std::string& target) const;
+ std::string& target) const;
};
class WstringConverterI : public Ice::WstringConverter
@@ -39,7 +39,7 @@ public:
virtual Ice::Byte* toUTF8(const wchar_t*, const wchar_t*, Ice::UTF8Buffer&) const;
virtual void fromUTF8(const Ice::Byte* sourceStart, const Ice::Byte* sourceEnd,
- std::wstring& target) const;
+ std::wstring& target) const;
};
}
diff --git a/cppe/test/IceE/custom/Test.ice b/cppe/test/IceE/custom/Test.ice
index 0fb6800313f..bfa77fb7f58 100644
--- a/cppe/test/IceE/custom/Test.ice
+++ b/cppe/test/IceE/custom/Test.ice
@@ -114,7 +114,7 @@ class TestIntf
["cpp:type:std::deque< ::Ice::Byte>"] ByteSeq
opByteSeq(["cpp:type:std::deque< ::Ice::Byte>"] ByteSeq inSeq,
- out ["cpp:type:std::deque< ::Ice::Byte>"] ByteSeq outSeq);
+ out ["cpp:type:std::deque< ::Ice::Byte>"] ByteSeq outSeq);
ByteList opByteList(ByteList inSeq, out ByteList outSeq);
@@ -123,7 +123,7 @@ class TestIntf
["cpp:type:std::deque<std::string>"] StringSeq
opStringSeq(["cpp:type:std::deque<std::string>"] StringSeq inSeq,
- out ["cpp:type:std::deque<std::string>"] StringSeq outSeq);
+ out ["cpp:type:std::deque<std::string>"] StringSeq outSeq);
StringList opStringList(StringList inSeq, out StringList outSeq);
@@ -135,13 +135,13 @@ class TestIntf
["cpp:type:std::deque< ::Test::Variable>"] VariableSeq
opVariableSeq(["cpp:type:std::deque< ::Test::Variable>"] VariableSeq inSeq,
- out ["cpp:type:std::deque< ::Test::Variable>"] VariableSeq outSeq);
+ out ["cpp:type:std::deque< ::Test::Variable>"] VariableSeq outSeq);
VariableList opVariableList(VariableList inSeq, out VariableList outSeq);
["cpp:type:std::deque< ::Test::StringStringDict>"] StringStringDictSeq
opStringStringDictSeq(["cpp:type:std::deque< ::Test::StringStringDict>"] StringStringDictSeq inSeq,
- out ["cpp:type:std::deque< ::Test::StringStringDict>"] StringStringDictSeq outSeq);
+ out ["cpp:type:std::deque< ::Test::StringStringDict>"] StringStringDictSeq outSeq);
StringStringDictList opStringStringDictList(StringStringDictList inSeq, out StringStringDictList outSeq);
@@ -152,7 +152,7 @@ class TestIntf
["cpp:type:std::deque< ::Test::CPrx>"] CPrxSeq
opCPrxSeq(["cpp:type:std::deque< ::Test::CPrx>"] CPrxSeq inSeq,
- out ["cpp:type:std::deque< ::Test::CPrx>"] CPrxSeq outSeq);
+ out ["cpp:type:std::deque< ::Test::CPrx>"] CPrxSeq outSeq);
CPrxList opCPrxList(CPrxList inSeq, out CPrxList outSeq);
diff --git a/cppe/test/IceE/custom/TestI.cpp b/cppe/test/IceE/custom/TestI.cpp
index 4e5a8753ed0..26b38f05282 100644
--- a/cppe/test/IceE/custom/TestI.cpp
+++ b/cppe/test/IceE/custom/TestI.cpp
@@ -17,8 +17,8 @@ TestIntfI::TestIntfI(const Ice::CommunicatorPtr& communicator)
Test::BoolSeq
TestIntfI::opBoolArray(const std::pair<const bool*, const bool*>& inSeq,
- Test::BoolSeq& outSeq,
- const Ice::Current& current)
+ Test::BoolSeq& outSeq,
+ const Ice::Current& current)
{
Test::BoolSeq(inSeq.first, inSeq.second).swap(outSeq);
return outSeq;
@@ -26,8 +26,8 @@ TestIntfI::opBoolArray(const std::pair<const bool*, const bool*>& inSeq,
Test::ByteList
TestIntfI::opByteArray(const std::pair<const Ice::Byte*, const Ice::Byte*>& inSeq,
- Test::ByteList& outSeq,
- const Ice::Current& current)
+ Test::ByteList& outSeq,
+ const Ice::Current& current)
{
Test::ByteList(inSeq.first, inSeq.second).swap(outSeq);
return outSeq;
@@ -35,8 +35,8 @@ TestIntfI::opByteArray(const std::pair<const Ice::Byte*, const Ice::Byte*>& inSe
Test::VariableList
TestIntfI::opVariableArray(const std::pair<const Test::Variable*, const Test::Variable*>& inSeq,
- Test::VariableList& outSeq,
- const Ice::Current& current)
+ Test::VariableList& outSeq,
+ const Ice::Current& current)
{
Test::VariableList(inSeq.first, inSeq.second).swap(outSeq);
return outSeq;
@@ -44,8 +44,8 @@ TestIntfI::opVariableArray(const std::pair<const Test::Variable*, const Test::Va
Test::BoolSeq
TestIntfI::opBoolRange(const std::pair<Test::BoolSeq::const_iterator, Test::BoolSeq::const_iterator>& inSeq,
- Test::BoolSeq& outSeq,
- const Ice::Current&)
+ Test::BoolSeq& outSeq,
+ const Ice::Current&)
{
Test::BoolSeq(inSeq.first, inSeq.second).swap(outSeq);
return outSeq;
@@ -53,8 +53,8 @@ TestIntfI::opBoolRange(const std::pair<Test::BoolSeq::const_iterator, Test::Bool
Test::ByteList
TestIntfI::opByteRange(const std::pair<Test::ByteList::const_iterator, Test::ByteList::const_iterator>& inSeq,
- Test::ByteList& outSeq,
- const Ice::Current&)
+ Test::ByteList& outSeq,
+ const Ice::Current&)
{
Test::ByteList(inSeq.first, inSeq.second).swap(outSeq);
return outSeq;
@@ -62,9 +62,9 @@ TestIntfI::opByteRange(const std::pair<Test::ByteList::const_iterator, Test::Byt
Test::VariableList
TestIntfI::opVariableRange(
- const std::pair<Test::VariableList::const_iterator, Test::VariableList::const_iterator>& inSeq,
- Test::VariableList& outSeq,
- const Ice::Current&)
+ const std::pair<Test::VariableList::const_iterator, Test::VariableList::const_iterator>& inSeq,
+ Test::VariableList& outSeq,
+ const Ice::Current&)
{
Test::VariableList(inSeq.first, inSeq.second).swap(outSeq);
return outSeq;
@@ -72,8 +72,8 @@ TestIntfI::opVariableRange(
Test::BoolSeq
TestIntfI::opBoolRangeType(const std::pair<const bool*, const bool*>& inSeq,
- Test::BoolSeq& outSeq,
- const Ice::Current&)
+ Test::BoolSeq& outSeq,
+ const Ice::Current&)
{
Test::BoolSeq(inSeq.first, inSeq.second).swap(outSeq);
return outSeq;
@@ -81,8 +81,8 @@ TestIntfI::opBoolRangeType(const std::pair<const bool*, const bool*>& inSeq,
Test::ByteList
TestIntfI::opByteRangeType(const std::pair<Test::ByteList::const_iterator, Test::ByteList::const_iterator>& inSeq,
- Test::ByteList& outSeq,
- const Ice::Current&)
+ Test::ByteList& outSeq,
+ const Ice::Current&)
{
Test::ByteList(inSeq.first, inSeq.second).swap(outSeq);
return outSeq;
@@ -90,9 +90,9 @@ TestIntfI::opByteRangeType(const std::pair<Test::ByteList::const_iterator, Test:
Test::VariableList
TestIntfI::opVariableRangeType(
- const std::pair<std::deque<Test::Variable>::const_iterator, std::deque<Test::Variable>::const_iterator>& inSeq,
- Test::VariableList& outSeq,
- const Ice::Current&)
+ const std::pair<std::deque<Test::Variable>::const_iterator, std::deque<Test::Variable>::const_iterator>& inSeq,
+ Test::VariableList& outSeq,
+ const Ice::Current&)
{
Test::VariableList(inSeq.first, inSeq.second).swap(outSeq);
return outSeq;
@@ -100,8 +100,8 @@ TestIntfI::opVariableRangeType(
std::deque<bool>
TestIntfI::opBoolSeq(const std::deque<bool>& inSeq,
- std::deque<bool>& outSeq,
- const Ice::Current& current)
+ std::deque<bool>& outSeq,
+ const Ice::Current& current)
{
outSeq = inSeq;
return inSeq;
@@ -109,8 +109,8 @@ TestIntfI::opBoolSeq(const std::deque<bool>& inSeq,
std::list<bool>
TestIntfI::opBoolList(const std::list<bool>& inSeq,
- std::list<bool>& outSeq,
- const Ice::Current& current)
+ std::list<bool>& outSeq,
+ const Ice::Current& current)
{
outSeq = inSeq;
return inSeq;
@@ -118,8 +118,8 @@ TestIntfI::opBoolList(const std::list<bool>& inSeq,
std::deque< ::Ice::Byte>
TestIntfI::opByteSeq(const std::deque< ::Ice::Byte>& inSeq,
- std::deque< ::Ice::Byte>& outSeq,
- const Ice::Current& current)
+ std::deque< ::Ice::Byte>& outSeq,
+ const Ice::Current& current)
{
outSeq = inSeq;
return inSeq;
@@ -127,8 +127,8 @@ TestIntfI::opByteSeq(const std::deque< ::Ice::Byte>& inSeq,
std::list< ::Ice::Byte>
TestIntfI::opByteList(const std::list< ::Ice::Byte>& inSeq,
- std::list< ::Ice::Byte>& outSeq,
- const Ice::Current& current)
+ std::list< ::Ice::Byte>& outSeq,
+ const Ice::Current& current)
{
outSeq = inSeq;
return inSeq;
@@ -136,8 +136,8 @@ TestIntfI::opByteList(const std::list< ::Ice::Byte>& inSeq,
MyByteSeq
TestIntfI::opMyByteSeq(const MyByteSeq& inSeq,
- MyByteSeq& outSeq,
- const Ice::Current& current)
+ MyByteSeq& outSeq,
+ const Ice::Current& current)
{
outSeq = inSeq;
return inSeq;
@@ -145,8 +145,8 @@ TestIntfI::opMyByteSeq(const MyByteSeq& inSeq,
std::deque< ::std::string>
TestIntfI::opStringSeq(const std::deque< ::std::string>& inSeq,
- std::deque< ::std::string>& outSeq,
- const Ice::Current& current)
+ std::deque< ::std::string>& outSeq,
+ const Ice::Current& current)
{
outSeq = inSeq;
return inSeq;
@@ -154,8 +154,8 @@ TestIntfI::opStringSeq(const std::deque< ::std::string>& inSeq,
std::list< ::std::string>
TestIntfI::opStringList(const std::list< ::std::string>& inSeq,
- std::list< ::std::string>& outSeq,
- const Ice::Current& current)
+ std::list< ::std::string>& outSeq,
+ const Ice::Current& current)
{
outSeq = inSeq;
return inSeq;
@@ -163,8 +163,8 @@ TestIntfI::opStringList(const std::list< ::std::string>& inSeq,
std::deque< ::Test::Fixed>
TestIntfI::opFixedSeq(const std::deque< ::Test::Fixed>& inSeq,
- std::deque< ::Test::Fixed>& outSeq,
- const Ice::Current& current)
+ std::deque< ::Test::Fixed>& outSeq,
+ const Ice::Current& current)
{
outSeq = inSeq;
return inSeq;
@@ -172,8 +172,8 @@ TestIntfI::opFixedSeq(const std::deque< ::Test::Fixed>& inSeq,
std::list< ::Test::Fixed>
TestIntfI::opFixedList(const std::list< ::Test::Fixed>& inSeq,
- std::list< ::Test::Fixed>& outSeq,
- const Ice::Current& current)
+ std::list< ::Test::Fixed>& outSeq,
+ const Ice::Current& current)
{
outSeq = inSeq;
return inSeq;
@@ -181,8 +181,8 @@ TestIntfI::opFixedList(const std::list< ::Test::Fixed>& inSeq,
std::deque< ::Test::Variable>
TestIntfI::opVariableSeq(const std::deque< ::Test::Variable>& inSeq,
- std::deque< ::Test::Variable>& outSeq,
- const Ice::Current& current)
+ std::deque< ::Test::Variable>& outSeq,
+ const Ice::Current& current)
{
outSeq = inSeq;
return inSeq;
@@ -190,8 +190,8 @@ TestIntfI::opVariableSeq(const std::deque< ::Test::Variable>& inSeq,
std::list< ::Test::Variable>
TestIntfI::opVariableList(const std::list< ::Test::Variable>& inSeq,
- std::list< ::Test::Variable>& outSeq,
- const Ice::Current& current)
+ std::list< ::Test::Variable>& outSeq,
+ const Ice::Current& current)
{
outSeq = inSeq;
return inSeq;
diff --git a/cppe/test/IceE/custom/TestI.h b/cppe/test/IceE/custom/TestI.h
index f9b95108f21..a9e5f529415 100644
--- a/cppe/test/IceE/custom/TestI.h
+++ b/cppe/test/IceE/custom/TestI.h
@@ -19,88 +19,88 @@ public:
TestIntfI(const Ice::CommunicatorPtr&);
virtual Test::BoolSeq opBoolArray(const std::pair<const bool*, const bool*>&,
- Test::BoolSeq&,
- const Ice::Current&);
+ Test::BoolSeq&,
+ const Ice::Current&);
virtual Test::ByteList opByteArray(const std::pair<const Ice::Byte*, const Ice::Byte*>&,
- Test::ByteList&,
- const Ice::Current&);
+ Test::ByteList&,
+ const Ice::Current&);
virtual Test::VariableList opVariableArray(const std::pair<const Test::Variable*, const Test::Variable*>&,
- Test::VariableList&,
- const Ice::Current&);
+ Test::VariableList&,
+ const Ice::Current&);
virtual Test::BoolSeq opBoolRange(const std::pair<Test::BoolSeq::const_iterator, Test::BoolSeq::const_iterator>&,
- Test::BoolSeq&,
- const Ice::Current&);
+ Test::BoolSeq&,
+ const Ice::Current&);
virtual Test::ByteList opByteRange(const std::pair<Test::ByteList::const_iterator, Test::ByteList::const_iterator>&,
- Test::ByteList&,
- const Ice::Current&);
+ Test::ByteList&,
+ const Ice::Current&);
virtual Test::VariableList
opVariableRange(const std::pair<Test::VariableList::const_iterator, Test::VariableList::const_iterator>&,
- Test::VariableList&,
- const Ice::Current&);
+ Test::VariableList&,
+ const Ice::Current&);
virtual Test::BoolSeq opBoolRangeType(const std::pair<const bool*, const bool*>&,
- Test::BoolSeq&,
- const Ice::Current&);
+ Test::BoolSeq&,
+ const Ice::Current&);
virtual Test::ByteList opByteRangeType(const std::pair<Test::ByteList::const_iterator,
- Test::ByteList::const_iterator>&,
- Test::ByteList&,
- const Ice::Current&);
+ Test::ByteList::const_iterator>&,
+ Test::ByteList&,
+ const Ice::Current&);
virtual Test::VariableList
opVariableRangeType(const std::pair<std::deque<Test::Variable>::const_iterator,
- std::deque<Test::Variable>::const_iterator>&,
- Test::VariableList&,
- const Ice::Current&);
+ std::deque<Test::Variable>::const_iterator>&,
+ Test::VariableList&,
+ const Ice::Current&);
virtual std::deque<bool> opBoolSeq(const std::deque<bool>&,
- std::deque<bool>&,
- const Ice::Current&);
+ std::deque<bool>&,
+ const Ice::Current&);
virtual std::list<bool> opBoolList(const std::list<bool>&,
- std::list<bool>&,
- const Ice::Current&);
+ std::list<bool>&,
+ const Ice::Current&);
virtual std::deque< ::Ice::Byte> opByteSeq(const std::deque< ::Ice::Byte>&,
- std::deque< ::Ice::Byte>&,
- const Ice::Current&);
+ std::deque< ::Ice::Byte>&,
+ const Ice::Current&);
virtual std::list< ::Ice::Byte> opByteList(const std::list< ::Ice::Byte>&,
- std::list< ::Ice::Byte>&,
- const Ice::Current&);
+ std::list< ::Ice::Byte>&,
+ const Ice::Current&);
virtual MyByteSeq opMyByteSeq(const MyByteSeq&,
- MyByteSeq&,
- const Ice::Current&);
+ MyByteSeq&,
+ const Ice::Current&);
virtual std::deque< ::std::string> opStringSeq(const std::deque< ::std::string>&,
- std::deque< ::std::string>&,
- const Ice::Current&);
+ std::deque< ::std::string>&,
+ const Ice::Current&);
virtual std::list< ::std::string> opStringList(const std::list< ::std::string>&,
- std::list< ::std::string>&,
- const Ice::Current&);
+ std::list< ::std::string>&,
+ const Ice::Current&);
virtual std::deque< ::Test::Fixed> opFixedSeq(const std::deque< ::Test::Fixed>&,
- std::deque< ::Test::Fixed>&,
- const Ice::Current&);
+ std::deque< ::Test::Fixed>&,
+ const Ice::Current&);
virtual std::list< ::Test::Fixed> opFixedList(const std::list< ::Test::Fixed>&,
- std::list< ::Test::Fixed>&,
- const Ice::Current&);
+ std::list< ::Test::Fixed>&,
+ const Ice::Current&);
virtual std::deque< ::Test::Variable> opVariableSeq(const std::deque< ::Test::Variable>&,
- std::deque< ::Test::Variable>&,
- const Ice::Current&);
+ std::deque< ::Test::Variable>&,
+ const Ice::Current&);
virtual std::list< ::Test::Variable> opVariableList(const std::list< ::Test::Variable>&,
- std::list< ::Test::Variable>&,
- const Ice::Current&);
+ std::list< ::Test::Variable>&,
+ const Ice::Current&);
virtual std::deque< ::Test::StringStringDict> opStringStringDictSeq(const std::deque< ::Test::StringStringDict>&,
std::deque< ::Test::StringStringDict>&,
diff --git a/cppe/test/IceE/custom/WstringI.cpp b/cppe/test/IceE/custom/WstringI.cpp
index 46b2208fc9d..05e5fd94e57 100644
--- a/cppe/test/IceE/custom/WstringI.cpp
+++ b/cppe/test/IceE/custom/WstringI.cpp
@@ -15,8 +15,8 @@
::std::wstring
Test1::WstringClassI::opString(const ::std::wstring& s1,
- ::std::wstring& s2,
- const Ice::Current& current)
+ ::std::wstring& s2,
+ const Ice::Current& current)
{
s2 = s1;
return s1;
@@ -24,8 +24,8 @@ Test1::WstringClassI::opString(const ::std::wstring& s1,
::Test1::WstringStruct
Test1::WstringClassI::opStruct(const ::Test1::WstringStruct& s1,
- ::Test1::WstringStruct& s2,
- const Ice::Current& current)
+ ::Test1::WstringStruct& s2,
+ const Ice::Current& current)
{
s2 = s1;
return s1;
@@ -33,7 +33,7 @@ Test1::WstringClassI::opStruct(const ::Test1::WstringStruct& s1,
void
Test1::WstringClassI::throwExcept(const ::std::wstring& reason,
- const Ice::Current& current)
+ const Ice::Current& current)
{
Test1::WstringException ex;
ex.reason = reason;
@@ -42,8 +42,8 @@ Test1::WstringClassI::throwExcept(const ::std::wstring& reason,
::std::wstring
Test2::WstringClassI::opString(const ::std::wstring& s1,
- ::std::wstring& s2,
- const Ice::Current& current)
+ ::std::wstring& s2,
+ const Ice::Current& current)
{
s2 = s1;
return s1;
@@ -51,8 +51,8 @@ Test2::WstringClassI::opString(const ::std::wstring& s1,
::Test2::WstringStruct
Test2::WstringClassI::opStruct(const ::Test2::WstringStruct& s1,
- ::Test2::WstringStruct& s2,
- const Ice::Current& current)
+ ::Test2::WstringStruct& s2,
+ const Ice::Current& current)
{
s2 = s1;
return s1;
@@ -60,7 +60,7 @@ Test2::WstringClassI::opStruct(const ::Test2::WstringStruct& s1,
void
Test2::WstringClassI::throwExcept(const ::std::wstring& reason,
- const Ice::Current& current)
+ const Ice::Current& current)
{
Test2::WstringException ex;
ex.reason = reason;
diff --git a/cppe/test/IceE/custom/WstringI.h b/cppe/test/IceE/custom/WstringI.h
index 7b5104a6ae8..3077a1b3f58 100644
--- a/cppe/test/IceE/custom/WstringI.h
+++ b/cppe/test/IceE/custom/WstringI.h
@@ -24,15 +24,15 @@ class WstringClassI : virtual public WstringClass
public:
virtual ::std::wstring opString(const ::std::wstring&,
- ::std::wstring&,
- const Ice::Current&);
+ ::std::wstring&,
+ const Ice::Current&);
virtual ::Test1::WstringStruct opStruct(const ::Test1::WstringStruct&,
- ::Test1::WstringStruct&,
- const Ice::Current&);
+ ::Test1::WstringStruct&,
+ const Ice::Current&);
virtual void throwExcept(const ::std::wstring&,
- const Ice::Current&);
+ const Ice::Current&);
};
}
@@ -45,15 +45,15 @@ class WstringClassI : virtual public WstringClass
public:
virtual ::std::wstring opString(const ::std::wstring&,
- ::std::wstring&,
- const Ice::Current&);
+ ::std::wstring&,
+ const Ice::Current&);
virtual ::Test2::WstringStruct opStruct(const ::Test2::WstringStruct&,
- ::Test2::WstringStruct&,
- const Ice::Current&);
+ ::Test2::WstringStruct&,
+ const Ice::Current&);
virtual void throwExcept(const ::std::wstring&,
- const Ice::Current&);
+ const Ice::Current&);
};
}
diff --git a/cppe/test/IceE/exceptions/AllTests.cpp b/cppe/test/IceE/exceptions/AllTests.cpp
index f9c3fbc7ebc..142ffc13218 100644
--- a/cppe/test/IceE/exceptions/AllTests.cpp
+++ b/cppe/test/IceE/exceptions/AllTests.cpp
@@ -23,7 +23,7 @@ class CallbackBase : public IceUtil::Monitor<IceUtil::Mutex>
public:
CallbackBase() :
- _called(false)
+ _called(false)
{
}
@@ -33,26 +33,26 @@ public:
bool check()
{
- IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
- while(!_called)
- {
- if(!timedWait(IceUtil::Time::seconds(5)))
- {
- return false;
- }
- }
- _called = false;
- return true;
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
+ while(!_called)
+ {
+ if(!timedWait(IceUtil::Time::seconds(5)))
+ {
+ return false;
+ }
+ }
+ _called = false;
+ return true;
}
protected:
void called()
{
- IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
- assert(!_called);
- _called = true;
- notify();
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
+ assert(!_called);
+ _called = true;
+ notify();
}
private:
@@ -90,67 +90,67 @@ allTests(const Ice::CommunicatorPtr& communicator)
tprintf("testing object adapter registration exceptions... ");
{
- Ice::ObjectAdapterPtr first = communicator->createObjectAdapter("TestAdapter0");
- try
- {
- Ice::ObjectAdapterPtr second = communicator->createObjectAdapter("TestAdapter0");
- test(false);
- }
- catch(const Ice::AlreadyRegisteredException&)
- {
- // Expected
- }
-
- communicator->getProperties()->setProperty("TestAdapter0.Endpoints", "");
- try
- {
- Ice::ObjectAdapterPtr second =
- communicator->createObjectAdapterWithEndpoints("TestAdapter0", "ssl -h foo -p 12011 -t 10000");
- test(false);
- }
- catch(const Ice::AlreadyRegisteredException&)
- {
- // Expected.
- }
- //
- // Properties must remain unaffected if an exception occurs.
- //
- test(communicator->getProperties()->getProperty("TestAdapter0.Endpoints") == "");
- first->deactivate();
+ Ice::ObjectAdapterPtr first = communicator->createObjectAdapter("TestAdapter0");
+ try
+ {
+ Ice::ObjectAdapterPtr second = communicator->createObjectAdapter("TestAdapter0");
+ test(false);
+ }
+ catch(const Ice::AlreadyRegisteredException&)
+ {
+ // Expected
+ }
+
+ communicator->getProperties()->setProperty("TestAdapter0.Endpoints", "");
+ try
+ {
+ Ice::ObjectAdapterPtr second =
+ communicator->createObjectAdapterWithEndpoints("TestAdapter0", "ssl -h foo -p 12011 -t 10000");
+ test(false);
+ }
+ catch(const Ice::AlreadyRegisteredException&)
+ {
+ // Expected.
+ }
+ //
+ // Properties must remain unaffected if an exception occurs.
+ //
+ test(communicator->getProperties()->getProperty("TestAdapter0.Endpoints") == "");
+ first->deactivate();
}
tprintf("ok\n");
tprintf("testing servant registration exceptions...");
{
- Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("TestAdapter1");
- Ice::ObjectPtr obj = new EmptyI;
- adapter->add(obj, communicator->stringToIdentity("x"));
- try
- {
- adapter->add(obj, communicator->stringToIdentity("x"));
- test(false);
- }
- catch(const Ice::AlreadyRegisteredException&)
- {
- }
-
- adapter->remove(communicator->stringToIdentity("x"));
- try
- {
- adapter->remove(communicator->stringToIdentity("x"));
- test(false);
- }
- catch(const Ice::NotRegisteredException&)
- {
- }
-
- adapter->deactivate();
+ Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("TestAdapter1");
+ Ice::ObjectPtr obj = new EmptyI;
+ adapter->add(obj, communicator->stringToIdentity("x"));
+ try
+ {
+ adapter->add(obj, communicator->stringToIdentity("x"));
+ test(false);
+ }
+ catch(const Ice::AlreadyRegisteredException&)
+ {
+ }
+
+ adapter->remove(communicator->stringToIdentity("x"));
+ try
+ {
+ adapter->remove(communicator->stringToIdentity("x"));
+ test(false);
+ }
+ catch(const Ice::NotRegisteredException&)
+ {
+ }
+
+ adapter->deactivate();
}
tprintf("ok\n");
tprintf("testing stringToProxy...");
string ref = communicator->getProperties()->getPropertyWithDefault(
- "Exception.Proxy", "thrower:default -p 12010 -t 10000");
+ "Exception.Proxy", "thrower:default -p 12010 -t 10000");
Ice::ObjectPrx base = communicator->stringToProxy(ref);
test(base);
tprintf("ok\n");
@@ -165,80 +165,80 @@ allTests(const Ice::CommunicatorPtr& communicator)
try
{
- thrower->throwAasA(1);
- test(false);
+ thrower->throwAasA(1);
+ test(false);
}
catch(const A& ex)
{
- test(ex.aMem == 1);
+ test(ex.aMem == 1);
}
catch(const Ice::Exception& ex)
{
- tprintf("%s\n", ex.toString().c_str());
- test(false);
+ tprintf("%s\n", ex.toString().c_str());
+ test(false);
}
catch(...)
{
- test(false);
+ test(false);
}
try
{
- thrower->throwAorDasAorD(1);
- test(false);
+ thrower->throwAorDasAorD(1);
+ test(false);
}
catch(const A& ex)
{
- test(ex.aMem == 1);
+ test(ex.aMem == 1);
}
catch(...)
{
- test(false);
+ test(false);
}
try
{
- thrower->throwAorDasAorD(-1);
- test(false);
+ thrower->throwAorDasAorD(-1);
+ test(false);
}
catch(const D& ex)
{
- test(ex.dMem == -1);
+ test(ex.dMem == -1);
}
catch(...)
{
- test(false);
+ test(false);
}
try
{
- thrower->throwBasB(1, 2);
- test(false);
+ thrower->throwBasB(1, 2);
+ test(false);
}
catch(const B& ex)
{
- test(ex.aMem == 1);
- test(ex.bMem == 2);
+ test(ex.aMem == 1);
+ test(ex.bMem == 2);
}
catch(...)
{
- test(false);
+ test(false);
}
try
{
- thrower->throwCasC(1, 2, 3);
- test(false);
+ thrower->throwCasC(1, 2, 3);
+ test(false);
}
catch(const C& ex)
{
- test(ex.aMem == 1);
- test(ex.bMem == 2);
- test(ex.cMem == 3);
+ test(ex.aMem == 1);
+ test(ex.bMem == 2);
+ test(ex.cMem == 3);
}
catch(...)
{
- test(false);
+ test(false);
}
#if (!defined(_MSC_VER) || _MSC_VER >= 1300)
@@ -247,23 +247,23 @@ allTests(const Ice::CommunicatorPtr& communicator)
//
try
{
- thrower->throwModA(1, 2);
- test(false);
+ thrower->throwModA(1, 2);
+ test(false);
}
catch(const Mod::A& ex)
{
- test(ex.aMem == 1);
- test(ex.a2Mem == 2);
+ test(ex.aMem == 1);
+ test(ex.a2Mem == 2);
}
catch(const Ice::OperationNotExistException&)
{
- //
+ //
// This operation is not supported in Java.
//
}
catch(...)
{
- test(false);
+ test(false);
}
#endif
@@ -273,31 +273,31 @@ allTests(const Ice::CommunicatorPtr& communicator)
try
{
- thrower->throwBasB(1, 2);
- test(false);
+ thrower->throwBasB(1, 2);
+ test(false);
}
catch(const A& ex)
{
- test(ex.aMem == 1);
+ test(ex.aMem == 1);
}
catch(...)
{
- test(false);
+ test(false);
}
try
{
- thrower->throwCasC(1, 2, 3);
- test(false);
+ thrower->throwCasC(1, 2, 3);
+ test(false);
}
catch(const B& ex)
{
- test(ex.aMem == 1);
- test(ex.bMem == 2);
+ test(ex.aMem == 1);
+ test(ex.bMem == 2);
}
catch(...)
{
- test(false);
+ test(false);
}
#if (!defined(_MSC_VER) || _MSC_VER >= 1300)
@@ -306,122 +306,122 @@ allTests(const Ice::CommunicatorPtr& communicator)
//
try
{
- thrower->throwModA(1, 2);
- test(false);
+ thrower->throwModA(1, 2);
+ test(false);
}
catch(const A& ex)
{
- test(ex.aMem == 1);
+ test(ex.aMem == 1);
}
catch(const Ice::OperationNotExistException&)
{
- //
+ //
// This operation is not supported in Java.
//
}
catch(...)
{
- test(false);
+ test(false);
}
#endif
tprintf("ok\n");
tprintf("catching derived types...");
-
+
try
{
- thrower->throwBasA(1, 2);
- test(false);
+ thrower->throwBasA(1, 2);
+ test(false);
}
catch(const B& ex)
{
- test(ex.aMem == 1);
- test(ex.bMem == 2);
+ test(ex.aMem == 1);
+ test(ex.bMem == 2);
}
catch(...)
{
- test(false);
+ test(false);
}
try
{
- thrower->throwCasA(1, 2, 3);
- test(false);
+ thrower->throwCasA(1, 2, 3);
+ test(false);
}
catch(const C& ex)
{
- test(ex.aMem == 1);
- test(ex.bMem == 2);
- test(ex.cMem == 3);
+ test(ex.aMem == 1);
+ test(ex.bMem == 2);
+ test(ex.cMem == 3);
}
catch(...)
{
- test(false);
+ test(false);
}
try
{
- thrower->throwCasB(1, 2, 3);
- test(false);
+ thrower->throwCasB(1, 2, 3);
+ test(false);
}
catch(const C& ex)
{
- test(ex.aMem == 1);
- test(ex.bMem == 2);
- test(ex.cMem == 3);
+ test(ex.aMem == 1);
+ test(ex.bMem == 2);
+ test(ex.cMem == 3);
}
catch(...)
{
- test(false);
+ test(false);
}
tprintf("ok\n");
if(thrower->supportsUndeclaredExceptions())
{
- tprintf("catching unknown user exception...");
-
- try
- {
- thrower->throwUndeclaredA(1);
- test(false);
- }
- catch(const Ice::UnknownUserException&)
- {
- }
- catch(...)
- {
- test(false);
- }
-
- try
- {
- thrower->throwUndeclaredB(1, 2);
- test(false);
- }
- catch(const Ice::UnknownUserException&)
- {
- }
- catch(...)
- {
- test(false);
- }
-
- try
- {
- thrower->throwUndeclaredC(1, 2, 3);
- test(false);
- }
- catch(const Ice::UnknownUserException&)
- {
- }
- catch(...)
- {
- test(false);
- }
-
- tprintf("ok\n");
+ tprintf("catching unknown user exception...");
+
+ try
+ {
+ thrower->throwUndeclaredA(1);
+ test(false);
+ }
+ catch(const Ice::UnknownUserException&)
+ {
+ }
+ catch(...)
+ {
+ test(false);
+ }
+
+ try
+ {
+ thrower->throwUndeclaredB(1, 2);
+ test(false);
+ }
+ catch(const Ice::UnknownUserException&)
+ {
+ }
+ catch(...)
+ {
+ test(false);
+ }
+
+ try
+ {
+ thrower->throwUndeclaredC(1, 2, 3);
+ test(false);
+ }
+ catch(const Ice::UnknownUserException&)
+ {
+ }
+ catch(...)
+ {
+ test(false);
+ }
+
+ tprintf("ok\n");
}
tprintf("catching object not exist exception...");
@@ -429,18 +429,18 @@ allTests(const Ice::CommunicatorPtr& communicator)
Ice::Identity id = communicator->stringToIdentity("does not exist");
try
{
- ThrowerPrx thrower2 = ThrowerPrx::uncheckedCast(thrower->ice_identity(id));
- thrower2->throwAasA(1);
-// thrower2->ice_ping();
- test(false);
+ ThrowerPrx thrower2 = ThrowerPrx::uncheckedCast(thrower->ice_identity(id));
+ thrower2->throwAasA(1);
+// thrower2->ice_ping();
+ test(false);
}
catch(const Ice::ObjectNotExistException& ex)
{
- test(ex.id == id);
+ test(ex.id == id);
}
catch(...)
{
- test(false);
+ test(false);
}
tprintf("ok\n");
@@ -450,12 +450,12 @@ allTests(const Ice::CommunicatorPtr& communicator)
ThrowerPrx thrower2 = ThrowerPrx::uncheckedCast(thrower, "no such facet");
try
{
- thrower2->ice_ping();
- test(false);
+ thrower2->ice_ping();
+ test(false);
}
catch(const Ice::FacetNotExistException& ex)
{
- test(ex.facet == "no such facet");
+ test(ex.facet == "no such facet");
}
tprintf("ok\n");
@@ -463,17 +463,17 @@ allTests(const Ice::CommunicatorPtr& communicator)
try
{
- WrongOperationPrx thrower2 = WrongOperationPrx::uncheckedCast(thrower);
- thrower2->noSuchOperation();
- test(false);
+ WrongOperationPrx thrower2 = WrongOperationPrx::uncheckedCast(thrower);
+ thrower2->noSuchOperation();
+ test(false);
}
catch(const Ice::OperationNotExistException& ex)
{
- test(ex.operation == "noSuchOperation");
+ test(ex.operation == "noSuchOperation");
}
catch(...)
{
- test(false);
+ test(false);
}
tprintf("ok\n");
@@ -482,15 +482,15 @@ allTests(const Ice::CommunicatorPtr& communicator)
try
{
- thrower->throwLocalException();
- test(false);
+ thrower->throwLocalException();
+ test(false);
}
catch(const Ice::UnknownLocalException&)
{
}
catch(...)
{
- test(false);
+ test(false);
}
tprintf("ok\n");
@@ -499,15 +499,15 @@ allTests(const Ice::CommunicatorPtr& communicator)
try
{
- thrower->throwNonIceException();
- test(false);
+ thrower->throwNonIceException();
+ test(false);
}
catch(const Ice::UnknownException&)
{
}
catch(...)
{
- assert(false);
+ assert(false);
}
tprintf("ok\n");
diff --git a/cppe/test/IceE/exceptions/Client.cpp b/cppe/test/IceE/exceptions/Client.cpp
index db5a032376c..8eb51491752 100644
--- a/cppe/test/IceE/exceptions/Client.cpp
+++ b/cppe/test/IceE/exceptions/Client.cpp
@@ -29,7 +29,7 @@ public:
Ice::InitializationData initData;
initData.properties = Ice::createProperties();
loadConfig(initData.properties);
- initData.logger = getLogger();
+ initData.logger = getLogger();
setCommunicator(Ice::initialize(argc, argv, initData));
ThrowerPrx allTests(const Ice::CommunicatorPtr&);
diff --git a/cppe/test/IceE/exceptions/Collocated.cpp b/cppe/test/IceE/exceptions/Collocated.cpp
index 840c87b2cac..1f782485520 100644
--- a/cppe/test/IceE/exceptions/Collocated.cpp
+++ b/cppe/test/IceE/exceptions/Collocated.cpp
@@ -27,13 +27,13 @@ public:
run(int argc, char* argv[])
{
Ice::InitializationData initData;
- initData.properties = Ice::createProperties();
+ initData.properties = Ice::createProperties();
- initData.properties->setProperty("TestAdapter.Endpoints", "default -p 12010 -t 10000");
+ initData.properties->setProperty("TestAdapter.Endpoints", "default -p 12010 -t 10000");
initData.properties->setProperty("Ice.Warn.Dispatch", "0");
loadConfig(initData.properties);
- initData.logger = getLogger();
+ initData.logger = getLogger();
setCommunicator(Ice::initialize(argc, argv, initData));
Ice::ObjectAdapterPtr adapter = communicator()->createObjectAdapter("TestAdapter");
diff --git a/cppe/test/IceE/exceptions/Server.cpp b/cppe/test/IceE/exceptions/Server.cpp
index 74d40626abd..3766b81011f 100644
--- a/cppe/test/IceE/exceptions/Server.cpp
+++ b/cppe/test/IceE/exceptions/Server.cpp
@@ -26,12 +26,12 @@ public:
run(int argc, char* argv[])
{
Ice::InitializationData initData;
- initData.properties = Ice::createProperties();
+ initData.properties = Ice::createProperties();
initData.properties->setProperty("Ice.Warn.Dispatch", "0");
initData.properties->setProperty("TestAdapter.Endpoints", "default -p 12010 -t 10000");
loadConfig(initData.properties);
- initData.logger = getLogger();
+ initData.logger = getLogger();
setCommunicator(Ice::initialize(argc, argv, initData));
Ice::ObjectAdapterPtr adapter = communicator()->createObjectAdapter("TestAdapter");
@@ -40,7 +40,7 @@ public:
adapter->activate();
#ifndef _WIN32_WCE
- communicator()->waitForShutdown();
+ communicator()->waitForShutdown();
#endif
return EXIT_SUCCESS;
diff --git a/cppe/test/IceE/exceptions/Test.ice b/cppe/test/IceE/exceptions/Test.ice
index aaa85038674..a8446418555 100644
--- a/cppe/test/IceE/exceptions/Test.ice
+++ b/cppe/test/IceE/exceptions/Test.ice
@@ -43,7 +43,7 @@ module Mod
{
exception A extends ::Test::A
{
- int a2Mem;
+ int a2Mem;
};
};
diff --git a/cppe/test/IceE/exceptions/TestI.cpp b/cppe/test/IceE/exceptions/TestI.cpp
index addf3c3bdae..72a0547cf6d 100644
--- a/cppe/test/IceE/exceptions/TestI.cpp
+++ b/cppe/test/IceE/exceptions/TestI.cpp
@@ -52,15 +52,15 @@ ThrowerI::throwAorDasAorD(Ice::Int a, const Ice::Current&)
{
if(a > 0)
{
- A ex;
- ex.aMem = a;
- throw ex;
+ A ex;
+ ex.aMem = a;
+ throw ex;
}
else
{
- D ex;
- ex.dMem = a;
- throw ex;
+ D ex;
+ ex.dMem = a;
+ throw ex;
}
}
diff --git a/cppe/test/IceE/facets/AllTests.cpp b/cppe/test/IceE/facets/AllTests.cpp
index 1618d592b48..4c33df3c372 100644
--- a/cppe/test/IceE/facets/AllTests.cpp
+++ b/cppe/test/IceE/facets/AllTests.cpp
@@ -28,8 +28,8 @@ allTests(const Ice::CommunicatorPtr& communicator)
adapter->addFacet(obj, communicator->stringToIdentity("d"), "facetABCD");
try
{
- adapter->addFacet(obj, communicator->stringToIdentity("d"), "facetABCD");
- test(false);
+ adapter->addFacet(obj, communicator->stringToIdentity("d"), "facetABCD");
+ test(false);
}
catch(Ice::AlreadyRegisteredException&)
{
@@ -37,8 +37,8 @@ allTests(const Ice::CommunicatorPtr& communicator)
adapter->removeFacet(communicator->stringToIdentity("d"), "facetABCD");
try
{
- adapter->removeFacet(communicator->stringToIdentity("d"), "facetABCD");
- test(false);
+ adapter->removeFacet(communicator->stringToIdentity("d"), "facetABCD");
+ test(false);
}
catch(Ice::NotRegisteredException&)
{
@@ -60,8 +60,8 @@ allTests(const Ice::CommunicatorPtr& communicator)
test(fm["f2"] == obj2);
try
{
- adapter->removeAllFacets(communicator->stringToIdentity("id1"));
- test(false);
+ adapter->removeAllFacets(communicator->stringToIdentity("id1"));
+ test(false);
}
catch(Ice::NotRegisteredException&)
{
diff --git a/cppe/test/IceE/facets/Client.cpp b/cppe/test/IceE/facets/Client.cpp
index 648bb51f897..759ff89500d 100644
--- a/cppe/test/IceE/facets/Client.cpp
+++ b/cppe/test/IceE/facets/Client.cpp
@@ -29,7 +29,7 @@ public:
Ice::InitializationData initData;
initData.properties = Ice::createProperties();
loadConfig(initData.properties);
- initData.logger = getLogger();
+ initData.logger = getLogger();
setCommunicator(Ice::initialize(argc, argv, initData));
GPrx allTests(const Ice::CommunicatorPtr&);
diff --git a/cppe/test/IceE/facets/Collocated.cpp b/cppe/test/IceE/facets/Collocated.cpp
index 5dd2b53ba2b..6783c38ef8c 100644
--- a/cppe/test/IceE/facets/Collocated.cpp
+++ b/cppe/test/IceE/facets/Collocated.cpp
@@ -27,11 +27,11 @@ public:
run(int argc, char* argv[])
{
Ice::InitializationData initData;
- initData.properties = Ice::createProperties();
- initData.properties->setProperty("TestAdapter.Endpoints", "default -p 12010 -t 10000");
+ initData.properties = Ice::createProperties();
+ initData.properties->setProperty("TestAdapter.Endpoints", "default -p 12010 -t 10000");
loadConfig(initData.properties);
- initData.logger = getLogger();
+ initData.logger = getLogger();
setCommunicator(Ice::initialize(argc, argv, initData));
Ice::ObjectAdapterPtr adapter = communicator()->createObjectAdapter("TestAdapter");
diff --git a/cppe/test/IceE/facets/Server.cpp b/cppe/test/IceE/facets/Server.cpp
index 56761890a34..d19453c2418 100644
--- a/cppe/test/IceE/facets/Server.cpp
+++ b/cppe/test/IceE/facets/Server.cpp
@@ -26,11 +26,11 @@ public:
run(int argc, char* argv[])
{
Ice::InitializationData initData;
- initData.properties = Ice::createProperties();
- initData.properties->setProperty("TestAdapter.Endpoints", "default -p 12010 -t 10000");
+ initData.properties = Ice::createProperties();
+ initData.properties->setProperty("TestAdapter.Endpoints", "default -p 12010 -t 10000");
loadConfig(initData.properties);
- initData.logger = getLogger();
+ initData.logger = getLogger();
setCommunicator(Ice::initialize(argc, argv, initData));
Ice::ObjectAdapterPtr adapter = communicator()->createObjectAdapter("TestAdapter");
@@ -45,7 +45,7 @@ public:
adapter->activate();
#ifndef _WIN32_WCE
- communicator()->waitForShutdown();
+ communicator()->waitForShutdown();
#endif
return EXIT_SUCCESS;
diff --git a/cppe/test/IceE/faultTolerance/AllTests.cpp b/cppe/test/IceE/faultTolerance/AllTests.cpp
index 6419c459288..00ae6a200d9 100644
--- a/cppe/test/IceE/faultTolerance/AllTests.cpp
+++ b/cppe/test/IceE/faultTolerance/AllTests.cpp
@@ -20,7 +20,7 @@ class CallbackBase : public IceUtil::Monitor<IceUtil::Mutex>
public:
CallbackBase() :
- _called(false)
+ _called(false)
{
}
@@ -30,26 +30,26 @@ public:
bool check()
{
- IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
- while(!_called)
- {
- if(!timedWait(IceUtil::Time::seconds(30)))
- {
- return false;
- }
- }
- _called = false;
- return true;
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
+ while(!_called)
+ {
+ if(!timedWait(IceUtil::Time::seconds(30)))
+ {
+ return false;
+ }
+ }
+ _called = false;
+ return true;
}
protected:
void called()
{
- IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
- assert(!_called);
- _called = true;
- notify();
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
+ assert(!_called);
+ _called = true;
+ notify();
}
private:
@@ -67,7 +67,7 @@ allTests(const Ice::CommunicatorPtr& communicator, const vector<int>& ports)
for(vector<int>::const_iterator p = ports.begin(); p != ports.end(); ++p)
{
sprintf(buf, ":default -t 60000 -p %d", *p);
- ref += buf;
+ ref += buf;
}
Ice::ObjectPrx base = communicator->stringToProxy(ref);
test(base);
@@ -82,73 +82,73 @@ allTests(const Ice::CommunicatorPtr& communicator, const vector<int>& ports)
int oldPid = 0;
for(unsigned int i = 1, j = 0; i <= ports.size(); ++i, ++j)
{
- if(j > 3)
- {
- j = 0;
- }
-
- tprintf("testing server #%d...", i);
- int pid = obj->pid();
- test(pid != oldPid);
- tprintf("ok\n");
- oldPid = pid;
-
- if(j == 0)
- {
- tprintf("shutting down server #%d...", i);
- obj->shutdown();
- tprintf("ok\n");
- }
- else if(j == 1 || i + 1 > ports.size())
- {
- tprintf("aborting server #%d...", i);
- try
- {
- obj->abort();
- test(false);
- }
- catch(const Ice::ConnectionLostException&)
- {
- tprintf("ok\n");
- }
- catch(const Ice::ConnectFailedException&)
- {
- tprintf("ok\n");
- }
- }
- else if(j == 2 || j == 3)
- {
- tprintf("aborting server #%d and #%d with idempotent call...", i, i + 1);
- try
- {
- obj->idempotentAbort();
- test(false);
- }
- catch(const Ice::ConnectionLostException&)
- {
- tprintf("ok\n");
- }
- catch(const Ice::ConnectFailedException&)
- {
- tprintf("ok\n");
- }
-
- ++i;
- }
- else
- {
- assert(false);
- }
+ if(j > 3)
+ {
+ j = 0;
+ }
+
+ tprintf("testing server #%d...", i);
+ int pid = obj->pid();
+ test(pid != oldPid);
+ tprintf("ok\n");
+ oldPid = pid;
+
+ if(j == 0)
+ {
+ tprintf("shutting down server #%d...", i);
+ obj->shutdown();
+ tprintf("ok\n");
+ }
+ else if(j == 1 || i + 1 > ports.size())
+ {
+ tprintf("aborting server #%d...", i);
+ try
+ {
+ obj->abort();
+ test(false);
+ }
+ catch(const Ice::ConnectionLostException&)
+ {
+ tprintf("ok\n");
+ }
+ catch(const Ice::ConnectFailedException&)
+ {
+ tprintf("ok\n");
+ }
+ }
+ else if(j == 2 || j == 3)
+ {
+ tprintf("aborting server #%d and #%d with idempotent call...", i, i + 1);
+ try
+ {
+ obj->idempotentAbort();
+ test(false);
+ }
+ catch(const Ice::ConnectionLostException&)
+ {
+ tprintf("ok\n");
+ }
+ catch(const Ice::ConnectFailedException&)
+ {
+ tprintf("ok\n");
+ }
+
+ ++i;
+ }
+ else
+ {
+ assert(false);
+ }
}
tprintf("testing whether all servers are gone...");
try
{
- obj->ice_ping();
- test(false);
+ obj->ice_ping();
+ test(false);
}
catch(const Ice::LocalException&)
{
- tprintf("ok\n");
+ tprintf("ok\n");
}
}
diff --git a/cppe/test/IceE/faultTolerance/Client.cpp b/cppe/test/IceE/faultTolerance/Client.cpp
index 0ec60e1dc98..2b02da88245 100644
--- a/cppe/test/IceE/faultTolerance/Client.cpp
+++ b/cppe/test/IceE/faultTolerance/Client.cpp
@@ -31,45 +31,45 @@ public:
virtual int
run(int argc, char* argv[])
{
- Ice::InitializationData initData;
- initData.properties = Ice::createProperties();
+ Ice::InitializationData initData;
+ initData.properties = Ice::createProperties();
loadConfig(initData.properties);
- //
- // This test aborts servers, so we don't want warnings.
- //
- setCommunicator(Ice::initialize(argc, argv, initData));
- communicator()->getProperties()->setProperty("Ice.Warn.Connections", "0");
+ //
+ // This test aborts servers, so we don't want warnings.
+ //
+ setCommunicator(Ice::initialize(argc, argv, initData));
+ communicator()->getProperties()->setProperty("Ice.Warn.Connections", "0");
vector<int> ports;
for(int i = 1; i < argc; ++i)
{
- if(argv[i][0] == '-')
- {
- tprintf("%s: unknown option `%s'\n", argv[0], argv[i]);
- usage(argv[0]);
- return EXIT_FAILURE;
- }
+ if(argv[i][0] == '-')
+ {
+ tprintf("%s: unknown option `%s'\n", argv[0], argv[i]);
+ usage(argv[0]);
+ return EXIT_FAILURE;
+ }
- ports.push_back(atoi(argv[i]));
+ ports.push_back(atoi(argv[i]));
}
if(ports.empty())
{
- tprintf("%s: no ports specified\n", argv[0]);
- usage(argv[0]);
- return EXIT_FAILURE;
+ tprintf("%s: no ports specified\n", argv[0]);
+ usage(argv[0]);
+ return EXIT_FAILURE;
}
try
{
- void allTests(const Ice::CommunicatorPtr&, const vector<int>&);
- allTests(communicator(), ports);
+ void allTests(const Ice::CommunicatorPtr&, const vector<int>&);
+ allTests(communicator(), ports);
}
catch(const Ice::Exception& ex)
{
- tprintf("%s\n", ex.toString().c_str());
- test(false);
+ tprintf("%s\n", ex.toString().c_str());
+ test(false);
}
return EXIT_SUCCESS;
diff --git a/cppe/test/IceE/faultTolerance/Server.cpp b/cppe/test/IceE/faultTolerance/Server.cpp
index dd40afbf034..b5aa9db8cc1 100644
--- a/cppe/test/IceE/faultTolerance/Server.cpp
+++ b/cppe/test/IceE/faultTolerance/Server.cpp
@@ -35,34 +35,34 @@ public:
Ice::InitializationData initData;
initData.properties = Ice::createProperties();
loadConfig(initData.properties);
- initData.logger = getLogger();
+ initData.logger = getLogger();
setCommunicator(Ice::initialize(argc, argv, initData));
int port = 0;
for(int i = 1; i < argc; ++i)
{
- if(argv[i][0] == '-')
- {
- tprintf("%s: unknown option `%s'\n", argv[0], argv[i]);
- usage(argv[0]);
- return EXIT_FAILURE;
- }
+ if(argv[i][0] == '-')
+ {
+ tprintf("%s: unknown option `%s'\n", argv[0], argv[i]);
+ usage(argv[0]);
+ return EXIT_FAILURE;
+ }
- if(port > 0)
- {
- tprintf("%s: only one port can be specified\n", argv[0]);
- usage(argv[0]);
- return EXIT_FAILURE;
- }
+ if(port > 0)
+ {
+ tprintf("%s: only one port can be specified\n", argv[0]);
+ usage(argv[0]);
+ return EXIT_FAILURE;
+ }
- port = atoi(argv[i]);
+ port = atoi(argv[i]);
}
if(port <= 0)
{
- tprintf("%s: no port specified\n", argv[0]);
- usage(argv[0]);
- return EXIT_FAILURE;
+ tprintf("%s: no port specified\n", argv[0]);
+ usage(argv[0]);
+ return EXIT_FAILURE;
}
char buf[32];
diff --git a/cppe/test/IceE/inheritance/AllTests.cpp b/cppe/test/IceE/inheritance/AllTests.cpp
index 2717bd60594..3b5c26becf4 100644
--- a/cppe/test/IceE/inheritance/AllTests.cpp
+++ b/cppe/test/IceE/inheritance/AllTests.cpp
@@ -19,7 +19,7 @@ allTests(const Ice::CommunicatorPtr& communicator)
{
tprintf("testing stringToProxy...");
string ref = communicator->getProperties()->getPropertyWithDefault(
- "Inheritance.Proxy", "initial:default -p 12010 -t 10000");
+ "Inheritance.Proxy", "initial:default -p 12010 -t 10000");
Ice::ObjectPrx base = communicator->stringToProxy(ref);
test(base);
tprintf("ok\n");
diff --git a/cppe/test/IceE/inheritance/Client.cpp b/cppe/test/IceE/inheritance/Client.cpp
index a070bb15aef..252454ded15 100644
--- a/cppe/test/IceE/inheritance/Client.cpp
+++ b/cppe/test/IceE/inheritance/Client.cpp
@@ -29,7 +29,7 @@ public:
Ice::InitializationData initData;
initData.properties = Ice::createProperties();
loadConfig(initData.properties);
- initData.logger = getLogger();
+ initData.logger = getLogger();
setCommunicator(Ice::initialize(argc, argv, initData));
InitialPrx allTests(const Ice::CommunicatorPtr&);
diff --git a/cppe/test/IceE/inheritance/Collocated.cpp b/cppe/test/IceE/inheritance/Collocated.cpp
index 279f6e6334d..009cf007a60 100644
--- a/cppe/test/IceE/inheritance/Collocated.cpp
+++ b/cppe/test/IceE/inheritance/Collocated.cpp
@@ -27,11 +27,11 @@ public:
run(int argc, char* argv[])
{
Ice::InitializationData initData;
- initData.properties = Ice::createProperties();
+ initData.properties = Ice::createProperties();
initData.properties->setProperty("TestAdapter.Endpoints", "default -p 12010 -t 10000");
loadConfig(initData.properties);
- initData.logger = getLogger();
+ initData.logger = getLogger();
setCommunicator(Ice::initialize(argc, argv, initData));
Ice::ObjectAdapterPtr adapter = communicator()->createObjectAdapter("TestAdapter");
diff --git a/cppe/test/IceE/inheritance/Server.cpp b/cppe/test/IceE/inheritance/Server.cpp
index 819a636903c..1ef7faa4849 100644
--- a/cppe/test/IceE/inheritance/Server.cpp
+++ b/cppe/test/IceE/inheritance/Server.cpp
@@ -25,12 +25,12 @@ public:
virtual int
run(int argc, char* argv[])
{
- Ice::InitializationData initData;
- initData.properties = Ice::createProperties();
+ Ice::InitializationData initData;
+ initData.properties = Ice::createProperties();
initData.properties->setProperty("TestAdapter.Endpoints", "default -p 12010 -t 10000");
loadConfig(initData.properties);
- initData.logger = getLogger();
+ initData.logger = getLogger();
setCommunicator(Ice::initialize(argc, argv, initData));
Ice::ObjectAdapterPtr adapter = communicator()->createObjectAdapter("TestAdapter");
@@ -39,7 +39,7 @@ public:
adapter->activate();
#ifndef _WIN32_WCE
- communicator()->waitForShutdown();
+ communicator()->waitForShutdown();
#endif
return EXIT_SUCCESS;
diff --git a/cppe/test/IceE/inheritance/TestI.h b/cppe/test/IceE/inheritance/TestI.h
index c6142467982..44d23af9e69 100644
--- a/cppe/test/IceE/inheritance/TestI.h
+++ b/cppe/test/IceE/inheritance/TestI.h
@@ -74,7 +74,7 @@ class IB1I : virtual public Test::MB::IB1, virtual public IAI
{
public:
- virtual Test::MB::IB1Prx ib1op(const Test::MB::IB1Prx&, const Ice::Current&);
+ virtual Test::MB::IB1Prx ib1op(const Test::MB::IB1Prx&, const Ice::Current&);
};
class IB2I : virtual public Test::MB::IB2, virtual public IAI
diff --git a/cppe/test/IceE/location/AllTests.cpp b/cppe/test/IceE/location/AllTests.cpp
index 4d751fd8c57..7d423792675 100644
--- a/cppe/test/IceE/location/AllTests.cpp
+++ b/cppe/test/IceE/location/AllTests.cpp
@@ -27,9 +27,9 @@ void
allTests(const Ice::CommunicatorPtr& communicator)
{
ServerManagerPrx manager = ServerManagerPrx::checkedCast(
- communicator->stringToProxy(
- communicator->getProperties()->getPropertyWithDefault(
- "Location.Proxy", "ServerManager:default -p 12010 -t 10000")));
+ communicator->stringToProxy(
+ communicator->getProperties()->getPropertyWithDefault(
+ "Location.Proxy", "ServerManager:default -p 12010 -t 10000")));
Ice::LocatorPrx locator = Ice::LocatorPrx::uncheckedCast(communicator->getDefaultLocator());
test(manager);
@@ -102,12 +102,12 @@ allTests(const Ice::CommunicatorPtr& communicator)
manager->startServer();
try
{
- obj2 = TestIntfPrx::checkedCast(base2);
- obj2->ice_ping();
+ obj2 = TestIntfPrx::checkedCast(base2);
+ obj2->ice_ping();
}
catch(const Ice::LocalException&)
{
- test(false);
+ test(false);
}
tprintf("ok\n");
@@ -116,12 +116,12 @@ allTests(const Ice::CommunicatorPtr& communicator)
manager->startServer();
try
{
- obj6 = TestIntfPrx::checkedCast(base6);
- obj6->ice_ping();
+ obj6 = TestIntfPrx::checkedCast(base6);
+ obj6->ice_ping();
}
catch(const Ice::LocalException&)
{
- test(false);
+ test(false);
}
tprintf("ok\n");
@@ -130,115 +130,115 @@ allTests(const Ice::CommunicatorPtr& communicator)
manager->startServer();
try
{
- obj3 = TestIntfPrx::checkedCast(base3);
- obj3->ice_ping();
+ obj3 = TestIntfPrx::checkedCast(base3);
+ obj3->ice_ping();
}
catch(const Ice::LocalException&)
{
- test(false);
+ test(false);
}
try
{
- obj2 = TestIntfPrx::checkedCast(base2);
- obj2->ice_ping();
+ obj2 = TestIntfPrx::checkedCast(base2);
+ obj2->ice_ping();
}
catch(const Ice::LocalException&)
{
- test(false);
+ test(false);
}
obj->shutdown();
manager->startServer();
try
{
- obj2 = TestIntfPrx::checkedCast(base2);
- obj2->ice_ping();
+ obj2 = TestIntfPrx::checkedCast(base2);
+ obj2->ice_ping();
}
catch(const Ice::LocalException&)
{
- test(false);
+ test(false);
}
try
{
- obj3 = TestIntfPrx::checkedCast(base3);
- obj3->ice_ping();
+ obj3 = TestIntfPrx::checkedCast(base3);
+ obj3->ice_ping();
}
catch(const Ice::LocalException&)
{
- test(false);
+ test(false);
}
obj->shutdown();
manager->startServer();
try
{
- obj2 = TestIntfPrx::checkedCast(base2);
- obj2->ice_ping();
+ obj2 = TestIntfPrx::checkedCast(base2);
+ obj2->ice_ping();
}
catch(const Ice::LocalException&)
{
- test(false);
+ test(false);
}
obj->shutdown();
manager->startServer();
try
{
- obj3 = TestIntfPrx::checkedCast(base3);
- obj3->ice_ping();
+ obj3 = TestIntfPrx::checkedCast(base3);
+ obj3->ice_ping();
}
catch(const Ice::LocalException&)
{
- test(false);
+ test(false);
}
obj->shutdown();
manager->startServer();
try
{
- obj2 = TestIntfPrx::checkedCast(base2);
- obj2->ice_ping();
+ obj2 = TestIntfPrx::checkedCast(base2);
+ obj2->ice_ping();
}
catch(const Ice::LocalException&)
{
- test(false);
+ test(false);
}
obj->shutdown();
manager->startServer();
try
{
- obj5 = TestIntfPrx::checkedCast(base5);
- obj5->ice_ping();
+ obj5 = TestIntfPrx::checkedCast(base5);
+ obj5->ice_ping();
}
catch(const Ice::LocalException&)
{
- test(false);
+ test(false);
}
tprintf("ok\n");
tprintf("testing reference with unknown identity...");
try
{
- base = communicator->stringToProxy("unknown/unknown");
- base->ice_ping();
- test(false);
+ base = communicator->stringToProxy("unknown/unknown");
+ base->ice_ping();
+ test(false);
}
catch (const Ice::NotRegisteredException& ex)
{
- test(ex.kindOfObject == "object");
- test(ex.id == "unknown/unknown");
+ test(ex.kindOfObject == "object");
+ test(ex.id == "unknown/unknown");
}
tprintf("ok\n");
tprintf("testing reference with unknown adapter...");
try
{
- base = communicator->stringToProxy("test @ TestAdapterUnknown");
- base->ice_ping();
- test(false);
+ base = communicator->stringToProxy("test @ TestAdapterUnknown");
+ base->ice_ping();
+ test(false);
}
catch (const Ice::NotRegisteredException& ex)
{
- test(ex.kindOfObject == "object adapter");
- test(ex.id == "TestAdapterUnknown");
+ test(ex.kindOfObject == "object adapter");
+ test(ex.id == "TestAdapterUnknown");
}
tprintf("ok\n");
@@ -274,24 +274,24 @@ allTests(const Ice::CommunicatorPtr& communicator)
tprintf("testing whether server is gone...");
try
{
- obj2->ice_ping();
- test(false);
+ obj2->ice_ping();
+ test(false);
}
catch(const Ice::LocalException&)
{
}
try
{
- obj3->ice_ping();
- test(false);
+ obj3->ice_ping();
+ test(false);
}
catch(const Ice::LocalException&)
{
}
try
{
- obj5->ice_ping();
- test(false);
+ obj5->ice_ping();
+ test(false);
}
catch(const Ice::LocalException&)
{
diff --git a/cppe/test/IceE/location/Client.cpp b/cppe/test/IceE/location/Client.cpp
index 9e4b52d9410..e0c06ab82d8 100644
--- a/cppe/test/IceE/location/Client.cpp
+++ b/cppe/test/IceE/location/Client.cpp
@@ -29,25 +29,25 @@ public:
run(int argc, char* argv[])
{
Ice::InitializationData initData;
- initData.properties = Ice::createProperties(argc, argv);
+ initData.properties = Ice::createProperties(argc, argv);
loadConfig(initData.properties);
- //
- // For blocking client change retry interval from default.
- //
- if(initData.properties->getPropertyAsInt("Ice.Blocking") > 0)
- {
- initData.properties->setProperty("Ice.RetryIntervals", "0 0");
- initData.properties->setProperty("Ice.Warn.Connections", "0");
- }
-
- initData.properties->setProperty("Ice.Default.Locator",
- initData.properties->getPropertyWithDefault("Location.Locator", "locator:default -p 12010"));
- initData.logger = getLogger();
+ //
+ // For blocking client change retry interval from default.
+ //
+ if(initData.properties->getPropertyAsInt("Ice.Blocking") > 0)
+ {
+ initData.properties->setProperty("Ice.RetryIntervals", "0 0");
+ initData.properties->setProperty("Ice.Warn.Connections", "0");
+ }
+
+ initData.properties->setProperty("Ice.Default.Locator",
+ initData.properties->getPropertyWithDefault("Location.Locator", "locator:default -p 12010"));
+ initData.logger = getLogger();
setCommunicator(Ice::initialize(argc, argv, initData));
void allTests(const Ice::CommunicatorPtr&);
- allTests(communicator());
+ allTests(communicator());
return EXIT_SUCCESS;
}
diff --git a/cppe/test/IceE/location/Server.cpp b/cppe/test/IceE/location/Server.cpp
index d600275c265..21d6d1c23eb 100644
--- a/cppe/test/IceE/location/Server.cpp
+++ b/cppe/test/IceE/location/Server.cpp
@@ -29,34 +29,34 @@ public:
virtual int
run(int argc, char* argv[])
{
- Ice::InitializationData initData;
- initData.properties = Ice::createProperties(argc, argv);
+ Ice::InitializationData initData;
+ initData.properties = Ice::createProperties(argc, argv);
initData.properties->setProperty("ServerManager.Endpoints", "default -p 12010");
loadConfig(initData.properties);
- //
- // For blocking client test, set timeout so CloseConnection send will
- // return quickly. Otherwise server will hang since client is not
- // listening for these messages.
- //
- if(initData.properties->getPropertyAsInt("Ice.Blocking") > 0)
- {
- initData.properties->setProperty("Ice.Override.Timeout", "100");
- initData.properties->setProperty("Ice.Warn.Connections", "0");
- }
-
- //
- // These properties cannot be overridden. The OAs started by
- // the ServerManager must be local.
- //
- initData.properties->setProperty("TestAdapter.Endpoints", "default");
- initData.properties->setProperty("TestAdapter.AdapterId", "TestAdapter");
- initData.properties->setProperty("TestAdapter.ReplicaGroupId", "ReplicatedAdapter");
- initData.properties->setProperty("TestAdapter2.Endpoints", "default");
- initData.properties->setProperty("TestAdapter2.AdapterId", "TestAdapter2");
-
- initData.logger = getLogger();
+ //
+ // For blocking client test, set timeout so CloseConnection send will
+ // return quickly. Otherwise server will hang since client is not
+ // listening for these messages.
+ //
+ if(initData.properties->getPropertyAsInt("Ice.Blocking") > 0)
+ {
+ initData.properties->setProperty("Ice.Override.Timeout", "100");
+ initData.properties->setProperty("Ice.Warn.Connections", "0");
+ }
+
+ //
+ // These properties cannot be overridden. The OAs started by
+ // the ServerManager must be local.
+ //
+ initData.properties->setProperty("TestAdapter.Endpoints", "default");
+ initData.properties->setProperty("TestAdapter.AdapterId", "TestAdapter");
+ initData.properties->setProperty("TestAdapter.ReplicaGroupId", "ReplicatedAdapter");
+ initData.properties->setProperty("TestAdapter2.Endpoints", "default");
+ initData.properties->setProperty("TestAdapter2.AdapterId", "TestAdapter2");
+
+ initData.logger = getLogger();
setCommunicator(Ice::initialize(argc, argv, initData));
//
@@ -78,7 +78,7 @@ public:
adapter->add(object, communicator()->stringToIdentity("ServerManager"));
Ice::LocatorRegistryPrx registryPrx =
- Ice::LocatorRegistryPrx::uncheckedCast(adapter->add(registry, communicator()->stringToIdentity("registry")));
+ Ice::LocatorRegistryPrx::uncheckedCast(adapter->add(registry, communicator()->stringToIdentity("registry")));
Ice::LocatorPtr locator = new ServerLocator(registry, registryPrx);
adapter->add(locator, communicator()->stringToIdentity("locator"));
@@ -86,7 +86,7 @@ public:
adapter->activate();
#ifndef _WIN32_WCE
- communicator()->waitForShutdown();
+ communicator()->waitForShutdown();
#endif
return EXIT_SUCCESS;
diff --git a/cppe/test/IceE/location/ServerLocator.cpp b/cppe/test/IceE/location/ServerLocator.cpp
index 03b5aec3986..32ca76d6925 100644
--- a/cppe/test/IceE/location/ServerLocator.cpp
+++ b/cppe/test/IceE/location/ServerLocator.cpp
@@ -23,14 +23,14 @@ ServerLocatorRegistry::ServerLocatorRegistry()
void
ServerLocatorRegistry::setAdapterDirectProxy(const ::std::string& adapter, const ::Ice::ObjectPrx& object,
- const ::Ice::Current&)
+ const ::Ice::Current&)
{
_adapters[adapter] = object;
}
void
ServerLocatorRegistry::setReplicatedAdapterDirectProxy(const std::string& adapter, const std::string& replicaId,
- const ::Ice::ObjectPrx& object, const ::Ice::Current&)
+ const ::Ice::ObjectPrx& object, const ::Ice::Current&)
{
_adapters[adapter] = object;
_adapters[replicaId] = object;
@@ -42,7 +42,7 @@ ServerLocatorRegistry::getAdapter(const ::std::string& adapter) const
::std::map< string, ::Ice::ObjectPrx>::const_iterator p = _adapters.find(adapter);
if(_adapters.find(adapter) == _adapters.end())
{
- throw Ice::AdapterNotFoundException();
+ throw Ice::AdapterNotFoundException();
}
return p->second;
}
@@ -53,7 +53,7 @@ ServerLocatorRegistry::getObject(const ::Ice::Identity& id) const
::std::map< ::Ice::Identity, ::Ice::ObjectPrx>::const_iterator p = _objects.find(id);
if(p == _objects.end())
{
- throw Ice::ObjectNotFoundException();
+ throw Ice::ObjectNotFoundException();
}
return p->second;
diff --git a/cppe/test/IceE/location/ServerLocator.h b/cppe/test/IceE/location/ServerLocator.h
index de2aa01ed89..f9282b9b6d0 100644
--- a/cppe/test/IceE/location/ServerLocator.h
+++ b/cppe/test/IceE/location/ServerLocator.h
@@ -25,7 +25,7 @@ public:
virtual void setAdapterDirectProxy(const ::std::string&, const ::Ice::ObjectPrx&, const ::Ice::Current&);
virtual void setReplicatedAdapterDirectProxy(const std::string&, const ::std::string&, const ::Ice::ObjectPrx&,
- const ::Ice::Current&);
+ const ::Ice::Current&);
//
// Internal method
diff --git a/cppe/test/IceE/location/TestI.cpp b/cppe/test/IceE/location/TestI.cpp
index 98e03f4cd53..7ad7e25aec6 100644
--- a/cppe/test/IceE/location/TestI.cpp
+++ b/cppe/test/IceE/location/TestI.cpp
@@ -19,7 +19,7 @@
using namespace Test;
ServerManagerI::ServerManagerI(const Ice::ObjectAdapterPtr& adapter, const ServerLocatorRegistryPtr& registry,
- const Ice::InitializationData& initData) :
+ const Ice::InitializationData& initData) :
_adapter(adapter), _registry(registry), _initData(initData)
{
@@ -32,8 +32,8 @@ ServerManagerI::startServer(const Ice::Current&)
{
for(::std::vector<Ice::CommunicatorPtr>::const_iterator i = _communicators.begin(); i != _communicators.end(); ++i)
{
- (*i)->waitForShutdown();
- (*i)->destroy();
+ (*i)->waitForShutdown();
+ (*i)->destroy();
}
_communicators.clear();
@@ -78,7 +78,7 @@ ServerManagerI::shutdown(const Ice::Current&)
//
for(::std::vector<Ice::CommunicatorPtr>::const_iterator i = _communicators.begin(); i != _communicators.end(); ++i)
{
- (*i)->destroy();
+ (*i)->destroy();
}
_adapter->getCommunicator()->shutdown();
#ifdef _WIN32_WCE
@@ -87,8 +87,8 @@ ServerManagerI::shutdown(const Ice::Current&)
}
TestI::TestI(const Ice::ObjectAdapterPtr& adapter,
- const Ice::ObjectAdapterPtr& adapter2,
- const ServerLocatorRegistryPtr& registry) :
+ const Ice::ObjectAdapterPtr& adapter2,
+ const ServerLocatorRegistryPtr& registry) :
_adapter1(adapter), _adapter2(adapter2), _registry(registry)
{
_registry->addObject(_adapter1->add(new HelloI(), _adapter1->getCommunicator()->stringToIdentity("hello")));
@@ -104,7 +104,7 @@ HelloPrx
TestI::getHello(const Ice::Current&)
{
return HelloPrx::uncheckedCast(_adapter1->createIndirectProxy(
- _adapter1->getCommunicator()->stringToIdentity("hello")));
+ _adapter1->getCommunicator()->stringToIdentity("hello")));
}
HelloPrx
@@ -119,11 +119,11 @@ TestI::migrateHello(const Ice::Current&)
const Ice::Identity id = _adapter1->getCommunicator()->stringToIdentity("hello");
try
{
- _registry->addObject(_adapter2->add(_adapter1->remove(id), id));
+ _registry->addObject(_adapter2->add(_adapter1->remove(id), id));
}
catch(Ice::NotRegisteredException&)
{
- _registry->addObject(_adapter1->add(_adapter2->remove(id), id));
+ _registry->addObject(_adapter1->add(_adapter2->remove(id), id));
}
}
diff --git a/cppe/test/IceE/location/TestI.h b/cppe/test/IceE/location/TestI.h
index 1cd4f1264b0..2b0286faa9b 100644
--- a/cppe/test/IceE/location/TestI.h
+++ b/cppe/test/IceE/location/TestI.h
@@ -23,7 +23,7 @@ class ServerManagerI : public Test::ServerManager
public:
ServerManagerI(const Ice::ObjectAdapterPtr&, const ServerLocatorRegistryPtr&,
- const Ice::InitializationData&);
+ const Ice::InitializationData&);
virtual void startServer(const Ice::Current&);
virtual void shutdown(const Ice::Current&);
diff --git a/cppe/test/IceE/operations/AllTests.cpp b/cppe/test/IceE/operations/AllTests.cpp
index 81533420a85..668658ddbc7 100644
--- a/cppe/test/IceE/operations/AllTests.cpp
+++ b/cppe/test/IceE/operations/AllTests.cpp
@@ -18,7 +18,7 @@ Test::MyClassPrx
allTests(const Ice::CommunicatorPtr& communicator, const Ice::InitializationData& initData)
{
string ref = communicator->getProperties()->getPropertyWithDefault(
- "Operations.Proxy", "test:default -p 12010 -t 10000");
+ "Operations.Proxy", "test:default -p 12010 -t 10000");
Ice::ObjectPrx base = communicator->stringToProxy(ref);
Test::MyClassPrx cl = Test::MyClassPrx::checkedCast(base);
Test::MyDerivedClassPrx derived = Test::MyDerivedClassPrx::checkedCast(cl);
@@ -27,8 +27,8 @@ allTests(const Ice::CommunicatorPtr& communicator, const Ice::InitializationData
Test::MyClassPrx clTimeout = Test::MyClassPrx::uncheckedCast(cl->ice_timeout(500));
try
{
- clTimeout->opSleep(2000);
- test(false);
+ clTimeout->opSleep(2000);
+ test(false);
}
catch(const Ice::TimeoutException&)
{
diff --git a/cppe/test/IceE/operations/BatchOneways.cpp b/cppe/test/IceE/operations/BatchOneways.cpp
index 289ac8b10a1..e06f351826e 100644
--- a/cppe/test/IceE/operations/BatchOneways.cpp
+++ b/cppe/test/IceE/operations/BatchOneways.cpp
@@ -22,32 +22,32 @@ batchOneways(const Test::MyClassPrx& p)
try
{
- p->opByteSOneway(bs1);
- test(true);
+ p->opByteSOneway(bs1);
+ test(true);
}
catch(const Ice::MemoryLimitException&)
{
- test(false);
+ test(false);
}
try
{
- p->opByteSOneway(bs2);
- test(true);
+ p->opByteSOneway(bs2);
+ test(true);
}
catch(const Ice::MemoryLimitException&)
{
- test(false);
+ test(false);
}
try
{
- p->opByteSOneway(bs3);
- test(false);
+ p->opByteSOneway(bs3);
+ test(false);
}
catch(const Ice::MemoryLimitException&)
{
- test(true);
+ test(true);
}
Test::MyClassPrx batch = Test::MyClassPrx::uncheckedCast(p->ice_batchOneway());
@@ -56,15 +56,15 @@ batchOneways(const Test::MyClassPrx& p)
for(i = 0 ; i < 30 ; ++i)
{
- try
- {
- batch->opByteSOneway(bs1);
- test(true);
- }
- catch(const Ice::MemoryLimitException&)
- {
- test(false);
- }
+ try
+ {
+ batch->opByteSOneway(bs1);
+ test(true);
+ }
+ catch(const Ice::MemoryLimitException&)
+ {
+ test(false);
+ }
}
batch->ice_getConnection()->flushBatchRequests();
diff --git a/cppe/test/IceE/operations/Client.cpp b/cppe/test/IceE/operations/Client.cpp
index f20f755f089..9f5b7d23266 100644
--- a/cppe/test/IceE/operations/Client.cpp
+++ b/cppe/test/IceE/operations/Client.cpp
@@ -26,29 +26,29 @@ public:
virtual int
run(int argc, char* argv[])
{
- Ice::InitializationData initData;
- initData.properties = Ice::createProperties();
- //
- // We must set MessageSizeMax to an explicit values, because
- // we run tests to check whether Ice.MemoryLimitException is
- // raised as expected.
- //
- initData.properties->setProperty("Ice.MessageSizeMax", "100");
-
- loadConfig(initData.properties);
-
- //
- // Now parse argc/argv into initData
- //
- initData.properties = Ice::createProperties(argc, argv, initData.properties);
-
- initData.logger = getLogger();
- setCommunicator(Ice::initialize(argc, argv, initData));
-
- //
- // We don't want connection warnings because of the timeout test.
- //
- communicator()->getProperties()->setProperty("Ice.Warn.Connections", "0");
+ Ice::InitializationData initData;
+ initData.properties = Ice::createProperties();
+ //
+ // We must set MessageSizeMax to an explicit values, because
+ // we run tests to check whether Ice.MemoryLimitException is
+ // raised as expected.
+ //
+ initData.properties->setProperty("Ice.MessageSizeMax", "100");
+
+ loadConfig(initData.properties);
+
+ //
+ // Now parse argc/argv into initData
+ //
+ initData.properties = Ice::createProperties(argc, argv, initData.properties);
+
+ initData.logger = getLogger();
+ setCommunicator(Ice::initialize(argc, argv, initData));
+
+ //
+ // We don't want connection warnings because of the timeout test.
+ //
+ communicator()->getProperties()->setProperty("Ice.Warn.Connections", "0");
Test::MyClassPrx allTests(const Ice::CommunicatorPtr&, const Ice::InitializationData&);
Test::MyClassPrx myClass = allTests(communicator(), initData);
@@ -57,8 +57,8 @@ public:
myClass->shutdown();
try
{
- myClass->opVoid();
- test(false);
+ myClass->opVoid();
+ test(false);
}
catch(const Ice::LocalException&)
{
diff --git a/cppe/test/IceE/operations/Collocated.cpp b/cppe/test/IceE/operations/Collocated.cpp
index 467ce78063f..4285fbac0d2 100644
--- a/cppe/test/IceE/operations/Collocated.cpp
+++ b/cppe/test/IceE/operations/Collocated.cpp
@@ -26,26 +26,26 @@ public:
virtual int
run(int argc, char* argv[])
{
- Ice::InitializationData initData;
- initData.properties = Ice::createProperties();
-
- //
- // We must set MessageSizeMax to an explicit values, because
- // we run tests to check whether Ice.MemoryLimitException is
- // raised as expected.
- //
- initData.properties->setProperty("Ice.MessageSizeMax", "100");
- initData.properties->setProperty("TestAdapter.Endpoints", "default -p 12010 -t 10000");
-
- loadConfig(initData.properties);
-
- //
- // Now parse argc/argv into initData.properties
- //
- initData.properties = Ice::createProperties(argc, argv, initData.properties);
-
- initData.logger = getLogger();
- setCommunicator(Ice::initialize(argc, argv, initData));
+ Ice::InitializationData initData;
+ initData.properties = Ice::createProperties();
+
+ //
+ // We must set MessageSizeMax to an explicit values, because
+ // we run tests to check whether Ice.MemoryLimitException is
+ // raised as expected.
+ //
+ initData.properties->setProperty("Ice.MessageSizeMax", "100");
+ initData.properties->setProperty("TestAdapter.Endpoints", "default -p 12010 -t 10000");
+
+ loadConfig(initData.properties);
+
+ //
+ // Now parse argc/argv into initData.properties
+ //
+ initData.properties = Ice::createProperties(argc, argv, initData.properties);
+
+ initData.logger = getLogger();
+ setCommunicator(Ice::initialize(argc, argv, initData));
Ice::ObjectAdapterPtr adapter = communicator()->createObjectAdapter("TestAdapter");
adapter->add(new MyDerivedClassI, communicator()->stringToIdentity("test"));
diff --git a/cppe/test/IceE/operations/Server.cpp b/cppe/test/IceE/operations/Server.cpp
index 3230ea5f079..8f52f004698 100644
--- a/cppe/test/IceE/operations/Server.cpp
+++ b/cppe/test/IceE/operations/Server.cpp
@@ -27,16 +27,16 @@ public:
run(int argc, char* argv[])
{
Ice::InitializationData initData;
- initData.properties = Ice::createProperties();
+ initData.properties = Ice::createProperties();
- initData.properties->setProperty("TestAdapter.Endpoints", "default -p 12010 -t 10000");
- //initData.properties->setProperty("Ice.Trace.Network", "5");
- //initData.properties->setProperty("Ice.Trace.Protocol", "5");
+ initData.properties->setProperty("TestAdapter.Endpoints", "default -p 12010 -t 10000");
+ //initData.properties->setProperty("Ice.Trace.Network", "5");
+ //initData.properties->setProperty("Ice.Trace.Protocol", "5");
- loadConfig(initData.properties);
- initData.logger = getLogger();
- setCommunicator(Ice::initialize(argc, argv, initData));
-
+ loadConfig(initData.properties);
+ initData.logger = getLogger();
+ setCommunicator(Ice::initialize(argc, argv, initData));
+
Ice::ObjectAdapterPtr adapter = communicator()->createObjectAdapter("TestAdapter");
adapter->add(new MyDerivedClassI, communicator()->stringToIdentity("test"));
adapter->activate();
diff --git a/cppe/test/IceE/operations/Test.ice b/cppe/test/IceE/operations/Test.ice
index 16769c4f97b..8363b373ac1 100644
--- a/cppe/test/IceE/operations/Test.ice
+++ b/cppe/test/IceE/operations/Test.ice
@@ -73,75 +73,75 @@ class MyClass
void opSleep(int duration);
byte opByte(byte p1, byte p2,
- out byte p3);
+ out byte p3);
bool opBool(bool p1, bool p2,
- out bool p3);
+ out bool p3);
long opShortIntLong(short p1, int p2, long p3,
- out short p4, out int p5, out long p6);
+ out short p4, out int p5, out long p6);
double opFloatDouble(float p1, double p2,
- out float p3, out double p4);
+ out float p3, out double p4);
string opString(string p1, string p2,
- out string p3);
+ out string p3);
MyEnum opMyEnum(MyEnum p1, out MyEnum p2);
MyClass* opMyClass(MyClass* p1, out MyClass* p2, out MyClass* p3);
Structure opStruct(Structure p1, Structure p2,
- out Structure p3);
+ out Structure p3);
ByteS opByteS(ByteS p1, ByteS p2,
- out ByteS p3);
+ out ByteS p3);
BoolS opBoolS(BoolS p1, BoolS p2,
- out BoolS p3);
+ out BoolS p3);
LongS opShortIntLongS(Test::ShortS p1, IntS p2, LongS p3,
- out ::Test::ShortS p4, out IntS p5, out LongS p6);
+ out ::Test::ShortS p4, out IntS p5, out LongS p6);
DoubleS opFloatDoubleS(FloatS p1, DoubleS p2,
- out FloatS p3, out DoubleS p4);
+ out FloatS p3, out DoubleS p4);
StringS opStringS(StringS p1, StringS p2,
- out StringS p3);
+ out StringS p3);
ByteSS opByteSS(ByteSS p1, ByteSS p2,
- out ByteSS p3);
+ out ByteSS p3);
BoolSS opBoolSS(BoolSS p1, BoolSS p2,
- out BoolSS p3);
+ out BoolSS p3);
LongSS opShortIntLongSS(ShortSS p1, IntSS p2, LongSS p3,
- out ShortSS p4, out IntSS p5, out LongSS p6);
+ out ShortSS p4, out IntSS p5, out LongSS p6);
DoubleSS opFloatDoubleSS(FloatSS p1, DoubleSS p2,
- out FloatSS p3, out DoubleSS p4);
+ out FloatSS p3, out DoubleSS p4);
StringSS opStringSS(StringSS p1, StringSS p2,
- out StringSS p3);
+ out StringSS p3);
StringSSS opStringSSS(StringSSS p1, StringSSS p2,
- out StringSSS p3);
+ out StringSSS p3);
ByteBoolD opByteBoolD(ByteBoolD p1, ByteBoolD p2,
- out ByteBoolD p3);
+ out ByteBoolD p3);
ShortIntD opShortIntD(ShortIntD p1, ShortIntD p2,
- out ShortIntD p3);
+ out ShortIntD p3);
LongFloatD opLongFloatD(LongFloatD p1, LongFloatD p2,
- out LongFloatD p3);
+ out LongFloatD p3);
StringStringD opStringStringD(StringStringD p1, StringStringD p2,
- out StringStringD p3);
+ out StringStringD p3);
StringMyEnumD opStringMyEnumD(StringMyEnumD p1, StringMyEnumD p2,
- out StringMyEnumD p3);
+ out StringMyEnumD p3);
IntS opIntS(IntS s);
diff --git a/cppe/test/IceE/operations/TestI.cpp b/cppe/test/IceE/operations/TestI.cpp
index 014b607afd1..d52d31051a1 100644
--- a/cppe/test/IceE/operations/TestI.cpp
+++ b/cppe/test/IceE/operations/TestI.cpp
@@ -38,9 +38,9 @@ MyDerivedClassI::opSleep(int duration, const Ice::Current&)
Ice::Byte
MyDerivedClassI::opByte(Ice::Byte p1,
- Ice::Byte p2,
- Ice::Byte& p3,
- const Ice::Current&)
+ Ice::Byte p2,
+ Ice::Byte& p3,
+ const Ice::Current&)
{
p3 = p1 ^ p2;
return p1;
@@ -48,9 +48,9 @@ MyDerivedClassI::opByte(Ice::Byte p1,
bool
MyDerivedClassI::opBool(bool p1,
- bool p2,
- bool& p3,
- const Ice::Current&)
+ bool p2,
+ bool& p3,
+ const Ice::Current&)
{
p3 = p1;
return p2;
@@ -58,12 +58,12 @@ MyDerivedClassI::opBool(bool p1,
Ice::Long
MyDerivedClassI::opShortIntLong(Ice::Short p1,
- Ice::Int p2,
- Ice::Long p3,
- Ice::Short& p4,
- Ice::Int& p5,
- Ice::Long& p6,
- const Ice::Current&)
+ Ice::Int p2,
+ Ice::Long p3,
+ Ice::Short& p4,
+ Ice::Int& p5,
+ Ice::Long& p6,
+ const Ice::Current&)
{
p4 = p1;
p5 = p2;
@@ -73,10 +73,10 @@ MyDerivedClassI::opShortIntLong(Ice::Short p1,
Ice::Double
MyDerivedClassI::opFloatDouble(Ice::Float p1,
- Ice::Double p2,
- Ice::Float& p3,
- Ice::Double& p4,
- const Ice::Current&)
+ Ice::Double p2,
+ Ice::Float& p3,
+ Ice::Double& p4,
+ const Ice::Current&)
{
p3 = p1;
p4 = p2;
@@ -85,9 +85,9 @@ MyDerivedClassI::opFloatDouble(Ice::Float p1,
std::string
MyDerivedClassI::opString(const std::string& p1,
- const std::string& p2,
- std::string& p3,
- const Ice::Current&)
+ const std::string& p2,
+ std::string& p3,
+ const Ice::Current&)
{
p3 = p2 + " " + p1;
return p1 + " " + p2;
@@ -95,8 +95,8 @@ MyDerivedClassI::opString(const std::string& p1,
Test::MyEnum
MyDerivedClassI::opMyEnum(Test::MyEnum p1,
- Test::MyEnum& p2,
- const Ice::Current&)
+ Test::MyEnum& p2,
+ const Ice::Current&)
{
p2 = p1;
return Test::enum3;
@@ -104,21 +104,21 @@ MyDerivedClassI::opMyEnum(Test::MyEnum p1,
Test::MyClassPrx
MyDerivedClassI::opMyClass(const Test::MyClassPrx& p1,
- Test::MyClassPrx& p2,
- Test::MyClassPrx& p3,
- const Ice::Current& current)
+ Test::MyClassPrx& p2,
+ Test::MyClassPrx& p3,
+ const Ice::Current& current)
{
p2 = p1;
p3 = Test::MyClassPrx::uncheckedCast(current.adapter->createProxy(
- current.adapter->getCommunicator()->stringToIdentity("noSuchIdentity")));
+ current.adapter->getCommunicator()->stringToIdentity("noSuchIdentity")));
return Test::MyClassPrx::uncheckedCast(current.adapter->createProxy(current.id));
}
Test::Structure
MyDerivedClassI::opStruct(const Test::Structure& p1,
- const ::Test::Structure& p2,
- ::Test::Structure& p3,
- const Ice::Current&)
+ const ::Test::Structure& p2,
+ ::Test::Structure& p3,
+ const Ice::Current&)
{
p3 = p1;
p3.s.s = "a new string";
@@ -127,9 +127,9 @@ MyDerivedClassI::opStruct(const Test::Structure& p1,
Test::ByteS
MyDerivedClassI::opByteS(const Test::ByteS& p1,
- const Test::ByteS& p2,
- Test::ByteS& p3,
- const Ice::Current&)
+ const Test::ByteS& p2,
+ Test::ByteS& p3,
+ const Ice::Current&)
{
p3.resize(p1.size());
std::reverse_copy(p1.begin(), p1.end(), p3.begin());
@@ -140,9 +140,9 @@ MyDerivedClassI::opByteS(const Test::ByteS& p1,
Test::BoolS
MyDerivedClassI::opBoolS(const Test::BoolS& p1,
- const Test::BoolS& p2,
- Test::BoolS& p3,
- const Ice::Current&)
+ const Test::BoolS& p2,
+ Test::BoolS& p3,
+ const Ice::Current&)
{
p3 = p1;
std::copy(p2.begin(), p2.end(), std::back_inserter(p3));
@@ -154,12 +154,12 @@ MyDerivedClassI::opBoolS(const Test::BoolS& p1,
Test::LongS
MyDerivedClassI::opShortIntLongS(const Test::ShortS& p1,
- const Test::IntS& p2,
- const Test::LongS& p3,
- Test::ShortS& p4,
- Test::IntS& p5,
- Test::LongS& p6,
- const Ice::Current&)
+ const Test::IntS& p2,
+ const Test::LongS& p3,
+ Test::ShortS& p4,
+ Test::IntS& p5,
+ Test::LongS& p6,
+ const Ice::Current&)
{
p4 = p1;
p5.resize(p2.size());
@@ -171,10 +171,10 @@ MyDerivedClassI::opShortIntLongS(const Test::ShortS& p1,
Test::DoubleS
MyDerivedClassI::opFloatDoubleS(const Test::FloatS& p1,
- const Test::DoubleS& p2,
- Test::FloatS& p3,
- Test::DoubleS& p4,
- const Ice::Current&)
+ const Test::DoubleS& p2,
+ Test::FloatS& p3,
+ Test::DoubleS& p4,
+ const Ice::Current&)
{
p3 = p1;
p4.resize(p2.size());
@@ -186,9 +186,9 @@ MyDerivedClassI::opFloatDoubleS(const Test::FloatS& p1,
Test::StringS
MyDerivedClassI::opStringS(const Test::StringS& p1,
- const Test::StringS& p2,
- Test::StringS& p3,
- const Ice::Current&)
+ const Test::StringS& p2,
+ Test::StringS& p3,
+ const Ice::Current&)
{
p3 = p1;
std::copy(p2.begin(), p2.end(), std::back_inserter(p3));
@@ -200,9 +200,9 @@ MyDerivedClassI::opStringS(const Test::StringS& p1,
Test::ByteSS
MyDerivedClassI::opByteSS(const Test::ByteSS& p1,
- const Test::ByteSS& p2,
- Test::ByteSS& p3,
- const Ice::Current&)
+ const Test::ByteSS& p2,
+ Test::ByteSS& p3,
+ const Ice::Current&)
{
p3.resize(p1.size());
std::reverse_copy(p1.begin(), p1.end(), p3.begin());
@@ -213,9 +213,9 @@ MyDerivedClassI::opByteSS(const Test::ByteSS& p1,
Test::BoolSS
MyDerivedClassI::opBoolSS(const Test::BoolSS& p1,
- const Test::BoolSS& p2,
- Test::BoolSS& p3,
- const Ice::Current&)
+ const Test::BoolSS& p2,
+ Test::BoolSS& p3,
+ const Ice::Current&)
{
p3 = p1;
std::copy(p2.begin(), p2.end(), std::back_inserter(p3));
@@ -227,12 +227,12 @@ MyDerivedClassI::opBoolSS(const Test::BoolSS& p1,
Test::LongSS
MyDerivedClassI::opShortIntLongSS(const Test::ShortSS& p1,
- const Test::IntSS& p2,
- const Test::LongSS& p3,
- Test::ShortSS& p4,
- Test::IntSS& p5,
- Test::LongSS& p6,
- const Ice::Current&)
+ const Test::IntSS& p2,
+ const Test::LongSS& p3,
+ Test::ShortSS& p4,
+ Test::IntSS& p5,
+ Test::LongSS& p6,
+ const Ice::Current&)
{
p4 = p1;
p5.resize(p2.size());
@@ -244,10 +244,10 @@ MyDerivedClassI::opShortIntLongSS(const Test::ShortSS& p1,
Test::DoubleSS
MyDerivedClassI::opFloatDoubleSS(const Test::FloatSS& p1,
- const Test::DoubleSS& p2,
- Test::FloatSS& p3,
- Test::DoubleSS& p4,
- const Ice::Current&)
+ const Test::DoubleSS& p2,
+ Test::FloatSS& p3,
+ Test::DoubleSS& p4,
+ const Ice::Current&)
{
p3 = p1;
p4.resize(p2.size());
@@ -259,9 +259,9 @@ MyDerivedClassI::opFloatDoubleSS(const Test::FloatSS& p1,
Test::StringSS
MyDerivedClassI::opStringSS(const Test::StringSS& p1,
- const Test::StringSS& p2,
- Test::StringSS& p3,
- const Ice::Current&)
+ const Test::StringSS& p2,
+ Test::StringSS& p3,
+ const Ice::Current&)
{
p3 = p1;
std::copy(p2.begin(), p2.end(), std::back_inserter(p3));
@@ -273,9 +273,9 @@ MyDerivedClassI::opStringSS(const Test::StringSS& p1,
Test::StringSSS
MyDerivedClassI::opStringSSS(const Test::StringSSS& p1,
- const Test::StringSSS& p2,
- Test::StringSSS& p3,
- const ::Ice::Current&)
+ const Test::StringSSS& p2,
+ Test::StringSSS& p3,
+ const ::Ice::Current&)
{
p3 = p1;
std::copy(p2.begin(), p2.end(), std::back_inserter(p3));
@@ -287,9 +287,9 @@ MyDerivedClassI::opStringSSS(const Test::StringSSS& p1,
Test::ByteBoolD
MyDerivedClassI::opByteBoolD(const Test::ByteBoolD& p1,
- const Test::ByteBoolD& p2,
- Test::ByteBoolD& p3,
- const Ice::Current&)
+ const Test::ByteBoolD& p2,
+ Test::ByteBoolD& p3,
+ const Ice::Current&)
{
p3 = p1;
Test::ByteBoolD r = p1;
@@ -299,9 +299,9 @@ MyDerivedClassI::opByteBoolD(const Test::ByteBoolD& p1,
Test::ShortIntD
MyDerivedClassI::opShortIntD(const Test::ShortIntD& p1,
- const Test::ShortIntD& p2,
- Test::ShortIntD& p3,
- const Ice::Current&)
+ const Test::ShortIntD& p2,
+ Test::ShortIntD& p3,
+ const Ice::Current&)
{
p3 = p1;
Test::ShortIntD r = p1;
@@ -311,9 +311,9 @@ MyDerivedClassI::opShortIntD(const Test::ShortIntD& p1,
Test::LongFloatD
MyDerivedClassI::opLongFloatD(const Test::LongFloatD& p1,
- const Test::LongFloatD& p2,
- Test::LongFloatD& p3,
- const Ice::Current&)
+ const Test::LongFloatD& p2,
+ Test::LongFloatD& p3,
+ const Ice::Current&)
{
p3 = p1;
Test::LongFloatD r = p1;
@@ -323,9 +323,9 @@ MyDerivedClassI::opLongFloatD(const Test::LongFloatD& p1,
Test::StringStringD
MyDerivedClassI::opStringStringD(const Test::StringStringD& p1,
- const Test::StringStringD& p2,
- Test::StringStringD& p3,
- const Ice::Current&)
+ const Test::StringStringD& p2,
+ Test::StringStringD& p3,
+ const Ice::Current&)
{
p3 = p1;
Test::StringStringD r = p1;
@@ -335,9 +335,9 @@ MyDerivedClassI::opStringStringD(const Test::StringStringD& p1,
Test::StringMyEnumD
MyDerivedClassI::opStringMyEnumD(const Test::StringMyEnumD& p1,
- const Test::StringMyEnumD& p2,
- Test::StringMyEnumD& p3,
- const Ice::Current&)
+ const Test::StringMyEnumD& p2,
+ Test::StringMyEnumD& p3,
+ const Ice::Current&)
{
p3 = p1;
Test::StringMyEnumD r = p1;
diff --git a/cppe/test/IceE/operations/TestI.h b/cppe/test/IceE/operations/TestI.h
index 7cb8b910adf..a8b92b30549 100644
--- a/cppe/test/IceE/operations/TestI.h
+++ b/cppe/test/IceE/operations/TestI.h
@@ -25,128 +25,128 @@ public:
virtual void opSleep(int, const Ice::Current&);
virtual Ice::Byte opByte(Ice::Byte,
- Ice::Byte,
- Ice::Byte&,
- const Ice::Current&);
+ Ice::Byte,
+ Ice::Byte&,
+ const Ice::Current&);
virtual bool opBool(bool,
- bool,
- bool&,
- const Ice::Current&);
+ bool,
+ bool&,
+ const Ice::Current&);
virtual Ice::Long opShortIntLong(Ice::Short,
- Ice::Int,
- Ice::Long,
- Ice::Short&,
- Ice::Int&,
- Ice::Long&,
- const Ice::Current&);
+ Ice::Int,
+ Ice::Long,
+ Ice::Short&,
+ Ice::Int&,
+ Ice::Long&,
+ const Ice::Current&);
virtual Ice::Double opFloatDouble(Ice::Float,
- Ice::Double,
- Ice::Float&,
- Ice::Double&,
- const Ice::Current&);
+ Ice::Double,
+ Ice::Float&,
+ Ice::Double&,
+ const Ice::Current&);
virtual std::string opString(const std::string&,
- const std::string&,
- std::string&,
- const Ice::Current&);
+ const std::string&,
+ std::string&,
+ const Ice::Current&);
virtual Test::MyEnum opMyEnum(Test::MyEnum,
- Test::MyEnum&,
- const Ice::Current&);
+ Test::MyEnum&,
+ const Ice::Current&);
virtual Test::MyClassPrx opMyClass(const Test::MyClassPrx&,
- Test::MyClassPrx&, Test::MyClassPrx&,
- const Ice::Current&);
+ Test::MyClassPrx&, Test::MyClassPrx&,
+ const Ice::Current&);
virtual Test::Structure opStruct(const Test::Structure&, const Test::Structure&,
- Test::Structure&,
- const Ice::Current&);
+ Test::Structure&,
+ const Ice::Current&);
virtual Test::ByteS opByteS(const Test::ByteS&,
- const Test::ByteS&,
- Test::ByteS&,
- const Ice::Current&);
+ const Test::ByteS&,
+ Test::ByteS&,
+ const Ice::Current&);
virtual Test::BoolS opBoolS(const Test::BoolS&,
- const Test::BoolS&,
- Test::BoolS&,
- const Ice::Current&);
+ const Test::BoolS&,
+ Test::BoolS&,
+ const Ice::Current&);
virtual Test::LongS opShortIntLongS(const Test::ShortS&,
- const Test::IntS&,
- const Test::LongS&,
- Test::ShortS&,
- Test::IntS&,
- Test::LongS&,
- const Ice::Current&);
+ const Test::IntS&,
+ const Test::LongS&,
+ Test::ShortS&,
+ Test::IntS&,
+ Test::LongS&,
+ const Ice::Current&);
virtual Test::DoubleS opFloatDoubleS(const Test::FloatS&,
- const Test::DoubleS&,
- Test::FloatS&,
- Test::DoubleS&,
- const Ice::Current&);
+ const Test::DoubleS&,
+ Test::FloatS&,
+ Test::DoubleS&,
+ const Ice::Current&);
virtual Test::StringS opStringS(const Test::StringS&,
- const Test::StringS&,
- Test::StringS&,
- const Ice::Current&);
+ const Test::StringS&,
+ Test::StringS&,
+ const Ice::Current&);
virtual Test::ByteSS opByteSS(const Test::ByteSS&,
- const Test::ByteSS&,
- Test::ByteSS&,
- const Ice::Current&);
+ const Test::ByteSS&,
+ Test::ByteSS&,
+ const Ice::Current&);
virtual Test::BoolSS opBoolSS(const Test::BoolSS&,
- const Test::BoolSS&,
- Test::BoolSS&,
- const Ice::Current&);
+ const Test::BoolSS&,
+ Test::BoolSS&,
+ const Ice::Current&);
virtual Test::LongSS opShortIntLongSS(const Test::ShortSS&,
- const Test::IntSS&,
- const Test::LongSS&,
- Test::ShortSS&,
- Test::IntSS&,
- Test::LongSS&,
- const Ice::Current&);
+ const Test::IntSS&,
+ const Test::LongSS&,
+ Test::ShortSS&,
+ Test::IntSS&,
+ Test::LongSS&,
+ const Ice::Current&);
virtual Test::DoubleSS opFloatDoubleSS(const Test::FloatSS&,
- const Test::DoubleSS&,
- Test::FloatSS&,
- Test::DoubleSS&,
- const Ice::Current&);
+ const Test::DoubleSS&,
+ Test::FloatSS&,
+ Test::DoubleSS&,
+ const Ice::Current&);
virtual Test::StringSS opStringSS(const Test::StringSS&,
- const Test::StringSS&,
- Test::StringSS&,
- const Ice::Current&);
+ const Test::StringSS&,
+ Test::StringSS&,
+ const Ice::Current&);
virtual Test::StringSSS opStringSSS(const Test::StringSSS&,
- const Test::StringSSS&,
- Test::StringSSS&,
- const ::Ice::Current&);
+ const Test::StringSSS&,
+ Test::StringSSS&,
+ const ::Ice::Current&);
virtual Test::ByteBoolD opByteBoolD(const Test::ByteBoolD&, const Test::ByteBoolD&,
- Test::ByteBoolD&,
- const Ice::Current&);
+ Test::ByteBoolD&,
+ const Ice::Current&);
virtual Test::ShortIntD opShortIntD(const Test::ShortIntD&, const Test::ShortIntD&,
- Test::ShortIntD&,
- const Ice::Current&);
+ Test::ShortIntD&,
+ const Ice::Current&);
virtual Test::LongFloatD opLongFloatD(const Test::LongFloatD&, const Test::LongFloatD&,
- Test::LongFloatD&,
- const Ice::Current&);
+ Test::LongFloatD&,
+ const Ice::Current&);
virtual Test::StringStringD opStringStringD(const Test::StringStringD&, const Test::StringStringD&,
- Test::StringStringD&,
- const Ice::Current&);
+ Test::StringStringD&,
+ const Ice::Current&);
virtual Test::StringMyEnumD opStringMyEnumD(const Test::StringMyEnumD&, const Test::StringMyEnumD&,
- Test::StringMyEnumD&,
- const Ice::Current&);
+ Test::StringMyEnumD&,
+ const Ice::Current&);
virtual Test::IntS opIntS(const Test::IntS&, const Ice::Current&);
diff --git a/cppe/test/IceE/operations/Twoways.cpp b/cppe/test/IceE/operations/Twoways.cpp
index e3717c7877c..c1e14970c18 100644
--- a/cppe/test/IceE/operations/Twoways.cpp
+++ b/cppe/test/IceE/operations/Twoways.cpp
@@ -26,645 +26,645 @@ using namespace std;
void
twoways(const Ice::CommunicatorPtr& communicator,
- const Ice::InitializationData& initializationData, const Test::MyClassPrx& p)
+ const Ice::InitializationData& initializationData, const Test::MyClassPrx& p)
{
{
- p->opVoid();
+ p->opVoid();
}
{
- Ice::Byte b;
- Ice::Byte r;
+ Ice::Byte b;
+ Ice::Byte r;
- r = p->opByte(Ice::Byte(0xff), Ice::Byte(0x0f), b);
- test(b == Ice::Byte(0xf0));
- test(r == Ice::Byte(0xff));
+ r = p->opByte(Ice::Byte(0xff), Ice::Byte(0x0f), b);
+ test(b == Ice::Byte(0xf0));
+ test(r == Ice::Byte(0xff));
}
{
- bool b;
- bool r;
+ bool b;
+ bool r;
- r = p->opBool(true, false, b);
- test(b);
- test(!r);
+ r = p->opBool(true, false, b);
+ test(b);
+ test(!r);
}
{
- Ice::Short s;
- Ice::Int i;
- Ice::Long l;
- Ice::Long r;
-
- r = p->opShortIntLong(10, 11, 12, s, i, l);
- test(s == 10);
- test(i == 11);
- test(l == 12);
- test(r == 12);
-
- r = p->opShortIntLong(numeric_limits<Ice::Short>::min(), numeric_limits<Ice::Int>::min(),
- numeric_limits<Ice::Long>::min(), s, i, l);
- test(s == numeric_limits<Ice::Short>::min());
- test(i == numeric_limits<Ice::Int>::min());
- test(l == numeric_limits<Ice::Long>::min());
- test(r == numeric_limits<Ice::Long>::min());
-
- r = p->opShortIntLong(numeric_limits<Ice::Short>::max(), numeric_limits<Ice::Int>::max(),
- numeric_limits<Ice::Long>::max(), s, i, l);
- test(s == numeric_limits<Ice::Short>::max());
- test(i == numeric_limits<Ice::Int>::max());
- test(l == numeric_limits<Ice::Long>::max());
- test(r == numeric_limits<Ice::Long>::max());
+ Ice::Short s;
+ Ice::Int i;
+ Ice::Long l;
+ Ice::Long r;
+
+ r = p->opShortIntLong(10, 11, 12, s, i, l);
+ test(s == 10);
+ test(i == 11);
+ test(l == 12);
+ test(r == 12);
+
+ r = p->opShortIntLong(numeric_limits<Ice::Short>::min(), numeric_limits<Ice::Int>::min(),
+ numeric_limits<Ice::Long>::min(), s, i, l);
+ test(s == numeric_limits<Ice::Short>::min());
+ test(i == numeric_limits<Ice::Int>::min());
+ test(l == numeric_limits<Ice::Long>::min());
+ test(r == numeric_limits<Ice::Long>::min());
+
+ r = p->opShortIntLong(numeric_limits<Ice::Short>::max(), numeric_limits<Ice::Int>::max(),
+ numeric_limits<Ice::Long>::max(), s, i, l);
+ test(s == numeric_limits<Ice::Short>::max());
+ test(i == numeric_limits<Ice::Int>::max());
+ test(l == numeric_limits<Ice::Long>::max());
+ test(r == numeric_limits<Ice::Long>::max());
}
{
- Ice::Float f;
- Ice::Double d;
- Ice::Double r;
-
- r = p->opFloatDouble(Ice::Float(3.14), Ice::Double(1.1E10), f, d);
- test(f == Ice::Float(3.14));
- test(d == Ice::Double(1.1E10));
- test(r == Ice::Double(1.1E10));
-
- r = p->opFloatDouble(numeric_limits<Ice::Float>::min(), numeric_limits<Ice::Double>::min(), f, d);
- test(f == numeric_limits<Ice::Float>::min());
- test(d == numeric_limits<Ice::Double>::min());
- test(r == numeric_limits<Ice::Double>::min());
-
- r = p->opFloatDouble(numeric_limits<Ice::Float>::max(), numeric_limits<Ice::Double>::max(), f, d);
- test(f == numeric_limits<Ice::Float>::max());
- test(d == numeric_limits<Ice::Double>::max());
- test(r == numeric_limits<Ice::Double>::max());
+ Ice::Float f;
+ Ice::Double d;
+ Ice::Double r;
+
+ r = p->opFloatDouble(Ice::Float(3.14), Ice::Double(1.1E10), f, d);
+ test(f == Ice::Float(3.14));
+ test(d == Ice::Double(1.1E10));
+ test(r == Ice::Double(1.1E10));
+
+ r = p->opFloatDouble(numeric_limits<Ice::Float>::min(), numeric_limits<Ice::Double>::min(), f, d);
+ test(f == numeric_limits<Ice::Float>::min());
+ test(d == numeric_limits<Ice::Double>::min());
+ test(r == numeric_limits<Ice::Double>::min());
+
+ r = p->opFloatDouble(numeric_limits<Ice::Float>::max(), numeric_limits<Ice::Double>::max(), f, d);
+ test(f == numeric_limits<Ice::Float>::max());
+ test(d == numeric_limits<Ice::Double>::max());
+ test(r == numeric_limits<Ice::Double>::max());
}
{
- string s;
- string r;
+ string s;
+ string r;
- r = p->opString("hello", "world", s);
- test(s == "world hello");
- test(r == "hello world");
+ r = p->opString("hello", "world", s);
+ test(s == "world hello");
+ test(r == "hello world");
}
{
- Test::MyEnum e;
- Test::MyEnum r;
-
- r = p->opMyEnum(Test::enum2, e);
- test(e == Test::enum2);
- test(r == Test::enum3);
+ Test::MyEnum e;
+ Test::MyEnum r;
+
+ r = p->opMyEnum(Test::enum2, e);
+ test(e == Test::enum2);
+ test(r == Test::enum3);
}
{
- Test::MyClassPrx c1;
- Test::MyClassPrx c2;
- Test::MyClassPrx r;
-
- r = p->opMyClass(p, c1, c2);
- test(Ice::proxyIdentityAndFacetEqual(c1, p));
- test(!Ice::proxyIdentityAndFacetEqual(c2, p));
- test(Ice::proxyIdentityAndFacetEqual(r, p));
- test(c1->ice_getIdentity() == communicator->stringToIdentity("test"));
- test(c2->ice_getIdentity() == communicator->stringToIdentity("noSuchIdentity"));
- test(r->ice_getIdentity() == communicator->stringToIdentity("test"));
- r->opVoid();
- c1->opVoid();
- try
- {
- c2->opVoid();
- test(false);
- }
- catch(const Ice::ObjectNotExistException&)
- {
- }
-
- r = p->opMyClass(0, c1, c2);
- test(c1 == 0);
- test(c2 != 0);
- test(Ice::proxyIdentityAndFacetEqual(r, p));
- r->opVoid();
+ Test::MyClassPrx c1;
+ Test::MyClassPrx c2;
+ Test::MyClassPrx r;
+
+ r = p->opMyClass(p, c1, c2);
+ test(Ice::proxyIdentityAndFacetEqual(c1, p));
+ test(!Ice::proxyIdentityAndFacetEqual(c2, p));
+ test(Ice::proxyIdentityAndFacetEqual(r, p));
+ test(c1->ice_getIdentity() == communicator->stringToIdentity("test"));
+ test(c2->ice_getIdentity() == communicator->stringToIdentity("noSuchIdentity"));
+ test(r->ice_getIdentity() == communicator->stringToIdentity("test"));
+ r->opVoid();
+ c1->opVoid();
+ try
+ {
+ c2->opVoid();
+ test(false);
+ }
+ catch(const Ice::ObjectNotExistException&)
+ {
+ }
+
+ r = p->opMyClass(0, c1, c2);
+ test(c1 == 0);
+ test(c2 != 0);
+ test(Ice::proxyIdentityAndFacetEqual(r, p));
+ r->opVoid();
}
{
- Test::Structure si1;
- si1.p = p;
- si1.e = Test::enum3;
- si1.s.s = "abc";
- Test::Structure si2;
- si2.p = 0;
- si2.e = Test::enum2;
- si2.s.s = "def";
-
- Test::Structure so;
- Test::Structure rso = p->opStruct(si1, si2, so);
- test(rso.p == 0);
- test(rso.e == Test::enum2);
- test(rso.s.s == "def");
- test(so.p == p);
- test(so.e == Test::enum3);
- test(so.s.s == "a new string");
- so.p->opVoid();
+ Test::Structure si1;
+ si1.p = p;
+ si1.e = Test::enum3;
+ si1.s.s = "abc";
+ Test::Structure si2;
+ si2.p = 0;
+ si2.e = Test::enum2;
+ si2.s.s = "def";
+
+ Test::Structure so;
+ Test::Structure rso = p->opStruct(si1, si2, so);
+ test(rso.p == 0);
+ test(rso.e == Test::enum2);
+ test(rso.s.s == "def");
+ test(so.p == p);
+ test(so.e == Test::enum3);
+ test(so.s.s == "a new string");
+ so.p->opVoid();
}
{
- Test::ByteS bsi1;
- Test::ByteS bsi2;
-
- bsi1.push_back(Ice::Byte(0x01));
- bsi1.push_back(Ice::Byte(0x11));
- bsi1.push_back(Ice::Byte(0x12));
- bsi1.push_back(Ice::Byte(0x22));
-
- bsi2.push_back(Ice::Byte(0xf1));
- bsi2.push_back(Ice::Byte(0xf2));
- bsi2.push_back(Ice::Byte(0xf3));
- bsi2.push_back(Ice::Byte(0xf4));
-
- Test::ByteS bso;
- Test::ByteS rso;
-
- rso = p->opByteS(bsi1, bsi2, bso);
- test(bso.size() == 4);
- test(bso[0] == Ice::Byte(0x22));
- test(bso[1] == Ice::Byte(0x12));
- test(bso[2] == Ice::Byte(0x11));
- test(bso[3] == Ice::Byte(0x01));
- test(rso.size() == 8);
- test(rso[0] == Ice::Byte(0x01));
- test(rso[1] == Ice::Byte(0x11));
- test(rso[2] == Ice::Byte(0x12));
- test(rso[3] == Ice::Byte(0x22));
- test(rso[4] == Ice::Byte(0xf1));
- test(rso[5] == Ice::Byte(0xf2));
- test(rso[6] == Ice::Byte(0xf3));
- test(rso[7] == Ice::Byte(0xf4));
+ Test::ByteS bsi1;
+ Test::ByteS bsi2;
+
+ bsi1.push_back(Ice::Byte(0x01));
+ bsi1.push_back(Ice::Byte(0x11));
+ bsi1.push_back(Ice::Byte(0x12));
+ bsi1.push_back(Ice::Byte(0x22));
+
+ bsi2.push_back(Ice::Byte(0xf1));
+ bsi2.push_back(Ice::Byte(0xf2));
+ bsi2.push_back(Ice::Byte(0xf3));
+ bsi2.push_back(Ice::Byte(0xf4));
+
+ Test::ByteS bso;
+ Test::ByteS rso;
+
+ rso = p->opByteS(bsi1, bsi2, bso);
+ test(bso.size() == 4);
+ test(bso[0] == Ice::Byte(0x22));
+ test(bso[1] == Ice::Byte(0x12));
+ test(bso[2] == Ice::Byte(0x11));
+ test(bso[3] == Ice::Byte(0x01));
+ test(rso.size() == 8);
+ test(rso[0] == Ice::Byte(0x01));
+ test(rso[1] == Ice::Byte(0x11));
+ test(rso[2] == Ice::Byte(0x12));
+ test(rso[3] == Ice::Byte(0x22));
+ test(rso[4] == Ice::Byte(0xf1));
+ test(rso[5] == Ice::Byte(0xf2));
+ test(rso[6] == Ice::Byte(0xf3));
+ test(rso[7] == Ice::Byte(0xf4));
}
{
- Test::BoolS bsi1;
- Test::BoolS bsi2;
-
- bsi1.push_back(true);
- bsi1.push_back(true);
- bsi1.push_back(false);
-
- bsi2.push_back(false);
-
- Test::BoolS bso;
- Test::BoolS rso;
-
- rso = p->opBoolS(bsi1, bsi2, bso);
- test(bso.size() == 4);
- test(bso[0]);
- test(bso[1]);
- test(!bso[2]);
- test(!bso[3]);
- test(rso.size() == 3);
- test(!rso[0]);
- test(rso[1]);
- test(rso[2]);
+ Test::BoolS bsi1;
+ Test::BoolS bsi2;
+
+ bsi1.push_back(true);
+ bsi1.push_back(true);
+ bsi1.push_back(false);
+
+ bsi2.push_back(false);
+
+ Test::BoolS bso;
+ Test::BoolS rso;
+
+ rso = p->opBoolS(bsi1, bsi2, bso);
+ test(bso.size() == 4);
+ test(bso[0]);
+ test(bso[1]);
+ test(!bso[2]);
+ test(!bso[3]);
+ test(rso.size() == 3);
+ test(!rso[0]);
+ test(rso[1]);
+ test(rso[2]);
}
{
- Test::ShortS ssi;
- Test::IntS isi;
- Test::LongS lsi;
-
- ssi.push_back(1);
- ssi.push_back(2);
- ssi.push_back(3);
-
- isi.push_back(5);
- isi.push_back(6);
- isi.push_back(7);
- isi.push_back(8);
-
- lsi.push_back(10);
- lsi.push_back(30);
- lsi.push_back(20);
-
- Test::ShortS sso;
- Test::IntS iso;
- Test::LongS lso;
- Test::LongS rso;
-
- rso = p->opShortIntLongS(ssi, isi, lsi, sso, iso, lso);
- test(sso.size() == 3);
- test(sso[0] == 1);
- test(sso[1] == 2);
- test(sso[2] == 3);
- test(iso.size() == 4);
- test(iso[0] == 8);
- test(iso[1] == 7);
- test(iso[2] == 6);
- test(iso[3] == 5);
- test(lso.size() == 6);
- test(lso[0] == 10);
- test(lso[1] == 30);
- test(lso[2] == 20);
- test(lso[3] == 10);
- test(lso[4] == 30);
- test(lso[5] == 20);
- test(rso.size() == 3);
- test(rso[0] == 10);
- test(rso[1] == 30);
- test(rso[2] == 20);
+ Test::ShortS ssi;
+ Test::IntS isi;
+ Test::LongS lsi;
+
+ ssi.push_back(1);
+ ssi.push_back(2);
+ ssi.push_back(3);
+
+ isi.push_back(5);
+ isi.push_back(6);
+ isi.push_back(7);
+ isi.push_back(8);
+
+ lsi.push_back(10);
+ lsi.push_back(30);
+ lsi.push_back(20);
+
+ Test::ShortS sso;
+ Test::IntS iso;
+ Test::LongS lso;
+ Test::LongS rso;
+
+ rso = p->opShortIntLongS(ssi, isi, lsi, sso, iso, lso);
+ test(sso.size() == 3);
+ test(sso[0] == 1);
+ test(sso[1] == 2);
+ test(sso[2] == 3);
+ test(iso.size() == 4);
+ test(iso[0] == 8);
+ test(iso[1] == 7);
+ test(iso[2] == 6);
+ test(iso[3] == 5);
+ test(lso.size() == 6);
+ test(lso[0] == 10);
+ test(lso[1] == 30);
+ test(lso[2] == 20);
+ test(lso[3] == 10);
+ test(lso[4] == 30);
+ test(lso[5] == 20);
+ test(rso.size() == 3);
+ test(rso[0] == 10);
+ test(rso[1] == 30);
+ test(rso[2] == 20);
}
{
- Test::FloatS fsi;
- Test::DoubleS dsi;
-
- fsi.push_back(Ice::Float(3.14));
- fsi.push_back(Ice::Float(1.11));
-
- dsi.push_back(Ice::Double(1.1E10));
- dsi.push_back(Ice::Double(1.2E10));
- dsi.push_back(Ice::Double(1.3E10));
-
- Test::FloatS fso;
- Test::DoubleS dso;
- Test::DoubleS rso;
-
- rso = p->opFloatDoubleS(fsi, dsi, fso, dso);
- test(fso.size() == 2);
- test(fso[0] == ::Ice::Float(3.14));
- test(fso[1] == ::Ice::Float(1.11));
- test(dso.size() == 3);
- test(dso[0] == ::Ice::Double(1.3E10));
- test(dso[1] == ::Ice::Double(1.2E10));
- test(dso[2] == ::Ice::Double(1.1E10));
- test(rso.size() == 5);
- test(rso[0] == ::Ice::Double(1.1E10));
- test(rso[1] == ::Ice::Double(1.2E10));
- test(rso[2] == ::Ice::Double(1.3E10));
- test(::Ice::Float(rso[3]) == ::Ice::Float(3.14));
- test(::Ice::Float(rso[4]) == ::Ice::Float(1.11));
+ Test::FloatS fsi;
+ Test::DoubleS dsi;
+
+ fsi.push_back(Ice::Float(3.14));
+ fsi.push_back(Ice::Float(1.11));
+
+ dsi.push_back(Ice::Double(1.1E10));
+ dsi.push_back(Ice::Double(1.2E10));
+ dsi.push_back(Ice::Double(1.3E10));
+
+ Test::FloatS fso;
+ Test::DoubleS dso;
+ Test::DoubleS rso;
+
+ rso = p->opFloatDoubleS(fsi, dsi, fso, dso);
+ test(fso.size() == 2);
+ test(fso[0] == ::Ice::Float(3.14));
+ test(fso[1] == ::Ice::Float(1.11));
+ test(dso.size() == 3);
+ test(dso[0] == ::Ice::Double(1.3E10));
+ test(dso[1] == ::Ice::Double(1.2E10));
+ test(dso[2] == ::Ice::Double(1.1E10));
+ test(rso.size() == 5);
+ test(rso[0] == ::Ice::Double(1.1E10));
+ test(rso[1] == ::Ice::Double(1.2E10));
+ test(rso[2] == ::Ice::Double(1.3E10));
+ test(::Ice::Float(rso[3]) == ::Ice::Float(3.14));
+ test(::Ice::Float(rso[4]) == ::Ice::Float(1.11));
}
{
- Test::StringS ssi1;
- Test::StringS ssi2;
-
- ssi1.push_back("abc");
- ssi1.push_back("de");
- ssi1.push_back("fghi");
-
- ssi2.push_back("xyz");
-
- Test::StringS sso;
- Test::StringS rso;
-
- rso = p->opStringS(ssi1, ssi2, sso);
- test(sso.size() == 4);
- test(sso[0] == "abc");
- test(sso[1] == "de");
- test(sso[2] == "fghi");
- test(sso[3] == "xyz");
- test(rso.size() == 3);
- test(rso[0] == "fghi");
- test(rso[1] == "de");
- test(rso[2] == "abc");
+ Test::StringS ssi1;
+ Test::StringS ssi2;
+
+ ssi1.push_back("abc");
+ ssi1.push_back("de");
+ ssi1.push_back("fghi");
+
+ ssi2.push_back("xyz");
+
+ Test::StringS sso;
+ Test::StringS rso;
+
+ rso = p->opStringS(ssi1, ssi2, sso);
+ test(sso.size() == 4);
+ test(sso[0] == "abc");
+ test(sso[1] == "de");
+ test(sso[2] == "fghi");
+ test(sso[3] == "xyz");
+ test(rso.size() == 3);
+ test(rso[0] == "fghi");
+ test(rso[1] == "de");
+ test(rso[2] == "abc");
}
{
- Test::ByteSS bsi1;
- bsi1.resize(2);
- Test::ByteSS bsi2;
- bsi2.resize(2);
-
- bsi1[0].push_back(Ice::Byte(0x01));
- bsi1[0].push_back(Ice::Byte(0x11));
- bsi1[0].push_back(Ice::Byte(0x12));
- bsi1[1].push_back(Ice::Byte(0xff));
-
- bsi2[0].push_back(Ice::Byte(0x0e));
- bsi2[1].push_back(Ice::Byte(0xf2));
- bsi2[1].push_back(Ice::Byte(0xf1));
-
- Test::ByteSS bso;
- Test::ByteSS rso;
-
- rso = p->opByteSS(bsi1, bsi2, bso);
- test(bso.size() == 2);
- test(bso[0].size() == 1);
- test(bso[0][0] == Ice::Byte(0xff));
- test(bso[1].size() == 3);
- test(bso[1][0] == Ice::Byte(0x01));
- test(bso[1][1] == Ice::Byte(0x11));
- test(bso[1][2] == Ice::Byte(0x12));
- test(rso.size() == 4);
- test(rso[0].size() == 3);
- test(rso[0][0] == Ice::Byte(0x01));
- test(rso[0][1] == Ice::Byte(0x11));
- test(rso[0][2] == Ice::Byte(0x12));
- test(rso[1].size() == 1);
- test(rso[1][0] == Ice::Byte(0xff));
- test(rso[2].size() == 1);
- test(rso[2][0] == Ice::Byte(0x0e));
- test(rso[3].size() == 2);
- test(rso[3][0] == Ice::Byte(0xf2));
- test(rso[3][1] == Ice::Byte(0xf1));
+ Test::ByteSS bsi1;
+ bsi1.resize(2);
+ Test::ByteSS bsi2;
+ bsi2.resize(2);
+
+ bsi1[0].push_back(Ice::Byte(0x01));
+ bsi1[0].push_back(Ice::Byte(0x11));
+ bsi1[0].push_back(Ice::Byte(0x12));
+ bsi1[1].push_back(Ice::Byte(0xff));
+
+ bsi2[0].push_back(Ice::Byte(0x0e));
+ bsi2[1].push_back(Ice::Byte(0xf2));
+ bsi2[1].push_back(Ice::Byte(0xf1));
+
+ Test::ByteSS bso;
+ Test::ByteSS rso;
+
+ rso = p->opByteSS(bsi1, bsi2, bso);
+ test(bso.size() == 2);
+ test(bso[0].size() == 1);
+ test(bso[0][0] == Ice::Byte(0xff));
+ test(bso[1].size() == 3);
+ test(bso[1][0] == Ice::Byte(0x01));
+ test(bso[1][1] == Ice::Byte(0x11));
+ test(bso[1][2] == Ice::Byte(0x12));
+ test(rso.size() == 4);
+ test(rso[0].size() == 3);
+ test(rso[0][0] == Ice::Byte(0x01));
+ test(rso[0][1] == Ice::Byte(0x11));
+ test(rso[0][2] == Ice::Byte(0x12));
+ test(rso[1].size() == 1);
+ test(rso[1][0] == Ice::Byte(0xff));
+ test(rso[2].size() == 1);
+ test(rso[2][0] == Ice::Byte(0x0e));
+ test(rso[3].size() == 2);
+ test(rso[3][0] == Ice::Byte(0xf2));
+ test(rso[3][1] == Ice::Byte(0xf1));
}
{
- Test::FloatSS fsi;
- fsi.resize(3);
- Test::DoubleSS dsi;
- dsi.resize(1);
-
- fsi[0].push_back(Ice::Float(3.14));
- fsi[1].push_back(Ice::Float(1.11));
-
- dsi[0].push_back(Ice::Double(1.1E10));
- dsi[0].push_back(Ice::Double(1.2E10));
- dsi[0].push_back(Ice::Double(1.3E10));
-
- Test::FloatSS fso;
- Test::DoubleSS dso;
- Test::DoubleSS rso;
-
- rso = p->opFloatDoubleSS(fsi, dsi, fso, dso);
- test(fso.size() == 3);
- test(fso[0].size() == 1);
- test(fso[0][0] == ::Ice::Float(3.14));
- test(fso[1].size() == 1);
- test(fso[1][0] == ::Ice::Float(1.11));
- test(fso[2].size() == 0);
- test(dso.size() == 1);
- test(dso[0].size() == 3);
- test(dso[0][0] == ::Ice::Double(1.1E10));
- test(dso[0][1] == ::Ice::Double(1.2E10));
- test(dso[0][2] == ::Ice::Double(1.3E10));
- test(rso.size() == 2);
- test(rso[0].size() == 3);
- test(rso[0][0] == ::Ice::Double(1.1E10));
- test(rso[0][1] == ::Ice::Double(1.2E10));
- test(rso[0][2] == ::Ice::Double(1.3E10));
- test(rso[1].size() == 3);
- test(rso[1][0] == ::Ice::Double(1.1E10));
- test(rso[1][1] == ::Ice::Double(1.2E10));
- test(rso[1][2] == ::Ice::Double(1.3E10));
+ Test::FloatSS fsi;
+ fsi.resize(3);
+ Test::DoubleSS dsi;
+ dsi.resize(1);
+
+ fsi[0].push_back(Ice::Float(3.14));
+ fsi[1].push_back(Ice::Float(1.11));
+
+ dsi[0].push_back(Ice::Double(1.1E10));
+ dsi[0].push_back(Ice::Double(1.2E10));
+ dsi[0].push_back(Ice::Double(1.3E10));
+
+ Test::FloatSS fso;
+ Test::DoubleSS dso;
+ Test::DoubleSS rso;
+
+ rso = p->opFloatDoubleSS(fsi, dsi, fso, dso);
+ test(fso.size() == 3);
+ test(fso[0].size() == 1);
+ test(fso[0][0] == ::Ice::Float(3.14));
+ test(fso[1].size() == 1);
+ test(fso[1][0] == ::Ice::Float(1.11));
+ test(fso[2].size() == 0);
+ test(dso.size() == 1);
+ test(dso[0].size() == 3);
+ test(dso[0][0] == ::Ice::Double(1.1E10));
+ test(dso[0][1] == ::Ice::Double(1.2E10));
+ test(dso[0][2] == ::Ice::Double(1.3E10));
+ test(rso.size() == 2);
+ test(rso[0].size() == 3);
+ test(rso[0][0] == ::Ice::Double(1.1E10));
+ test(rso[0][1] == ::Ice::Double(1.2E10));
+ test(rso[0][2] == ::Ice::Double(1.3E10));
+ test(rso[1].size() == 3);
+ test(rso[1][0] == ::Ice::Double(1.1E10));
+ test(rso[1][1] == ::Ice::Double(1.2E10));
+ test(rso[1][2] == ::Ice::Double(1.3E10));
}
{
- Test::StringSS ssi1;
- ssi1.resize(2);
- Test::StringSS ssi2;
- ssi2.resize(3);
-
- ssi1[0].push_back("abc");
- ssi1[1].push_back("de");
- ssi1[1].push_back("fghi");
-
- ssi2[2].push_back("xyz");
-
- Test::StringSS sso;
- Test::StringSS rso;
-
- rso = p->opStringSS(ssi1, ssi2, sso);
- test(sso.size() == 5);
- test(sso[0].size() == 1);
- test(sso[0][0] == "abc");
- test(sso[1].size() == 2);
- test(sso[1][0] == "de");
- test(sso[1][1] == "fghi");
- test(sso[2].size() == 0);
- test(sso[3].size() == 0);
- test(sso[4].size() == 1);
- test(sso[4][0] == "xyz");
- test(rso.size() == 3);
- test(rso[0].size() == 1);
- test(rso[0][0] == "xyz");
- test(rso[1].size() == 0);
- test(rso[2].size() == 0);
+ Test::StringSS ssi1;
+ ssi1.resize(2);
+ Test::StringSS ssi2;
+ ssi2.resize(3);
+
+ ssi1[0].push_back("abc");
+ ssi1[1].push_back("de");
+ ssi1[1].push_back("fghi");
+
+ ssi2[2].push_back("xyz");
+
+ Test::StringSS sso;
+ Test::StringSS rso;
+
+ rso = p->opStringSS(ssi1, ssi2, sso);
+ test(sso.size() == 5);
+ test(sso[0].size() == 1);
+ test(sso[0][0] == "abc");
+ test(sso[1].size() == 2);
+ test(sso[1][0] == "de");
+ test(sso[1][1] == "fghi");
+ test(sso[2].size() == 0);
+ test(sso[3].size() == 0);
+ test(sso[4].size() == 1);
+ test(sso[4][0] == "xyz");
+ test(rso.size() == 3);
+ test(rso[0].size() == 1);
+ test(rso[0][0] == "xyz");
+ test(rso[1].size() == 0);
+ test(rso[2].size() == 0);
}
{
- Test::StringSSS sssi1;
- sssi1.resize(2);
- sssi1[0].resize(2);
- sssi1[0][0].push_back("abc");
- sssi1[0][0].push_back("de");
- sssi1[0][1].push_back("xyz");
- sssi1[1].resize(1);
- sssi1[1][0].push_back("hello");
-
- Test::StringSSS sssi2;
- sssi2.resize(3);
- sssi2[0].resize(2);
- sssi2[0][0].push_back("");
- sssi2[0][0].push_back("");
- sssi2[0][1].push_back("abcd");
- sssi2[1].resize(1);
- sssi2[1][0].push_back("");
-
- Test::StringSSS ssso;
- Test::StringSSS rsso;
-
- rsso = p->opStringSSS(sssi1, sssi2, ssso);
- test(ssso.size() == 5);
- test(ssso[0].size() == 2);
- test(ssso[0][0].size() == 2);
- test(ssso[0][1].size() == 1);
- test(ssso[1].size() == 1);
- test(ssso[1][0].size() == 1);
- test(ssso[2].size() == 2);
- test(ssso[2][0].size() == 2);
- test(ssso[2][1].size() == 1);
- test(ssso[3].size() == 1);
- test(ssso[3][0].size() == 1);
- test(ssso[4].size() == 0);
- test(ssso[0][0][0] == "abc");
- test(ssso[0][0][1] == "de");
- test(ssso[0][1][0] == "xyz");
- test(ssso[1][0][0] == "hello");
- test(ssso[2][0][0] == "");
- test(ssso[2][0][1] == "");
- test(ssso[2][1][0] == "abcd");
- test(ssso[3][0][0] == "");
-
- test(rsso.size() == 3);
- test(rsso[0].size() == 0);
- test(rsso[1].size() == 1);
- test(rsso[1][0].size() == 1);
- test(rsso[2].size() == 2);
- test(rsso[2][0].size() == 2);
- test(rsso[2][1].size() == 1);
- test(rsso[1][0][0] == "");
- test(rsso[2][0][0] == "");
- test(rsso[2][0][1] == "");
- test(rsso[2][1][0] == "abcd");
+ Test::StringSSS sssi1;
+ sssi1.resize(2);
+ sssi1[0].resize(2);
+ sssi1[0][0].push_back("abc");
+ sssi1[0][0].push_back("de");
+ sssi1[0][1].push_back("xyz");
+ sssi1[1].resize(1);
+ sssi1[1][0].push_back("hello");
+
+ Test::StringSSS sssi2;
+ sssi2.resize(3);
+ sssi2[0].resize(2);
+ sssi2[0][0].push_back("");
+ sssi2[0][0].push_back("");
+ sssi2[0][1].push_back("abcd");
+ sssi2[1].resize(1);
+ sssi2[1][0].push_back("");
+
+ Test::StringSSS ssso;
+ Test::StringSSS rsso;
+
+ rsso = p->opStringSSS(sssi1, sssi2, ssso);
+ test(ssso.size() == 5);
+ test(ssso[0].size() == 2);
+ test(ssso[0][0].size() == 2);
+ test(ssso[0][1].size() == 1);
+ test(ssso[1].size() == 1);
+ test(ssso[1][0].size() == 1);
+ test(ssso[2].size() == 2);
+ test(ssso[2][0].size() == 2);
+ test(ssso[2][1].size() == 1);
+ test(ssso[3].size() == 1);
+ test(ssso[3][0].size() == 1);
+ test(ssso[4].size() == 0);
+ test(ssso[0][0][0] == "abc");
+ test(ssso[0][0][1] == "de");
+ test(ssso[0][1][0] == "xyz");
+ test(ssso[1][0][0] == "hello");
+ test(ssso[2][0][0] == "");
+ test(ssso[2][0][1] == "");
+ test(ssso[2][1][0] == "abcd");
+ test(ssso[3][0][0] == "");
+
+ test(rsso.size() == 3);
+ test(rsso[0].size() == 0);
+ test(rsso[1].size() == 1);
+ test(rsso[1][0].size() == 1);
+ test(rsso[2].size() == 2);
+ test(rsso[2][0].size() == 2);
+ test(rsso[2][1].size() == 1);
+ test(rsso[1][0][0] == "");
+ test(rsso[2][0][0] == "");
+ test(rsso[2][0][1] == "");
+ test(rsso[2][1][0] == "abcd");
}
{
- Test::ByteBoolD di1;
- di1[10] = true;
- di1[100] = false;
- Test::ByteBoolD di2;
- di2[10] = true;
- di2[11] = false;
- di2[101] = true;
-
- Test::ByteBoolD _do;
- Test::ByteBoolD ro = p->opByteBoolD(di1, di2, _do);
-
- test(_do == di1);
- test(ro.size() == 4);
- test(ro[10] == true);
- test(ro[11] == false);
- test(ro[100] == false);
- test(ro[101] == true);
+ Test::ByteBoolD di1;
+ di1[10] = true;
+ di1[100] = false;
+ Test::ByteBoolD di2;
+ di2[10] = true;
+ di2[11] = false;
+ di2[101] = true;
+
+ Test::ByteBoolD _do;
+ Test::ByteBoolD ro = p->opByteBoolD(di1, di2, _do);
+
+ test(_do == di1);
+ test(ro.size() == 4);
+ test(ro[10] == true);
+ test(ro[11] == false);
+ test(ro[100] == false);
+ test(ro[101] == true);
}
{
- Test::ShortIntD di1;
- di1[110] = -1;
- di1[1100] = 123123;
- Test::ShortIntD di2;
- di2[110] = -1;
- di2[111] = -100;
- di2[1101] = 0;
-
- Test::ShortIntD _do;
- Test::ShortIntD ro = p->opShortIntD(di1, di2, _do);
-
- test(_do == di1);
- test(ro.size() == 4);
- test(ro[110] == -1);
- test(ro[111] == -100);
- test(ro[1100] == 123123);
- test(ro[1101] == 0);
+ Test::ShortIntD di1;
+ di1[110] = -1;
+ di1[1100] = 123123;
+ Test::ShortIntD di2;
+ di2[110] = -1;
+ di2[111] = -100;
+ di2[1101] = 0;
+
+ Test::ShortIntD _do;
+ Test::ShortIntD ro = p->opShortIntD(di1, di2, _do);
+
+ test(_do == di1);
+ test(ro.size() == 4);
+ test(ro[110] == -1);
+ test(ro[111] == -100);
+ test(ro[1100] == 123123);
+ test(ro[1101] == 0);
}
{
- Test::LongFloatD di1;
- di1[999999110] = Ice::Float(-1.1);
- di1[999999111] = Ice::Float(123123.2);
- Test::LongFloatD di2;
- di2[999999110] = Ice::Float(-1.1);
- di2[999999120] = Ice::Float(-100.4);
- di2[999999130] = Ice::Float(0.5);
-
- Test::LongFloatD _do;
- Test::LongFloatD ro = p->opLongFloatD(di1, di2, _do);
-
- test(_do == di1);
- test(ro.size() == 4);
- test(ro[999999110] == Ice::Float(-1.1));
- test(ro[999999120] == Ice::Float(-100.4));
- test(ro[999999111] == Ice::Float(123123.2));
- test(ro[999999130] == Ice::Float(0.5));
+ Test::LongFloatD di1;
+ di1[999999110] = Ice::Float(-1.1);
+ di1[999999111] = Ice::Float(123123.2);
+ Test::LongFloatD di2;
+ di2[999999110] = Ice::Float(-1.1);
+ di2[999999120] = Ice::Float(-100.4);
+ di2[999999130] = Ice::Float(0.5);
+
+ Test::LongFloatD _do;
+ Test::LongFloatD ro = p->opLongFloatD(di1, di2, _do);
+
+ test(_do == di1);
+ test(ro.size() == 4);
+ test(ro[999999110] == Ice::Float(-1.1));
+ test(ro[999999120] == Ice::Float(-100.4));
+ test(ro[999999111] == Ice::Float(123123.2));
+ test(ro[999999130] == Ice::Float(0.5));
}
{
- Test::StringStringD di1;
- di1["foo"] = "abc -1.1";
- di1["bar"] = "abc 123123.2";
- Test::StringStringD di2;
- di2["foo"] = "abc -1.1";
- di2["FOO"] = "abc -100.4";
- di2["BAR"] = "abc 0.5";
-
- Test::StringStringD _do;
- Test::StringStringD ro = p->opStringStringD(di1, di2, _do);
-
- test(_do == di1);
- test(ro.size() == 4);
- test(ro["foo"] == "abc -1.1");
- test(ro["FOO"] == "abc -100.4");
- test(ro["bar"] == "abc 123123.2");
- test(ro["BAR"] == "abc 0.5");
+ Test::StringStringD di1;
+ di1["foo"] = "abc -1.1";
+ di1["bar"] = "abc 123123.2";
+ Test::StringStringD di2;
+ di2["foo"] = "abc -1.1";
+ di2["FOO"] = "abc -100.4";
+ di2["BAR"] = "abc 0.5";
+
+ Test::StringStringD _do;
+ Test::StringStringD ro = p->opStringStringD(di1, di2, _do);
+
+ test(_do == di1);
+ test(ro.size() == 4);
+ test(ro["foo"] == "abc -1.1");
+ test(ro["FOO"] == "abc -100.4");
+ test(ro["bar"] == "abc 123123.2");
+ test(ro["BAR"] == "abc 0.5");
}
{
- Test::StringMyEnumD di1;
- di1["abc"] = Test::enum1;
- di1[""] = Test::enum2;
- Test::StringMyEnumD di2;
- di2["abc"] = Test::enum1;
- di2["qwerty"] = Test::enum3;
- di2["Hello!!"] = Test::enum2;
-
- Test::StringMyEnumD _do;
- Test::StringMyEnumD ro = p->opStringMyEnumD(di1, di2, _do);
-
- test(_do == di1);
- test(ro.size() == 4);
- test(ro["abc"] == Test::enum1);
- test(ro["qwerty"] == Test::enum3);
- test(ro[""] == Test::enum2);
- test(ro["Hello!!"] == Test::enum2);
+ Test::StringMyEnumD di1;
+ di1["abc"] = Test::enum1;
+ di1[""] = Test::enum2;
+ Test::StringMyEnumD di2;
+ di2["abc"] = Test::enum1;
+ di2["qwerty"] = Test::enum3;
+ di2["Hello!!"] = Test::enum2;
+
+ Test::StringMyEnumD _do;
+ Test::StringMyEnumD ro = p->opStringMyEnumD(di1, di2, _do);
+
+ test(_do == di1);
+ test(ro.size() == 4);
+ test(ro["abc"] == Test::enum1);
+ test(ro["qwerty"] == Test::enum3);
+ test(ro[""] == Test::enum2);
+ test(ro["Hello!!"] == Test::enum2);
}
{
- const int lengths[] = { 0, 1, 2, 126, 127, 128, 129, 253, 254, 255, 256, 257, 1000 };
-
- for(int l = 0; l != sizeof(lengths) / sizeof(*lengths); ++l)
- {
- Test::IntS s;
- for(int i = 0; i < lengths[l]; ++i)
- {
- s.push_back(i);
- }
- Test::IntS r = p->opIntS(s);
- test(r.size() == static_cast<size_t>(lengths[l]));
- for(int j = 0; j < static_cast<int>(r.size()); ++j)
- {
- test(r[j] == -j);
- }
- }
+ const int lengths[] = { 0, 1, 2, 126, 127, 128, 129, 253, 254, 255, 256, 257, 1000 };
+
+ for(int l = 0; l != sizeof(lengths) / sizeof(*lengths); ++l)
+ {
+ Test::IntS s;
+ for(int i = 0; i < lengths[l]; ++i)
+ {
+ s.push_back(i);
+ }
+ Test::IntS r = p->opIntS(s);
+ test(r.size() == static_cast<size_t>(lengths[l]));
+ for(int j = 0; j < static_cast<int>(r.size()); ++j)
+ {
+ test(r[j] == -j);
+ }
+ }
}
{
- Ice::Context ctx;
- ctx["one"] = "ONE";
- ctx["two"] = "TWO";
- ctx["three"] = "THREE";
- {
- Test::StringStringD r = p->opContext();
- test(p->ice_getContext().empty());
- test(r != ctx);
- }
- {
- Test::StringStringD r = p->opContext(ctx);
- test(p->ice_getContext().empty());
- test(r == ctx);
- }
- {
- Test::MyClassPrx p2 = Test::MyClassPrx::checkedCast(p->ice_context(ctx));
- test(p2->ice_getContext() == ctx);
- Test::StringStringD r = p2->opContext();
- test(r == ctx);
- r = p2->opContext(ctx);
- test(r == ctx);
- }
-
- {
- //
- // Test proxy context
- //
+ Ice::Context ctx;
+ ctx["one"] = "ONE";
+ ctx["two"] = "TWO";
+ ctx["three"] = "THREE";
+ {
+ Test::StringStringD r = p->opContext();
+ test(p->ice_getContext().empty());
+ test(r != ctx);
+ }
+ {
+ Test::StringStringD r = p->opContext(ctx);
+ test(p->ice_getContext().empty());
+ test(r == ctx);
+ }
+ {
+ Test::MyClassPrx p2 = Test::MyClassPrx::checkedCast(p->ice_context(ctx));
+ test(p2->ice_getContext() == ctx);
+ Test::StringStringD r = p2->opContext();
+ test(r == ctx);
+ r = p2->opContext(ctx);
+ test(r == ctx);
+ }
+
+ {
+ //
+ // Test proxy context
+ //
string ref = communicator->getProperties()->getPropertyWithDefault(
"Operations.Proxy", "test:default -p 12010 -t 10000");
Test::MyClassPrx c = Test::MyClassPrx::checkedCast(communicator->stringToProxy(ref));
- Ice::Context dflt;
- dflt["a"] = "b";
- Test::MyClassPrx c2 = Test::MyClassPrx::uncheckedCast(c->ice_context(dflt));
- test(c2->opContext()["a"] == "b");
+ Ice::Context dflt;
+ dflt["a"] = "b";
+ Test::MyClassPrx c2 = Test::MyClassPrx::uncheckedCast(c->ice_context(dflt));
+ test(c2->opContext()["a"] == "b");
- dflt.clear();
- Test::MyClassPrx c3 = Test::MyClassPrx::uncheckedCast(c2->ice_context(dflt));
- Ice::Context tmp = c3->opContext();
- test(tmp.find("a") == tmp.end());
- }
+ dflt.clear();
+ Test::MyClassPrx c3 = Test::MyClassPrx::uncheckedCast(c2->ice_context(dflt));
+ Ice::Context tmp = c3->opContext();
+ test(tmp.find("a") == tmp.end());
+ }
}
{
Ice::Double d = 1278312346.0 / 13.0;
- Test::DoubleS ds(5, d);
- p->opDoubleMarshaling(d, ds);
+ Test::DoubleS ds(5, d);
+ p->opDoubleMarshaling(d, ds);
}
}
diff --git a/cppe/test/IceE/proxy/Client.cpp b/cppe/test/IceE/proxy/Client.cpp
index f784087c6c1..409c225fc7b 100644
--- a/cppe/test/IceE/proxy/Client.cpp
+++ b/cppe/test/IceE/proxy/Client.cpp
@@ -36,16 +36,16 @@ public:
initData.properties->setProperty("Ice.ThreadPool.Client.Size", "2");
initData.properties->setProperty("Ice.ThreadPool.Client.SizeWarn", "0");
- loadConfig(initData.properties);
+ loadConfig(initData.properties);
- //
- // Now parse argc/argv into initData
- //
- initData.properties = Ice::createProperties(argc, argv, initData.properties);
+ //
+ // Now parse argc/argv into initData
+ //
+ initData.properties = Ice::createProperties(argc, argv, initData.properties);
- initData.logger = getLogger();
- setCommunicator(Ice::initialize(argc, argv, initData));
-
+ initData.logger = getLogger();
+ setCommunicator(Ice::initialize(argc, argv, initData));
+
//
// We don't want connection warnings because of the timeout test.
//
diff --git a/cppe/test/IceE/proxy/Collocated.cpp b/cppe/test/IceE/proxy/Collocated.cpp
index fca190babce..48680607cd2 100644
--- a/cppe/test/IceE/proxy/Collocated.cpp
+++ b/cppe/test/IceE/proxy/Collocated.cpp
@@ -26,17 +26,17 @@ public:
virtual int
run(int argc, char* argv[])
{
- Ice::InitializationData initData;
- initData.properties = Ice::createProperties();
+ Ice::InitializationData initData;
+ initData.properties = Ice::createProperties();
initData.properties->setProperty("TestAdapter.Endpoints", "default -p 12010 -t 10000");
- loadConfig(initData.properties);
- //
- // Now parse argc/argv into initData.properties
- //
- initData.properties = Ice::createProperties(argc, argv, initData.properties);
- initData.logger = getLogger();
- setCommunicator(Ice::initialize(argc, argv, initData));
+ loadConfig(initData.properties);
+ //
+ // Now parse argc/argv into initData.properties
+ //
+ initData.properties = Ice::createProperties(argc, argv, initData.properties);
+ initData.logger = getLogger();
+ setCommunicator(Ice::initialize(argc, argv, initData));
Ice::ObjectAdapterPtr adapter = communicator()->createObjectAdapter("TestAdapter");
adapter->add(new MyDerivedClassI, communicator()->stringToIdentity("test"));
diff --git a/cppe/test/IceE/proxy/Server.cpp b/cppe/test/IceE/proxy/Server.cpp
index c928a86ae17..d2a7a73614c 100644
--- a/cppe/test/IceE/proxy/Server.cpp
+++ b/cppe/test/IceE/proxy/Server.cpp
@@ -31,9 +31,9 @@ public:
initData.properties->setProperty("TestAdapter.Endpoints", "default -p 12010 -t 10000");
initData.properties->setProperty("Ice.Warn.Connections", "0");
- loadConfig(initData.properties);
- initData.logger = getLogger();
- setCommunicator(Ice::initialize(argc, argv, initData));
+ loadConfig(initData.properties);
+ initData.logger = getLogger();
+ setCommunicator(Ice::initialize(argc, argv, initData));
Ice::ObjectAdapterPtr adapter = communicator()->createObjectAdapter("TestAdapter");
adapter->add(new MyDerivedClassI, communicator()->stringToIdentity("test"));
diff --git a/cppe/test/IceE/retry/AllTests.cpp b/cppe/test/IceE/retry/AllTests.cpp
index f2227de7c3c..557a27b773e 100644
--- a/cppe/test/IceE/retry/AllTests.cpp
+++ b/cppe/test/IceE/retry/AllTests.cpp
@@ -42,12 +42,12 @@ allTests(const Ice::CommunicatorPtr& communicator)
tprintf("calling operation to kill connection with second proxy... ");
try
{
- retry2->op(true);
- test(false);
+ retry2->op(true);
+ test(false);
}
catch(Ice::ConnectionLostException)
{
- tprintf("ok\n");
+ tprintf("ok\n");
}
tprintf("calling regular operation with first proxy again... ");
diff --git a/cppe/test/IceE/retry/Client.cpp b/cppe/test/IceE/retry/Client.cpp
index 0cbafc1b3cd..45ddd78d996 100644
--- a/cppe/test/IceE/retry/Client.cpp
+++ b/cppe/test/IceE/retry/Client.cpp
@@ -28,23 +28,23 @@ public:
{
Ice::InitializationData initData;
initData.properties = Ice::createProperties();
- //initData.properties->setProperty("Ice.Trace.Network", "5");
- //initData.properties->setProperty("Ice.Trace.Protocol", "5");
+ //initData.properties->setProperty("Ice.Trace.Network", "5");
+ //initData.properties->setProperty("Ice.Trace.Protocol", "5");
- loadConfig(initData.properties);
+ loadConfig(initData.properties);
- //
- // For this test, we want to disable retries.
- //
- initData.properties->setProperty("Ice.RetryIntervals", "-1");
+ //
+ // For this test, we want to disable retries.
+ //
+ initData.properties->setProperty("Ice.RetryIntervals", "-1");
- initData.logger = getLogger();
- setCommunicator(Ice::initialize(argc, argv, initData));
+ initData.logger = getLogger();
+ setCommunicator(Ice::initialize(argc, argv, initData));
- //
- // This test kills connections, so we don't want warnings.
- //
- communicator()->getProperties()->setProperty("Ice.Warn.Connections", "0");
+ //
+ // This test kills connections, so we don't want warnings.
+ //
+ communicator()->getProperties()->setProperty("Ice.Warn.Connections", "0");
Test::RetryPrx allTests(const Ice::CommunicatorPtr&);
Test::RetryPrx retry = allTests(communicator());
diff --git a/cppe/test/IceE/retry/Server.cpp b/cppe/test/IceE/retry/Server.cpp
index fba90fdde84..bd4e16a2dc9 100644
--- a/cppe/test/IceE/retry/Server.cpp
+++ b/cppe/test/IceE/retry/Server.cpp
@@ -26,16 +26,16 @@ public:
virtual int
run(int argc, char* argv[])
{
- Ice::InitializationData initData;
+ Ice::InitializationData initData;
initData.properties = Ice::createProperties();
- initData.properties->setProperty("TestAdapter.Endpoints", "default -p 12010 -t 10000");
- //initData.properties->setProperty("Ice.Trace.Network", "5");
- //initData.properties->setProperty("Ice.Trace.Protocol", "5");
+ initData.properties->setProperty("TestAdapter.Endpoints", "default -p 12010 -t 10000");
+ //initData.properties->setProperty("Ice.Trace.Network", "5");
+ //initData.properties->setProperty("Ice.Trace.Protocol", "5");
- loadConfig(initData.properties);
- initData.logger = getLogger();
- setCommunicator(Ice::initialize(argc, argv, initData));
+ loadConfig(initData.properties);
+ initData.logger = getLogger();
+ setCommunicator(Ice::initialize(argc, argv, initData));
Ice::ObjectAdapterPtr adapter = communicator()->createObjectAdapter("TestAdapter");
Ice::ObjectPtr object = new RetryI;
diff --git a/cppe/test/IceE/retry/TestI.cpp b/cppe/test/IceE/retry/TestI.cpp
index c6429890591..d4d9666dc37 100644
--- a/cppe/test/IceE/retry/TestI.cpp
+++ b/cppe/test/IceE/retry/TestI.cpp
@@ -16,7 +16,7 @@ RetryI::op(bool kill, const Ice::Current& current)
{
if(kill)
{
- current.con->close(true);
+ current.con->close(true);
}
}
diff --git a/cppe/test/IceE/slicing/AllTests.cpp b/cppe/test/IceE/slicing/AllTests.cpp
index 8172ce850fe..9e7f7301b0f 100644
--- a/cppe/test/IceE/slicing/AllTests.cpp
+++ b/cppe/test/IceE/slicing/AllTests.cpp
@@ -19,7 +19,7 @@ class CallbackBase : public IceUtil::Monitor<IceUtil::Mutex>
public:
CallbackBase() :
- _called(false)
+ _called(false)
{
}
@@ -29,26 +29,26 @@ public:
bool check()
{
- IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
- while(!_called)
- {
- if(!timedWait(IceUtil::Time::seconds(5)))
- {
- return false;
- }
- }
- _called = false;
- return true;
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
+ while(!_called)
+ {
+ if(!timedWait(IceUtil::Time::seconds(5)))
+ {
+ return false;
+ }
+ }
+ _called = false;
+ return true;
}
protected:
void called()
{
- IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
- assert(!_called);
- _called = true;
- notify();
+ IceUtil::Monitor<IceUtil::Mutex>::Lock sync(*this);
+ assert(!_called);
+ _called = true;
+ notify();
}
private:
@@ -65,260 +65,260 @@ allTests(const Ice::CommunicatorPtr& communicator)
tprintf("base... "); fflush(stdout);
{
- try
- {
- test->baseAsBase();
- test(false);
- }
- catch(const Base& b)
- {
- test(b.b == "Base.b");
- test(b.ice_name() =="Test::Base");
- }
- catch(...)
- {
- test(false);
- }
+ try
+ {
+ test->baseAsBase();
+ test(false);
+ }
+ catch(const Base& b)
+ {
+ test(b.b == "Base.b");
+ test(b.ice_name() =="Test::Base");
+ }
+ catch(...)
+ {
+ test(false);
+ }
}
tprintf("ok\n");
tprintf("slicing of unknown derived... "); fflush(stdout);
{
- try
- {
- test->unknownDerivedAsBase();
- test(false);
- }
- catch(const Base& b)
- {
- test(b.b == "UnknownDerived.b");
- test(b.ice_name() =="Test::Base");
- }
- catch(...)
- {
- test(false);
- }
+ try
+ {
+ test->unknownDerivedAsBase();
+ test(false);
+ }
+ catch(const Base& b)
+ {
+ test(b.b == "UnknownDerived.b");
+ test(b.ice_name() =="Test::Base");
+ }
+ catch(...)
+ {
+ test(false);
+ }
}
tprintf("ok\n");
tprintf("non-slicing of known derived as base... "); fflush(stdout);
{
- try
- {
- test->knownDerivedAsBase();
- test(false);
- }
- catch(const KnownDerived& k)
- {
- test(k.b == "KnownDerived.b");
- test(k.kd == "KnownDerived.kd");
- test(k.ice_name() =="Test::KnownDerived");
- }
- catch(...)
- {
- test(false);
- }
+ try
+ {
+ test->knownDerivedAsBase();
+ test(false);
+ }
+ catch(const KnownDerived& k)
+ {
+ test(k.b == "KnownDerived.b");
+ test(k.kd == "KnownDerived.kd");
+ test(k.ice_name() =="Test::KnownDerived");
+ }
+ catch(...)
+ {
+ test(false);
+ }
}
tprintf("ok\n");
tprintf("non-slicing of known derived as derived... "); fflush(stdout);
{
- try
- {
- test->knownDerivedAsKnownDerived();
- test(false);
- }
- catch(const KnownDerived& k)
- {
- test(k.b == "KnownDerived.b");
- test(k.kd == "KnownDerived.kd");
- test(k.ice_name() =="Test::KnownDerived");
- }
- catch(...)
- {
- test(false);
- }
+ try
+ {
+ test->knownDerivedAsKnownDerived();
+ test(false);
+ }
+ catch(const KnownDerived& k)
+ {
+ test(k.b == "KnownDerived.b");
+ test(k.kd == "KnownDerived.kd");
+ test(k.ice_name() =="Test::KnownDerived");
+ }
+ catch(...)
+ {
+ test(false);
+ }
}
tprintf("ok\n");
tprintf("slicing of unknown intermediate as base... "); fflush(stdout);
{
- try
- {
- test->unknownIntermediateAsBase();
- test(false);
- }
- catch(const Base& b)
- {
- test(b.b == "UnknownIntermediate.b");
- test(b.ice_name() =="Test::Base");
- }
- catch(...)
- {
- test(false);
- }
+ try
+ {
+ test->unknownIntermediateAsBase();
+ test(false);
+ }
+ catch(const Base& b)
+ {
+ test(b.b == "UnknownIntermediate.b");
+ test(b.ice_name() =="Test::Base");
+ }
+ catch(...)
+ {
+ test(false);
+ }
}
tprintf("ok\n");
tprintf("slicing of known intermediate as base... "); fflush(stdout);
{
- try
- {
- test->knownIntermediateAsBase();
- test(false);
- }
- catch(const KnownIntermediate& ki)
- {
- test(ki.b == "KnownIntermediate.b");
- test(ki.ki == "KnownIntermediate.ki");
- test(ki.ice_name() =="Test::KnownIntermediate");
- }
- catch(...)
- {
- test(false);
- }
+ try
+ {
+ test->knownIntermediateAsBase();
+ test(false);
+ }
+ catch(const KnownIntermediate& ki)
+ {
+ test(ki.b == "KnownIntermediate.b");
+ test(ki.ki == "KnownIntermediate.ki");
+ test(ki.ice_name() =="Test::KnownIntermediate");
+ }
+ catch(...)
+ {
+ test(false);
+ }
}
tprintf("ok\n");
tprintf("slicing of known most derived as base... "); fflush(stdout);
{
- try
- {
- test->knownMostDerivedAsBase();
- test(false);
- }
- catch(const KnownMostDerived& kmd)
- {
- test(kmd.b == "KnownMostDerived.b");
- test(kmd.ki == "KnownMostDerived.ki");
- test(kmd.kmd == "KnownMostDerived.kmd");
- test(kmd.ice_name() =="Test::KnownMostDerived");
- }
- catch(...)
- {
- test(false);
- }
+ try
+ {
+ test->knownMostDerivedAsBase();
+ test(false);
+ }
+ catch(const KnownMostDerived& kmd)
+ {
+ test(kmd.b == "KnownMostDerived.b");
+ test(kmd.ki == "KnownMostDerived.ki");
+ test(kmd.kmd == "KnownMostDerived.kmd");
+ test(kmd.ice_name() =="Test::KnownMostDerived");
+ }
+ catch(...)
+ {
+ test(false);
+ }
}
tprintf("ok\n");
tprintf("non-slicing of known intermediate as intermediate... "); fflush(stdout);
{
- try
- {
- test->knownIntermediateAsKnownIntermediate();
- test(false);
- }
- catch(const KnownIntermediate& ki)
- {
- test(ki.b == "KnownIntermediate.b");
- test(ki.ki == "KnownIntermediate.ki");
- test(ki.ice_name() =="Test::KnownIntermediate");
- }
- catch(...)
- {
- test(false);
- }
+ try
+ {
+ test->knownIntermediateAsKnownIntermediate();
+ test(false);
+ }
+ catch(const KnownIntermediate& ki)
+ {
+ test(ki.b == "KnownIntermediate.b");
+ test(ki.ki == "KnownIntermediate.ki");
+ test(ki.ice_name() =="Test::KnownIntermediate");
+ }
+ catch(...)
+ {
+ test(false);
+ }
}
tprintf("ok\n");
tprintf("non-slicing of known most derived exception as intermediate... "); fflush(stdout);
{
- try
- {
- test->knownMostDerivedAsKnownIntermediate();
- test(false);
- }
- catch(const KnownMostDerived& kmd)
- {
- test(kmd.b == "KnownMostDerived.b");
- test(kmd.ki == "KnownMostDerived.ki");
- test(kmd.kmd == "KnownMostDerived.kmd");
- test(kmd.ice_name() =="Test::KnownMostDerived");
- }
- catch(...)
- {
- test(false);
- }
+ try
+ {
+ test->knownMostDerivedAsKnownIntermediate();
+ test(false);
+ }
+ catch(const KnownMostDerived& kmd)
+ {
+ test(kmd.b == "KnownMostDerived.b");
+ test(kmd.ki == "KnownMostDerived.ki");
+ test(kmd.kmd == "KnownMostDerived.kmd");
+ test(kmd.ice_name() =="Test::KnownMostDerived");
+ }
+ catch(...)
+ {
+ test(false);
+ }
}
tprintf("ok\n");
tprintf("non-slicing of known most derived as most derived... "); fflush(stdout);
{
- try
- {
- test->knownMostDerivedAsKnownMostDerived();
- test(false);
- }
- catch(const KnownMostDerived& kmd)
- {
- test(kmd.b == "KnownMostDerived.b");
- test(kmd.ki == "KnownMostDerived.ki");
- test(kmd.kmd == "KnownMostDerived.kmd");
- test(kmd.ice_name() =="Test::KnownMostDerived");
- }
- catch(...)
- {
- test(false);
- }
+ try
+ {
+ test->knownMostDerivedAsKnownMostDerived();
+ test(false);
+ }
+ catch(const KnownMostDerived& kmd)
+ {
+ test(kmd.b == "KnownMostDerived.b");
+ test(kmd.ki == "KnownMostDerived.ki");
+ test(kmd.kmd == "KnownMostDerived.kmd");
+ test(kmd.ice_name() =="Test::KnownMostDerived");
+ }
+ catch(...)
+ {
+ test(false);
+ }
}
tprintf("ok\n");
tprintf("slicing of unknown most derived, known intermediate as base... "); fflush(stdout);
{
- try
- {
- test->unknownMostDerived1AsBase();
- test(false);
- }
- catch(const KnownIntermediate& ki)
- {
- test(ki.b == "UnknownMostDerived1.b");
- test(ki.ki == "UnknownMostDerived1.ki");
- test(ki.ice_name() =="Test::KnownIntermediate");
- }
- catch(...)
- {
- test(false);
- }
+ try
+ {
+ test->unknownMostDerived1AsBase();
+ test(false);
+ }
+ catch(const KnownIntermediate& ki)
+ {
+ test(ki.b == "UnknownMostDerived1.b");
+ test(ki.ki == "UnknownMostDerived1.ki");
+ test(ki.ice_name() =="Test::KnownIntermediate");
+ }
+ catch(...)
+ {
+ test(false);
+ }
}
tprintf("ok\n");
tprintf("slicing of unknown most derived, known intermediate as intermediate... "); fflush(stdout);
{
- try
- {
- test->unknownMostDerived1AsKnownIntermediate();
- test(false);
- }
- catch(const KnownIntermediate& ki)
- {
- test(ki.b == "UnknownMostDerived1.b");
- test(ki.ki == "UnknownMostDerived1.ki");
- test(ki.ice_name() =="Test::KnownIntermediate");
- }
- catch(...)
- {
- test(false);
- }
+ try
+ {
+ test->unknownMostDerived1AsKnownIntermediate();
+ test(false);
+ }
+ catch(const KnownIntermediate& ki)
+ {
+ test(ki.b == "UnknownMostDerived1.b");
+ test(ki.ki == "UnknownMostDerived1.ki");
+ test(ki.ice_name() =="Test::KnownIntermediate");
+ }
+ catch(...)
+ {
+ test(false);
+ }
}
tprintf("ok\n");
tprintf("slicing of unknown most derived, unknown intermediate as base... "); fflush(stdout);
{
- try
- {
- test->unknownMostDerived2AsBase();
- test(false);
- }
- catch(const Base& b)
- {
- test(b.b == "UnknownMostDerived2.b");
- test(b.ice_name() =="Test::Base");
- }
- catch(...)
- {
- test(false);
- }
+ try
+ {
+ test->unknownMostDerived2AsBase();
+ test(false);
+ }
+ catch(const Base& b)
+ {
+ test(b.b == "UnknownMostDerived2.b");
+ test(b.ice_name() =="Test::Base");
+ }
+ catch(...)
+ {
+ test(false);
+ }
}
tprintf("ok\n");
diff --git a/cppe/test/IceE/slicing/Client.cpp b/cppe/test/IceE/slicing/Client.cpp
index 62f10a5ca01..7ae8414a960 100644
--- a/cppe/test/IceE/slicing/Client.cpp
+++ b/cppe/test/IceE/slicing/Client.cpp
@@ -29,7 +29,7 @@ public:
Ice::InitializationData initData;
initData.properties = Ice::createProperties();
loadConfig(initData.properties);
- initData.logger = getLogger();
+ initData.logger = getLogger();
setCommunicator(Ice::initialize(argc, argv, initData));
TestIntfPrx allTests(const Ice::CommunicatorPtr&);
diff --git a/cppe/test/IceE/slicing/Server.cpp b/cppe/test/IceE/slicing/Server.cpp
index 3d21896dbf2..479b3db1982 100644
--- a/cppe/test/IceE/slicing/Server.cpp
+++ b/cppe/test/IceE/slicing/Server.cpp
@@ -31,7 +31,7 @@ public:
initData.properties->setProperty("TestAdapter.Endpoints", "default -p 12010 -t 2000");
loadConfig(initData.properties);
- initData.logger = getLogger();
+ initData.logger = getLogger();
setCommunicator(Ice::initialize(argc, argv, initData));
Ice::ObjectAdapterPtr adapter = communicator()->createObjectAdapter("TestAdapter");
@@ -40,7 +40,7 @@ public:
adapter->activate();
#ifndef _WIN32_WCE
- communicator()->waitForShutdown();
+ communicator()->waitForShutdown();
#endif
return EXIT_SUCCESS;
diff --git a/cppe/test/IceE/thread/AliveTest.cpp b/cppe/test/IceE/thread/AliveTest.cpp
index 8961b07157f..eda4e37e7a6 100644
--- a/cppe/test/IceE/thread/AliveTest.cpp
+++ b/cppe/test/IceE/thread/AliveTest.cpp
@@ -21,24 +21,24 @@ class CondVar : public IceUtil::Monitor<IceUtil::RecMutex>
public:
CondVar() :
- _done(false)
+ _done(false)
{
}
void waitForSignal()
{
- IceUtil::Monitor<IceUtil::RecMutex>::Lock lock(*this);
- while(!_done)
- {
- wait();
- }
+ IceUtil::Monitor<IceUtil::RecMutex>::Lock lock(*this);
+ while(!_done)
+ {
+ wait();
+ }
}
void signal()
{
- IceUtil::Monitor<IceUtil::RecMutex>::Lock lock(*this);
- _done = true;
- notify();
+ IceUtil::Monitor<IceUtil::RecMutex>::Lock lock(*this);
+ _done = true;
+ notify();
}
private:
@@ -51,20 +51,20 @@ class AliveTestThread : public Thread
public:
AliveTestThread(CondVar& childCreated, CondVar& parentReady) :
- _childCreated(childCreated), _parentReady(parentReady)
+ _childCreated(childCreated), _parentReady(parentReady)
{
}
virtual void run()
{
- try
- {
- _childCreated.signal();
- _parentReady.waitForSignal();
- }
- catch(IceUtil::ThreadLockedException &)
- {
- }
+ try
+ {
+ _childCreated.signal();
+ _parentReady.waitForSignal();
+ }
+ catch(IceUtil::ThreadLockedException &)
+ {
+ }
}
private:
diff --git a/cppe/test/IceE/thread/Client.cpp b/cppe/test/IceE/thread/Client.cpp
index 7c38af8b853..a0a25c350bc 100644
--- a/cppe/test/IceE/thread/Client.cpp
+++ b/cppe/test/IceE/thread/Client.cpp
@@ -27,21 +27,21 @@ public:
virtual int run(int argc, char* argv[])
{
- try
- {
- initializeTestSuite();
+ try
+ {
+ initializeTestSuite();
- for(list<TestBasePtr>::const_iterator p = allTests.begin(); p != allTests.end(); ++p)
- {
- (*p)->start();
- }
- }
- catch(const TestFailed& e)
- {
- tprintf("test %s failed\n", e.name.c_str());
- return EXIT_FAILURE;
- }
- return EXIT_SUCCESS;
+ for(list<TestBasePtr>::const_iterator p = allTests.begin(); p != allTests.end(); ++p)
+ {
+ (*p)->start();
+ }
+ }
+ catch(const TestFailed& e)
+ {
+ tprintf("test %s failed\n", e.name.c_str());
+ return EXIT_FAILURE;
+ }
+ return EXIT_SUCCESS;
}
};
diff --git a/cppe/test/IceE/thread/CreateTest.cpp b/cppe/test/IceE/thread/CreateTest.cpp
index 9bee30ac317..70ff6513d7d 100644
--- a/cppe/test/IceE/thread/CreateTest.cpp
+++ b/cppe/test/IceE/thread/CreateTest.cpp
@@ -25,13 +25,13 @@ class CreateTestThread : public Thread
public:
CreateTestThread() :
- threadran(false)
+ threadran(false)
{
}
virtual void run()
{
- threadran = true;
+ threadran = true;
}
bool threadran;
@@ -56,22 +56,22 @@ CreateTest::run()
#endif
for(int i = 0; i < nthreads ; ++i)
{
- CreateTestThreadPtr t = new CreateTestThread();
- ThreadControl control = t->start();
- control.join();
- test(t->threadran);
+ CreateTestThreadPtr t = new CreateTestThread();
+ ThreadControl control = t->start();
+ control.join();
+ test(t->threadran);
#ifdef _WIN32_WCE
- if((i % 32) == 0)
- {
- tprintf(".");
- }
+ if((i % 32) == 0)
+ {
+ tprintf(".");
+ }
#else
- if((i % 256) == 0)
- {
- char buf[5];
- sprintf(buf, "%04d", i);
- tprintf("%s", buf);
- }
+ if((i % 256) == 0)
+ {
+ char buf[5];
+ sprintf(buf, "%04d", i);
+ tprintf("%s", buf);
+ }
#endif
}
#ifndef _WIN32_WCE
diff --git a/cppe/test/IceE/thread/MonitorMutexTest.cpp b/cppe/test/IceE/thread/MonitorMutexTest.cpp
index d987205033f..55dbf5531b3 100644
--- a/cppe/test/IceE/thread/MonitorMutexTest.cpp
+++ b/cppe/test/IceE/thread/MonitorMutexTest.cpp
@@ -20,33 +20,33 @@ class MonitorMutexTestThread : public Thread
public:
MonitorMutexTestThread(Monitor<Mutex>& m) :
- _monitor(m),
- _tryLock(false)
+ _monitor(m),
+ _tryLock(false)
{
}
virtual void run()
{
- Monitor<Mutex>::TryLock tlock(_monitor);
- test(!tlock.acquired());
-
- {
- Mutex::Lock lock(_tryLockMutex);
- _tryLock = true;
- }
- _tryLockCond.signal();
-
- Monitor<Mutex>::Lock lock(_monitor);
+ Monitor<Mutex>::TryLock tlock(_monitor);
+ test(!tlock.acquired());
+
+ {
+ Mutex::Lock lock(_tryLockMutex);
+ _tryLock = true;
+ }
+ _tryLockCond.signal();
+
+ Monitor<Mutex>::Lock lock(_monitor);
}
void
waitTryLock()
{
- Mutex::Lock lock(_tryLockMutex);
- while(!_tryLock)
- {
- _tryLockCond.wait(lock);
- }
+ Mutex::Lock lock(_tryLockMutex);
+ while(!_tryLock)
+ {
+ _tryLockCond.wait(lock);
+ }
}
private:
@@ -67,16 +67,16 @@ class MonitorMutexTestThread2 : public Thread
public:
MonitorMutexTestThread2(Monitor<Mutex>& monitor) :
- finished(false),
- _monitor(monitor)
+ finished(false),
+ _monitor(monitor)
{
}
virtual void run()
{
- Monitor<Mutex>::Lock lock(_monitor);
- _monitor.wait();
- finished = true;
+ Monitor<Mutex>::Lock lock(_monitor);
+ _monitor.wait();
+ finished = true;
}
bool finished;
@@ -106,23 +106,23 @@ MonitorMutexTest::run()
ThreadControl control2;
{
- Monitor<Mutex>::Lock lock(monitor);
-
- try
- {
- Monitor<Mutex>::TryLock tlock(monitor);
- test(!tlock.acquired());
- }
- catch(const ThreadLockedException&)
- {
- }
-
- // TEST: Start thread, try to acquire the mutex.
- t = new MonitorMutexTestThread(monitor);
- control = t->start();
-
- // TEST: Wait until the tryLock has been tested.
- t->waitTryLock();
+ Monitor<Mutex>::Lock lock(monitor);
+
+ try
+ {
+ Monitor<Mutex>::TryLock tlock(monitor);
+ test(!tlock.acquired());
+ }
+ catch(const ThreadLockedException&)
+ {
+ }
+
+ // TEST: Start thread, try to acquire the mutex.
+ t = new MonitorMutexTestThread(monitor);
+ control = t->start();
+
+ // TEST: Wait until the tryLock has been tested.
+ t->waitTryLock();
}
//
@@ -141,8 +141,8 @@ MonitorMutexTest::run()
ThreadControl::sleep(Time::seconds(1));
{
- Monitor<Mutex>::Lock lock(monitor);
- monitor.notify();
+ Monitor<Mutex>::Lock lock(monitor);
+ monitor.notify();
}
// Give one thread time to terminate
@@ -151,8 +151,8 @@ MonitorMutexTest::run()
test((t2->finished && !t3->finished) || (t3->finished && !t2->finished));
{
- Monitor<Mutex>::Lock lock(monitor);
- monitor.notify();
+ Monitor<Mutex>::Lock lock(monitor);
+ monitor.notify();
}
control.join();
control2.join();
@@ -167,8 +167,8 @@ MonitorMutexTest::run()
ThreadControl::sleep(Time::seconds(1));
{
- Monitor<Mutex>::Lock lock(monitor);
- monitor.notifyAll();
+ Monitor<Mutex>::Lock lock(monitor);
+ monitor.notifyAll();
}
control.join();
@@ -176,7 +176,7 @@ MonitorMutexTest::run()
// TEST: timedWait
{
- Monitor<Mutex>::Lock lock(monitor);
- test(!monitor.timedWait(Time::milliSeconds(500)));
+ Monitor<Mutex>::Lock lock(monitor);
+ test(!monitor.timedWait(Time::milliSeconds(500)));
}
}
diff --git a/cppe/test/IceE/thread/MonitorRecMutexTest.cpp b/cppe/test/IceE/thread/MonitorRecMutexTest.cpp
index ca4c5072a5b..8cd2e1854cd 100644
--- a/cppe/test/IceE/thread/MonitorRecMutexTest.cpp
+++ b/cppe/test/IceE/thread/MonitorRecMutexTest.cpp
@@ -20,34 +20,34 @@ class MonitorRecMutexTestThread : public Thread
public:
MonitorRecMutexTestThread(Monitor<RecMutex>& m) :
- _monitor(m),
- _tryLock(false)
+ _monitor(m),
+ _tryLock(false)
{
}
virtual void run()
{
-
- Monitor<RecMutex>::TryLock tlock(_monitor);
- test(!tlock.acquired());
-
- {
- Mutex::Lock lock(_tryLockMutex);
- _tryLock = true;
- }
- _tryLockCond.signal();
-
- Monitor<RecMutex>::Lock lock(_monitor);
+
+ Monitor<RecMutex>::TryLock tlock(_monitor);
+ test(!tlock.acquired());
+
+ {
+ Mutex::Lock lock(_tryLockMutex);
+ _tryLock = true;
+ }
+ _tryLockCond.signal();
+
+ Monitor<RecMutex>::Lock lock(_monitor);
}
void
waitTryLock()
{
- Mutex::Lock lock(_tryLockMutex);
- while(!_tryLock)
- {
- _tryLockCond.wait(lock);
- }
+ Mutex::Lock lock(_tryLockMutex);
+ while(!_tryLock)
+ {
+ _tryLockCond.wait(lock);
+ }
}
private:
@@ -68,16 +68,16 @@ class MonitorRecMutexTestThread2 : public Thread, public Monitor<RecMutex>
public:
MonitorRecMutexTestThread2(Monitor<RecMutex>& monitor) :
- finished(false),
- _monitor(monitor)
+ finished(false),
+ _monitor(monitor)
{
}
virtual void run()
{
- Monitor<RecMutex>::Lock lock(_monitor);
- _monitor.wait();
- finished = true;
+ Monitor<RecMutex>::Lock lock(_monitor);
+ _monitor.wait();
+ finished = true;
}
bool finished;
@@ -108,22 +108,22 @@ MonitorRecMutexTest::run()
{
- Monitor<RecMutex>::Lock lock(monitor);
-
- Monitor<RecMutex>::TryLock lock2(monitor);
- test(lock2.acquired());
-
- // TEST: TryLock
-
- Monitor<RecMutex>::TryLock tlock(monitor);
- test(tlock.acquired());
-
- // TEST: Start thread, try to acquire the mutex.
- t = new MonitorRecMutexTestThread(monitor);
- control = t->start();
-
- // TEST: Wait until the tryLock has been tested.
- t->waitTryLock();
+ Monitor<RecMutex>::Lock lock(monitor);
+
+ Monitor<RecMutex>::TryLock lock2(monitor);
+ test(lock2.acquired());
+
+ // TEST: TryLock
+
+ Monitor<RecMutex>::TryLock tlock(monitor);
+ test(tlock.acquired());
+
+ // TEST: Start thread, try to acquire the mutex.
+ t = new MonitorRecMutexTestThread(monitor);
+ control = t->start();
+
+ // TEST: Wait until the tryLock has been tested.
+ t->waitTryLock();
}
//
@@ -142,8 +142,8 @@ MonitorRecMutexTest::run()
ThreadControl::sleep(Time::seconds(1));
{
- Monitor<RecMutex>::Lock lock(monitor);
- monitor.notify();
+ Monitor<RecMutex>::Lock lock(monitor);
+ monitor.notify();
}
// Give one thread time to terminate
@@ -152,8 +152,8 @@ MonitorRecMutexTest::run()
test((t2->finished && !t3->finished) || (t3->finished && !t2->finished));
{
- Monitor<RecMutex>::Lock lock(monitor);
- monitor.notify();
+ Monitor<RecMutex>::Lock lock(monitor);
+ monitor.notify();
}
control.join();
control2.join();
@@ -168,8 +168,8 @@ MonitorRecMutexTest::run()
ThreadControl::sleep(Time::seconds(1));
{
- Monitor<RecMutex>::Lock lock(monitor);
- monitor.notifyAll();
+ Monitor<RecMutex>::Lock lock(monitor);
+ monitor.notifyAll();
}
control.join();
@@ -177,7 +177,7 @@ MonitorRecMutexTest::run()
// TEST: timedWait
{
- Monitor<RecMutex>::Lock lock(monitor);
- test(!monitor.timedWait(Time::milliSeconds(500)));
+ Monitor<RecMutex>::Lock lock(monitor);
+ test(!monitor.timedWait(Time::milliSeconds(500)));
}
}
diff --git a/cppe/test/IceE/thread/MutexTest.cpp b/cppe/test/IceE/thread/MutexTest.cpp
index b5a29e7e9b2..371af7d08a6 100644
--- a/cppe/test/IceE/thread/MutexTest.cpp
+++ b/cppe/test/IceE/thread/MutexTest.cpp
@@ -22,33 +22,33 @@ class MutexTestThread : public Thread
public:
MutexTestThread(Mutex& m) :
- _mutex(m),
- _tryLock(false)
+ _mutex(m),
+ _tryLock(false)
{
}
virtual void run()
- {
- Mutex::TryLock tlock(_mutex);
- test(!tlock.acquired());
+ {
+ Mutex::TryLock tlock(_mutex);
+ test(!tlock.acquired());
- {
- Mutex::Lock lock(_tryLockMutex);
- _tryLock = true;
- }
- _tryLockCond.signal();
+ {
+ Mutex::Lock lock(_tryLockMutex);
+ _tryLock = true;
+ }
+ _tryLockCond.signal();
- Mutex::Lock lock(_mutex);
+ Mutex::Lock lock(_mutex);
}
void
waitTryLock()
{
- Mutex::Lock lock(_tryLockMutex);
- while(!_tryLock)
- {
- _tryLockCond.wait(lock);
- }
+ Mutex::Lock lock(_tryLockMutex);
+ while(!_tryLock)
+ {
+ _tryLockCond.wait(lock);
+ }
}
private:
@@ -77,79 +77,79 @@ MutexTest::run()
ThreadControl control;
{
- Mutex::Lock lock(mutex);
-
- // LockT testing:
- //
-
- test(lock.acquired());
-
- try
- {
- lock.acquire();
- test(false);
- }
- catch(const ThreadLockedException&)
- {
- // Expected
- }
-
- try
- {
- lock.tryAcquire();
- test(false);
- }
- catch(const ThreadLockedException&)
- {
- // Expected
- }
-
- test(lock.acquired());
- lock.release();
- test(!lock.acquired());
-
- try
- {
- lock.release();
- test(false);
- }
- catch(const ThreadLockedException&)
- {
- // Expected
- }
-
- Mutex::TryLock lock2(mutex);
- try
- {
- test(lock.tryAcquire() == false);
- }
- catch(const IceUtil::ThreadLockedException&)
- {
- }
- lock2.release();
- test(lock.tryAcquire() == true);
- test(lock.acquired());
-
- // Deadlock testing
- //
+ Mutex::Lock lock(mutex);
+
+ // LockT testing:
+ //
+
+ test(lock.acquired());
+
+ try
+ {
+ lock.acquire();
+ test(false);
+ }
+ catch(const ThreadLockedException&)
+ {
+ // Expected
+ }
+
+ try
+ {
+ lock.tryAcquire();
+ test(false);
+ }
+ catch(const ThreadLockedException&)
+ {
+ // Expected
+ }
+
+ test(lock.acquired());
+ lock.release();
+ test(!lock.acquired());
+
+ try
+ {
+ lock.release();
+ test(false);
+ }
+ catch(const ThreadLockedException&)
+ {
+ // Expected
+ }
+
+ Mutex::TryLock lock2(mutex);
+ try
+ {
+ test(lock.tryAcquire() == false);
+ }
+ catch(const IceUtil::ThreadLockedException&)
+ {
+ }
+ lock2.release();
+ test(lock.tryAcquire() == true);
+ test(lock.acquired());
+
+ // Deadlock testing
+ //
#if !defined(NDEBUG) && !defined(_WIN32)
- try
- {
- Mutex::Lock lock3(mutex);
- test(false);
- }
- catch(const ThreadLockedException&)
- {
- }
+ try
+ {
+ Mutex::Lock lock3(mutex);
+ test(false);
+ }
+ catch(const ThreadLockedException&)
+ {
+ }
#endif
- // TEST: Start thread, try to acquire the mutex.
- t = new MutexTestThread(mutex);
- control = t->start();
-
- // TEST: Wait until the tryLock has been tested.
- t->waitTryLock();
+ // TEST: Start thread, try to acquire the mutex.
+ t = new MutexTestThread(mutex);
+ control = t->start();
+
+ // TEST: Wait until the tryLock has been tested.
+ t->waitTryLock();
}
//
diff --git a/cppe/test/IceE/thread/RecMutexTest.cpp b/cppe/test/IceE/thread/RecMutexTest.cpp
index 3d52bb13164..0e4d8c14fb7 100644
--- a/cppe/test/IceE/thread/RecMutexTest.cpp
+++ b/cppe/test/IceE/thread/RecMutexTest.cpp
@@ -22,34 +22,34 @@ class RecMutexTestThread : public Thread
public:
RecMutexTestThread(RecMutex& m) :
- _mutex(m),
- _tryLock(false)
+ _mutex(m),
+ _tryLock(false)
{
}
virtual void run()
{
-
- RecMutex::TryLock tlock(_mutex);
- test(!tlock.acquired());
-
- {
- Mutex::Lock lock(_tryLockMutex);
- _tryLock = true;
- }
- _tryLockCond.signal();
-
- RecMutex::Lock lock(_mutex);
+
+ RecMutex::TryLock tlock(_mutex);
+ test(!tlock.acquired());
+
+ {
+ Mutex::Lock lock(_tryLockMutex);
+ _tryLock = true;
+ }
+ _tryLockCond.signal();
+
+ RecMutex::Lock lock(_mutex);
}
void
waitTryLock()
{
- Mutex::Lock lock(_tryLockMutex);
- while(!_tryLock)
- {
- _tryLockCond.wait(lock);
- }
+ Mutex::Lock lock(_tryLockMutex);
+ while(!_tryLock)
+ {
+ _tryLockCond.wait(lock);
+ }
}
private:
@@ -78,22 +78,22 @@ RecMutexTest::run()
ThreadControl control;
{
- RecMutex::Lock lock(mutex);
-
- // TEST: lock twice
- RecMutex::Lock lock2(mutex);
-
- // TEST: TryLock
- RecMutex::TryLock lock3(mutex);
- test(lock3.acquired());
-
- // TEST: Start thread, try to acquire the mutex.
- t = new RecMutexTestThread(mutex);
- control = t->start();
-
- // TEST: Wait until the tryLock has been tested.
- t->waitTryLock();
-
+ RecMutex::Lock lock(mutex);
+
+ // TEST: lock twice
+ RecMutex::Lock lock2(mutex);
+
+ // TEST: TryLock
+ RecMutex::TryLock lock3(mutex);
+ test(lock3.acquired());
+
+ // TEST: Start thread, try to acquire the mutex.
+ t = new RecMutexTestThread(mutex);
+ control = t->start();
+
+ // TEST: Wait until the tryLock has been tested.
+ t->waitTryLock();
+
}
//
diff --git a/cppe/test/IceE/thread/StartTest.cpp b/cppe/test/IceE/thread/StartTest.cpp
index fc19b8e1907..5545b1a737b 100644
--- a/cppe/test/IceE/thread/StartTest.cpp
+++ b/cppe/test/IceE/thread/StartTest.cpp
@@ -32,8 +32,8 @@ public:
virtual void run()
{
- IceUtil::Mutex::Lock sync(threadCountMutex);
- --threadCount;
+ IceUtil::Mutex::Lock sync(threadCountMutex);
+ --threadCount;
}
};
@@ -55,8 +55,8 @@ StartTest::run()
control.join();
try
{
- t->start();
- test(false);
+ t->start();
+ test(false);
}
catch(const ThreadStartedException&)
{
@@ -69,39 +69,39 @@ StartTest::run()
#ifdef _WIN32_WCE
for(int i = 0; i < 50; i++)
{
- for(int j = 0; j < 5; j++)
- {
- {
- IceUtil::Mutex::Lock sync(threadCountMutex);
- ++threadCount;
- }
- Thread* t = new StartTestThread;
- t->start().detach();
- }
+ for(int j = 0; j < 5; j++)
+ {
+ {
+ IceUtil::Mutex::Lock sync(threadCountMutex);
+ ++threadCount;
+ }
+ Thread* t = new StartTestThread;
+ t->start().detach();
+ }
- // Wait for the threads to all terminate. I don't want to use
- // a monitor here, since monitor hasn't been tested yet.
- while(true)
- {
- {
- IceUtil::Mutex::Lock sync(threadCountMutex);
- if(threadCount == 0)
- {
- break;
- }
- }
- ThreadControl::sleep(Time::milliSeconds(5));
- }
+ // Wait for the threads to all terminate. I don't want to use
+ // a monitor here, since monitor hasn't been tested yet.
+ while(true)
+ {
+ {
+ IceUtil::Mutex::Lock sync(threadCountMutex);
+ if(threadCount == 0)
+ {
+ break;
+ }
+ }
+ ThreadControl::sleep(Time::milliSeconds(5));
+ }
}
#else
for(int i = 0; i < 50; i++)
{
- for(int j = 0; j < 50; j++)
- {
- Thread* t = new StartTestThread;
- t->start().detach();
- }
- ThreadControl::sleep(Time::milliSeconds(5));
+ for(int j = 0; j < 50; j++)
+ {
+ Thread* t = new StartTestThread;
+ t->start().detach();
+ }
+ ThreadControl::sleep(Time::milliSeconds(5));
}
#endif
}
diff --git a/cppe/test/IceE/thread/StaticMutexTest.cpp b/cppe/test/IceE/thread/StaticMutexTest.cpp
index f7c40712bc7..e1133d04dde 100644
--- a/cppe/test/IceE/thread/StaticMutexTest.cpp
+++ b/cppe/test/IceE/thread/StaticMutexTest.cpp
@@ -25,32 +25,32 @@ class StaticMutexTestThread : public Thread
public:
StaticMutexTestThread() :
- _tryLock(false)
+ _tryLock(false)
{
}
virtual void run()
- {
- StaticMutex::TryLock tlock(staticMutex);
- test(!tlock.acquired());
+ {
+ StaticMutex::TryLock tlock(staticMutex);
+ test(!tlock.acquired());
- {
- Mutex::Lock lock(_tryLockMutex);
- _tryLock = true;
- }
- _tryLockCond.signal();
+ {
+ Mutex::Lock lock(_tryLockMutex);
+ _tryLock = true;
+ }
+ _tryLockCond.signal();
- StaticMutex::Lock lock(staticMutex);
+ StaticMutex::Lock lock(staticMutex);
}
void
waitTryLock()
{
- Mutex::Lock lock(_tryLockMutex);
- while(!_tryLock)
- {
- _tryLockCond.wait(lock);
- }
+ Mutex::Lock lock(_tryLockMutex);
+ while(!_tryLock)
+ {
+ _tryLockCond.wait(lock);
+ }
}
private:
@@ -77,70 +77,70 @@ StaticMutexTest::run()
ThreadControl control;
{
- StaticMutex::Lock lock(staticMutex);
-
- // LockT testing:
- //
-
- test(lock.acquired());
-
- try
- {
- lock.acquire();
- test(false);
- }
- catch(const ThreadLockedException&)
- {
- // Expected
- }
-
- try
- {
- lock.tryAcquire();
- test(false);
- }
- catch(const ThreadLockedException&)
- {
- // Expected
- }
-
- test(lock.acquired());
- lock.release();
- test(!lock.acquired());
-
- try
- {
- lock.release();
- test(false);
- }
- catch(const ThreadLockedException&)
- {
- // Expected
- }
-
- StaticMutex::TryLock lock2(staticMutex);
- //
- // Under WinCE tryAcquire() does not do recursion checks.
- //
+ StaticMutex::Lock lock(staticMutex);
+
+ // LockT testing:
+ //
+
+ test(lock.acquired());
+
+ try
+ {
+ lock.acquire();
+ test(false);
+ }
+ catch(const ThreadLockedException&)
+ {
+ // Expected
+ }
+
+ try
+ {
+ lock.tryAcquire();
+ test(false);
+ }
+ catch(const ThreadLockedException&)
+ {
+ // Expected
+ }
+
+ test(lock.acquired());
+ lock.release();
+ test(!lock.acquired());
+
+ try
+ {
+ lock.release();
+ test(false);
+ }
+ catch(const ThreadLockedException&)
+ {
+ // Expected
+ }
+
+ StaticMutex::TryLock lock2(staticMutex);
+ //
+ // Under WinCE tryAcquire() does not do recursion checks.
+ //
#ifndef _WIN32_WCE
- try
- {
- test(lock.tryAcquire() == false);
- }
- catch(const IceUtil::ThreadLockedException&)
- {
- }
- lock2.release();
- test(lock.tryAcquire() == true);
- test(lock.acquired());
+ try
+ {
+ test(lock.tryAcquire() == false);
+ }
+ catch(const IceUtil::ThreadLockedException&)
+ {
+ }
+ lock2.release();
+ test(lock.tryAcquire() == true);
+ test(lock.acquired());
#endif
- // TEST: Start thread, try to acquire the mutex.
- t = new StaticMutexTestThread;
- control = t->start();
-
- // TEST: Wait until the tryLock has been tested.
- t->waitTryLock();
+ // TEST: Start thread, try to acquire the mutex.
+ t = new StaticMutexTestThread;
+ control = t->start();
+
+ // TEST: Wait until the tryLock has been tested.
+ t->waitTryLock();
}
//
diff --git a/cppe/test/IceE/thread/TestBase.cpp b/cppe/test/IceE/thread/TestBase.cpp
index 7fdb25442eb..6628ad2f3c4 100644
--- a/cppe/test/IceE/thread/TestBase.cpp
+++ b/cppe/test/IceE/thread/TestBase.cpp
@@ -38,12 +38,12 @@ TestBase::start()
tprintf("running %s test... ", _name.c_str());
try
{
- run();
+ run();
}
catch(const IceUtil::Exception& e)
{
tprintf("%s failed\n", e.toString().c_str());
- throw TestFailed(_name);
+ throw TestFailed(_name);
}
tprintf("ok\n");
}
diff --git a/cppe/test/IceE/uuid/Client.cpp b/cppe/test/IceE/uuid/Client.cpp
index ae3645ba9b4..62daa8a64b2 100644
--- a/cppe/test/IceE/uuid/Client.cpp
+++ b/cppe/test/IceE/uuid/Client.cpp
@@ -31,36 +31,36 @@ class CountedBarrier : public Shared, public Monitor<Mutex>
public:
CountedBarrier(int count) :
- _count(count)
+ _count(count)
{
}
void
decrement()
{
- Lock sync(*this);
- --_count;
- if(_count == 0)
- {
- notifyAll();
- }
+ Lock sync(*this);
+ --_count;
+ if(_count == 0)
+ {
+ notifyAll();
+ }
}
void
waitZero()
{
- Lock sync(*this);
- while(_count != 0)
- {
- wait();
- }
+ Lock sync(*this);
+ while(_count != 0)
+ {
+ wait();
+ }
}
bool
isZero() const
{
- Lock sync(*this);
- return _count == 0;
+ Lock sync(*this);
+ return _count == 0;
}
private:
@@ -74,63 +74,63 @@ class InsertThread : public Thread, public Mutex
public:
InsertThread(const CountedBarrierPtr& start, const CountedBarrierPtr& stop, int threadId, set<string>& uuidSet, long howMany, bool verbose)
- : _start(start), _stop(stop), _threadId(threadId), _uuidSet(uuidSet), _howMany(howMany), _verbose(verbose), _destroyed(false)
+ : _start(start), _stop(stop), _threadId(threadId), _uuidSet(uuidSet), _howMany(howMany), _verbose(verbose), _destroyed(false)
{
}
virtual void
run()
{
- _start->decrement();
- _start->waitZero();
-
- for(long i = 0; i < _howMany && !destroyed(); i++)
- {
- string uuid = generateUUID();
- {
- StaticMutex::Lock lock(staticMutex);
- pair<set<string>::iterator, bool> ok = _uuidSet.insert(uuid);
- if(!ok.second)
- {
- tprintf("******* iteration %d\n", i);
- tprintf("******* Duplicate UUID: %s\n", (*ok.first).c_str());
- }
-
- test(ok.second);
- }
+ _start->decrement();
+ _start->waitZero();
+
+ for(long i = 0; i < _howMany && !destroyed(); i++)
+ {
+ string uuid = generateUUID();
+ {
+ StaticMutex::Lock lock(staticMutex);
+ pair<set<string>::iterator, bool> ok = _uuidSet.insert(uuid);
+ if(!ok.second)
+ {
+ tprintf("******* iteration %d\n", i);
+ tprintf("******* Duplicate UUID: %s\n", (*ok.first).c_str());
+ }
+
+ test(ok.second);
+ }
#ifdef _WIN32_WCE
- if(i > 0 && (i % 100) == 0)
- {
- tprintf(".");
- }
+ if(i > 0 && (i % 100) == 0)
+ {
+ tprintf(".");
+ }
#else
- if(_verbose && i > 0 && (i % 100000 == 0))
- {
- tprintf("Thread %d: generated %d UUIDs.\n", _threadId, i);
- }
+ if(_verbose && i > 0 && (i % 100000 == 0))
+ {
+ tprintf("Thread %d: generated %d UUIDs.\n", _threadId, i);
+ }
#endif
- }
+ }
- _stop->decrement();
+ _stop->decrement();
#ifdef _WIN32_WCE
- // This will cause the main thread to wake.
- tprintf(".");
+ // This will cause the main thread to wake.
+ tprintf(".");
#endif
}
void
destroy()
{
- Lock sync(*this);
- _destroyed = true;
+ Lock sync(*this);
+ _destroyed = true;
}
bool
destroyed() const
{
- Lock sync(*this);
- return _destroyed;
+ Lock sync(*this);
+ return _destroyed;
}
private:
@@ -166,56 +166,56 @@ public:
if(argc > 3)
{
- usage(argv[0]);
- return EXIT_FAILURE;
+ usage(argv[0]);
+ return EXIT_FAILURE;
}
else if(argc == 3)
{
- howMany = atol(argv[1]);
- if (howMany == 0)
- {
- usage(argv[0]);
- return EXIT_FAILURE;
- }
- threadCount = atoi(argv[2]);
- if(threadCount <= 0)
- {
- usage(argv[0]);
- return EXIT_FAILURE;
- }
- verbose = true;
+ howMany = atol(argv[1]);
+ if (howMany == 0)
+ {
+ usage(argv[0]);
+ return EXIT_FAILURE;
+ }
+ threadCount = atoi(argv[2]);
+ if(threadCount <= 0)
+ {
+ usage(argv[0]);
+ return EXIT_FAILURE;
+ }
+ verbose = true;
}
else if(argc == 2)
{
- howMany = atol(argv[1]);
- if (howMany == 0)
- {
- usage(argv[0]);
- return EXIT_FAILURE;
- }
+ howMany = atol(argv[1]);
+ if (howMany == 0)
+ {
+ usage(argv[0]);
+ return EXIT_FAILURE;
+ }
}
- tprintf("Generating %d UUIDs", howMany);
+ tprintf("Generating %d UUIDs", howMany);
tprintf("... ");
if(verbose)
{
- tprintf("\n");
+ tprintf("\n");
}
- //
- // First measure raw time to produce UUIDs.
- //
+ //
+ // First measure raw time to produce UUIDs.
+ //
Time startTime = Time::now();
- long i;
- for(i = 0; i < howMany; i++)
- {
- generateUUID();
- }
+ long i;
+ for(i = 0; i < howMany; i++)
+ {
+ generateUUID();
+ }
#ifdef _WIN32_WCE
- if(terminated())
- {
- return EXIT_SUCCESS;
- }
+ if(terminated())
+ {
+ return EXIT_SUCCESS;
+ }
#endif
Time finish = Time::now();
@@ -227,73 +227,73 @@ public:
#endif
{
tprintf("Each UUID took an average of %.04f ms to generate and insert into a set<string>.\n",
- ((double) ((finish - startTime).toMilliSeconds())) / howMany);
+ ((double) ((finish - startTime).toMilliSeconds())) / howMany);
}
tprintf("Generating %d UUIDs using %d thread", howMany, threadCount);
if(threadCount > 1)
{
- tprintf("s");
+ tprintf("s");
}
tprintf("... ");
if(verbose)
{
- tprintf("\n");
+ tprintf("\n");
}
- set<string> uuidSet;
+ set<string> uuidSet;
- startTime = Time::now();
- vector<InsertThreadPtr> threads;
+ startTime = Time::now();
+ vector<InsertThreadPtr> threads;
- CountedBarrierPtr stop = new CountedBarrier(threadCount);
- CountedBarrierPtr start = new CountedBarrier(threadCount);
+ CountedBarrierPtr stop = new CountedBarrier(threadCount);
+ CountedBarrierPtr start = new CountedBarrier(threadCount);
for(i = 0; i < threadCount; i++)
{
- InsertThreadPtr t = new InsertThread(start, stop, i, uuidSet, howMany / threadCount, verbose);
- t->start();
- threads.push_back(t);
+ InsertThreadPtr t = new InsertThread(start, stop, i, uuidSet, howMany / threadCount, verbose);
+ t->start();
+ threads.push_back(t);
}
vector<InsertThreadPtr>::iterator p;
#ifdef _WIN32_WCE
- while(!stop->isZero() && !terminated())
- {
- MSG Msg;
- if(GetMessage(&Msg, NULL, 0, 0))
- {
- //
- // Process all pending events.
- //
- do
- {
- TranslateMessage(&Msg);
- DispatchMessage(&Msg);
- }
- while(PeekMessage(&Msg, NULL, 0, 0, PM_REMOVE));
- }
- }
-
- //
- // If the user terminated the app, the destroy all the
- // threads. This loop will end once all the threads have gone.
- //
- if(terminated())
- {
- for(p = threads.begin(); p != threads.end(); ++p)
- {
- (*p)->destroy();
- }
- }
+ while(!stop->isZero() && !terminated())
+ {
+ MSG Msg;
+ if(GetMessage(&Msg, NULL, 0, 0))
+ {
+ //
+ // Process all pending events.
+ //
+ do
+ {
+ TranslateMessage(&Msg);
+ DispatchMessage(&Msg);
+ }
+ while(PeekMessage(&Msg, NULL, 0, 0, PM_REMOVE));
+ }
+ }
+
+ //
+ // If the user terminated the app, the destroy all the
+ // threads. This loop will end once all the threads have gone.
+ //
+ if(terminated())
+ {
+ for(p = threads.begin(); p != threads.end(); ++p)
+ {
+ (*p)->destroy();
+ }
+ }
#endif
- stop->waitZero();
+ stop->waitZero();
finish = Time::now();
- for(p = threads.begin(); p != threads.end(); ++p)
+ for(p = threads.begin(); p != threads.end(); ++p)
{
- (*p)->getThreadControl().join();
+ (*p)->getThreadControl().join();
}
tprintf("ok\n");
@@ -303,7 +303,7 @@ public:
#endif
{
tprintf("Each UUID took an average of %.04f ms to generate and insert into a set<string>.\n",
- ((double) ((finish - startTime).toMilliSeconds())) / howMany);
+ ((double) ((finish - startTime).toMilliSeconds())) / howMany);
}
return EXIT_SUCCESS;
diff --git a/javae/ant/JADTask.java b/javae/ant/JADTask.java
index 4816c3b6eb9..a206b4fc5cb 100644
--- a/javae/ant/JADTask.java
+++ b/javae/ant/JADTask.java
@@ -17,45 +17,45 @@ public class JADTask extends org.apache.tools.ant.Task
public void
setFile(java.io.File jadFile)
{
- _jad = jadFile;
+ _jad = jadFile;
}
public void
addConfiguredAttribute(JADAttribute attribute)
{
- _attributes.add(attribute);
+ _attributes.add(attribute);
}
public void
execute()
- throws org.apache.tools.ant.BuildException
+ throws org.apache.tools.ant.BuildException
{
- if(_jad == null)
- {
- throw new org.apache.tools.ant.BuildException("No JAD filename set.");
- }
+ if(_jad == null)
+ {
+ throw new org.apache.tools.ant.BuildException("No JAD filename set.");
+ }
- if(_jad.exists() && !_jad.canWrite())
- {
- throw new org.apache.tools.ant.BuildException("Cannot write to " + _jad.getName());
- }
+ if(_jad.exists() && !_jad.canWrite())
+ {
+ throw new org.apache.tools.ant.BuildException("Cannot write to " + _jad.getName());
+ }
- try
- {
- java.io.PrintWriter out = new java.io.PrintWriter(new java.io.FileWriter(_jad));
- java.util.Iterator iter = _attributes.iterator();
- while(iter.hasNext())
- {
- JADAttribute attr = (JADAttribute)iter.next();
- out.println(attr.getName() + ": " + attr.getValue());
- }
- out.flush();
- out.close();
- }
- catch(java.io.IOException ex)
- {
- throw new org.apache.tools.ant.BuildException(ex.getMessage());
- }
+ try
+ {
+ java.io.PrintWriter out = new java.io.PrintWriter(new java.io.FileWriter(_jad));
+ java.util.Iterator iter = _attributes.iterator();
+ while(iter.hasNext())
+ {
+ JADAttribute attr = (JADAttribute)iter.next();
+ out.println(attr.getName() + ": " + attr.getValue());
+ }
+ out.flush();
+ out.close();
+ }
+ catch(java.io.IOException ex)
+ {
+ throw new org.apache.tools.ant.BuildException(ex.getMessage());
+ }
}
private java.io.File _jad;
diff --git a/javae/ant/Javac11.java b/javae/ant/Javac11.java
index d6cd4cc2e6c..b496a5ef1f6 100644
--- a/javae/ant/Javac11.java
+++ b/javae/ant/Javac11.java
@@ -26,73 +26,73 @@ public class Javac11 extends org.apache.tools.ant.taskdefs.compilers.DefaultComp
protected boolean
assumeJava11()
{
- return true;
+ return true;
}
protected Path
getCompileClasspath()
{
- Path classpath = new Path(attributes.getProject());
+ Path classpath = new Path(attributes.getProject());
- java.io.File destDir = attributes.getDestdir();
- if(destDir != null)
- {
- classpath.setLocation(destDir);
- }
+ java.io.File destDir = attributes.getDestdir();
+ if(destDir != null)
+ {
+ classpath.setLocation(destDir);
+ }
- Path cp = attributes.getClasspath();
- if(cp != null)
- {
- classpath.addExisting(cp);
- }
+ Path cp = attributes.getClasspath();
+ if(cp != null)
+ {
+ classpath.addExisting(cp);
+ }
- Path runtime = new Path(attributes.getProject(), _javacHome + "/lib/classes.zip");
- classpath.append(runtime);
+ Path runtime = new Path(attributes.getProject(), _javacHome + "/lib/classes.zip");
+ classpath.append(runtime);
- return classpath;
+ return classpath;
}
public boolean
execute()
- throws BuildException
+ throws BuildException
{
- Project project = attributes.getProject();
- _javacHome = project.getProperty("java11.home");
- if(_javacHome == null)
- {
- throw new BuildException("The property java11.home is not defined");
- }
+ Project project = attributes.getProject();
+ _javacHome = project.getProperty("java11.home");
+ if(_javacHome == null)
+ {
+ throw new BuildException("The property java11.home is not defined");
+ }
- attributes.log("Using javac 1.1 compiler", Project.MSG_VERBOSE);
+ attributes.log("Using javac 1.1 compiler", Project.MSG_VERBOSE);
- Commandline cmd = new Commandline();
- cmd.setExecutable(_javacHome + "/bin/javac");
- setupJavacCommandlineSwitches(cmd, true);
- logAndAddFilesToCompile(cmd);
+ Commandline cmd = new Commandline();
+ cmd.setExecutable(_javacHome + "/bin/javac");
+ setupJavacCommandlineSwitches(cmd, true);
+ logAndAddFilesToCompile(cmd);
String[] commandArray = cmd.getCommandline();
- try
- {
- Execute exe = new Execute(new LogStreamHandler(attributes, Project.MSG_INFO, Project.MSG_WARN));
-
- //
- // Overwrite JAVA_HOME so that javac runs correctly.
- //
- final String[] env = { "JAVA_HOME=" + _javacHome };
- exe.setEnvironment(env);
-
- exe.setAntRun(project);
- exe.setWorkingDirectory(project.getBaseDir());
- exe.setCommandline(commandArray);
- exe.execute();
-
- return exe.getExitValue() == 0;
- }
- catch(java.io.IOException ex)
- {
- throw new BuildException("Error running " + commandArray[0] + " compiler", ex, location);
- }
+ try
+ {
+ Execute exe = new Execute(new LogStreamHandler(attributes, Project.MSG_INFO, Project.MSG_WARN));
+
+ //
+ // Overwrite JAVA_HOME so that javac runs correctly.
+ //
+ final String[] env = { "JAVA_HOME=" + _javacHome };
+ exe.setEnvironment(env);
+
+ exe.setAntRun(project);
+ exe.setWorkingDirectory(project.getBaseDir());
+ exe.setCommandline(commandArray);
+ exe.execute();
+
+ return exe.getExitValue() == 0;
+ }
+ catch(java.io.IOException ex)
+ {
+ throw new BuildException("Error running " + commandArray[0] + " compiler", ex, location);
+ }
}
private String _javacHome;
diff --git a/javae/ant/Slice2JavaETask.java b/javae/ant/Slice2JavaETask.java
index 311ea000002..56dcfa11331 100644
--- a/javae/ant/Slice2JavaETask.java
+++ b/javae/ant/Slice2JavaETask.java
@@ -90,10 +90,10 @@ public class Slice2JavaETask extends SliceTask
throw new BuildException("No fileset specified");
}
- //
- // Read the set of dependencies for this task.
- //
- java.util.HashMap dependencies = readDependencies();
+ //
+ // Read the set of dependencies for this task.
+ //
+ java.util.HashMap dependencies = readDependencies();
//
// Compose a list of the files that need to be translated. A
@@ -115,15 +115,15 @@ public class Slice2JavaETask extends SliceTask
{
File slice = new File(fileset.getDir(getProject()), files[i]);
- SliceDependency depend = (SliceDependency)dependencies.get(getTargetKey(slice.toString()));
- if(depend == null || !depend.isUpToDate())
- {
+ SliceDependency depend = (SliceDependency)dependencies.get(getTargetKey(slice.toString()));
+ if(depend == null || !depend.isUpToDate())
+ {
buildList.addElement(slice);
}
- else
- {
+ else
+ {
log("skipping " + files[i]);
- }
+ }
}
}
@@ -208,9 +208,9 @@ public class Slice2JavaETask extends SliceTask
cmd.append(" --tie");
}
- //
- // Add --ice
- //
+ //
+ // Add --ice
+ //
if(_ice)
{
cmd.append(" --ice");
@@ -256,7 +256,7 @@ public class Slice2JavaETask extends SliceTask
//
// Update the dependencies.
//
- cmd = new StringBuffer("--depend");
+ cmd = new StringBuffer("--depend");
//
// Add include directives
@@ -296,49 +296,49 @@ public class Slice2JavaETask extends SliceTask
}
}
- //
- // It's not possible anymore to re-use the same output property since Ant 1.5.x. so we use a
- // unique property name here. Perhaps we should output the dependencies to a file instead.
- //
- final String outputProperty = "slice2javae.depend." + System.currentTimeMillis();
+ //
+ // It's not possible anymore to re-use the same output property since Ant 1.5.x. so we use a
+ // unique property name here. Perhaps we should output the dependencies to a file instead.
+ //
+ final String outputProperty = "slice2javae.depend." + System.currentTimeMillis();
- task = (ExecTask)getProject().createTask("exec");
+ task = (ExecTask)getProject().createTask("exec");
task.setFailonerror(true);
- arg = task.createArg();
+ arg = task.createArg();
arg.setLine(cmd.toString());
task.setExecutable(translator);
- task.setOutputproperty(outputProperty);
+ task.setOutputproperty(outputProperty);
task.execute();
- //
- // Update dependency file.
- //
- java.util.List newDependencies = parseDependencies(getProject().getProperty(outputProperty));
- p = newDependencies.iterator();
- while(p.hasNext())
- {
- SliceDependency dep = (SliceDependency)p.next();
- dependencies.put(getTargetKey(dep._dependencies[0]), dep);
- }
-
- writeDependencies(dependencies);
+ //
+ // Update dependency file.
+ //
+ java.util.List newDependencies = parseDependencies(getProject().getProperty(outputProperty));
+ p = newDependencies.iterator();
+ while(p.hasNext())
+ {
+ SliceDependency dep = (SliceDependency)p.next();
+ dependencies.put(getTargetKey(dep._dependencies[0]), dep);
+ }
+
+ writeDependencies(dependencies);
}
}
private String
getTargetKey(String slice)
{
- //
- // Since the dependency file can be shared by several slice
- // tasks we need to make sure that each dependency has a
- // unique key. We use the name of the task, the output
- // directory and the name of the slice file to be compiled.
- //
- // If there's two slice2javae tasks using the same dependency
- // file, with the same output dir and which compiles the same
- // slice file they'll use the same dependency.
- //
- return "slice2javae " + _outputDir.toString() + " " + slice;
+ //
+ // Since the dependency file can be shared by several slice
+ // tasks we need to make sure that each dependency has a
+ // unique key. We use the name of the task, the output
+ // directory and the name of the slice file to be compiled.
+ //
+ // If there's two slice2javae tasks using the same dependency
+ // file, with the same output dir and which compiles the same
+ // slice file they'll use the same dependency.
+ //
+ return "slice2javae " + _outputDir.toString() + " " + slice;
}
private File _translator;
diff --git a/javae/ant/SliceTask.java b/javae/ant/SliceTask.java
index 6a14e215bf7..643da089fdc 100644
--- a/javae/ant/SliceTask.java
+++ b/javae/ant/SliceTask.java
@@ -58,7 +58,7 @@ public class SliceTask extends org.apache.tools.ant.Task
_dependencyFile = null;
_outputDir = null;
_outputDirString = null;
- _caseSensitive = false;
+ _caseSensitive = false;
_ice = false;
_includePath = null;
@@ -163,48 +163,48 @@ public class SliceTask extends org.apache.tools.ant.Task
protected java.util.HashMap
readDependencies()
{
- if(_dependencyFile == null)
- {
- if(_outputDir != null)
- {
- _dependencyFile = new File(_outputDir, ".depend");
- }
- else
- {
- _dependencyFile = new File(".depend");
- }
- }
-
- try
- {
- java.io.ObjectInputStream in = new java.io.ObjectInputStream(new java.io.FileInputStream(_dependencyFile));
- java.util.HashMap dependencies = (java.util.HashMap)in.readObject();
- in.close();
- return dependencies;
- }
- catch(java.io.IOException ex)
- {
- }
- catch(java.lang.ClassNotFoundException ex)
- {
- }
-
- return new java.util.HashMap();
+ if(_dependencyFile == null)
+ {
+ if(_outputDir != null)
+ {
+ _dependencyFile = new File(_outputDir, ".depend");
+ }
+ else
+ {
+ _dependencyFile = new File(".depend");
+ }
+ }
+
+ try
+ {
+ java.io.ObjectInputStream in = new java.io.ObjectInputStream(new java.io.FileInputStream(_dependencyFile));
+ java.util.HashMap dependencies = (java.util.HashMap)in.readObject();
+ in.close();
+ return dependencies;
+ }
+ catch(java.io.IOException ex)
+ {
+ }
+ catch(java.lang.ClassNotFoundException ex)
+ {
+ }
+
+ return new java.util.HashMap();
}
protected void
writeDependencies(java.util.HashMap dependencies)
{
- try
- {
- java.io.ObjectOutputStream out = new java.io.ObjectOutputStream(new FileOutputStream(_dependencyFile));
- out.writeObject(dependencies);
- out.close();
- }
- catch(java.io.IOException ex)
- {
- throw new BuildException("Unable to write dependencies in file " + _dependencyFile.getPath() + ": " + ex);
- }
+ try
+ {
+ java.io.ObjectOutputStream out = new java.io.ObjectOutputStream(new FileOutputStream(_dependencyFile));
+ out.writeObject(dependencies);
+ out.close();
+ }
+ catch(java.io.IOException ex)
+ {
+ throw new BuildException("Unable to write dependencies in file " + _dependencyFile.getPath() + ": " + ex);
+ }
}
//
@@ -214,22 +214,22 @@ public class SliceTask extends org.apache.tools.ant.Task
protected java.util.List
parseDependencies(String allDependencies)
{
- java.util.List dependencies = new java.util.LinkedList();
- try
- {
- BufferedReader in = new BufferedReader(new StringReader(allDependencies));
- StringBuffer depline = new StringBuffer();
- String line;
-
- while((line = in.readLine()) != null)
- {
- if(line.endsWith("\\"))
- {
- depline.append(line.substring(0, line.length() - 1));
- }
- else
- {
- depline.append(line);
+ java.util.List dependencies = new java.util.LinkedList();
+ try
+ {
+ BufferedReader in = new BufferedReader(new StringReader(allDependencies));
+ StringBuffer depline = new StringBuffer();
+ String line;
+
+ while((line = in.readLine()) != null)
+ {
+ if(line.endsWith("\\"))
+ {
+ depline.append(line.substring(0, line.length() - 1));
+ }
+ else
+ {
+ depline.append(line);
//
// It's easier to split up the filenames if we first convert Windows
@@ -256,43 +256,43 @@ public class SliceTask extends org.apache.tools.ant.Task
++pos;
}
- //
- // Split the dependencies up into filenames. Note that filenames containing
- // spaces are escaped and the initial file may have escaped colons
+ //
+ // Split the dependencies up into filenames. Note that filenames containing
+ // spaces are escaped and the initial file may have escaped colons
// (e.g., "C\:/Program\ Files/...").
//
- java.util.ArrayList l = new java.util.ArrayList();
+ java.util.ArrayList l = new java.util.ArrayList();
StringBuffer file = new StringBuffer();
pos = 0;
- while(pos < chars.length)
- {
- if(Character.isWhitespace(chars[pos]))
- {
- if(file.length() > 0)
- {
- l.add(file.toString());
- file = new StringBuffer();
- }
- }
+ while(pos < chars.length)
+ {
+ if(Character.isWhitespace(chars[pos]))
+ {
+ if(file.length() > 0)
+ {
+ l.add(file.toString());
+ file = new StringBuffer();
+ }
+ }
else if(chars[pos] != '\\') // Skip backslash of an escaped character.
{
file.append(chars[pos]);
}
- ++pos;
- }
+ ++pos;
+ }
if(file.length() > 0)
{
l.add(file.toString());
}
- //
- // Create SliceDependency. We need to remove the trailing colon from the first file.
+ //
+ // Create SliceDependency. We need to remove the trailing colon from the first file.
// We also normalize the pathname for this platform.
- //
- SliceDependency depend = new SliceDependency();
- depend._dependencies = new String[l.size()];
- l.toArray(depend._dependencies);
- depend._timeStamp = new java.util.Date().getTime();
+ //
+ SliceDependency depend = new SliceDependency();
+ depend._dependencies = new String[l.size()];
+ l.toArray(depend._dependencies);
+ depend._timeStamp = new java.util.Date().getTime();
pos = depend._dependencies[0].lastIndexOf(':');
//assert(pos == depend._dependencies[0].length() - 1);
depend._dependencies[0] = depend._dependencies[0].substring(0, pos);
@@ -300,18 +300,18 @@ public class SliceTask extends org.apache.tools.ant.Task
{
depend._dependencies[i] = new File(depend._dependencies[i]).toString();
}
- dependencies.add(depend);
-
- depline = new StringBuffer();
- }
- }
- }
- catch(java.io.IOException ex)
- {
- throw new BuildException("Unable to read dependencies from slice translator: " + ex);
- }
-
- return dependencies;
+ dependencies.add(depend);
+
+ depline = new StringBuffer();
+ }
+ }
+ }
+ catch(java.io.IOException ex)
+ {
+ throw new BuildException("Unable to read dependencies from slice translator: " + ex);
+ }
+
+ return dependencies;
}
@@ -367,37 +367,37 @@ public class SliceTask extends org.apache.tools.ant.Task
//
protected class SliceDependency implements java.io.Serializable
{
- private void writeObject(java.io.ObjectOutputStream out)
- throws java.io.IOException
+ private void writeObject(java.io.ObjectOutputStream out)
+ throws java.io.IOException
{
- out.writeObject(_dependencies);
- out.writeLong(_timeStamp);
- }
+ out.writeObject(_dependencies);
+ out.writeLong(_timeStamp);
+ }
- private void readObject(java.io.ObjectInputStream in)
- throws java.io.IOException, java.lang.ClassNotFoundException
+ private void readObject(java.io.ObjectInputStream in)
+ throws java.io.IOException, java.lang.ClassNotFoundException
{
- _dependencies = (String[])in.readObject();
- _timeStamp = in.readLong();
- }
+ _dependencies = (String[])in.readObject();
+ _timeStamp = in.readLong();
+ }
- public boolean
- isUpToDate()
+ public boolean
+ isUpToDate()
{
- for(int i = 0; i < _dependencies.length; ++i)
- {
- File dep = new File(_dependencies[i]);
- if(!dep.exists() || _timeStamp < dep.lastModified())
- {
- return false;
- }
- }
-
- return true;
- }
-
- public String[] _dependencies;
- public long _timeStamp;
+ for(int i = 0; i < _dependencies.length; ++i)
+ {
+ File dep = new File(_dependencies[i]);
+ if(!dep.exists() || _timeStamp < dep.lastModified())
+ {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ public String[] _dependencies;
+ public long _timeStamp;
}
protected File _dependencyFile;
diff --git a/javae/demo/IceE/jdk/bidir/CallbackSenderI.java b/javae/demo/IceE/jdk/bidir/CallbackSenderI.java
index 4aa1cd87b05..7a159fa1de6 100644
--- a/javae/demo/IceE/jdk/bidir/CallbackSenderI.java
+++ b/javae/demo/IceE/jdk/bidir/CallbackSenderI.java
@@ -14,71 +14,81 @@ class CallbackSenderI extends _CallbackSenderDisp implements java.lang.Runnable
CallbackSenderI(Ice.Communicator communicator)
{
_communicator = communicator;
- _destroy = false;
- _num = 0;
- _clients = new java.util.Vector();
}
synchronized public void
destroy()
{
- System.out.println("destroying callback sender");
- _destroy = true;
+ System.out.println("destroying callback sender");
+ _destroy = true;
- this.notify();
+ this.notify();
}
synchronized public void
addClient(Ice.Identity ident, Ice.Current current)
{
- System.out.println("adding client `" + _communicator.identityToString(ident) + "'");
+ System.out.println("adding client `" + _communicator.identityToString(ident) + "'");
- Ice.ObjectPrx base = current.con.createProxy(ident);
- CallbackReceiverPrx client = CallbackReceiverPrxHelper.uncheckedCast(base);
- _clients.addElement(client);
+ Ice.ObjectPrx base = current.con.createProxy(ident);
+ CallbackReceiverPrx client = CallbackReceiverPrxHelper.uncheckedCast(base);
+ _clients.addElement(client);
}
- synchronized public void
+ public void
run()
{
- while(!_destroy)
- {
- try
- {
- this.wait(2000);
- }
- catch(java.lang.InterruptedException ex)
- {
- }
+ int num = 0;
+ while(true)
+ {
+ CallbackReceiverPrx[] clients;
+ synchronized(this)
+ {
+ try
+ {
+ this.wait(2000);
+ }
+ catch(java.lang.InterruptedException ex)
+ {
+ }
+
+ if(_destroy)
+ {
+ break;
+ }
+
+ clients = new CallbackReceiverPrx[_clients.size()];
+ _clients.copyInto((Object[])clients);
+ }
+
+ if(clients.length > 0)
+ {
+ ++num;
- if(!_destroy && !_clients.isEmpty())
- {
- ++_num;
+ for(int i = 0; i < clients.length; ++i)
+ {
+ CallbackReceiverPrx r = (CallbackReceiverPrx)clients[i];
+ try
+ {
+ r.callback(num);
+ }
+ catch(Exception ex)
+ {
+ System.out.println("removing client `" + _communicator.identityToString(r.ice_getIdentity()) +
+ "':");
+ ex.printStackTrace();
- int i = 0;
- while(i < _clients.size())
- {
- CallbackReceiverPrx r = (CallbackReceiverPrx)_clients.elementAt(i);
- try
- {
- r.callback(_num);
- }
- catch(Exception ex)
- {
- System.out.println("removing client `" +
- _communicator.identityToString(r.ice_getIdentity()) + "':");
- ex.printStackTrace();
- _clients.removeElementAt(i);
- continue;
- }
- ++i;
- }
- }
- }
+ synchronized(this)
+ {
+ _clients.removeElement(r);
+ }
+ }
+ }
+ }
+ }
}
private Ice.Communicator _communicator;
- private boolean _destroy;
- private int _num;
- private java.util.Vector _clients;
+ private boolean _destroy = false;
+ private java.util.Vector _clients = new java.util.Vector();
}
diff --git a/javae/demo/IceE/jdk/bidir/Client.java b/javae/demo/IceE/jdk/bidir/Client.java
index fa425dc6c36..71b49349f78 100644
--- a/javae/demo/IceE/jdk/bidir/Client.java
+++ b/javae/demo/IceE/jdk/bidir/Client.java
@@ -15,7 +15,7 @@ public class Client
run(String[] args, Ice.Communicator communicator)
{
Ice.Properties properties = communicator.getProperties();
- final String proxyProperty = "Callback.Client.CallbackServer";
+ final String proxyProperty = "CallbackSender.Proxy";
String proxy = properties.getProperty(proxyProperty);
if(proxy.length() == 0)
{
@@ -31,15 +31,15 @@ public class Client
return 1;
}
- Ice.ObjectAdapter adapter = communicator.createObjectAdapter("Callback.Client");
- Ice.Identity ident = new Ice.Identity();
- ident.name = Ice.Util.generateUUID();
- ident.category = "";
+ Ice.ObjectAdapter adapter = communicator.createObjectAdapter("");
+ Ice.Identity ident = new Ice.Identity();
+ ident.name = Ice.Util.generateUUID();
+ ident.category = "";
adapter.add(new CallbackReceiverI(), ident);
adapter.activate();
- server.ice_getConnection().setAdapter(adapter);
- server.addClient(ident);
- communicator.waitForShutdown();
+ server.ice_getConnection().setAdapter(adapter);
+ server.addClient(ident);
+ communicator.waitForShutdown();
return 0;
}
@@ -52,9 +52,9 @@ public class Client
try
{
- Ice.InitializationData initData = new Ice.InitializationData();
+ Ice.InitializationData initData = new Ice.InitializationData();
initData.properties = Ice.Util.createProperties();
- initData.properties.load("config");
+ initData.properties.load("config.client");
communicator = Ice.Util.initialize(args, initData);
status = run(args, communicator);
}
diff --git a/javae/demo/IceE/jdk/bidir/Server.java b/javae/demo/IceE/jdk/bidir/Server.java
index af94b5a0708..872ed89929e 100644
--- a/javae/demo/IceE/jdk/bidir/Server.java
+++ b/javae/demo/IceE/jdk/bidir/Server.java
@@ -19,24 +19,24 @@ public class Server
adapter.add(sender, communicator.stringToIdentity("sender"));
adapter.activate();
- Thread t = new Thread(sender);
- t.start();
+ Thread t = new Thread(sender);
+ t.start();
- try
- {
- communicator.waitForShutdown();
- }
- finally
- {
- sender.destroy();
- try
- {
- t.join();
- }
- catch(java.lang.InterruptedException ex)
- {
- }
- }
+ try
+ {
+ communicator.waitForShutdown();
+ }
+ finally
+ {
+ sender.destroy();
+ try
+ {
+ t.join();
+ }
+ catch(java.lang.InterruptedException ex)
+ {
+ }
+ }
return 0;
}
@@ -49,9 +49,9 @@ public class Server
try
{
- Ice.InitializationData initData = new Ice.InitializationData();
+ Ice.InitializationData initData = new Ice.InitializationData();
initData.properties = Ice.Util.createProperties();
- initData.properties.load("config");
+ initData.properties.load("config.server");
communicator = Ice.Util.initialize(args, initData);
status = run(args, communicator);
}
diff --git a/javae/demo/IceE/jdk/bidir/config b/javae/demo/IceE/jdk/bidir/config
deleted file mode 100644
index 199cf3608f6..00000000000
--- a/javae/demo/IceE/jdk/bidir/config
+++ /dev/null
@@ -1,7 +0,0 @@
-Callback.Client.CallbackServer=sender:tcp -p 10000
-Callback.Client.Endpoints=
-Callback.Server.Endpoints=tcp -p 10000
-
-#Ice.Trace.Network=1
-#Ice.Trace.Protocol=1
-Ice.Warn.Connections=1
diff --git a/javae/demo/IceE/jdk/bidir/config.client b/javae/demo/IceE/jdk/bidir/config.client
new file mode 100644
index 00000000000..fa7a6ae7fb4
--- /dev/null
+++ b/javae/demo/IceE/jdk/bidir/config.client
@@ -0,0 +1,28 @@
+#
+# The client reads this property to create the reference to the
+# "CallbackSender" object in the server.
+#
+CallbackSender.Proxy=sender:tcp -p 10000
+
+#
+# Warn about connection exceptions
+#
+Ice.Warn.Connections=1
+
+#
+# Network Tracing
+#
+# 0 = no network tracing
+# 1 = trace connection establishment and closure
+# 2 = like 1, but more detailed
+# 3 = like 2, but also trace data transfer
+#
+#Ice.Trace.Network=1
+
+#
+# Protocol Tracing
+#
+# 0 = no protocol tracing
+# 1 = trace protocol messages
+#
+#Ice.Trace.Protocol=1
diff --git a/javae/demo/IceE/jdk/bidir/config.server b/javae/demo/IceE/jdk/bidir/config.server
new file mode 100644
index 00000000000..e7e23e47480
--- /dev/null
+++ b/javae/demo/IceE/jdk/bidir/config.server
@@ -0,0 +1,29 @@
+#
+# The server creates one single object adapter with the name
+# "Callback.Server". The following line sets the endpoints for this
+# adapter.
+#
+Callback.Server.Endpoints=tcp -p 10000
+
+#
+# Warn about connection exceptions
+#
+Ice.Warn.Connections=1
+
+#
+# Network Tracing
+#
+# 0 = no network tracing
+# 1 = trace connection establishment and closure
+# 2 = like 1, but more detailed
+# 3 = like 2, but also trace data transfer
+#
+#Ice.Trace.Network=1
+
+#
+# Protocol Tracing
+#
+# 0 = no protocol tracing
+# 1 = trace protocol messages
+#
+#Ice.Trace.Protocol=1
diff --git a/javae/demo/IceE/jdk/callback/CallbackSenderI.java b/javae/demo/IceE/jdk/callback/CallbackSenderI.java
index e688eccb0a4..38f495fece2 100644
--- a/javae/demo/IceE/jdk/callback/CallbackSenderI.java
+++ b/javae/demo/IceE/jdk/callback/CallbackSenderI.java
@@ -15,27 +15,27 @@ public final class CallbackSenderI extends _CallbackSenderDisp
initiateCallback(CallbackReceiverPrx proxy, Ice.Current current)
{
System.out.println("initiating callback");
- try
- {
- proxy.callback(current.ctx);
- }
- catch(Ice.LocalException ex)
- {
- ex.printStackTrace();
- }
+ try
+ {
+ proxy.callback(current.ctx);
+ }
+ catch(Ice.LocalException ex)
+ {
+ ex.printStackTrace();
+ }
}
public void
shutdown(Ice.Current current)
{
System.out.println("Shutting down...");
- try
- {
- current.adapter.getCommunicator().shutdown();
- }
- catch(Ice.LocalException ex)
- {
- ex.printStackTrace();
- }
+ try
+ {
+ current.adapter.getCommunicator().shutdown();
+ }
+ catch(Ice.LocalException ex)
+ {
+ ex.printStackTrace();
+ }
}
}
diff --git a/javae/demo/IceE/jdk/callback/Client.java b/javae/demo/IceE/jdk/callback/Client.java
index fdb81dc89e6..ba1bef8cefc 100644
--- a/javae/demo/IceE/jdk/callback/Client.java
+++ b/javae/demo/IceE/jdk/callback/Client.java
@@ -29,7 +29,7 @@ public class Client
run(String[] args, Ice.Communicator communicator)
{
Ice.Properties properties = communicator.getProperties();
- final String proxyProperty = "Callback.Client.CallbackServer";
+ final String proxyProperty = "CallbackSender.Proxy";
String proxy = properties.getProperty(proxyProperty);
if(proxy.length() == 0)
{
@@ -52,7 +52,7 @@ public class Client
adapter.activate();
CallbackReceiverPrx twowayR =
- CallbackReceiverPrxHelper.uncheckedCast(adapter.createProxy(
+ CallbackReceiverPrxHelper.uncheckedCast(adapter.createProxy(
communicator.stringToIdentity("callbackReceiver")));
CallbackReceiverPrx onewayR = CallbackReceiverPrxHelper.uncheckedCast(twowayR.ice_oneway());
@@ -86,7 +86,7 @@ public class Client
}
else if(line.equals("f"))
{
- communicator.flushBatchRequests();
+ communicator.flushBatchRequests();
}
else if(line.equals("s"))
{
@@ -128,9 +128,9 @@ public class Client
try
{
- Ice.InitializationData initData = new Ice.InitializationData();
+ Ice.InitializationData initData = new Ice.InitializationData();
initData.properties = Ice.Util.createProperties();
- initData.properties.load("config");
+ initData.properties.load("config.client");
communicator = Ice.Util.initialize(args, initData);
status = run(args, communicator);
}
diff --git a/javae/demo/IceE/jdk/callback/Server.java b/javae/demo/IceE/jdk/callback/Server.java
index 5626254f7e7..6941e908021 100644
--- a/javae/demo/IceE/jdk/callback/Server.java
+++ b/javae/demo/IceE/jdk/callback/Server.java
@@ -29,9 +29,9 @@ public class Server
try
{
- Ice.InitializationData initData = new Ice.InitializationData();
+ Ice.InitializationData initData = new Ice.InitializationData();
initData.properties = Ice.Util.createProperties();
- initData.properties.load("config");
+ initData.properties.load("config.server");
communicator = Ice.Util.initialize(args, initData);
status = run(args, communicator);
}
diff --git a/javae/demo/IceE/jdk/callback/config b/javae/demo/IceE/jdk/callback/config
deleted file mode 100644
index 3b224be4236..00000000000
--- a/javae/demo/IceE/jdk/callback/config
+++ /dev/null
@@ -1,7 +0,0 @@
-Callback.Client.CallbackServer=callback:tcp -p 10000
-Callback.Client.Endpoints=tcp
-Callback.Server.Endpoints=tcp -p 10000
-
-#Ice.Trace.Network=1
-#Ice.Trace.Protocol=1
-Ice.Warn.Connections=1
diff --git a/javae/demo/IceE/jdk/callback/config.client b/javae/demo/IceE/jdk/callback/config.client
new file mode 100644
index 00000000000..4e67d75c5e1
--- /dev/null
+++ b/javae/demo/IceE/jdk/callback/config.client
@@ -0,0 +1,35 @@
+#
+# The client reads this property to create the reference to the
+# "CallbackSender" object in the server.
+#
+CallbackSender.Proxy=callback:tcp -p 10000
+
+#
+# The client creates one single object adapter with the name
+# "Callback.Client". The following line sets the endpoints for this
+# adapter.
+#
+Callback.Client.Endpoints=tcp
+
+#
+# Warn about connection exceptions
+#
+Ice.Warn.Connections=1
+
+#
+# Network Tracing
+#
+# 0 = no network tracing
+# 1 = trace connection establishment and closure
+# 2 = like 1, but more detailed
+# 3 = like 2, but also trace data transfer
+#
+#Ice.Trace.Network=1
+
+#
+# Protocol Tracing
+#
+# 0 = no protocol tracing
+# 1 = trace protocol messages
+#
+#Ice.Trace.Protocol=1
diff --git a/javae/demo/IceE/jdk/callback/config.server b/javae/demo/IceE/jdk/callback/config.server
new file mode 100644
index 00000000000..d9c7154678a
--- /dev/null
+++ b/javae/demo/IceE/jdk/callback/config.server
@@ -0,0 +1,29 @@
+#
+# The server creates one single object adapter with the name
+# "Callback.Server". The following line sets the endpoints for this
+# adapter.
+#
+Callback.Server.Endpoints=tcp -p 10000
+
+#
+# Warn about connection exceptions
+#
+Ice.Warn.Connections=1
+
+#
+# Network Tracing
+#
+# 0 = no network tracing
+# 1 = trace connection establishment and closure
+# 2 = like 1, but more detailed
+# 3 = like 2, but also trace data transfer
+#
+#Ice.Trace.Network=1
+
+#
+# Protocol Tracing
+#
+# 0 = no protocol tracing
+# 1 = trace protocol messages
+#
+#Ice.Trace.Protocol=1
diff --git a/javae/demo/IceE/jdk/chat/ChatCallbackI.java b/javae/demo/IceE/jdk/chat/ChatCallbackI.java
index 3da20ee28cf..6688be1c55f 100644
--- a/javae/demo/IceE/jdk/chat/ChatCallbackI.java
+++ b/javae/demo/IceE/jdk/chat/ChatCallbackI.java
@@ -17,6 +17,6 @@ public class ChatCallbackI extends Demo._ChatCallbackDisp
public void
message(String data, Ice.Current current)
{
- System.out.println(data);
+ System.out.println(data);
}
}
diff --git a/javae/demo/IceE/jdk/chat/Client.java b/javae/demo/IceE/jdk/chat/Client.java
index 892af3aff5b..876f44b6246 100644
--- a/javae/demo/IceE/jdk/chat/Client.java
+++ b/javae/demo/IceE/jdk/chat/Client.java
@@ -21,81 +21,80 @@ public class Client
run(String[] args, Ice.Communicator communicator)
{
Ice.RouterPrx defaultRouter = communicator.getDefaultRouter();
- if(defaultRouter == null)
- {
- System.err.println("no default router set");
- return 1;
- }
-
- Glacier2.RouterPrx router = Glacier2.RouterPrxHelper.checkedCast(defaultRouter);
- if(router == null)
- {
- System.err.println("configured router is not a Glacier2 router");
- return 1;
- }
+ if(defaultRouter == null)
+ {
+ System.err.println("no default router set");
+ return 1;
+ }
+
+ _router = Glacier2.RouterPrxHelper.checkedCast(defaultRouter);
+ if(_router == null)
+ {
+ System.err.println("configured router is not a Glacier2 router");
+ return 1;
+ }
java.io.BufferedReader in = new java.io.BufferedReader(new java.io.InputStreamReader(System.in));
- ChatSessionPrx session = null;
- while(true)
- {
- System.out.println("This demo accepts any user-id / password combination.");
+ ChatSessionPrx session = null;
+ while(true)
+ {
+ System.out.println("This demo accepts any user-id / password combination.");
- String id = null;
- String pw = null;
+ String id = null;
+ String pw = null;
- try
- {
- System.out.print("user id: ");
+ try
+ {
+ System.out.print("user id: ");
System.out.flush();
- id = in.readLine();
- id = id.trim();
+ id = in.readLine();
+ id = id.trim();
- System.out.print("password: ");
+ System.out.print("password: ");
System.out.flush();
- pw = in.readLine();
- pw = pw.trim();
- }
- catch(java.io.IOException ex)
- {
- ex.printStackTrace();
- return 1;
- }
-
- try
- {
- session = ChatSessionPrxHelper.uncheckedCast(router.createSession(id, pw));
- break;
- }
- catch(Glacier2.CannotCreateSessionException ex)
- {
- ex.printStackTrace();
- }
- catch(Glacier2.PermissionDeniedException ex)
- {
- ex.printStackTrace();
- }
- }
-
- SessionPingThread ping = new SessionPingThread(session, router.getSessionTimeout() / 2);
- ping.start();
-
- String category = router.getServerProxy().ice_getIdentity().category;
- Ice.Identity callbackReceiverIdent = new Ice.Identity();
- callbackReceiverIdent.name = "callbackReceiver";
- callbackReceiverIdent.category = category;
-
- Ice.ObjectAdapter adapter = communicator.createObjectAdapter("Chat.Client");
- ChatCallbackPrx callback = ChatCallbackPrxHelper.uncheckedCast(
- adapter.add(new ChatCallbackI(), callbackReceiverIdent));
- adapter.activate();
-
- session.setCallback(callback);
+ pw = in.readLine();
+ pw = pw.trim();
+ }
+ catch(java.io.IOException ex)
+ {
+ ex.printStackTrace();
+ return 1;
+ }
+
+ try
+ {
+ session = ChatSessionPrxHelper.uncheckedCast(_router.createSession(id, pw));
+ break;
+ }
+ catch(Glacier2.CannotCreateSessionException ex)
+ {
+ ex.printStackTrace();
+ }
+ catch(Glacier2.PermissionDeniedException ex)
+ {
+ System.out.println("permission denied:\n" + ex.reason);
+ }
+ }
+
+ _ping = new SessionPingThread(session, _router.getSessionTimeout() / 2);
+ _ping.start();
+
+ Ice.Identity callbackReceiverIdent = new Ice.Identity();
+ callbackReceiverIdent.name = "callbackReceiver";
+ callbackReceiverIdent.category = _router.getCategoryForClient();
+
+ Ice.ObjectAdapter adapter = communicator.createObjectAdapterWithRouter("Chat.Client", defaultRouter);
+ ChatCallbackI cb = new ChatCallbackI();
+ ChatCallbackPrx callback = ChatCallbackPrxHelper.uncheckedCast(adapter.add(cb, callbackReceiverIdent));
+ adapter.activate();
+
+ session.setCallback(callback);
menu();
- try
- {
+ try
+ {
String line = null;
do
{
@@ -106,18 +105,15 @@ public class Client
{
break;
}
- line = line.trim();
+ line = line.trim();
if(line.startsWith("/"))
- {
- if(line.equals("/quit"))
+ {
+ if(line.equals("/quit"))
{
- break;
- }
- else
- {
- menu();
- }
+ break;
+ }
+ menu();
}
else
{
@@ -126,33 +122,46 @@ public class Client
}
while(true);
- try
- {
- router.destroySession();
- }
- catch(Ice.ConnectionLostException ex)
- {
- //
- // Expected: the router closed the connection.
- //
- }
- }
- catch(Exception ex)
- {
- ex.printStackTrace();
- }
-
- ping.destroy();
- try
- {
- ping.join();
- }
- catch(java.lang.InterruptedException ex)
- {
- }
+ cleanup();
+ }
+ catch(Exception ex)
+ {
+ ex.printStackTrace();
+ cleanup();
+ return 1;
+ }
+
return 0;
}
+ private static void
+ cleanup()
+ {
+ try
+ {
+ _router.destroySession();
+ }
+ catch(Glacier2.SessionNotExistException ex)
+ {
+ ex.printStackTrace();
+ }
+ catch(Ice.ConnectionLostException ex)
+ {
+ //
+ // Expected: the router closed the connection.
+ //
+ }
+
+ _ping.destroy();
+ try
+ {
+ _ping.join();
+ }
+ catch(java.lang.InterruptedException ex)
+ {
+ }
+ }
+
public static void
main(String[] args)
{
@@ -161,7 +170,7 @@ public class Client
try
{
- Ice.InitializationData initData = new Ice.InitializationData();
+ Ice.InitializationData initData = new Ice.InitializationData();
initData.properties = Ice.Util.createProperties();
initData.properties.load("config");
communicator = Ice.Util.initialize(args, initData);
@@ -188,4 +197,7 @@ public class Client
System.exit(status);
}
+
+ private static Glacier2.RouterPrx _router;
+ private static SessionPingThread _ping;
}
diff --git a/javae/demo/IceE/jdk/chat/README b/javae/demo/IceE/jdk/chat/README
index 164874b1b20..fc432c14798 100644
--- a/javae/demo/IceE/jdk/chat/README
+++ b/javae/demo/IceE/jdk/chat/README
@@ -9,17 +9,17 @@ $ server
In a separate window, change to the Ice demo directory and modify the
file config.glacier2 as follows: change the Glacier2.Client.Endpoints
-property to use a tcp endpoint. In addition, if the client is run
+property to use a TCP endpoint. In addition, if the client is run
outside the Glacier2 router's host, the router must also listen on a
public interface instead of the loopback interface.
For most configurations the property can be changed from:
-Glacier2.Client.Endpoints=ssl -p 10005 -h 127.0.0.1
+Glacier2.Client.Endpoints=ssl -p 4064 -h 127.0.0.1
to:
-Glacier2.Client.Endpoints=tcp -p 10005
+Glacier2.Client.Endpoints=tcp -p 4063
Next, start the Glacier2 router:
diff --git a/javae/demo/IceE/jdk/chat/Router.ice b/javae/demo/IceE/jdk/chat/Router.ice
index b1c1bb97201..1af3b88a1e6 100644
--- a/javae/demo/IceE/jdk/chat/Router.ice
+++ b/javae/demo/IceE/jdk/chat/Router.ice
@@ -107,7 +107,7 @@ interface Router extends Ice::Router
*
**/
Session* createSession(string userId, string password)
- throws PermissionDeniedException, CannotCreateSessionException;
+ throws PermissionDeniedException, CannotCreateSessionException;
/**
*
@@ -118,7 +118,7 @@ interface Router extends Ice::Router
*
**/
void destroySession()
- throws SessionNotExistException;
+ throws SessionNotExistException;
/**
*
diff --git a/javae/demo/IceE/jdk/chat/Session.ice b/javae/demo/IceE/jdk/chat/Session.ice
index f2fb6861fc3..f1f9c39b54d 100644
--- a/javae/demo/IceE/jdk/chat/Session.ice
+++ b/javae/demo/IceE/jdk/chat/Session.ice
@@ -224,7 +224,7 @@ interface SessionManager
*
**/
Session* create(string userId, SessionControl* control)
- throws CannotCreateSessionException;
+ throws CannotCreateSessionException;
};
};
diff --git a/javae/demo/IceE/jdk/chat/SessionPingThread.java b/javae/demo/IceE/jdk/chat/SessionPingThread.java
index 5525ea309e3..46cf403cb37 100644
--- a/javae/demo/IceE/jdk/chat/SessionPingThread.java
+++ b/javae/demo/IceE/jdk/chat/SessionPingThread.java
@@ -14,47 +14,47 @@ class SessionPingThread extends Thread
SessionPingThread(ChatSessionPrx session, long timeout)
{
_session = session;
- _destroy = false;
- _timeout = timeout*1000;
+ _timeout = timeout * 1000;
+ _destroy = false;
}
synchronized public void
- destroy()
+ run()
{
- _destroy = true;
- this.notify();
+ while(!_destroy)
+ {
+ try
+ {
+ this.wait(_timeout);
+ }
+ catch(java.lang.InterruptedException ex)
+ {
+ }
+
+ if(_destroy)
+ {
+ break;
+ }
+
+ try
+ {
+ _session.ice_ping();
+ }
+ catch(Ice.LocalException ex)
+ {
+ break;
+ }
+ }
}
synchronized public void
- run()
+ destroy()
{
- while(!_destroy)
- {
- try
- {
- this.wait(_timeout);
- }
- catch(java.lang.InterruptedException ex)
- {
- }
-
- if(_destroy)
- {
- break;
- }
-
- try
- {
- _session.ice_ping();
- }
- catch(Ice.LocalException ex)
- {
- break;
- }
- }
+ _destroy = true;
+ this.notify();
}
private ChatSessionPrx _session;
- private boolean _destroy;
private long _timeout;
+ private boolean _destroy;
}
diff --git a/javae/demo/IceE/jdk/chat/config b/javae/demo/IceE/jdk/chat/config
index 83d3000811e..df1e0f217b1 100644
--- a/javae/demo/IceE/jdk/chat/config
+++ b/javae/demo/IceE/jdk/chat/config
@@ -2,14 +2,7 @@
# The proxy to the Glacier2 router for all outgoing connections. This
# must match the value of Glacier2.Client.Endpoints in config.glacier2.
#
-Ice.Default.Router=DemoGlacier2/router:tcp -p 10005 -h 127.0.0.1
-
-#
-# The proxy for the Glacier2 router, installed in the client's
-# object adapter named Chat.Client. This router proxy must
-# match the value of Glacier2.Client.Endpoints.
-#
-Chat.Client.Router=DemoGlacier2/router:tcp -p 10005 -h 127.0.0.1
+Ice.Default.Router=DemoGlacier2/router:tcp -p 4063 -h 127.0.0.1
#
# We don't need any endpoints for the client if we use a
diff --git a/javae/demo/IceE/jdk/hello/Client.java b/javae/demo/IceE/jdk/hello/Client.java
index 01228c1f6d3..e17acf115b6 100644
--- a/javae/demo/IceE/jdk/hello/Client.java
+++ b/javae/demo/IceE/jdk/hello/Client.java
@@ -50,7 +50,7 @@ public class Client
HelloPrx batchOneway = HelloPrxHelper.uncheckedCast(twoway.ice_batchOneway());
int timeout = -1;
- int delay = 0;
+ int delay = 0;
menu();
@@ -82,7 +82,7 @@ public class Client
}
else if(line.equals("f"))
{
- communicator.flushBatchRequests();
+ communicator.flushBatchRequests();
}
else if(line.equals("T"))
{
@@ -168,9 +168,9 @@ public class Client
try
{
- Ice.InitializationData initData = new Ice.InitializationData();
+ Ice.InitializationData initData = new Ice.InitializationData();
initData.properties = Ice.Util.createProperties();
- initData.properties.load("config");
+ initData.properties.load("config.client");
communicator = Ice.Util.initialize(args, initData);
status = run(args, communicator);
}
diff --git a/javae/demo/IceE/jdk/hello/Server.java b/javae/demo/IceE/jdk/hello/Server.java
index 1d914e67a0e..7a7df6cbe4c 100644
--- a/javae/demo/IceE/jdk/hello/Server.java
+++ b/javae/demo/IceE/jdk/hello/Server.java
@@ -30,9 +30,9 @@ public class Server
try
{
- Ice.InitializationData initData = new Ice.InitializationData();
+ Ice.InitializationData initData = new Ice.InitializationData();
initData.properties = Ice.Util.createProperties();
- initData.properties.load("config");
+ initData.properties.load("config.server");
communicator = Ice.Util.initialize(args, initData);
status = run(args, communicator);
}
diff --git a/javae/demo/IceE/jdk/hello/config.client b/javae/demo/IceE/jdk/hello/config.client
new file mode 100644
index 00000000000..b575d7ad38e
--- /dev/null
+++ b/javae/demo/IceE/jdk/hello/config.client
@@ -0,0 +1,28 @@
+#
+# The client reads this property to create the reference to the
+# "hello" object in the server.
+#
+Hello.Proxy=hello:tcp -p 10000
+
+#
+# Warn about connection exceptions.
+#
+Ice.Warn.Connections=1
+
+#
+# Network Tracing
+#
+# 0 = no network tracing
+# 1 = trace connection establishment and closure
+# 2 = like 1, but more detailed
+# 3 = like 2, but also trace data transfer
+#
+#Ice.Trace.Network=1
+
+#
+# Protocol Tracing
+#
+# 0 = no protocol tracing
+# 1 = trace protocol messages
+#
+#Ice.Trace.Protocol=1
diff --git a/cppe/demo/IceE/hello/config b/javae/demo/IceE/jdk/hello/config.server
index 99491820ac2..147d3c96ade 100644
--- a/cppe/demo/IceE/hello/config
+++ b/javae/demo/IceE/jdk/hello/config.server
@@ -1,10 +1,4 @@
#
-# The client reads this property to create the reference to the
-# "hello" object in the server.
-#
-Hello.Proxy=hello:tcp -p 10000
-
-#
# The server creates one single object adapter with the name
# "Hello". The following line sets the endpoints for this
# adapter.
@@ -14,7 +8,7 @@ Hello.Endpoints=tcp -p 10000
#
# Warn about connection exceptions
#
-#Ice.Warn.Connections=1
+Ice.Warn.Connections=1
#
# Network Tracing
@@ -24,7 +18,7 @@ Hello.Endpoints=tcp -p 10000
# 2 = like 1, but more detailed
# 3 = like 2, but also trace data transfer
#
-Ice.Trace.Network=0
+#Ice.Trace.Network=1
#
# Protocol Tracing
@@ -32,4 +26,4 @@ Ice.Trace.Network=0
# 0 = no protocol tracing
# 1 = trace protocol messages
#
-Ice.Trace.Protocol=0
+#Ice.Trace.Protocol=1
diff --git a/javae/demo/IceE/jdk/latency/Client.java b/javae/demo/IceE/jdk/latency/Client.java
index ba1eea7df02..cb605402f13 100644
--- a/javae/demo/IceE/jdk/latency/Client.java
+++ b/javae/demo/IceE/jdk/latency/Client.java
@@ -15,7 +15,7 @@ public class Client
run(String[] args, Ice.Communicator communicator)
{
Ice.Properties properties = communicator.getProperties();
- final String refProperty = "Latency.Ping";
+ final String refProperty = "Ping.Proxy";
String ref = properties.getProperty(refProperty);
if(ref.length() == 0)
{
@@ -60,9 +60,9 @@ public class Client
try
{
- Ice.InitializationData initData = new Ice.InitializationData();
+ Ice.InitializationData initData = new Ice.InitializationData();
initData.properties = Ice.Util.createProperties();
- initData.properties.load("config");
+ initData.properties.load("config.client");
communicator = Ice.Util.initialize(args, initData);
status = run(args, communicator);
}
diff --git a/javae/demo/IceE/jdk/latency/Server.java b/javae/demo/IceE/jdk/latency/Server.java
index db1935ebbd4..be25c641c83 100644
--- a/javae/demo/IceE/jdk/latency/Server.java
+++ b/javae/demo/IceE/jdk/latency/Server.java
@@ -30,9 +30,9 @@ public class Server
try
{
- Ice.InitializationData initData = new Ice.InitializationData();
+ Ice.InitializationData initData = new Ice.InitializationData();
initData.properties = Ice.Util.createProperties();
- initData.properties.load("config");
+ initData.properties.load("config.server");
communicator = Ice.Util.initialize(args, initData);
status = run(args, communicator);
}
diff --git a/javae/demo/IceE/jdk/latency/config b/javae/demo/IceE/jdk/latency/config
deleted file mode 100644
index 51b2c587616..00000000000
--- a/javae/demo/IceE/jdk/latency/config
+++ /dev/null
@@ -1,7 +0,0 @@
-Latency.Ping=ping:default -p 10000 -h 127.0.0.1
-Latency.Endpoints=default -p 10000 -h 127.0.0.1
-
-#
-# Use faster blocking client side model by default.
-#
-Ice.Blocking=1
diff --git a/javae/demo/IceE/jdk/latency/config.client b/javae/demo/IceE/jdk/latency/config.client
new file mode 100644
index 00000000000..efede8629e4
--- /dev/null
+++ b/javae/demo/IceE/jdk/latency/config.client
@@ -0,0 +1,5 @@
+#
+# The client reads this property to create the reference to the "Ping"
+# object in the server.
+#
+Ping.Proxy=ping:default -p 10000 -h 127.0.0.1
diff --git a/javae/demo/IceE/jdk/latency/config.server b/javae/demo/IceE/jdk/latency/config.server
new file mode 100644
index 00000000000..75e3479d6fe
--- /dev/null
+++ b/javae/demo/IceE/jdk/latency/config.server
@@ -0,0 +1,10 @@
+#
+# The server creates one single object adapter with the name
+# "Latency". The following line sets the endpoints for this adapter.
+#
+Latency.Endpoints=default -p 10000 -h 127.0.0.1
+
+#
+# Warn about connection exceptions
+#
+Ice.Warn.Connections=1
diff --git a/javae/demo/IceE/jdk/throughput/Client.java b/javae/demo/IceE/jdk/throughput/Client.java
index a426d413daa..2ea6ae15150 100644
--- a/javae/demo/IceE/jdk/throughput/Client.java
+++ b/javae/demo/IceE/jdk/throughput/Client.java
@@ -39,19 +39,19 @@ public class Client
run(String[] args, Ice.Communicator communicator)
{
//
- // Check if we need to run with small sequences.
- //
- int reduce = 1;
- for(int i = 0; i < args.length; ++i)
- {
- if(args[i].equals("--small"))
- {
- reduce = 100;
- }
- }
+ // Check if we need to run with small sequences.
+ //
+ int reduce = 1;
+ for(int i = 0; i < args.length; ++i)
+ {
+ if(args[i].equals("--small"))
+ {
+ reduce = 100;
+ }
+ }
Ice.Properties properties = communicator.getProperties();
- final String refProperty = "Throughput.Throughput";
+ final String refProperty = "Throughput.Proxy";
String ref = properties.getProperty(refProperty);
if(ref.length() == 0)
{
@@ -66,43 +66,83 @@ public class Client
System.err.println("invalid proxy");
return 1;
}
- ThroughputPrx throughputOneway = ThroughputPrxHelper.uncheckedCast(throughput.ice_oneway());
+ ThroughputPrx throughputOneway = ThroughputPrxHelper.uncheckedCast(throughput.ice_oneway());
byte[] byteSeq = new byte[ByteSeqSize.value / reduce];
- String[] stringSeq = new String[StringSeqSize.value / reduce];
- for(int i = 0; i < StringSeqSize.value / reduce; ++i)
- {
- stringSeq[i] = "hello";
- }
-
- StringDouble[] structSeq = new StringDouble[StringDoubleSeqSize.value / reduce];
- for(int i = 0; i < StringDoubleSeqSize.value / reduce; ++i)
- {
- structSeq[i] = new StringDouble();
- structSeq[i].s = "hello";
- structSeq[i].d = 3.14;
- }
-
- Fixed[] fixedSeq = new Fixed[FixedSeqSize.value / reduce];
- for(int i = 0; i < FixedSeqSize.value / reduce; ++i)
- {
- fixedSeq[i] = new Fixed();
- fixedSeq[i].i = 0;
- fixedSeq[i].j = 0;
- fixedSeq[i].d = 0;
- }
-
- menu();
+ String[] stringSeq = new String[StringSeqSize.value / reduce];
+ for(int i = 0; i < StringSeqSize.value / reduce; ++i)
+ {
+ stringSeq[i] = "hello";
+ }
+
+ StringDouble[] structSeq = new StringDouble[StringDoubleSeqSize.value / reduce];
+ for(int i = 0; i < StringDoubleSeqSize.value / reduce; ++i)
+ {
+ structSeq[i] = new StringDouble();
+ structSeq[i].s = "hello";
+ structSeq[i].d = 3.14;
+ }
+
+ Fixed[] fixedSeq = new Fixed[FixedSeqSize.value / reduce];
+ for(int i = 0; i < FixedSeqSize.value / reduce; ++i)
+ {
+ fixedSeq[i] = new Fixed();
+ fixedSeq[i].i = 0;
+ fixedSeq[i].j = 0;
+ fixedSeq[i].d = 0;
+ }
+
+ //
+ // A method needs to be invoked thousands of times before the
+ // JIT compiler will convert it to native code. To ensure an
+ // accurate throughput measurement, we need to "warm up" the
+ // JIT compiler.
+ //
+ {
+ byte[] emptyBytes= new byte[1];
+ String[] emptyStrings = new String[1];
+ StringDouble[] emptyStructs = new StringDouble[1];
+ emptyStructs[0] = new StringDouble();
+ Fixed[] emptyFixed = new Fixed[1];
+ emptyFixed[0] = new Fixed();
+
+ throughput.startWarmup();
+
+ System.out.print("warming up the client/server...");
+ System.out.flush();
+ for(int i = 0; i < 10000; i++)
+ {
+ throughput.sendByteSeq(emptyBytes);
+ throughput.sendStringSeq(emptyStrings);
+ throughput.sendStructSeq(emptyStructs);
+ throughput.sendFixedSeq(emptyFixed);
+
+ throughput.recvByteSeq();
+ throughput.recvStringSeq();
+ throughput.recvStructSeq();
+ throughput.recvFixedSeq();
+
+ throughput.echoByteSeq(emptyBytes);
+ throughput.echoStringSeq(emptyStrings);
+ throughput.echoStructSeq(emptyStructs);
+ throughput.echoFixedSeq(emptyFixed);
+ }
+ throughput.endWarmup();
+
+ System.out.println(" ok");
+ }
+
+ menu();
java.io.BufferedReader in = new java.io.BufferedReader(new java.io.InputStreamReader(System.in));
- char currentType = '1';
- int seqSize = ByteSeqSize.value / reduce;
+ char currentType = '1';
+ int seqSize = ByteSeqSize.value / reduce;
+
+ // Initial ping to setup the connection.
+ throughput.ice_ping();
- // Initial ping to setup the connection.
- throughput.ice_ping();
-
String line = null;
do
{
@@ -116,280 +156,280 @@ public class Client
break;
}
- long tmsec = System.currentTimeMillis();
- final int repetitions = 100;
-
- if(line.equals("1") || line.equals("2") || line.equals("3") || line.equals("4"))
- {
- currentType = line.charAt(0);
-
- switch(currentType)
- {
- case '1':
- {
- System.out.println("using byte sequences");
- seqSize = ByteSeqSize.value;
- break;
- }
-
- case '2':
- {
- System.out.println("using string sequences");
- seqSize = StringSeqSize.value;
- break;
- }
-
- case '3':
- {
- System.out.println("using variable-length struct sequences");
- seqSize = StringDoubleSeqSize.value;
- break;
- }
-
- case '4':
- {
- System.out.println("using fixed-length struct sequences");
- seqSize = FixedSeqSize.value;
- break;
- }
- }
- }
+ long tmsec = System.currentTimeMillis();
+ final int repetitions = 100;
+
+ if(line.equals("1") || line.equals("2") || line.equals("3") || line.equals("4"))
+ {
+ currentType = line.charAt(0);
+
+ switch(currentType)
+ {
+ case '1':
+ {
+ System.out.println("using byte sequences");
+ seqSize = ByteSeqSize.value;
+ break;
+ }
+
+ case '2':
+ {
+ System.out.println("using string sequences");
+ seqSize = StringSeqSize.value;
+ break;
+ }
+
+ case '3':
+ {
+ System.out.println("using variable-length struct sequences");
+ seqSize = StringDoubleSeqSize.value;
+ break;
+ }
+
+ case '4':
+ {
+ System.out.println("using fixed-length struct sequences");
+ seqSize = FixedSeqSize.value;
+ break;
+ }
+ }
+ }
else if(line.equals("t") || line.equals("o") || line.equals("r") || line.equals("e"))
{
- char c = line.charAt(0);
-
- switch(c)
- {
- case 't':
- case 'o':
- {
- System.out.print("sending");
- break;
- }
-
- case 'r':
- {
- System.out.print("receiving");
- break;
- }
-
- case 'e':
- {
- System.out.print("sending and receiving");
- break;
- }
- }
-
- System.out.print(" " + repetitions);
- switch(currentType)
- {
- case '1':
- {
- System.out.print(" byte");
- break;
- }
-
- case '2':
- {
- System.out.print(" string");
- break;
- }
-
- case '3':
- {
- System.out.print(" variable-length struct");
- break;
- }
-
- case '4':
- {
- System.out.print(" fixed-length struct");
- break;
- }
- }
-
- System.out.print(" sequences of size " + seqSize);
-
- if(c == 'o')
- {
- System.out.print(" as oneway");
- }
-
- System.out.println("...");
-
- for(int i = 0; i < repetitions; ++i)
- {
- switch(currentType)
- {
- case '1':
- {
- switch(c)
- {
- case 't':
- {
- throughput.sendByteSeq(byteSeq);
- break;
- }
-
- case 'o':
- {
- throughputOneway.sendByteSeq(byteSeq);
- break;
- }
-
- case 'r':
- {
- throughput.recvByteSeq();
- break;
- }
-
- case 'e':
- {
- throughput.echoByteSeq(byteSeq);
- break;
- }
- }
- break;
- }
-
- case '2':
- {
- switch(c)
- {
- case 't':
- {
- throughput.sendStringSeq(stringSeq);
- break;
- }
-
- case 'o':
- {
- throughputOneway.sendStringSeq(stringSeq);
- break;
- }
-
- case 'r':
- {
- throughput.recvStringSeq();
- break;
- }
-
- case 'e':
- {
- throughput.echoStringSeq(stringSeq);
- break;
- }
- }
- break;
- }
-
- case '3':
- {
- switch(c)
- {
- case 't':
- {
- throughput.sendStructSeq(structSeq);
- break;
- }
-
- case 'o':
- {
- throughputOneway.sendStructSeq(structSeq);
- break;
- }
-
- case 'r':
- {
- throughput.recvStructSeq();
- break;
- }
-
- case 'e':
- {
- throughput.echoStructSeq(structSeq);
- break;
- }
- }
- break;
- }
-
- case '4':
- {
- switch(c)
- {
- case 't':
- {
- throughput.sendFixedSeq(fixedSeq);
- break;
- }
-
- case 'o':
- {
- throughputOneway.sendFixedSeq(fixedSeq);
- break;
- }
-
- case 'r':
- {
- throughput.recvFixedSeq();
- break;
- }
-
- case 'e':
- {
- throughput.echoFixedSeq(fixedSeq);
- break;
- }
- }
- break;
- }
- }
- }
-
- double dmsec = System.currentTimeMillis() - tmsec;
- System.out.println("time for " + repetitions + " sequences: " + dmsec + "ms");
- System.out.println("time per sequence: " + dmsec / repetitions + "ms");
- int wireSize = 0;
- switch(currentType)
- {
- case '1':
- {
- wireSize = 1;
- break;
- }
-
- case '2':
- {
- wireSize = stringSeq[0].length();
- break;
- }
-
- case '3':
- {
- wireSize = structSeq[0].s.length();
- wireSize += 8; // Size of double on the wire.
- break;
- }
-
- case '4':
- {
- wireSize = 16; // Size of two ints and a double on the wire.
- break;
- }
- }
- double mbit = repetitions * seqSize * wireSize * 8.0 / dmsec / 1000.0;
- if(c == 'e')
- {
- mbit *= 2;
- }
- System.out.println("throughput: " + new java.text.DecimalFormat("#.##").format(mbit) + "Mbps");
- }
- else if(line.equals("s"))
- {
- throughput.shutdown();
- }
- else if(line.equals("x"))
+ char c = line.charAt(0);
+
+ switch(c)
+ {
+ case 't':
+ case 'o':
+ {
+ System.out.print("sending");
+ break;
+ }
+
+ case 'r':
+ {
+ System.out.print("receiving");
+ break;
+ }
+
+ case 'e':
+ {
+ System.out.print("sending and receiving");
+ break;
+ }
+ }
+
+ System.out.print(" " + repetitions);
+ switch(currentType)
+ {
+ case '1':
+ {
+ System.out.print(" byte");
+ break;
+ }
+
+ case '2':
+ {
+ System.out.print(" string");
+ break;
+ }
+
+ case '3':
+ {
+ System.out.print(" variable-length struct");
+ break;
+ }
+
+ case '4':
+ {
+ System.out.print(" fixed-length struct");
+ break;
+ }
+ }
+
+ System.out.print(" sequences of size " + seqSize);
+
+ if(c == 'o')
+ {
+ System.out.print(" as oneway");
+ }
+
+ System.out.println("...");
+
+ for(int i = 0; i < repetitions; ++i)
+ {
+ switch(currentType)
+ {
+ case '1':
+ {
+ switch(c)
+ {
+ case 't':
+ {
+ throughput.sendByteSeq(byteSeq);
+ break;
+ }
+
+ case 'o':
+ {
+ throughputOneway.sendByteSeq(byteSeq);
+ break;
+ }
+
+ case 'r':
+ {
+ throughput.recvByteSeq();
+ break;
+ }
+
+ case 'e':
+ {
+ throughput.echoByteSeq(byteSeq);
+ break;
+ }
+ }
+ break;
+ }
+
+ case '2':
+ {
+ switch(c)
+ {
+ case 't':
+ {
+ throughput.sendStringSeq(stringSeq);
+ break;
+ }
+
+ case 'o':
+ {
+ throughputOneway.sendStringSeq(stringSeq);
+ break;
+ }
+
+ case 'r':
+ {
+ throughput.recvStringSeq();
+ break;
+ }
+
+ case 'e':
+ {
+ throughput.echoStringSeq(stringSeq);
+ break;
+ }
+ }
+ break;
+ }
+
+ case '3':
+ {
+ switch(c)
+ {
+ case 't':
+ {
+ throughput.sendStructSeq(structSeq);
+ break;
+ }
+
+ case 'o':
+ {
+ throughputOneway.sendStructSeq(structSeq);
+ break;
+ }
+
+ case 'r':
+ {
+ throughput.recvStructSeq();
+ break;
+ }
+
+ case 'e':
+ {
+ throughput.echoStructSeq(structSeq);
+ break;
+ }
+ }
+ break;
+ }
+
+ case '4':
+ {
+ switch(c)
+ {
+ case 't':
+ {
+ throughput.sendFixedSeq(fixedSeq);
+ break;
+ }
+
+ case 'o':
+ {
+ throughputOneway.sendFixedSeq(fixedSeq);
+ break;
+ }
+
+ case 'r':
+ {
+ throughput.recvFixedSeq();
+ break;
+ }
+
+ case 'e':
+ {
+ throughput.echoFixedSeq(fixedSeq);
+ break;
+ }
+ }
+ break;
+ }
+ }
+ }
+
+ double dmsec = System.currentTimeMillis() - tmsec;
+ System.out.println("time for " + repetitions + " sequences: " + dmsec + "ms");
+ System.out.println("time per sequence: " + dmsec / repetitions + "ms");
+ int wireSize = 0;
+ switch(currentType)
+ {
+ case '1':
+ {
+ wireSize = 1;
+ break;
+ }
+
+ case '2':
+ {
+ wireSize = stringSeq[0].length();
+ break;
+ }
+
+ case '3':
+ {
+ wireSize = structSeq[0].s.length();
+ wireSize += 8; // Size of double on the wire.
+ break;
+ }
+
+ case '4':
+ {
+ wireSize = 16; // Size of two ints and a double on the wire.
+ break;
+ }
+ }
+ double mbit = repetitions * seqSize * wireSize * 8.0 / dmsec / 1000.0;
+ if(c == 'e')
+ {
+ mbit *= 2;
+ }
+ System.out.println("throughput: " + new java.text.DecimalFormat("#.##").format(mbit) + "Mbps");
+ }
+ else if(line.equals("s"))
+ {
+ throughput.shutdown();
+ }
+ else if(line.equals("x"))
{
// Nothing to do
}
@@ -425,9 +465,9 @@ public class Client
try
{
- Ice.InitializationData initData = new Ice.InitializationData();
+ Ice.InitializationData initData = new Ice.InitializationData();
initData.properties = Ice.Util.createProperties();
- initData.properties.load("config");
+ initData.properties.load("config.client");
communicator = Ice.Util.initialize(args, initData);
status = run(args, communicator);
}
diff --git a/javae/demo/IceE/jdk/throughput/Server.java b/javae/demo/IceE/jdk/throughput/Server.java
index e58a7a2534b..3c52bb51363 100644
--- a/javae/demo/IceE/jdk/throughput/Server.java
+++ b/javae/demo/IceE/jdk/throughput/Server.java
@@ -40,9 +40,9 @@ public class Server
try
{
- Ice.InitializationData initData = new Ice.InitializationData();
+ Ice.InitializationData initData = new Ice.InitializationData();
initData.properties = Ice.Util.createProperties();
- initData.properties.load("config");
+ initData.properties.load("config.server");
communicator = Ice.Util.initialize(args, initData);
status = run(args, communicator);
}
diff --git a/javae/demo/IceE/jdk/throughput/Throughput.ice b/javae/demo/IceE/jdk/throughput/Throughput.ice
index fb6b08389ed..6c33d145f2c 100644
--- a/javae/demo/IceE/jdk/throughput/Throughput.ice
+++ b/javae/demo/IceE/jdk/throughput/Throughput.ice
@@ -38,6 +38,10 @@ const int FixedSeqSize = 50000;
interface Throughput
{
+ bool needsWarmup();
+ void startWarmup();
+ void endWarmup();
+
void sendByteSeq(ByteSeq seq);
ByteSeq recvByteSeq();
ByteSeq echoByteSeq(ByteSeq seq);
diff --git a/javae/demo/IceE/jdk/throughput/ThroughputI.java b/javae/demo/IceE/jdk/throughput/ThroughputI.java
index 571a358a9c7..e8ed08fcf2a 100644
--- a/javae/demo/IceE/jdk/throughput/ThroughputI.java
+++ b/javae/demo/IceE/jdk/throughput/ThroughputI.java
@@ -16,28 +16,48 @@ public final class ThroughputI extends _ThroughputDisp
{
_byteSeq = new byte[ByteSeqSize.value / reduce];
- _stringSeq = new String[StringSeqSize.value / reduce];
- for(int i = 0; i < StringSeqSize.value / reduce; ++i)
- {
- _stringSeq[i] = "hello";
- }
-
- _structSeq = new StringDouble[StringDoubleSeqSize.value / reduce];
- for(int i = 0; i < StringDoubleSeqSize.value / reduce; ++i)
- {
- _structSeq[i] = new StringDouble();
- _structSeq[i].s = "hello";
- _structSeq[i].d = 3.14;
- }
-
- _fixedSeq = new Fixed[FixedSeqSize.value / reduce];
- for(int i = 0; i < FixedSeqSize.value / reduce; ++i)
- {
- _fixedSeq[i] = new Fixed();
- _fixedSeq[i].i = 0;
- _fixedSeq[i].j = 0;
- _fixedSeq[i].d = 0;
- }
+ _stringSeq = new String[StringSeqSize.value / reduce];
+ for(int i = 0; i < StringSeqSize.value / reduce; ++i)
+ {
+ _stringSeq[i] = "hello";
+ }
+
+ _structSeq = new StringDouble[StringDoubleSeqSize.value / reduce];
+ for(int i = 0; i < StringDoubleSeqSize.value / reduce; ++i)
+ {
+ _structSeq[i] = new StringDouble();
+ _structSeq[i].s = "hello";
+ _structSeq[i].d = 3.14;
+ }
+
+ _fixedSeq = new Fixed[FixedSeqSize.value / reduce];
+ for(int i = 0; i < FixedSeqSize.value / reduce; ++i)
+ {
+ _fixedSeq[i] = new Fixed();
+ _fixedSeq[i].i = 0;
+ _fixedSeq[i].j = 0;
+ _fixedSeq[i].d = 0;
+ }
+ }
+
+ public boolean
+ needsWarmup(Ice.Current current)
+ {
+ _warmup = false;
+ return _needsWarmup;
+ }
+
+ public void
+ startWarmup(Ice.Current current)
+ {
+ _warmup = true;
+ }
+
+ public void
+ endWarmup(Ice.Current current)
+ {
+ _warmup = false;
+ _needsWarmup = false;
}
public void
@@ -48,7 +68,14 @@ public final class ThroughputI extends _ThroughputDisp
public byte[]
recvByteSeq(Ice.Current current)
{
- return _byteSeq;
+ if(_warmup)
+ {
+ return _emptyByteSeq;
+ }
+ else
+ {
+ return _byteSeq;
+ }
}
public byte[]
@@ -65,7 +92,14 @@ public final class ThroughputI extends _ThroughputDisp
public String[]
recvStringSeq(Ice.Current current)
{
- return _stringSeq;
+ if(_warmup)
+ {
+ return _emptyStringSeq;
+ }
+ else
+ {
+ return _stringSeq;
+ }
}
public String[]
@@ -82,7 +116,14 @@ public final class ThroughputI extends _ThroughputDisp
public StringDouble[]
recvStructSeq(Ice.Current current)
{
- return _structSeq;
+ if(_warmup)
+ {
+ return _emptyStructSeq;
+ }
+ else
+ {
+ return _structSeq;
+ }
}
public StringDouble[]
@@ -99,7 +140,14 @@ public final class ThroughputI extends _ThroughputDisp
public Fixed[]
recvFixedSeq(Ice.Current current)
{
- return _fixedSeq;
+ if(_warmup)
+ {
+ return _emptyFixedSeq;
+ }
+ else
+ {
+ return _fixedSeq;
+ }
}
public Fixed[]
@@ -118,4 +166,12 @@ public final class ThroughputI extends _ThroughputDisp
private String[] _stringSeq;
private StringDouble[] _structSeq;
private Fixed[] _fixedSeq;
+
+ private byte[] _emptyByteSeq = new byte[0];
+ private String[] _emptyStringSeq = new String[0];
+ private StringDouble[] _emptyStructSeq = new StringDouble[0];
+ private Fixed[] _emptyFixedSeq = new Fixed[0];
+
+ private boolean _needsWarmup = true;
+ private boolean _warmup = false;
}
diff --git a/javae/demo/IceE/jdk/throughput/config b/javae/demo/IceE/jdk/throughput/config
deleted file mode 100644
index dcf3c6d4f66..00000000000
--- a/javae/demo/IceE/jdk/throughput/config
+++ /dev/null
@@ -1,7 +0,0 @@
-Throughput.Throughput=throughput:default -p 10000 -h 127.0.0.1
-Throughput.Endpoints=default -p 10000 -h 127.0.0.1
-
-#
-# Use faster blocking client side model by default.
-#
-Ice.Blocking=1
diff --git a/javae/demo/IceE/jdk/throughput/config.client b/javae/demo/IceE/jdk/throughput/config.client
new file mode 100644
index 00000000000..02ef8276f6c
--- /dev/null
+++ b/javae/demo/IceE/jdk/throughput/config.client
@@ -0,0 +1,5 @@
+#
+# The client reads this property to create the reference to the
+# "Throughput" object in the server.
+#
+Throughput.Proxy=throughput:default -p 10000 -h 127.0.0.1
diff --git a/javae/demo/IceE/jdk/throughput/config.server b/javae/demo/IceE/jdk/throughput/config.server
new file mode 100644
index 00000000000..1a301bb3ed6
--- /dev/null
+++ b/javae/demo/IceE/jdk/throughput/config.server
@@ -0,0 +1,11 @@
+#
+# The server creates one single object adapter with the name
+# "Throughput". The following line sets the endpoints for this
+# adapter.
+#
+Throughput.Endpoints=default -p 10000 -h 127.0.0.1
+
+#
+# Warn about connection exceptions
+#
+Ice.Warn.Connections=1
diff --git a/javae/demo/IceE/midp/chat/ChatCallbackI.java b/javae/demo/IceE/midp/chat/ChatCallbackI.java
index ca146c965af..5d283b59a5f 100644
--- a/javae/demo/IceE/midp/chat/ChatCallbackI.java
+++ b/javae/demo/IceE/midp/chat/ChatCallbackI.java
@@ -12,13 +12,13 @@ public class ChatCallbackI extends Demo._ChatCallbackDisp
public
ChatCallbackI(Console console)
{
- _console = console;
+ _console = console;
}
public void
message(String data, Ice.Current current)
{
- _console.addText(data + "\n");
+ _console.addText(data + "\n");
}
private Console _console;
diff --git a/javae/demo/IceE/midp/chat/ChatForm.java b/javae/demo/IceE/midp/chat/ChatForm.java
index cc0fc762ee2..784dc87bf07 100644
--- a/javae/demo/IceE/midp/chat/ChatForm.java
+++ b/javae/demo/IceE/midp/chat/ChatForm.java
@@ -14,145 +14,145 @@ public class ChatForm extends Form implements CommandListener
public
ChatForm(ChatMIDlet parent, String user, Demo.ChatSessionPrx session, Glacier2.RouterPrx router)
{
- super("Chat Demo");
+ super("Chat Demo");
- _parent = parent;
- _user = user;
- _session = session;
- _router = router;
+ _parent = parent;
+ _user = user;
+ _session = session;
+ _router = router;
- StringItem str = new StringItem(null, "Messages");
- _message = new TextField(null, "", 255, TextField.ANY);
+ StringItem str = new StringItem(null, "Messages");
+ _message = new TextField(null, "", 255, TextField.ANY);
- _console = new Console(null, null, null, getWidth(), 4);
+ _console = new Console(null, null, null, getWidth(), 4);
- str.setLayout(Item.LAYOUT_TOP | Item.LAYOUT_LEFT | Item.LAYOUT_VSHRINK);
- _message.setLayout(Item.LAYOUT_BOTTOM | Item.LAYOUT_LEFT | Item.LAYOUT_EXPAND | Item.LAYOUT_VSHRINK);
- _console.setLayout(Item.LAYOUT_TOP | Item.LAYOUT_LEFT | Item.LAYOUT_EXPAND | Item.LAYOUT_VEXPAND);
+ str.setLayout(Item.LAYOUT_TOP | Item.LAYOUT_LEFT | Item.LAYOUT_VSHRINK);
+ _message.setLayout(Item.LAYOUT_BOTTOM | Item.LAYOUT_LEFT | Item.LAYOUT_EXPAND | Item.LAYOUT_VSHRINK);
+ _console.setLayout(Item.LAYOUT_TOP | Item.LAYOUT_LEFT | Item.LAYOUT_EXPAND | Item.LAYOUT_VEXPAND);
- append(str);
- append(_console);
- append(_message);
+ append(str);
+ append(_console);
+ append(_message);
- addCommand(new Command("Send", Command.SCREEN, 0));
- addCommand(new Command("Exit", Command.EXIT, 1));
- setCommandListener(this);
+ addCommand(new Command("Send", Command.SCREEN, 0));
+ addCommand(new Command("Exit", Command.EXIT, 1));
+ setCommandListener(this);
- _pingThread = new PingThread();
- _pingThread.start();
+ _pingThread = new PingThread();
+ _pingThread.start();
}
public Console
getConsole()
{
- return _console;
+ return _console;
}
public void
commandAction(Command c, Displayable s)
{
- if(c.getCommandType() == Command.EXIT)
- {
- new ExitThread().start();
- }
- else
- {
- String message = _message.getString();
- _message.setString("");
- new SendThread(message).start();
- }
+ if(c.getCommandType() == Command.EXIT)
+ {
+ new ExitThread().start();
+ }
+ else
+ {
+ String message = _message.getString();
+ _message.setString("");
+ new SendThread(message).start();
+ }
}
private class PingThread extends Thread
{
- public synchronized void
- run()
- {
- while(!_destroy)
- {
- try
- {
- wait(20000); // 20 seconds.
- }
- catch(Exception ex)
- {
- }
-
- if(_destroy)
- {
- break;
- }
-
- try
- {
- _session.ice_ping();
- }
- catch(Exception ex)
- {
- break;
- }
- }
- }
-
- public void
- destroy()
- {
- synchronized(this)
- {
- _destroy = true;
- notify();
- }
- try
- {
- join();
- }
- catch(Exception ex)
- {
- // Ignore.
- }
- }
-
- boolean _destroy = false;
+ public synchronized void
+ run()
+ {
+ while(!_destroy)
+ {
+ try
+ {
+ wait(20000); // 20 seconds.
+ }
+ catch(Exception ex)
+ {
+ }
+
+ if(_destroy)
+ {
+ break;
+ }
+
+ try
+ {
+ _session.ice_ping();
+ }
+ catch(Exception ex)
+ {
+ break;
+ }
+ }
+ }
+
+ public void
+ destroy()
+ {
+ synchronized(this)
+ {
+ _destroy = true;
+ notify();
+ }
+ try
+ {
+ join();
+ }
+ catch(Exception ex)
+ {
+ // Ignore.
+ }
+ }
+
+ boolean _destroy = false;
}
private class ExitThread extends Thread
{
- public void
- run()
- {
- ChatForm.this._pingThread.destroy();
- try
- {
- ChatForm.this._router.destroySession();
- }
- catch(Exception ex)
- {
- // Ignore.
- }
- ChatForm.this._parent.destroy();
- }
+ public void
+ run()
+ {
+ ChatForm.this._pingThread.destroy();
+ try
+ {
+ ChatForm.this._router.destroySession();
+ }
+ catch(Exception ex)
+ {
+ // Ignore.
+ }
+ ChatForm.this._parent.destroy();
+ }
}
private class SendThread extends Thread
{
- SendThread(String message)
- {
- _message = message;
- }
-
- public void
- run()
- {
- try
- {
- _session.say(_message);
- }
- catch(Exception ex)
- {
- }
- }
-
- String _message;
+ SendThread(String message)
+ {
+ _message = message;
+ }
+
+ public void
+ run()
+ {
+ try
+ {
+ _session.say(_message);
+ }
+ catch(Exception ex)
+ {
+ }
+ }
+
+ String _message;
}
private ChatMIDlet _parent;
diff --git a/javae/demo/IceE/midp/chat/ChatMIDlet.java b/javae/demo/IceE/midp/chat/ChatMIDlet.java
index b61862f00db..ea454022baa 100644
--- a/javae/demo/IceE/midp/chat/ChatMIDlet.java
+++ b/javae/demo/IceE/midp/chat/ChatMIDlet.java
@@ -20,24 +20,24 @@ public class ChatMIDlet extends MIDlet
public void
destroy()
{
- if(_communicator != null)
- {
- try
- {
- _communicator.destroy();
- }
- catch(Exception ex)
- {
- // Ignore.
- }
- }
- notifyDestroyed();
+ if(_communicator != null)
+ {
+ try
+ {
+ _communicator.destroy();
+ }
+ catch(Exception ex)
+ {
+ // Ignore.
+ }
+ }
+ notifyDestroyed();
}
protected void
destroyApp(boolean unconditional)
{
- destroy();
+ destroy();
}
protected void
@@ -48,22 +48,22 @@ public class ChatMIDlet extends MIDlet
protected void
startApp()
{
- try
- {
- final String[] args = new String[0];
- _communicator = Ice.Util.initialize(args);
- }
- catch(Exception ex)
- {
- Alert alert = new Alert("Ice Error", ex.getMessage(), null, AlertType.ERROR);
- alert.setTimeout(Alert.FOREVER);
- Display.getDisplay(this).setCurrent(alert);
- notifyDestroyed();
- return;
- }
+ try
+ {
+ final String[] args = new String[0];
+ _communicator = Ice.Util.initialize(args);
+ }
+ catch(Exception ex)
+ {
+ Alert alert = new Alert("Ice Error", ex.getMessage(), null, AlertType.ERROR);
+ alert.setTimeout(Alert.FOREVER);
+ Display.getDisplay(this).setCurrent(alert);
+ notifyDestroyed();
+ return;
+ }
- _loginForm = new LoginForm(this, _communicator);
- Display.getDisplay(this).setCurrent(_loginForm);
+ _loginForm = new LoginForm(this, _communicator);
+ Display.getDisplay(this).setCurrent(_loginForm);
}
private Form _loginForm;
diff --git a/javae/demo/IceE/midp/chat/Console.java b/javae/demo/IceE/midp/chat/Console.java
index 1782d4bf7b4..71e58e26649 100644
--- a/javae/demo/IceE/midp/chat/Console.java
+++ b/javae/demo/IceE/midp/chat/Console.java
@@ -15,309 +15,309 @@ public class Console extends CustomItem
public
Console(String label, String text, Font f, int w, int minLines)
{
- super(label);
-
- if(text != null && text.length() > 0)
- {
- _text = new StringBuffer(text);
- }
- else
- {
- _text = new StringBuffer();
- }
-
- _font = f;
- if(_font == null)
- {
- _font = Font.getFont(Font.FACE_PROPORTIONAL, Font.STYLE_PLAIN, Font.SIZE_SMALL);
- }
-
- _maxWidth = w;
- _minLines = minLines;
-
- _topLine = -1;
+ super(label);
+
+ if(text != null && text.length() > 0)
+ {
+ _text = new StringBuffer(text);
+ }
+ else
+ {
+ _text = new StringBuffer();
+ }
+
+ _font = f;
+ if(_font == null)
+ {
+ _font = Font.getFont(Font.FACE_PROPORTIONAL, Font.STYLE_PLAIN, Font.SIZE_SMALL);
+ }
+
+ _maxWidth = w;
+ _minLines = minLines;
+
+ _topLine = -1;
}
public synchronized void
setText(String text)
{
- _lines.removeAllElements();
- if(text != null && text.length() > 0)
- {
- _text = new StringBuffer(text);
- }
- else
- {
- _text = new StringBuffer();
- }
- formatText(0);
- _topLine = -1;
- repaint();
+ _lines.removeAllElements();
+ if(text != null && text.length() > 0)
+ {
+ _text = new StringBuffer(text);
+ }
+ else
+ {
+ _text = new StringBuffer();
+ }
+ formatText(0);
+ _topLine = -1;
+ repaint();
}
public synchronized void
addText(String text)
{
- if(text != null && text.length() > 0)
- {
- int start = _text.length();
- _text.append(text);
- formatText(start);
- _topLine = -1;
- repaint();
- }
+ if(text != null && text.length() > 0)
+ {
+ int start = _text.length();
+ _text.append(text);
+ formatText(start);
+ _topLine = -1;
+ repaint();
+ }
}
protected int
getMinContentHeight()
{
- return _font.getHeight() + 2;
+ return _font.getHeight() + 2;
}
protected int
getMinContentWidth()
{
- return _maxWidth;
+ return _maxWidth;
}
protected int
getPrefContentHeight(int w)
{
- return _font.getHeight() * _minLines + 2;
+ return _font.getHeight() * _minLines + 2;
}
protected int
getPrefContentWidth(int h)
{
- return _maxWidth;
+ return _maxWidth;
}
protected synchronized void
paint(Graphics g, int w, int h)
{
- //
- // Clear the screen.
- //
- g.setColor(255, 255, 255);
- g.fillRect(0, 0, _actualWidth, _actualHeight);
-
- g.setColor(0, 0, 0);
- g.setFont(_font);
-
- int i;
- final int sz = _lines.size();
- if(_topLine == -1)
- {
- if(sz < _linesPerPage)
- {
- i = 0;
- }
- else
- {
- i = sz - _linesPerPage;
- }
- }
- else
- {
- i = _topLine;
- }
-
- final int fh = _font.getHeight();
- final String text = _text.toString();
-
- if(i > 0)
- {
- g.drawImage(_upImage, _textWidth + 2, 0, Graphics.TOP | Graphics.LEFT);
- }
-
- if(i + _linesPerPage < sz)
- {
- g.drawImage(_downImage, _textWidth + 2, _actualHeight, Graphics.BOTTOM | Graphics.LEFT);
- }
-
- int y = 2;
- while(i < sz)
- {
- Line l = (Line)_lines.elementAt(i);
- if(l.len > 0)
- {
- g.drawSubstring(text, l.start, l.len, 2, y, Graphics.TOP | Graphics.LEFT);
- }
- y += fh;
- ++i;
- }
-
- g.drawRect(0, 0, _textWidth - 1, _actualHeight - 1);
+ //
+ // Clear the screen.
+ //
+ g.setColor(255, 255, 255);
+ g.fillRect(0, 0, _actualWidth, _actualHeight);
+
+ g.setColor(0, 0, 0);
+ g.setFont(_font);
+
+ int i;
+ final int sz = _lines.size();
+ if(_topLine == -1)
+ {
+ if(sz < _linesPerPage)
+ {
+ i = 0;
+ }
+ else
+ {
+ i = sz - _linesPerPage;
+ }
+ }
+ else
+ {
+ i = _topLine;
+ }
+
+ final int fh = _font.getHeight();
+ final String text = _text.toString();
+
+ if(i > 0)
+ {
+ g.drawImage(_upImage, _textWidth + 2, 0, Graphics.TOP | Graphics.LEFT);
+ }
+
+ if(i + _linesPerPage < sz)
+ {
+ g.drawImage(_downImage, _textWidth + 2, _actualHeight, Graphics.BOTTOM | Graphics.LEFT);
+ }
+
+ int y = 2;
+ while(i < sz)
+ {
+ Line l = (Line)_lines.elementAt(i);
+ if(l.len > 0)
+ {
+ g.drawSubstring(text, l.start, l.len, 2, y, Graphics.TOP | Graphics.LEFT);
+ }
+ y += fh;
+ ++i;
+ }
+
+ g.drawRect(0, 0, _textWidth - 1, _actualHeight - 1);
}
protected synchronized void
sizeChanged(int w, int h)
{
- if(w != _actualWidth || h != _actualHeight)
- {
- _actualWidth = w;
- _actualHeight = h;
- _textWidth = _actualWidth - _upImage.getWidth() - 2;
- _linesPerPage = (_actualHeight - 2) / _font.getHeight();
- _lines.removeAllElements();
- formatText(0);
- }
+ if(w != _actualWidth || h != _actualHeight)
+ {
+ _actualWidth = w;
+ _actualHeight = h;
+ _textWidth = _actualWidth - _upImage.getWidth() - 2;
+ _linesPerPage = (_actualHeight - 2) / _font.getHeight();
+ _lines.removeAllElements();
+ formatText(0);
+ }
}
protected boolean
traverse(int dir, int viewportWidth, int viewportHeight, int[] visRect_inout)
{
- if(_traversing)
- {
- switch(dir)
- {
- case Canvas.UP:
- if(_topLine == -1 && _lines.size() > _linesPerPage)
- {
- _topLine = _lines.size() - _linesPerPage - 1;
- repaint();
- }
- else if(_topLine > 0)
- {
- --_topLine;
- repaint();
- }
- break;
-
- case Canvas.DOWN:
- if(_topLine >= 0)
- {
- ++_topLine;
- if(_topLine + _linesPerPage > _lines.size())
- {
- _topLine = -1;
- }
- repaint();
- }
- break;
-
- case Canvas.LEFT:
- case Canvas.RIGHT:
- _traversing = false;
- return false;
- }
- }
-
- visRect_inout[0] = 0;
- visRect_inout[1] = 0;
- visRect_inout[2] = _actualWidth;
- visRect_inout[3] = _actualHeight;
- _traversing = true;
- return true;
+ if(_traversing)
+ {
+ switch(dir)
+ {
+ case Canvas.UP:
+ if(_topLine == -1 && _lines.size() > _linesPerPage)
+ {
+ _topLine = _lines.size() - _linesPerPage - 1;
+ repaint();
+ }
+ else if(_topLine > 0)
+ {
+ --_topLine;
+ repaint();
+ }
+ break;
+
+ case Canvas.DOWN:
+ if(_topLine >= 0)
+ {
+ ++_topLine;
+ if(_topLine + _linesPerPage > _lines.size())
+ {
+ _topLine = -1;
+ }
+ repaint();
+ }
+ break;
+
+ case Canvas.LEFT:
+ case Canvas.RIGHT:
+ _traversing = false;
+ return false;
+ }
+ }
+
+ visRect_inout[0] = 0;
+ visRect_inout[1] = 0;
+ visRect_inout[2] = _actualWidth;
+ visRect_inout[3] = _actualHeight;
+ _traversing = true;
+ return true;
}
private void
formatText(int start)
{
- final int len = _text.length();
- if(len <= start)
- {
- return;
- }
-
- int pos = start;
-
- Line line = null;
- boolean addLine = false;
- if(!_lines.isEmpty())
- {
- Line l = (Line)_lines.lastElement();
- if(l.open)
- {
- line = l;
- }
- }
-
- final String text = _text.toString();
- final int maxWidth = _textWidth - 2;
-
- while(pos < len)
- {
- if(line == null)
- {
- line = new Line(pos, 0, true);
- addLine = true;
- }
-
- int end;
- int nl = text.indexOf('\n', line.start);
- if(nl == -1)
- {
- end = len;
- }
- else if(nl == line.start) // Empty line.
- {
- end = pos;
- }
- else
- {
- end = nl;
- }
-
- //
- // Determine the longest substring that will fit in maxWidth.
- //
- if(end > line.start && _font.substringWidth(text, line.start, end - line.start) > maxWidth)
- {
- int low = line.start;
- int high = end;
- while(low <= high)
- {
- int mid = (low + high) >> 1;
-
- int w = _font.substringWidth(text, line.start, mid - line.start);
- if(w > maxWidth)
- {
- high = mid - 1;
- }
- else
- {
- if(mid < end && (w + _font.charWidth(text.charAt(mid)) < maxWidth))
- {
- low = mid + 1;
- }
- else
- {
- end = mid;
- break;
- }
- }
- }
- }
-
- line.len = end - line.start;
- line.open = nl == -1 || nl > end;
- if(addLine)
- {
- _lines.addElement(line);
- }
- if(!line.open)
- {
- ++end;
- }
- line = null;
-
- pos = end;
- }
+ final int len = _text.length();
+ if(len <= start)
+ {
+ return;
+ }
+
+ int pos = start;
+
+ Line line = null;
+ boolean addLine = false;
+ if(!_lines.isEmpty())
+ {
+ Line l = (Line)_lines.lastElement();
+ if(l.open)
+ {
+ line = l;
+ }
+ }
+
+ final String text = _text.toString();
+ final int maxWidth = _textWidth - 2;
+
+ while(pos < len)
+ {
+ if(line == null)
+ {
+ line = new Line(pos, 0, true);
+ addLine = true;
+ }
+
+ int end;
+ int nl = text.indexOf('\n', line.start);
+ if(nl == -1)
+ {
+ end = len;
+ }
+ else if(nl == line.start) // Empty line.
+ {
+ end = pos;
+ }
+ else
+ {
+ end = nl;
+ }
+
+ //
+ // Determine the longest substring that will fit in maxWidth.
+ //
+ if(end > line.start && _font.substringWidth(text, line.start, end - line.start) > maxWidth)
+ {
+ int low = line.start;
+ int high = end;
+ while(low <= high)
+ {
+ int mid = (low + high) >> 1;
+
+ int w = _font.substringWidth(text, line.start, mid - line.start);
+ if(w > maxWidth)
+ {
+ high = mid - 1;
+ }
+ else
+ {
+ if(mid < end && (w + _font.charWidth(text.charAt(mid)) < maxWidth))
+ {
+ low = mid + 1;
+ }
+ else
+ {
+ end = mid;
+ break;
+ }
+ }
+ }
+ }
+
+ line.len = end - line.start;
+ line.open = nl == -1 || nl > end;
+ if(addLine)
+ {
+ _lines.addElement(line);
+ }
+ if(!line.open)
+ {
+ ++end;
+ }
+ line = null;
+
+ pos = end;
+ }
}
private static class Line
{
- Line(int start, int len, boolean open)
- {
- this.start = start;
- this.len = len;
- this.open = open;
- }
-
- int start;
- int len;
- boolean open;
+ Line(int start, int len, boolean open)
+ {
+ this.start = start;
+ this.len = len;
+ this.open = open;
+ }
+
+ int start;
+ int len;
+ boolean open;
}
private StringBuffer _text;
@@ -355,7 +355,7 @@ public class Console extends CustomItem
};
static
{
- _upImage = Image.createImage(_upImageData, 0, _upImageData.length);
- _downImage = Image.createImage(_downImageData, 0, _downImageData.length);
+ _upImage = Image.createImage(_upImageData, 0, _upImageData.length);
+ _downImage = Image.createImage(_downImageData, 0, _downImageData.length);
}
}
diff --git a/javae/demo/IceE/midp/chat/LoginForm.java b/javae/demo/IceE/midp/chat/LoginForm.java
index 2442c1bba75..2ca0e3d3e58 100644
--- a/javae/demo/IceE/midp/chat/LoginForm.java
+++ b/javae/demo/IceE/midp/chat/LoginForm.java
@@ -14,117 +14,113 @@ public class LoginForm extends Form implements CommandListener, Runnable
public
LoginForm(ChatMIDlet parent, Ice.Communicator communicator)
{
- super("Login");
+ super("Login");
- _parent = parent;
- _communicator = communicator;
+ _parent = parent;
+ _communicator = communicator;
- _user = new TextField("Name", "", 255, TextField.ANY);
- _password = new TextField("Password", "", 255, TextField.PASSWORD);
- _server = new TextField("Server", "", 255, TextField.ANY);
- _port = new TextField("Port", "10005", 255, TextField.NUMERIC);
+ _user = new TextField("Name", "", 255, TextField.ANY);
+ _password = new TextField("Password", "", 255, TextField.PASSWORD);
+ _server = new TextField("Server", "", 255, TextField.ANY);
+ _port = new TextField("Port", "10005", 255, TextField.NUMERIC);
- append(_user);
- append(_password);
- append(_server);
- append(_port);
+ append(_user);
+ append(_password);
+ append(_server);
+ append(_port);
- addCommand(new Command("OK", Command.OK, 0));
- addCommand(new Command("Exit", Command.EXIT, 1));
- setCommandListener(this);
+ addCommand(new Command("OK", Command.OK, 0));
+ addCommand(new Command("Exit", Command.EXIT, 1));
+ setCommandListener(this);
}
public void
commandAction(Command c, Displayable s)
{
- if(c.getCommandType() == Command.EXIT)
- {
- _parent.destroy();
- }
- else
- {
- Thread t = new Thread(this);
- t.start();
- }
+ if(c.getCommandType() == Command.EXIT)
+ {
+ _parent.destroy();
+ }
+ else
+ {
+ Thread t = new Thread(this);
+ t.start();
+ }
}
public void
run()
{
- String user = _user.getString();
- String password = _password.getString();
-
- //
- // Validate server address.
- //
- String server = _server.getString().trim();
- if(server.length() == 0)
- {
- Alert alert = new Alert("Login Error", "Server address is required", null, AlertType.ERROR);
- alert.setTimeout(Alert.FOREVER);
- Display.getDisplay(_parent).setCurrent(alert, this);
- return;
- }
-
- //
- // Validate port number.
- //
- String port = _port.getString().trim();
- if(port.length() == 0)
- {
- Alert alert = new Alert("Login Error", "Port number is required", null, AlertType.ERROR);
- alert.setTimeout(Alert.FOREVER);
- Display.getDisplay(_parent).setCurrent(alert, this);
- return;
- }
-
- Demo.ChatSessionPrx session = null;
- try
- {
- String routerStr = "DemoGlacier2/router:tcp -h " + server + " -p " + port;
- Glacier2.RouterPrx router =
- Glacier2.RouterPrxHelper.checkedCast(_communicator.stringToProxy(routerStr));
- if(router != null)
- {
- _communicator.setDefaultRouter(router);
-
- Ice.Properties properties = _communicator.getProperties();
- properties.setProperty("Chat.Client.Router", routerStr);
- properties.setProperty("Chat.Client.Endpoints", "");
-
- session = Demo.ChatSessionPrxHelper.uncheckedCast(router.createSession(user, password));
-
- String category = router.getServerProxy().ice_getIdentity().category;
- Ice.Identity callbackReceiverIdent = new Ice.Identity();
- callbackReceiverIdent.name = "callbackReceiver";
- callbackReceiverIdent.category = category;
-
- ChatForm cf = new ChatForm(_parent, user, session, router);
-
- Ice.ObjectAdapter adapter = _communicator.createObjectAdapter("Chat.Client");
- Demo.ChatCallbackPrx callback = Demo.ChatCallbackPrxHelper.uncheckedCast(
- adapter.add(new ChatCallbackI(cf.getConsole()), callbackReceiverIdent));
- adapter.activate();
-
- session.setCallback(callback);
-
- Display.getDisplay(_parent).setCurrent(cf);
- }
- else
- {
- Alert alert = new Alert("Router Error", "Router is not a Glacier2 router", null, AlertType.ERROR);
- alert.setTimeout(Alert.FOREVER);
- Display.getDisplay(_parent).setCurrent(alert, this);
- return;
- }
- }
- catch(Exception ex)
- {
- Alert alert = new Alert("Ice Error", ex.getMessage(), null, AlertType.ERROR);
- alert.setTimeout(Alert.FOREVER);
- Display.getDisplay(_parent).setCurrent(alert, this);
- return;
- }
+ String user = _user.getString();
+ String password = _password.getString();
+
+ //
+ // Validate server address.
+ //
+ String server = _server.getString().trim();
+ if(server.length() == 0)
+ {
+ Alert alert = new Alert("Login Error", "Server address is required", null, AlertType.ERROR);
+ alert.setTimeout(Alert.FOREVER);
+ Display.getDisplay(_parent).setCurrent(alert, this);
+ return;
+ }
+
+ //
+ // Validate port number.
+ //
+ String port = _port.getString().trim();
+ if(port.length() == 0)
+ {
+ Alert alert = new Alert("Login Error", "Port number is required", null, AlertType.ERROR);
+ alert.setTimeout(Alert.FOREVER);
+ Display.getDisplay(_parent).setCurrent(alert, this);
+ return;
+ }
+
+ Demo.ChatSessionPrx session = null;
+ try
+ {
+ String routerStr = "DemoGlacier2/router:tcp -h " + server + " -p " + port;
+ Glacier2.RouterPrx router =
+ Glacier2.RouterPrxHelper.checkedCast(_communicator.stringToProxy(routerStr));
+ if(router != null)
+ {
+ _communicator.setDefaultRouter(router);
+
+ session = Demo.ChatSessionPrxHelper.uncheckedCast(router.createSession(user, password));
+
+ Ice.Identity callbackReceiverIdent = new Ice.Identity();
+ callbackReceiverIdent.name = "callbackReceiver";
+ callbackReceiverIdent.category = router.getCategoryForClient();
+
+ ChatForm cf = new ChatForm(_parent, user, session, router);
+
+ Ice.ObjectAdapter adapter = _communicator.createObjectAdapterWithRouter("Chat.Client", router);
+ ChatCallbackI cb = new ChatCallbackI(cf.getConsole());
+ Demo.ChatCallbackPrx callback = Demo.ChatCallbackPrxHelper.uncheckedCast(
+ adapter.add(cb, callbackReceiverIdent));
+ adapter.activate();
+
+ session.setCallback(callback);
+
+ Display.getDisplay(_parent).setCurrent(cf);
+ }
+ else
+ {
+ Alert alert = new Alert("Router Error", "Router is not a Glacier2 router", null, AlertType.ERROR);
+ alert.setTimeout(Alert.FOREVER);
+ Display.getDisplay(_parent).setCurrent(alert, this);
+ return;
+ }
+ }
+ catch(Exception ex)
+ {
+ Alert alert = new Alert("Ice Error", ex.getMessage(), null, AlertType.ERROR);
+ alert.setTimeout(Alert.FOREVER);
+ Display.getDisplay(_parent).setCurrent(alert, this);
+ return;
+ }
}
private ChatMIDlet _parent;
diff --git a/javae/demo/IceE/midp/hello/ClientMIDlet.java b/javae/demo/IceE/midp/hello/ClientMIDlet.java
index 952c76c59c4..ca51657d0bc 100644
--- a/javae/demo/IceE/midp/hello/ClientMIDlet.java
+++ b/javae/demo/IceE/midp/hello/ClientMIDlet.java
@@ -15,136 +15,136 @@ public class ClientMIDlet
{
class HelloRequest implements Runnable
{
- public void
- run()
- {
- handleHelloCmd();
- }
+ public void
+ run()
+ {
+ handleHelloCmd();
+ }
}
class Shutdown implements Runnable
{
- public void
- run()
- {
- handleExitCmd();
- }
+ public void
+ run()
+ {
+ handleExitCmd();
+ }
}
protected void
startApp()
{
- java.io.InputStream is = getClass().getResourceAsStream("config");
- Ice.InitializationData initData = new Ice.InitializationData();
- initData.properties = Ice.Util.createProperties();
- initData.properties.load(is);
- _communicator = Ice.Util.initialize(new String[0], initData);
-
- if(_display == null)
- {
- _display = javax.microedition.lcdui.Display.getDisplay(this);
- _form = new javax.microedition.lcdui.Form("Ice - Hello World Client");
- _form.append("Select the `Hello' command to send a request to the hello server.\n");
- _form.append(_msg);
- _form.addCommand(CMD_EXIT);
- _form.addCommand(CMD_HELLO);
- _form.setCommandListener(this);
- }
- _display.setCurrent(_form);
+ java.io.InputStream is = getClass().getResourceAsStream("config");
+ Ice.InitializationData initData = new Ice.InitializationData();
+ initData.properties = Ice.Util.createProperties();
+ initData.properties.load(is);
+ _communicator = Ice.Util.initialize(new String[0], initData);
+
+ if(_display == null)
+ {
+ _display = javax.microedition.lcdui.Display.getDisplay(this);
+ _form = new javax.microedition.lcdui.Form("Ice - Hello World Client");
+ _form.append("Select the `Hello' command to send a request to the hello server.\n");
+ _form.append(_msg);
+ _form.addCommand(CMD_EXIT);
+ _form.addCommand(CMD_HELLO);
+ _form.setCommandListener(this);
+ }
+ _display.setCurrent(_form);
}
protected void
pauseApp()
{
- if(_communicator != null)
- {
- try
- {
- _communicator.destroy();
- _communicator = null;
- }
- catch(Exception ex)
- {
- }
- }
+ if(_communicator != null)
+ {
+ try
+ {
+ _communicator.destroy();
+ _communicator = null;
+ }
+ catch(Exception ex)
+ {
+ }
+ }
}
protected void
destroyApp(boolean unconditional)
{
- if(_communicator != null)
- {
- try
- {
- _communicator.destroy();
- _communicator = null;
- }
- catch(Exception ex)
- {
- }
- }
+ if(_communicator != null)
+ {
+ try
+ {
+ _communicator.destroy();
+ _communicator = null;
+ }
+ catch(Exception ex)
+ {
+ }
+ }
}
public void
commandAction(javax.microedition.lcdui.Command cmd, javax.microedition.lcdui.Displayable source)
{
- if(source == _form)
- {
- if(cmd == CMD_EXIT)
- {
- new Thread(new Shutdown()).start();
- }
- else if(cmd == CMD_HELLO)
- {
- new Thread(_helloRequest).start();
- }
- }
+ if(source == _form)
+ {
+ if(cmd == CMD_EXIT)
+ {
+ new Thread(new Shutdown()).start();
+ }
+ else if(cmd == CMD_HELLO)
+ {
+ new Thread(_helloRequest).start();
+ }
+ }
}
public void
handleHelloCmd()
{
- if(_helloPrx == null)
- {
- Ice.Properties properties = _communicator.getProperties();
- String proxy = properties.getProperty("Hello.Proxy");
- if(proxy == null || proxy.length() == 0)
- {
- _msg.setText("(unable to retrieve reference, please check the config file in the demo directory)");
- }
- try
- {
- Ice.ObjectPrx base = _communicator.stringToProxy(proxy);
- _helloPrx = HelloPrxHelper.checkedCast(base);
- }
- catch(Exception ex)
- {
- _msg.setText("'sayHello()' failed");
- return;
- }
- }
- try
- {
- _helloPrx.sayHello(0);
- _msg.setText("'sayHello()' succeeded");
- }
- catch(Exception ex)
- {
- _msg.setText("'sayHello()' failed");
- }
+ if(_helloPrx == null)
+ {
+ Ice.Properties properties = _communicator.getProperties();
+ String proxy = properties.getProperty("Hello.Proxy");
+ if(proxy == null || proxy.length() == 0)
+ {
+ _msg.setText("(unable to retrieve reference, please check the config file in the demo directory)");
+ }
+ try
+ {
+ Ice.ObjectPrx base = _communicator.stringToProxy(proxy);
+ _helloPrx = HelloPrxHelper.checkedCast(base);
+ }
+ catch(Exception ex)
+ {
+ _msg.setText("'sayHello()' failed");
+ return;
+ }
+ }
+ try
+ {
+ _helloPrx.sayHello(0);
+ _msg.setText("'sayHello()' succeeded");
+ }
+ catch(Exception ex)
+ {
+ _msg.setText("'sayHello()' failed");
+ }
}
public void
handleExitCmd()
{
- destroyApp(true);
- notifyDestroyed();
+ destroyApp(true);
+ notifyDestroyed();
}
public javax.microedition.lcdui.Form
getForm()
{
- return _form;
+ return _form;
}
private HelloRequest _helloRequest = new HelloRequest();
diff --git a/javae/demo/IceE/midp/hello/ServerMIDlet.java b/javae/demo/IceE/midp/hello/ServerMIDlet.java
index b3b87875231..5840c0d8b87 100644
--- a/javae/demo/IceE/midp/hello/ServerMIDlet.java
+++ b/javae/demo/IceE/midp/hello/ServerMIDlet.java
@@ -15,129 +15,129 @@ public class ServerMIDlet
{
static class HelloI extends Demo._HelloDisp
{
- public
- HelloI(javax.microedition.lcdui.StringItem msg)
- {
- _msg = msg;
- }
-
- public void
- sayHello(int delay, Ice.Current current)
- {
- _msg.setText("Hello World!");
- }
-
- public void
- shutdown(Ice.Current current)
- {
- _msg.setText("received shutdown request");
- }
-
- javax.microedition.lcdui.StringItem _msg = null;
+ public
+ HelloI(javax.microedition.lcdui.StringItem msg)
+ {
+ _msg = msg;
+ }
+
+ public void
+ sayHello(int delay, Ice.Current current)
+ {
+ _msg.setText("Hello World!");
+ }
+
+ public void
+ shutdown(Ice.Current current)
+ {
+ _msg.setText("received shutdown request");
+ }
+
+ javax.microedition.lcdui.StringItem _msg = null;
}
class StartServer implements Runnable
{
- public void
- run()
- {
- try
- {
- Ice.ObjectAdapter adapter = _communicator.createObjectAdapter("Hello");
- Ice.Object object = new HelloI(_msg);
- adapter.add(object, _communicator.stringToIdentity("hello"));
- adapter.activate();
- _msg.setText("Using address " + System.getProperty("microedition.hostname"));
- }
- catch(Exception ex)
- {
- _msg.setText("Unable to initialize Ice server, please check your configuration and start again.");
- }
- }
+ public void
+ run()
+ {
+ try
+ {
+ Ice.ObjectAdapter adapter = _communicator.createObjectAdapter("Hello");
+ Ice.Object object = new HelloI(_msg);
+ adapter.add(object, _communicator.stringToIdentity("hello"));
+ adapter.activate();
+ _msg.setText("Using address " + System.getProperty("microedition.hostname"));
+ }
+ catch(Exception ex)
+ {
+ _msg.setText("Unable to initialize Ice server, please check your configuration and start again.");
+ }
+ }
}
class StopServer implements Runnable
{
- public void
- run()
- {
- handleExitCmd();
- }
+ public void
+ run()
+ {
+ handleExitCmd();
+ }
}
-
+
protected void
startApp()
{
- java.io.InputStream is = getClass().getResourceAsStream("config");
- Ice.InitializationData initData = new Ice.InitializationData();
- initData.properties = Ice.Util.createProperties();
- initData.properties.load(is);
- _communicator = Ice.Util.initialize(new String[0], initData);
-
- if(_display == null)
- {
- _display = javax.microedition.lcdui.Display.getDisplay(this);
- _form = new javax.microedition.lcdui.Form("Ice - Hello World Server");
- _form.append(_msg);
- _form.addCommand(CMD_EXIT);
- _form.setCommandListener(this);
- }
- _display.setCurrent(_form);
- new Thread(new StartServer()).start();
+ java.io.InputStream is = getClass().getResourceAsStream("config");
+ Ice.InitializationData initData = new Ice.InitializationData();
+ initData.properties = Ice.Util.createProperties();
+ initData.properties.load(is);
+ _communicator = Ice.Util.initialize(new String[0], initData);
+
+ if(_display == null)
+ {
+ _display = javax.microedition.lcdui.Display.getDisplay(this);
+ _form = new javax.microedition.lcdui.Form("Ice - Hello World Server");
+ _form.append(_msg);
+ _form.addCommand(CMD_EXIT);
+ _form.setCommandListener(this);
+ }
+ _display.setCurrent(_form);
+ new Thread(new StartServer()).start();
}
protected void
pauseApp()
{
- if(_communicator != null)
- {
- try
- {
- _communicator.destroy();
- _communicator = null;
- }
- catch(Exception ex)
- {
- }
- }
+ if(_communicator != null)
+ {
+ try
+ {
+ _communicator.destroy();
+ _communicator = null;
+ }
+ catch(Exception ex)
+ {
+ }
+ }
}
protected void
destroyApp(boolean unconditional)
{
- if(_communicator != null)
- {
- try
- {
- _communicator.destroy();
- _communicator = null;
- }
- catch(Exception ex)
- {
- }
- }
+ if(_communicator != null)
+ {
+ try
+ {
+ _communicator.destroy();
+ _communicator = null;
+ }
+ catch(Exception ex)
+ {
+ }
+ }
}
public void
commandAction(javax.microedition.lcdui.Command cmd, javax.microedition.lcdui.Displayable source)
{
- if(source == _form && cmd == CMD_EXIT)
- {
- new Thread(new StopServer()).start();
- }
+ if(source == _form && cmd == CMD_EXIT)
+ {
+ new Thread(new StopServer()).start();
+ }
}
public void
handleExitCmd()
{
- destroyApp(true);
- notifyDestroyed();
+ destroyApp(true);
+ notifyDestroyed();
}
public javax.microedition.lcdui.Form
getForm()
{
- return _form;
+ return _form;
}
private javax.microedition.lcdui.Form _form;
diff --git a/javae/jdk/Ice/LoggerI.java b/javae/jdk/Ice/LoggerI.java
index 3da7106f07e..9b0d40dfe6c 100644
--- a/javae/jdk/Ice/LoggerI.java
+++ b/javae/jdk/Ice/LoggerI.java
@@ -14,10 +14,10 @@ public final class LoggerI implements Logger
public
LoggerI(String prefix)
{
- if(prefix.length() > 0)
- {
- _prefix = prefix + ": ";
- }
+ if(prefix.length() > 0)
+ {
+ _prefix = prefix + ": ";
+ }
_date = java.text.DateFormat.getDateInstance(java.text.DateFormat.SHORT);
_time = new java.text.SimpleDateFormat(" HH:mm:ss:SSS");
@@ -36,9 +36,9 @@ public final class LoggerI implements Logger
s.append(_date.format(new java.util.Date()));
s.append(_time.format(new java.util.Date()));
s.append(' ');
- s.append(_prefix);
- s.append(category);
- s.append(": ");
+ s.append(_prefix);
+ s.append(category);
+ s.append(": ");
s.append(message);
s.append(" ]");
int idx = 0;
@@ -53,27 +53,27 @@ public final class LoggerI implements Logger
public void
warning(String message)
{
- StringBuffer s = new StringBuffer();
+ StringBuffer s = new StringBuffer();
s.append(_date.format(new java.util.Date()));
s.append(_time.format(new java.util.Date()));
s.append(' ');
- s.append(_prefix);
- s.append("warning: ");
- s.append(message);
- System.err.println(s.toString());
+ s.append(_prefix);
+ s.append("warning: ");
+ s.append(message);
+ System.err.println(s.toString());
}
public void
error(String message)
{
- StringBuffer s = new StringBuffer();
+ StringBuffer s = new StringBuffer();
s.append(_date.format(new java.util.Date()));
s.append(_time.format(new java.util.Date()));
s.append(' ');
- s.append(_prefix);
- s.append("error: ");
- s.append(message);
- System.err.print(s.toString() + "\n");
+ s.append(_prefix);
+ s.append("error: ");
+ s.append(message);
+ System.err.print(s.toString() + "\n");
}
String _prefix = "";
diff --git a/javae/jdk/Ice/Properties.java b/javae/jdk/Ice/Properties.java
index 04211856da4..01613225791 100644
--- a/javae/jdk/Ice/Properties.java
+++ b/javae/jdk/Ice/Properties.java
@@ -44,7 +44,7 @@ public final class Properties
public int
getPropertyAsInt(String key)
{
- return getPropertyAsIntWithDefault(key, 0);
+ return getPropertyAsIntWithDefault(key, 0);
}
public synchronized int
@@ -60,20 +60,20 @@ public final class Properties
return value;
}
- try
- {
- return Integer.parseInt(result);
- }
- catch(NumberFormatException ex)
- {
- return value;
- }
+ try
+ {
+ return Integer.parseInt(result);
+ }
+ catch(NumberFormatException ex)
+ {
+ return value;
+ }
}
public synchronized java.util.Hashtable
getPropertiesForPrefix(String prefix)
{
- java.util.Hashtable result = new java.util.Hashtable();
+ java.util.Hashtable result = new java.util.Hashtable();
java.util.Enumeration p = _properties.keys();
while(p.hasMoreElements())
{
@@ -81,10 +81,10 @@ public final class Properties
String value = (String)_properties.get(key);
if(prefix.length() == 0 || key.startsWith(prefix))
{
- result.put(key, value);
+ result.put(key, value);
}
}
- return result;
+ return result;
}
public synchronized String[]
@@ -96,27 +96,27 @@ public final class Properties
while(p.hasMoreElements())
{
java.lang.Object key = p.nextElement();
- java.lang.Object value = _properties.get(key);
+ java.lang.Object value = _properties.get(key);
result[i++] = "--" + key + "=" + value;
}
- if(IceUtil.Debug.ASSERT)
- {
- IceUtil.Debug.Assert(i == result.length);
- }
+ if(IceUtil.Debug.ASSERT)
+ {
+ IceUtil.Debug.Assert(i == result.length);
+ }
return result;
}
public synchronized String[]
parseCommandLineOptions(String pfx, String[] options)
{
- String prefix = pfx;
- if(pfx.length() > 0 && pfx.charAt(pfx.length() - 1) != '.')
- {
- pfx += '.';
- }
- pfx = "--" + pfx;
-
- java.util.Vector result = new java.util.Vector();
+ String prefix = pfx;
+ if(pfx.length() > 0 && pfx.charAt(pfx.length() - 1) != '.')
+ {
+ pfx += '.';
+ }
+ pfx = "--" + pfx;
+
+ java.util.Vector result = new java.util.Vector();
for(int i = 0; i < options.length; i++)
{
String opt = options[i];
@@ -153,13 +153,13 @@ public final class Properties
Properties(Properties p)
{
- java.util.Enumeration e = p._properties.keys();
- while(e.hasMoreElements())
- {
- java.lang.Object key = e.nextElement();
- java.lang.Object value = p._properties.get(key);
- _properties.put(key, value);
- }
+ java.util.Enumeration e = p._properties.keys();
+ while(e.hasMoreElements())
+ {
+ java.lang.Object key = e.nextElement();
+ java.lang.Object value = p._properties.get(key);
+ _properties.put(key, value);
+ }
}
Properties()
@@ -168,19 +168,19 @@ public final class Properties
Properties(StringSeqHolder args, Properties defaults)
{
- if(defaults != null)
- {
- java.util.Hashtable m = defaults.getPropertiesForPrefix("");
- java.util.Enumeration e = m.keys();
- while(e.hasMoreElements())
- {
- java.lang.Object key = e.nextElement();
- java.lang.Object value = m.get(key);
- _properties.put(key, value);
- }
- }
-
- boolean loadConfigFiles = false;
+ if(defaults != null)
+ {
+ java.util.Hashtable m = defaults.getPropertiesForPrefix("");
+ java.util.Enumeration e = m.keys();
+ while(e.hasMoreElements())
+ {
+ java.lang.Object key = e.nextElement();
+ java.lang.Object value = m.get(key);
+ _properties.put(key, value);
+ }
+ }
+
+ boolean loadConfigFiles = false;
for(int i = 0; i < args.value.length; i++)
{
@@ -192,7 +192,7 @@ public final class Properties
line += "=1";
}
parseLine(line.substring(2));
- loadConfigFiles = true;
+ loadConfigFiles = true;
String[] arr = new String[args.value.length - 1];
System.arraycopy(args.value, 0, arr, 0, i);
if(i < args.value.length - 1)
@@ -203,38 +203,38 @@ public final class Properties
}
}
- if(loadConfigFiles)
- {
- loadConfig();
- }
+ if(loadConfigFiles)
+ {
+ loadConfig();
+ }
- args.value = parseIceCommandLineOptions(args.value);
+ args.value = parseIceCommandLineOptions(args.value);
}
public synchronized void
setProperty(String key, String value)
{
- //
- // Check if the property is legal. (We write to System.err instead of using
- // a logger because no logger may be established at the time the property
- // is parsed.)
- //
- if(key == null || key.length() == 0)
- {
- return;
- }
-
- //
- // Set or clear the property.
- //
- if(value != null && value.length() > 0)
- {
- _properties.put(key, value);
- }
- else
- {
- _properties.remove(key);
- }
+ //
+ // Check if the property is legal. (We write to System.err instead of using
+ // a logger because no logger may be established at the time the property
+ // is parsed.)
+ //
+ if(key == null || key.length() == 0)
+ {
+ return;
+ }
+
+ //
+ // Set or clear the property.
+ //
+ if(value != null && value.length() > 0)
+ {
+ _properties.put(key, value);
+ }
+ else
+ {
+ _properties.remove(key);
+ }
}
private void
@@ -300,7 +300,7 @@ public final class Properties
String[] files = IceUtil.StringUtil.split(value, ",");
for(int i = 0; i < files.length; i++)
{
- load(files[i]);
+ load(files[i]);
}
}
@@ -314,16 +314,16 @@ public final class Properties
{
java.io.FileReader fr = new java.io.FileReader(file);
java.io.BufferedReader br = new java.io.BufferedReader(fr);
- String line;
- while((line = br.readLine()) != null)
- {
- parseLine(line);
- }
+ String line;
+ while((line = br.readLine()) != null)
+ {
+ parseLine(line);
+ }
}
catch(java.io.IOException ex)
{
FileException se = new FileException();
- se.path = file;
+ se.path = file;
se.initCause(ex); // Exception chaining
throw se;
}
@@ -332,19 +332,19 @@ public final class Properties
public synchronized void
load(java.io.InputStream is)
{
- try
- {
- java.io.BufferedReader reader = new java.io.BufferedReader(new java.io.InputStreamReader(is));
- String line;
- while((line = reader.readLine()) != null)
- {
- parseLine(line);
- }
+ try
+ {
+ java.io.BufferedReader reader = new java.io.BufferedReader(new java.io.InputStreamReader(is));
+ String line;
+ while((line = reader.readLine()) != null)
+ {
+ parseLine(line);
+ }
}
catch(java.io.IOException ex)
{
FileException se = new FileException();
- se.path = is.toString();
+ se.path = is.toString();
se.initCause(ex); // Exception chaining
throw se;
}
@@ -353,7 +353,7 @@ public final class Properties
public java.lang.Object
ice_clone()
{
- return new Properties(this);
+ return new Properties(this);
}
private java.util.Hashtable _properties = new java.util.Hashtable();
diff --git a/javae/jdk/IceInternal/Acceptor.java b/javae/jdk/IceInternal/Acceptor.java
index 762464004d1..9e56e54312b 100644
--- a/javae/jdk/IceInternal/Acceptor.java
+++ b/javae/jdk/IceInternal/Acceptor.java
@@ -21,11 +21,11 @@ class Acceptor
}
java.net.ServerSocket fd;
- synchronized(this)
+ synchronized(this)
{
- fd = _fd;
+ fd = _fd;
_fd = null;
- }
+ }
if(fd != null)
{
try
@@ -54,57 +54,57 @@ class Acceptor
public Transceiver
accept(int timeout)
{
- java.net.Socket fd = null;
- try
- {
- if(timeout == -1)
- {
- timeout = 0; // Infinite
- }
- else if(timeout == 0)
- {
- timeout = 1;
- }
- _fd.setSoTimeout(timeout);
- fd = _fd.accept();
+ java.net.Socket fd = null;
+ try
+ {
+ if(timeout == -1)
+ {
+ timeout = 0; // Infinite
+ }
+ else if(timeout == 0)
+ {
+ timeout = 1;
+ }
+ _fd.setSoTimeout(timeout);
+ fd = _fd.accept();
Network.setTcpBufSize(fd, _instance.initializationData().properties, _logger);
- }
- catch(java.io.InterruptedIOException ex)
- {
- Ice.TimeoutException e = new Ice.TimeoutException();
- e.initCause(ex);
- throw e;
- }
- catch(java.io.IOException ex)
- {
- Ice.SocketException e = new Ice.SocketException();
- e.initCause(ex);
- throw e;
- }
-
- if(_traceLevels.network >= 1)
- {
- String s = "accepted tcp connection\n" + Network.fdToString(fd);
- _logger.trace(_traceLevels.networkCat, s);
- }
-
- return new Transceiver(_instance, fd);
+ }
+ catch(java.io.InterruptedIOException ex)
+ {
+ Ice.TimeoutException e = new Ice.TimeoutException();
+ e.initCause(ex);
+ throw e;
+ }
+ catch(java.io.IOException ex)
+ {
+ Ice.SocketException e = new Ice.SocketException();
+ e.initCause(ex);
+ throw e;
+ }
+
+ if(_traceLevels.network >= 1)
+ {
+ String s = "accepted tcp connection\n" + Network.fdToString(fd);
+ _logger.trace(_traceLevels.networkCat, s);
+ }
+
+ return new Transceiver(_instance, fd);
}
public void
connectToSelf()
{
- try
- {
- java.net.Socket fd = new java.net.Socket(_addr.getAddress(), _addr.getPort());
- fd.close();
- }
- catch(java.io.IOException ex)
- {
- Ice.SocketException e = new Ice.SocketException();
- e.initCause(ex);
- throw e;
- }
+ try
+ {
+ java.net.Socket fd = new java.net.Socket(_addr.getAddress(), _addr.getPort());
+ fd.close();
+ }
+ catch(java.io.IOException ex)
+ {
+ Ice.SocketException e = new Ice.SocketException();
+ e.initCause(ex);
+ throw e;
+ }
}
public String
@@ -133,14 +133,14 @@ class Acceptor
try
{
- _addr = Network.getAddress(host, port);
- if(_traceLevels.network >= 2)
- {
- String s = "attempting to bind to tcp socket " + toString();
- _logger.trace(_traceLevels.networkCat, s);
- }
- _fd = new java.net.ServerSocket(port, _backlog, _addr.getAddress());
- _addr = new InetSocketAddress(_addr.getAddress(), _fd.getLocalPort());
+ _addr = Network.getAddress(host, port);
+ if(_traceLevels.network >= 2)
+ {
+ String s = "attempting to bind to tcp socket " + toString();
+ _logger.trace(_traceLevels.networkCat, s);
+ }
+ _fd = new java.net.ServerSocket(port, _backlog, _addr.getAddress());
+ _addr = new InetSocketAddress(_addr.getAddress(), _fd.getLocalPort());
if(!System.getProperty("os.name").startsWith("Windows"))
{
_fd.setReuseAddress(true);
@@ -149,34 +149,34 @@ class Acceptor
}
catch(java.io.IOException ex)
{
- if(_fd != null)
- {
- try
- {
- _fd.close();
- }
- catch(java.io.IOException e)
- {
- }
- _fd = null;
- }
- Ice.SocketException e = new Ice.SocketException();
- e.initCause(ex);
- throw e;
+ if(_fd != null)
+ {
+ try
+ {
+ _fd.close();
+ }
+ catch(java.io.IOException e)
+ {
+ }
+ _fd = null;
+ }
+ Ice.SocketException e = new Ice.SocketException();
+ e.initCause(ex);
+ throw e;
}
catch(RuntimeException ex)
{
- if(_fd != null)
- {
- try
- {
- _fd.close();
- }
- catch(java.io.IOException e)
- {
- }
- _fd = null;
- }
+ if(_fd != null)
+ {
+ try
+ {
+ _fd.close();
+ }
+ catch(java.io.IOException e)
+ {
+ }
+ _fd = null;
+ }
throw ex;
}
}
diff --git a/javae/jdk/IceInternal/Connector.java b/javae/jdk/IceInternal/Connector.java
index 474a1fda81f..1913902421e 100644
--- a/javae/jdk/IceInternal/Connector.java
+++ b/javae/jdk/IceInternal/Connector.java
@@ -13,164 +13,164 @@ final class Connector
{
private static class ConnectThread extends Thread
{
- ConnectThread(InetSocketAddress addr)
- {
- _addr = addr;
- }
-
- public void
- run()
- {
- try
- {
- java.net.Socket fd = new java.net.Socket(_addr.getAddress(), _addr.getPort());
- synchronized(this)
- {
- _fd = fd;
- notifyAll();
- }
- }
- catch(java.io.IOException ex)
- {
- synchronized(this)
- {
- _ex = ex;
- notifyAll();
- }
- }
- }
-
- java.net.Socket
- getFd(int timeout)
- throws java.io.IOException
- {
- java.net.Socket fd = null;
-
- synchronized(this)
- {
- while(_fd == null && _ex == null)
- {
- try
- {
- wait(timeout);
- break;
- }
- catch(InterruptedException ex)
- {
- continue;
- }
- }
-
- if(_ex != null)
- {
- throw _ex;
- }
-
- fd = _fd;
- _fd = null;
- }
-
- return fd;
- }
-
- private InetSocketAddress _addr;
- private java.net.Socket _fd;
- private java.io.IOException _ex;
+ ConnectThread(InetSocketAddress addr)
+ {
+ _addr = addr;
+ }
+
+ public void
+ run()
+ {
+ try
+ {
+ java.net.Socket fd = new java.net.Socket(_addr.getAddress(), _addr.getPort());
+ synchronized(this)
+ {
+ _fd = fd;
+ notifyAll();
+ }
+ }
+ catch(java.io.IOException ex)
+ {
+ synchronized(this)
+ {
+ _ex = ex;
+ notifyAll();
+ }
+ }
+ }
+
+ java.net.Socket
+ getFd(int timeout)
+ throws java.io.IOException
+ {
+ java.net.Socket fd = null;
+
+ synchronized(this)
+ {
+ while(_fd == null && _ex == null)
+ {
+ try
+ {
+ wait(timeout);
+ break;
+ }
+ catch(InterruptedException ex)
+ {
+ continue;
+ }
+ }
+
+ if(_ex != null)
+ {
+ throw _ex;
+ }
+
+ fd = _fd;
+ _fd = null;
+ }
+
+ return fd;
+ }
+
+ private InetSocketAddress _addr;
+ private java.net.Socket _fd;
+ private java.io.IOException _ex;
}
public Transceiver
connect(int timeout)
{
- if(_traceLevels.network >= 2)
- {
- String s = "trying to establish tcp connection to " + toString();
- _logger.trace(_traceLevels.networkCat, s);
- }
-
- java.net.Socket fd = null;
- try
- {
- //
- // If a connect timeout is specified, do the connect in a separate thread.
- //
- if(timeout >= 0)
- {
- ConnectThread ct = new ConnectThread(_addr);
- ct.start();
- fd = ct.getFd(timeout == 0 ? 1 : timeout);
- if(fd == null)
- {
- throw new Ice.ConnectTimeoutException();
- }
- }
- else
- {
- fd = new java.net.Socket(_addr.getAddress(), _addr.getPort());
- }
+ if(_traceLevels.network >= 2)
+ {
+ String s = "trying to establish tcp connection to " + toString();
+ _logger.trace(_traceLevels.networkCat, s);
+ }
+
+ java.net.Socket fd = null;
+ try
+ {
+ //
+ // If a connect timeout is specified, do the connect in a separate thread.
+ //
+ if(timeout >= 0)
+ {
+ ConnectThread ct = new ConnectThread(_addr);
+ ct.start();
+ fd = ct.getFd(timeout == 0 ? 1 : timeout);
+ if(fd == null)
+ {
+ throw new Ice.ConnectTimeoutException();
+ }
+ }
+ else
+ {
+ fd = new java.net.Socket(_addr.getAddress(), _addr.getPort());
+ }
Network.setTcpBufSize(fd, _instance.initializationData().properties, _logger);
- }
+ }
catch(java.net.ConnectException ex)
{
- if(fd != null)
- {
- try
- {
- fd.close();
- }
- catch(java.io.IOException e)
- {
- }
- }
+ if(fd != null)
+ {
+ try
+ {
+ fd.close();
+ }
+ catch(java.io.IOException e)
+ {
+ }
+ }
Ice.ConnectFailedException se;
- if(Network.connectionRefused(ex))
- {
- se = new Ice.ConnectionRefusedException();
- }
- else
- {
- se = new Ice.ConnectFailedException();
- }
+ if(Network.connectionRefused(ex))
+ {
+ se = new Ice.ConnectionRefusedException();
+ }
+ else
+ {
+ se = new Ice.ConnectFailedException();
+ }
se.initCause(ex);
throw se;
}
- catch(java.io.IOException ex)
- {
- if(fd != null)
- {
- try
- {
- fd.close();
- }
- catch(java.io.IOException e)
- {
- }
- }
- Ice.SocketException e = new Ice.SocketException();
- e.initCause(ex);
- throw e;
- }
- catch(RuntimeException ex)
- {
- if(fd != null)
- {
- try
- {
- fd.close();
- }
- catch(java.io.IOException e)
- {
- }
- }
- throw ex;
- }
-
- if(_traceLevels.network >= 1)
- {
- String s = "tcp connection established\n" + IceInternal.Network.fdToString(fd);
- _logger.trace(_traceLevels.networkCat, s);
- }
-
- return new Transceiver(_instance, fd);
+ catch(java.io.IOException ex)
+ {
+ if(fd != null)
+ {
+ try
+ {
+ fd.close();
+ }
+ catch(java.io.IOException e)
+ {
+ }
+ }
+ Ice.SocketException e = new Ice.SocketException();
+ e.initCause(ex);
+ throw e;
+ }
+ catch(RuntimeException ex)
+ {
+ if(fd != null)
+ {
+ try
+ {
+ fd.close();
+ }
+ catch(java.io.IOException e)
+ {
+ }
+ }
+ throw ex;
+ }
+
+ if(_traceLevels.network >= 1)
+ {
+ String s = "tcp connection established\n" + IceInternal.Network.fdToString(fd);
+ _logger.trace(_traceLevels.networkCat, s);
+ }
+
+ return new Transceiver(_instance, fd);
}
public String
diff --git a/javae/jdk/IceInternal/InetSocketAddress.java b/javae/jdk/IceInternal/InetSocketAddress.java
index 55b51e5a646..5721e86c714 100644
--- a/javae/jdk/IceInternal/InetSocketAddress.java
+++ b/javae/jdk/IceInternal/InetSocketAddress.java
@@ -13,67 +13,67 @@ class InetSocketAddress
{
InetSocketAddress(String host, int port)
{
- try
- {
- _addr = java.net.InetAddress.getByName(host);
- }
- catch(java.net.UnknownHostException ex)
- {
- Ice.DNSException e = new Ice.DNSException();
- e.host = host;
- e.initCause(ex);
- throw e;
- }
- catch(RuntimeException ex)
- {
- Ice.SocketException se = new Ice.SocketException();
- se.initCause(ex);
- throw se;
- }
- _port = port;
+ try
+ {
+ _addr = java.net.InetAddress.getByName(host);
+ }
+ catch(java.net.UnknownHostException ex)
+ {
+ Ice.DNSException e = new Ice.DNSException();
+ e.host = host;
+ e.initCause(ex);
+ throw e;
+ }
+ catch(RuntimeException ex)
+ {
+ Ice.SocketException se = new Ice.SocketException();
+ se.initCause(ex);
+ throw se;
+ }
+ _port = port;
}
InetSocketAddress(java.net.InetAddress addr, int port)
{
- _addr = addr;
- _port = port;
+ _addr = addr;
+ _port = port;
}
java.net.InetAddress
getAddress()
{
- return _addr;
+ return _addr;
}
String
getHostName()
{
- return _addr.getHostName();
+ return _addr.getHostName();
}
int
getPort()
{
- return _port;
+ return _port;
}
public int
hashCode()
{
- return 5 * _addr.hashCode() + _port;
+ return 5 * _addr.hashCode() + _port;
}
public String
toString()
{
- return _addr.toString() + ":" + _port;
+ return _addr.toString() + ":" + _port;
}
public boolean
equals(Object rhs)
{
- InetSocketAddress addr = (InetSocketAddress)rhs;
- return _addr.equals(addr._addr) && _port == addr._port;
+ InetSocketAddress addr = (InetSocketAddress)rhs;
+ return _addr.equals(addr._addr) && _port == addr._port;
}
private java.net.InetAddress _addr;
diff --git a/javae/jdk/IceInternal/Network.java b/javae/jdk/IceInternal/Network.java
index d96469fecb1..070248b1e48 100644
--- a/javae/jdk/IceInternal/Network.java
+++ b/javae/jdk/IceInternal/Network.java
@@ -52,31 +52,31 @@ public final class Network
}
catch(java.net.UnknownHostException ex)
{
- Ice.DNSException e = new Ice.DNSException();
- e.host = host;
- throw e;
+ Ice.DNSException e = new Ice.DNSException();
+ e.host = host;
+ throw e;
}
}
public static String
getLocalHost(boolean numeric)
{
- byte[] addr = getLocalAddress();
- StringBuffer buf = new StringBuffer();
- for(int i = 0; i < addr.length; ++i)
- {
- if(i != 0)
- {
- buf.append('.');
- }
- int b = addr[i];
- if(b < 0)
- {
- b += 256;
- }
- buf.append(Integer.toString(b));
- }
- return buf.toString();
+ byte[] addr = getLocalAddress();
+ StringBuffer buf = new StringBuffer();
+ for(int i = 0; i < addr.length; ++i)
+ {
+ if(i != 0)
+ {
+ buf.append('.');
+ }
+ int b = addr[i];
+ if(b < 0)
+ {
+ b += 256;
+ }
+ buf.append(Integer.toString(b));
+ }
+ return buf.toString();
}
public static byte[]
@@ -101,25 +101,25 @@ public final class Network
//
}
- if(addr == null)
- {
- try
- {
- addr = java.net.InetAddress.getByName("127.0.0.1");
- }
- catch(java.net.UnknownHostException ex)
- {
- Ice.DNSException e = new Ice.DNSException();
- e.host = "127.0.0.1";
- throw e;
- }
- }
+ if(addr == null)
+ {
+ try
+ {
+ addr = java.net.InetAddress.getByName("127.0.0.1");
+ }
+ catch(java.net.UnknownHostException ex)
+ {
+ Ice.DNSException e = new Ice.DNSException();
+ e.host = "127.0.0.1";
+ throw e;
+ }
+ }
- if(IceUtil.Debug.ASSERT)
- {
- IceUtil.Debug.Assert(addr != null);
- }
- return addr.getAddress();
+ if(IceUtil.Debug.ASSERT)
+ {
+ IceUtil.Debug.Assert(addr != null);
+ }
+ return addr.getAddress();
}
public static void
@@ -234,40 +234,40 @@ public final class Network
public static String
fdToString(java.net.Socket fd)
{
- if(fd == null)
- {
- return "<closed>";
- }
+ if(fd == null)
+ {
+ return "<closed>";
+ }
- java.net.InetAddress localAddr = fd.getLocalAddress();
- int localPort = fd.getLocalPort();
- java.net.InetAddress remoteAddr = fd.getInetAddress();
- int remotePort = fd.getPort();
+ java.net.InetAddress localAddr = fd.getLocalAddress();
+ int localPort = fd.getLocalPort();
+ java.net.InetAddress remoteAddr = fd.getInetAddress();
+ int remotePort = fd.getPort();
- return addressesToString(localAddr, localPort, remoteAddr, remotePort);
+ return addressesToString(localAddr, localPort, remoteAddr, remotePort);
}
public static String
addressesToString(java.net.InetAddress localAddr, int localPort, java.net.InetAddress remoteAddr, int remotePort)
{
- StringBuffer s = new StringBuffer();
- s.append("local address = ");
- s.append(localAddr.getHostAddress());
- s.append(':');
- s.append(localPort);
- if(remoteAddr == null)
- {
- s.append("\nremote address = <not connected>");
- }
- else
- {
- s.append("\nremote address = ");
- s.append(remoteAddr.getHostAddress());
- s.append(':');
- s.append(remotePort);
- }
+ StringBuffer s = new StringBuffer();
+ s.append("local address = ");
+ s.append(localAddr.getHostAddress());
+ s.append(':');
+ s.append(localPort);
+ if(remoteAddr == null)
+ {
+ s.append("\nremote address = <not connected>");
+ }
+ else
+ {
+ s.append("\nremote address = ");
+ s.append(remoteAddr.getHostAddress());
+ s.append(':');
+ s.append(remotePort);
+ }
- return s.toString();
+ return s.toString();
}
public static String
diff --git a/javae/jdk/IceInternal/TcpEndpoint.java b/javae/jdk/IceInternal/TcpEndpoint.java
index a0d1385c61d..a4e0c3ada85 100644
--- a/javae/jdk/IceInternal/TcpEndpoint.java
+++ b/javae/jdk/IceInternal/TcpEndpoint.java
@@ -46,8 +46,8 @@ final class TcpEndpoint implements Endpoint
if(option.length() != 2 || option.charAt(0) != '-')
{
Ice.EndpointParseException e = new Ice.EndpointParseException();
- e.str = "tcp " + str;
- throw e;
+ e.str = "tcp " + str;
+ throw e;
}
String argument = null;
@@ -63,8 +63,8 @@ final class TcpEndpoint implements Endpoint
if(argument == null)
{
Ice.EndpointParseException e = new Ice.EndpointParseException();
- e.str = "tcp " + str;
- throw e;
+ e.str = "tcp " + str;
+ throw e;
}
_host = argument;
@@ -76,8 +76,8 @@ final class TcpEndpoint implements Endpoint
if(argument == null)
{
Ice.EndpointParseException e = new Ice.EndpointParseException();
- e.str = "tcp " + str;
- throw e;
+ e.str = "tcp " + str;
+ throw e;
}
try
@@ -87,15 +87,15 @@ final class TcpEndpoint implements Endpoint
catch(NumberFormatException ex)
{
Ice.EndpointParseException e = new Ice.EndpointParseException();
- e.str = "tcp " + str;
- throw e;
+ e.str = "tcp " + str;
+ throw e;
}
- if(_port < 0 || _port > 65535)
+ if(_port < 0 || _port > 65535)
{
Ice.EndpointParseException e = new Ice.EndpointParseException();
- e.str = "tcp " + str;
- throw e;
+ e.str = "tcp " + str;
+ throw e;
}
break;
@@ -106,8 +106,8 @@ final class TcpEndpoint implements Endpoint
if(argument == null)
{
Ice.EndpointParseException e = new Ice.EndpointParseException();
- e.str = "tcp " + str;
- throw e;
+ e.str = "tcp " + str;
+ throw e;
}
try
@@ -117,24 +117,24 @@ final class TcpEndpoint implements Endpoint
catch(NumberFormatException ex)
{
Ice.EndpointParseException e = new Ice.EndpointParseException();
- e.str = "tcp " + str;
- throw e;
+ e.str = "tcp " + str;
+ throw e;
}
break;
}
- case 'z':
- {
- // Ignore compression flag.
- break;
- }
+ case 'z':
+ {
+ // Ignore compression flag.
+ break;
+ }
default:
{
Ice.EndpointParseException e = new Ice.EndpointParseException();
- e.str = "tcp " + str;
- throw e;
+ e.str = "tcp " + str;
+ throw e;
}
}
}
@@ -155,7 +155,7 @@ final class TcpEndpoint implements Endpoint
_host = s.readString();
_port = s.readInt();
_timeout = s.readInt();
- boolean compress = s.readBool();
+ boolean compress = s.readBool();
s.endReadEncaps();
calcHashValue();
}
@@ -171,7 +171,7 @@ final class TcpEndpoint implements Endpoint
s.writeString(_host);
s.writeInt(_port);
s.writeInt(_timeout);
- s.writeBool(false);
+ s.writeBool(false);
s.endWriteEncaps();
}
@@ -360,51 +360,51 @@ final class TcpEndpoint implements Endpoint
// We do the most time-consuming part of the comparison last.
//
InetSocketAddress laddr = null;
- try
- {
- laddr = Network.getAddress(_host, _port);
- }
- catch(Ice.DNSException ex)
- {
- }
+ try
+ {
+ laddr = Network.getAddress(_host, _port);
+ }
+ catch(Ice.DNSException ex)
+ {
+ }
InetSocketAddress raddr = null;
- try
- {
- raddr = Network.getAddress(p._host, p._port);
- }
- catch(Ice.DNSException ex)
- {
- }
-
- if(laddr == null && raddr != null)
- {
- return -1;
- }
- else if(raddr == null && laddr != null)
- {
- return 1;
- }
- else if(laddr != null && raddr != null)
- {
- byte[] larr = laddr.getAddress().getAddress();
- byte[] rarr = raddr.getAddress().getAddress();
- if(IceUtil.Debug.ASSERT)
- {
- IceUtil.Debug.Assert(larr.length == rarr.length);
- }
- for(int i = 0; i < larr.length; i++)
- {
- if(larr[i] < rarr[i])
- {
- return -1;
- }
- else if(rarr[i] < larr[i])
- {
- return 1;
- }
- }
- }
+ try
+ {
+ raddr = Network.getAddress(p._host, p._port);
+ }
+ catch(Ice.DNSException ex)
+ {
+ }
+
+ if(laddr == null && raddr != null)
+ {
+ return -1;
+ }
+ else if(raddr == null && laddr != null)
+ {
+ return 1;
+ }
+ else if(laddr != null && raddr != null)
+ {
+ byte[] larr = laddr.getAddress().getAddress();
+ byte[] rarr = raddr.getAddress().getAddress();
+ if(IceUtil.Debug.ASSERT)
+ {
+ IceUtil.Debug.Assert(larr.length == rarr.length);
+ }
+ for(int i = 0; i < larr.length; i++)
+ {
+ if(larr[i] < rarr[i])
+ {
+ return -1;
+ }
+ else if(rarr[i] < larr[i])
+ {
+ return 1;
+ }
+ }
+ }
}
return 0;
@@ -414,14 +414,14 @@ final class TcpEndpoint implements Endpoint
calcHashValue()
{
try
- {
- java.net.InetAddress addr = java.net.InetAddress.getByName(_host);
- _hashCode = addr.getHostAddress().hashCode();
- }
- catch(java.net.UnknownHostException ex)
- {
+ {
+ java.net.InetAddress addr = java.net.InetAddress.getByName(_host);
+ _hashCode = addr.getHostAddress().hashCode();
+ }
+ catch(java.net.UnknownHostException ex)
+ {
_hashCode = _host.hashCode();
- }
+ }
_hashCode = 5 * _hashCode + _port;
_hashCode = 5 * _hashCode + _timeout;
}
diff --git a/javae/jdk/IceInternal/Transceiver.java b/javae/jdk/IceInternal/Transceiver.java
index 4bed55b1a68..ca7c8d17985 100644
--- a/javae/jdk/IceInternal/Transceiver.java
+++ b/javae/jdk/IceInternal/Transceiver.java
@@ -20,52 +20,52 @@ final public class Transceiver
_logger.trace(_traceLevels.networkCat, s);
}
- synchronized(this)
- {
- if(IceUtil.Debug.ASSERT)
- {
- IceUtil.Debug.Assert(_fd != null);
- }
- try
- {
- _fd.close();
- }
- catch(java.io.IOException ex)
- {
- Ice.SocketException se = new Ice.SocketException();
- se.initCause(ex);
- throw se;
- }
- finally
- {
- _fd = null;
- }
- }
+ synchronized(this)
+ {
+ if(IceUtil.Debug.ASSERT)
+ {
+ IceUtil.Debug.Assert(_fd != null);
+ }
+ try
+ {
+ _fd.close();
+ }
+ catch(java.io.IOException ex)
+ {
+ Ice.SocketException se = new Ice.SocketException();
+ se.initCause(ex);
+ throw se;
+ }
+ finally
+ {
+ _fd = null;
+ }
+ }
}
public void
shutdownWrite()
{
- //
- // Not implemented.
- //
+ //
+ // Not implemented.
+ //
}
public void
shutdownReadWrite()
{
- if(_traceLevels.network >= 2)
- {
- String s = "shutting down tcp connection for reading and writing\n" + toString();
- _logger.trace(_traceLevels.networkCat, s);
- }
+ if(_traceLevels.network >= 2)
+ {
+ String s = "shutting down tcp connection for reading and writing\n" + toString();
+ _logger.trace(_traceLevels.networkCat, s);
+ }
- if(IceUtil.Debug.ASSERT)
- {
- IceUtil.Debug.Assert(_fd != null);
- }
+ if(IceUtil.Debug.ASSERT)
+ {
+ IceUtil.Debug.Assert(_fd != null);
+ }
- _shutdown = true;
+ _shutdown = true;
}
public void
@@ -73,26 +73,26 @@ final public class Transceiver
{
ByteBuffer buf = stream.prepareWrite();
- byte[] data = buf.array();
+ byte[] data = buf.array();
- try
- {
- if(timeout == -1)
- {
- timeout = 0; // Infinite
- }
- else if(timeout == 0)
- {
- timeout = 1;
- }
- _fd.setSoTimeout(timeout);
- }
- catch(java.net.SocketException ex)
- {
- Ice.SocketException se = new Ice.SocketException();
- se.initCause(ex);
- throw se;
- }
+ try
+ {
+ if(timeout == -1)
+ {
+ timeout = 0; // Infinite
+ }
+ else if(timeout == 0)
+ {
+ timeout = 1;
+ }
+ _fd.setSoTimeout(timeout);
+ }
+ catch(java.net.SocketException ex)
+ {
+ Ice.SocketException se = new Ice.SocketException();
+ se.initCause(ex);
+ throw se;
+ }
int remaining = buf.remaining();
int packetSize = remaining;
@@ -102,34 +102,34 @@ final public class Transceiver
}
int pos = buf.position();
- while(buf.hasRemaining() && !_shutdown)
- {
- try
- {
- if(IceUtil.Debug.ASSERT)
- {
- IceUtil.Debug.Assert(_fd != null);
- }
+ while(buf.hasRemaining() && !_shutdown)
+ {
+ try
+ {
+ if(IceUtil.Debug.ASSERT)
+ {
+ IceUtil.Debug.Assert(_fd != null);
+ }
- _out.write(data, pos, packetSize);
+ _out.write(data, pos, packetSize);
pos += packetSize;
- if(_traceLevels.network >= 3)
- {
- String s = "sent " + packetSize + " of " + buf.limit() + " bytes via tcp\n" + toString();
- _logger.trace(_traceLevels.networkCat, s);
- }
- }
- catch(java.io.InterruptedIOException ex)
- {
+ if(_traceLevels.network >= 3)
+ {
+ String s = "sent " + packetSize + " of " + buf.limit() + " bytes via tcp\n" + toString();
+ _logger.trace(_traceLevels.networkCat, s);
+ }
+ }
+ catch(java.io.InterruptedIOException ex)
+ {
pos += ex.bytesTransferred;
- }
- catch(java.io.IOException ex)
- {
- Ice.SocketException se = new Ice.SocketException();
- se.initCause(ex);
- throw se;
- }
+ }
+ catch(java.io.IOException ex)
+ {
+ Ice.SocketException se = new Ice.SocketException();
+ se.initCause(ex);
+ throw se;
+ }
buf.position(pos);
if(buf.remaining() < packetSize)
@@ -138,86 +138,86 @@ final public class Transceiver
}
}
- if(_shutdown && buf.hasRemaining())
- {
- throw new Ice.ConnectionLostException();
- }
+ if(_shutdown && buf.hasRemaining())
+ {
+ throw new Ice.ConnectionLostException();
+ }
}
public void
read(BasicStream stream, int timeout)
{
- ByteBuffer buf = stream.prepareRead();
+ ByteBuffer buf = stream.prepareRead();
- int remaining = 0;
- if(_traceLevels.network >= 3)
- {
- remaining = buf.remaining();
- }
+ int remaining = 0;
+ if(_traceLevels.network >= 3)
+ {
+ remaining = buf.remaining();
+ }
- byte[] data = buf.array();
+ byte[] data = buf.array();
- int interval = 500;
- if(timeout >= 0 && timeout < interval)
- {
- interval = timeout;
- }
+ int interval = 500;
+ if(timeout >= 0 && timeout < interval)
+ {
+ interval = timeout;
+ }
- while(buf.hasRemaining() && !_shutdown)
- {
- int pos = buf.position();
- try
- {
- _fd.setSoTimeout(interval);
- if(IceUtil.Debug.ASSERT)
- {
- IceUtil.Debug.Assert(_fd != null);
- }
- int ret = _in.read(data, pos, buf.remaining());
-
- if(ret == -1)
- {
- throw new Ice.ConnectionLostException();
- }
+ while(buf.hasRemaining() && !_shutdown)
+ {
+ int pos = buf.position();
+ try
+ {
+ _fd.setSoTimeout(interval);
+ if(IceUtil.Debug.ASSERT)
+ {
+ IceUtil.Debug.Assert(_fd != null);
+ }
+ int ret = _in.read(data, pos, buf.remaining());
+
+ if(ret == -1)
+ {
+ throw new Ice.ConnectionLostException();
+ }
- if(ret > 0)
- {
- if(_traceLevels.network >= 3)
- {
- String s = "received " + ret + " of " + remaining + " bytes via tcp\n" + toString();
- _logger.trace(_traceLevels.networkCat, s);
- }
+ if(ret > 0)
+ {
+ if(_traceLevels.network >= 3)
+ {
+ String s = "received " + ret + " of " + remaining + " bytes via tcp\n" + toString();
+ _logger.trace(_traceLevels.networkCat, s);
+ }
- buf.position(pos + ret);
- }
- }
- catch(java.io.InterruptedIOException ex)
- {
- if(ex.bytesTransferred > 0)
- {
- buf.position(pos + ex.bytesTransferred);
- }
- if(timeout >= 0)
- {
- if(interval >= timeout)
- {
- throw new Ice.TimeoutException();
- }
- timeout -= interval;
- }
- }
- catch(java.io.IOException ex)
- {
+ buf.position(pos + ret);
+ }
+ }
+ catch(java.io.InterruptedIOException ex)
+ {
+ if(ex.bytesTransferred > 0)
+ {
+ buf.position(pos + ex.bytesTransferred);
+ }
+ if(timeout >= 0)
+ {
+ if(interval >= timeout)
+ {
+ throw new Ice.TimeoutException();
+ }
+ timeout -= interval;
+ }
+ }
+ catch(java.io.IOException ex)
+ {
Ice.ConnectionLostException se = new Ice.ConnectionLostException();
se.initCause(ex);
throw se;
- }
- }
+ }
+ }
- if(_shutdown)
- {
- throw new Ice.ConnectionLostException();
- }
+ if(_shutdown)
+ {
+ throw new Ice.ConnectionLostException();
+ }
}
public String
@@ -265,26 +265,26 @@ final public class Transceiver
}
}
- try
- {
- _in = _fd.getInputStream();
- _out = _fd.getOutputStream();
- }
- catch(java.io.IOException ex)
- {
- try
- {
- _fd.close();
- }
- catch(java.io.IOException e)
- {
- }
- _fd = null;
- Ice.SocketException se = new Ice.SocketException();
- se.initCause(ex);
- throw se;
- }
- _shutdown = false;
+ try
+ {
+ _in = _fd.getInputStream();
+ _out = _fd.getOutputStream();
+ }
+ catch(java.io.IOException ex)
+ {
+ try
+ {
+ _fd.close();
+ }
+ catch(java.io.IOException e)
+ {
+ }
+ _fd = null;
+ Ice.SocketException se = new Ice.SocketException();
+ se.initCause(ex);
+ throw se;
+ }
+ _shutdown = false;
}
protected synchronized void
diff --git a/javae/midp/Ice/LoggerI.java b/javae/midp/Ice/LoggerI.java
index 3243c38f72f..5405528e8d8 100644
--- a/javae/midp/Ice/LoggerI.java
+++ b/javae/midp/Ice/LoggerI.java
@@ -20,10 +20,10 @@ public final class LoggerI implements Logger
public
LoggerI(String prefix)
{
- if(prefix.length() > 0)
- {
- _prefix = prefix + ": ";
- }
+ if(prefix.length() > 0)
+ {
+ _prefix = prefix + ": ";
+ }
_date = java.util.Calendar.getInstance();
}
@@ -31,11 +31,11 @@ public final class LoggerI implements Logger
public void
print(String message)
{
- synchronized(_globalMutex)
- {
- _out.println(message);
- _out.flush();
- }
+ synchronized(_globalMutex)
+ {
+ _out.println(message);
+ _out.flush();
+ }
}
public void
@@ -44,9 +44,9 @@ public final class LoggerI implements Logger
StringBuffer s = new StringBuffer("[ ");
s = timeStamp(s);
s.append(" ");
- s.append(_prefix);
- s.append(category);
- s.append(": ");
+ s.append(_prefix);
+ s.append(category);
+ s.append(": ");
s.append(message);
s.append(" ]");
int start = 0;
@@ -61,11 +61,11 @@ public final class LoggerI implements Logger
}
s.append(temp.substring(start));
- synchronized(_globalMutex)
+ synchronized(_globalMutex)
{
_out.println(s.toString());
- _out.flush();
- }
+ _out.flush();
+ }
}
//
@@ -109,35 +109,35 @@ public final class LoggerI implements Logger
public void
warning(String message)
{
- StringBuffer s = new StringBuffer();
+ StringBuffer s = new StringBuffer();
s = timeStamp(s);
s.append(" ");
- s.append(_prefix);
- s.append("warning: ");
- s.append(message);
+ s.append(_prefix);
+ s.append("warning: ");
+ s.append(message);
- synchronized(_globalMutex)
- {
- _out.println(s.toString());
- _out.flush();
- }
+ synchronized(_globalMutex)
+ {
+ _out.println(s.toString());
+ _out.flush();
+ }
}
public void
error(String message)
{
- StringBuffer s = new StringBuffer();
+ StringBuffer s = new StringBuffer();
s = timeStamp(s);
s.append(" ");
- s.append(_prefix);
- s.append("error: ");
- s.append(message);
+ s.append(_prefix);
+ s.append("error: ");
+ s.append(message);
- synchronized(_globalMutex)
- {
- _out.println(s.toString());
- _out.flush();
- }
+ synchronized(_globalMutex)
+ {
+ _out.println(s.toString());
+ _out.flush();
+ }
}
String _prefix = "";
diff --git a/javae/midp/Ice/Properties.java b/javae/midp/Ice/Properties.java
index 1dfa29fe23e..08c5c023b37 100644
--- a/javae/midp/Ice/Properties.java
+++ b/javae/midp/Ice/Properties.java
@@ -44,7 +44,7 @@ public final class Properties
public int
getPropertyAsInt(String key)
{
- return getPropertyAsIntWithDefault(key, 0);
+ return getPropertyAsIntWithDefault(key, 0);
}
public synchronized int
@@ -60,20 +60,20 @@ public final class Properties
return value;
}
- try
- {
- return Integer.parseInt(result);
- }
- catch(NumberFormatException ex)
- {
- return value;
- }
+ try
+ {
+ return Integer.parseInt(result);
+ }
+ catch(NumberFormatException ex)
+ {
+ return value;
+ }
}
public synchronized java.util.Hashtable
getPropertiesForPrefix(String prefix)
{
- java.util.Hashtable result = new java.util.Hashtable();
+ java.util.Hashtable result = new java.util.Hashtable();
java.util.Enumeration p = _properties.keys();
while(p.hasMoreElements())
{
@@ -81,10 +81,10 @@ public final class Properties
String value = (String)_properties.get(key);
if(prefix.length() == 0 || key.startsWith(prefix))
{
- result.put(key, value);
+ result.put(key, value);
}
}
- return result;
+ return result;
}
public synchronized String[]
@@ -96,27 +96,27 @@ public final class Properties
while(p.hasMoreElements())
{
java.lang.Object key = p.nextElement();
- java.lang.Object value = _properties.get(key);
+ java.lang.Object value = _properties.get(key);
result[i++] = "--" + key + "=" + value;
}
- if(IceUtil.Debug.ASSERT)
- {
- IceUtil.Debug.Assert(i == result.length);
- }
+ if(IceUtil.Debug.ASSERT)
+ {
+ IceUtil.Debug.Assert(i == result.length);
+ }
return result;
}
public synchronized String[]
parseCommandLineOptions(String pfx, String[] options)
{
- String prefix = pfx;
- if(pfx.length() > 0 && pfx.charAt(pfx.length() - 1) != '.')
- {
- pfx += '.';
- }
- pfx = "--" + pfx;
-
- java.util.Vector result = new java.util.Vector();
+ String prefix = pfx;
+ if(pfx.length() > 0 && pfx.charAt(pfx.length() - 1) != '.')
+ {
+ pfx += '.';
+ }
+ pfx = "--" + pfx;
+
+ java.util.Vector result = new java.util.Vector();
for(int i = 0; i < options.length; i++)
{
String opt = options[i];
@@ -153,13 +153,13 @@ public final class Properties
Properties(Properties p)
{
- java.util.Enumeration e = p._properties.keys();
- while(e.hasMoreElements())
- {
- java.lang.Object key = e.nextElement();
- java.lang.Object value = p._properties.get(key);
- _properties.put(key, value);
- }
+ java.util.Enumeration e = p._properties.keys();
+ while(e.hasMoreElements())
+ {
+ java.lang.Object key = e.nextElement();
+ java.lang.Object value = p._properties.get(key);
+ _properties.put(key, value);
+ }
}
Properties()
@@ -168,19 +168,19 @@ public final class Properties
Properties(StringSeqHolder args, Properties defaults)
{
- if(defaults != null)
- {
- java.util.Hashtable m = defaults.getPropertiesForPrefix("");
- java.util.Enumeration e = m.keys();
- while(e.hasMoreElements())
- {
- java.lang.Object key = e.nextElement();
- java.lang.Object value = m.get(key);
- _properties.put(key, value);
- }
- }
-
- boolean loadConfigFiles = false;
+ if(defaults != null)
+ {
+ java.util.Hashtable m = defaults.getPropertiesForPrefix("");
+ java.util.Enumeration e = m.keys();
+ while(e.hasMoreElements())
+ {
+ java.lang.Object key = e.nextElement();
+ java.lang.Object value = m.get(key);
+ _properties.put(key, value);
+ }
+ }
+
+ boolean loadConfigFiles = false;
for(int i = 0; i < args.value.length; i++)
{
@@ -192,7 +192,7 @@ public final class Properties
line += "=1";
}
parseLine(line.substring(2));
- loadConfigFiles = true;
+ loadConfigFiles = true;
String[] arr = new String[args.value.length - 1];
System.arraycopy(args.value, 0, arr, 0, i);
if(i < args.value.length - 1)
@@ -203,38 +203,38 @@ public final class Properties
}
}
- if(loadConfigFiles)
- {
- loadConfig();
- }
+ if(loadConfigFiles)
+ {
+ loadConfig();
+ }
- args.value = parseIceCommandLineOptions(args.value);
+ args.value = parseIceCommandLineOptions(args.value);
}
public synchronized void
setProperty(String key, String value)
{
- //
- // Check if the property is legal. (We write to System.err instead of using
- // a logger because no logger may be established at the time the property
- // is parsed.)
- //
- if(key == null || key.length() == 0)
- {
- return;
- }
-
- //
- // Set or clear the property.
- //
- if(value != null && value.length() > 0)
- {
- _properties.put(key, value);
- }
- else
- {
- _properties.remove(key);
- }
+ //
+ // Check if the property is legal. (We write to System.err instead of using
+ // a logger because no logger may be established at the time the property
+ // is parsed.)
+ //
+ if(key == null || key.length() == 0)
+ {
+ return;
+ }
+
+ //
+ // Set or clear the property.
+ //
+ if(value != null && value.length() > 0)
+ {
+ _properties.put(key, value);
+ }
+ else
+ {
+ _properties.remove(key);
+ }
}
private void
@@ -300,7 +300,7 @@ public final class Properties
String[] files = IceUtil.StringUtil.split(value, ",");
for(int i = 0; i < files.length; i++)
{
- load(files[i]);
+ load(files[i]);
}
}
@@ -312,12 +312,12 @@ public final class Properties
{
try
{
- load(javax.microedition.io.Connector.openInputStream("file://" + file));
+ load(javax.microedition.io.Connector.openInputStream("file://" + file));
}
catch(java.io.IOException ex)
{
FileException se = new FileException();
- se.path = file;
+ se.path = file;
se.initCause(ex); // Exception chaining
throw se;
}
@@ -326,19 +326,19 @@ public final class Properties
public synchronized void
load(java.io.InputStream is)
{
- try
- {
- java.io.InputStreamReader reader = new java.io.InputStreamReader(is);
- String line;
- while((line = readLine(reader)) != null)
- {
- parseLine(line);
- }
+ try
+ {
+ java.io.InputStreamReader reader = new java.io.InputStreamReader(is);
+ String line;
+ while((line = readLine(reader)) != null)
+ {
+ parseLine(line);
+ }
}
catch(java.io.IOException ex)
{
FileException se = new FileException();
- se.path = is.toString();
+ se.path = is.toString();
se.initCause(ex); // Exception chaining
throw se;
}
@@ -346,36 +346,36 @@ public final class Properties
private String
readLine(java.io.InputStreamReader in)
- throws java.io.IOException
+ throws java.io.IOException
{
- StringBuffer line = new StringBuffer(128);
- try
- {
- int ch = in.read();
- if(ch == -1)
- {
- return null;
- }
-
- while(ch != '\n' && ch != -1)
- {
- line.append((char)ch);
- ch = in.read();
- }
- }
- catch(java.io.EOFException ex)
- {
- //
- // Pass through on EOF.
- //
- }
- return line.toString();
+ StringBuffer line = new StringBuffer(128);
+ try
+ {
+ int ch = in.read();
+ if(ch == -1)
+ {
+ return null;
+ }
+
+ while(ch != '\n' && ch != -1)
+ {
+ line.append((char)ch);
+ ch = in.read();
+ }
+ }
+ catch(java.io.EOFException ex)
+ {
+ //
+ // Pass through on EOF.
+ //
+ }
+ return line.toString();
}
public java.lang.Object
ice_clone()
{
- return new Properties(this);
+ return new Properties(this);
}
private java.util.Hashtable _properties = new java.util.Hashtable();
diff --git a/javae/midp/IceInternal/Acceptor.java b/javae/midp/IceInternal/Acceptor.java
index eef7ad35a5c..6cd430c6c50 100644
--- a/javae/midp/IceInternal/Acceptor.java
+++ b/javae/midp/IceInternal/Acceptor.java
@@ -14,18 +14,18 @@ class Acceptor
public void
close()
{
- if(_traceLevels.network >=1)
- {
- String s = "stopping to accept tcp connections at " + toString();
- _logger.trace(_traceLevels.networkCat, s);
- }
-
- javax.microedition.io.ServerSocketConnection connection;
- synchronized(this)
- {
- connection = _connection;
+ if(_traceLevels.network >=1)
+ {
+ String s = "stopping to accept tcp connections at " + toString();
+ _logger.trace(_traceLevels.networkCat, s);
+ }
+
+ javax.microedition.io.ServerSocketConnection connection;
+ synchronized(this)
+ {
+ connection = _connection;
_connection = null;
- }
+ }
if(connection != null)
{
try
@@ -54,75 +54,75 @@ class Acceptor
public Transceiver
accept(int timeout)
{
- javax.microedition.io.SocketConnection incoming = null;
- try
- {
- if(timeout == -1)
- {
- timeout = 0; // Infinite
- }
- else if(timeout == 0)
- {
- timeout = 1;
- }
- incoming = (javax.microedition.io.SocketConnection)_connection.acceptAndOpen();
- }
- catch(java.io.InterruptedIOException ex)
- {
- Ice.TimeoutException e = new Ice.TimeoutException();
- e.initCause(ex);
- throw e;
- }
- catch(java.io.IOException ex)
- {
- Ice.SocketException e = new Ice.SocketException();
- e.initCause(ex);
- throw e;
- }
-
- if(_traceLevels.network >= 1)
- {
- String s = "accepted tcp connection " + Network.toString(incoming);
- _logger.trace(_traceLevels.networkCat, s);
- }
-
- return new Transceiver(_instance, incoming);
+ javax.microedition.io.SocketConnection incoming = null;
+ try
+ {
+ if(timeout == -1)
+ {
+ timeout = 0; // Infinite
+ }
+ else if(timeout == 0)
+ {
+ timeout = 1;
+ }
+ incoming = (javax.microedition.io.SocketConnection)_connection.acceptAndOpen();
+ }
+ catch(java.io.InterruptedIOException ex)
+ {
+ Ice.TimeoutException e = new Ice.TimeoutException();
+ e.initCause(ex);
+ throw e;
+ }
+ catch(java.io.IOException ex)
+ {
+ Ice.SocketException e = new Ice.SocketException();
+ e.initCause(ex);
+ throw e;
+ }
+
+ if(_traceLevels.network >= 1)
+ {
+ String s = "accepted tcp connection " + Network.toString(incoming);
+ _logger.trace(_traceLevels.networkCat, s);
+ }
+
+ return new Transceiver(_instance, incoming);
}
public void
connectToSelf()
{
- String ip = System.getProperty("microedition.hostname");
- if(ip == null || ip.length() == 0 || ip.equals("0.0.0.0"))
- {
- try
- {
- ip = _connection.getLocalAddress();
- }
- catch(java.io.IOException ex)
- {
- ip = "127.0.0.1";
- }
- }
-
- try
- {
- javax.microedition.io.Connection localConn =
- javax.microedition.io.Connector.open("socket://" + ip + ':' + _connection.getLocalPort());
- localConn.close();
- }
- catch(java.io.IOException ex)
- {
- Ice.SocketException e = new Ice.SocketException();
- e.initCause(ex);
- throw e;
- }
+ String ip = System.getProperty("microedition.hostname");
+ if(ip == null || ip.length() == 0 || ip.equals("0.0.0.0"))
+ {
+ try
+ {
+ ip = _connection.getLocalAddress();
+ }
+ catch(java.io.IOException ex)
+ {
+ ip = "127.0.0.1";
+ }
+ }
+
+ try
+ {
+ javax.microedition.io.Connection localConn =
+ javax.microedition.io.Connector.open("socket://" + ip + ':' + _connection.getLocalPort());
+ localConn.close();
+ }
+ catch(java.io.IOException ex)
+ {
+ Ice.SocketException e = new Ice.SocketException();
+ e.initCause(ex);
+ throw e;
+ }
}
public String
toString()
{
- return _addr.getAddress() + ":" + _addr.getPort();
+ return _addr.getAddress() + ":" + _addr.getPort();
}
int
@@ -146,54 +146,54 @@ class Acceptor
_backlog = 5;
}
- String connectString = "socket://";
- if(port > 0)
- {
- connectString = connectString + ":" + port;
- }
+ String connectString = "socket://";
+ if(port > 0)
+ {
+ connectString = connectString + ":" + port;
+ }
try
{
- if(_traceLevels.network >= 2)
- {
- String s = "attempting to bind to tcp socket on port " + port;
- _logger.trace(_traceLevels.networkCat, s);
- }
- _connection =
- (javax.microedition.io.ServerSocketConnection)javax.microedition.io.Connector.open(connectString);
+ if(_traceLevels.network >= 2)
+ {
+ String s = "attempting to bind to tcp socket on port " + port;
+ _logger.trace(_traceLevels.networkCat, s);
+ }
+ _connection =
+ (javax.microedition.io.ServerSocketConnection)javax.microedition.io.Connector.open(connectString);
- _addr = new InetSocketAddress(_connection.getLocalAddress(), _connection.getLocalPort());
+ _addr = new InetSocketAddress(_connection.getLocalAddress(), _connection.getLocalPort());
}
catch(java.io.IOException ex)
{
- if(_connection != null)
- {
- try
- {
- _connection.close();
- }
- catch(java.io.IOException e)
- {
- }
- _connection = null;
- }
- Ice.SocketException e = new Ice.SocketException();
- e.initCause(ex);
- throw e;
+ if(_connection != null)
+ {
+ try
+ {
+ _connection.close();
+ }
+ catch(java.io.IOException e)
+ {
+ }
+ _connection = null;
+ }
+ Ice.SocketException e = new Ice.SocketException();
+ e.initCause(ex);
+ throw e;
}
catch(RuntimeException ex)
{
- if(_connection != null)
- {
- try
- {
- _connection.close();
- }
- catch(java.io.IOException e)
- {
- }
- _connection = null;
- }
+ if(_connection != null)
+ {
+ try
+ {
+ _connection.close();
+ }
+ catch(java.io.IOException e)
+ {
+ }
+ _connection = null;
+ }
throw ex;
}
}
diff --git a/javae/midp/IceInternal/Connector.java b/javae/midp/IceInternal/Connector.java
index 49b541ff0e8..22ca2e82473 100644
--- a/javae/midp/IceInternal/Connector.java
+++ b/javae/midp/IceInternal/Connector.java
@@ -13,174 +13,174 @@ final class Connector
{
private static class ConnectThread extends Thread
{
- ConnectThread(String addr)
- {
- _url = addr;
- }
-
- public void
- run()
- {
- try
- {
- javax.microedition.io.Connection connection =
- javax.microedition.io.Connector.open(_url, javax.microedition.io.Connector.READ_WRITE,
- true);
- synchronized(this)
- {
- _connection = connection;
- notifyAll();
- }
- }
- catch(java.io.IOException ex)
- {
- synchronized(this)
- {
- _ex = ex;
- notifyAll();
- }
- }
- }
-
- javax.microedition.io.Connection
- getConnection(int timeout)
- throws java.io.IOException
- {
- javax.microedition.io.Connection connection = null;
-
- synchronized(this)
- {
- while(_connection == null && _ex == null)
- {
- try
- {
- wait(timeout);
- break;
- }
- catch(InterruptedException ex)
- {
- continue;
- }
- }
-
- if(_ex != null)
- {
- throw _ex;
- }
-
- connection = _connection;
- _connection = null;
- }
-
- return connection;
- }
-
- private String _url;
- private java.io.IOException _ex;
- private javax.microedition.io.Connection _connection;
+ ConnectThread(String addr)
+ {
+ _url = addr;
+ }
+
+ public void
+ run()
+ {
+ try
+ {
+ javax.microedition.io.Connection connection =
+ javax.microedition.io.Connector.open(_url, javax.microedition.io.Connector.READ_WRITE,
+ true);
+ synchronized(this)
+ {
+ _connection = connection;
+ notifyAll();
+ }
+ }
+ catch(java.io.IOException ex)
+ {
+ synchronized(this)
+ {
+ _ex = ex;
+ notifyAll();
+ }
+ }
+ }
+
+ javax.microedition.io.Connection
+ getConnection(int timeout)
+ throws java.io.IOException
+ {
+ javax.microedition.io.Connection connection = null;
+
+ synchronized(this)
+ {
+ while(_connection == null && _ex == null)
+ {
+ try
+ {
+ wait(timeout);
+ break;
+ }
+ catch(InterruptedException ex)
+ {
+ continue;
+ }
+ }
+
+ if(_ex != null)
+ {
+ throw _ex;
+ }
+
+ connection = _connection;
+ _connection = null;
+ }
+
+ return connection;
+ }
+
+ private String _url;
+ private java.io.IOException _ex;
+ private javax.microedition.io.Connection _connection;
}
public Transceiver
connect(int timeout)
{
- if(_traceLevels.network >= 2)
- {
- String s = "trying to establish tcp connection to " + toString();
- _logger.trace(_traceLevels.networkCat, s);
- }
-
- javax.microedition.io.SocketConnection connection = null;
- try
- {
- //
- // If a connect timeout is specified, do the connect in a separate thread.
- //
- if(timeout >= 0)
- {
- ConnectThread ct = new ConnectThread(_url);
- ct.start();
- connection = (javax.microedition.io.SocketConnection)ct.getConnection(timeout == 0 ? 1 : timeout);
- if(connection == null)
- {
- throw new Ice.ConnectTimeoutException();
- }
- }
- else
- {
- connection = (javax.microedition.io.SocketConnection)javax.microedition.io.Connector.open(_url,
- javax.microedition.io.Connector.READ_WRITE, true);
- }
-
- connection.setSocketOption(javax.microedition.io.SocketConnection.DELAY, 0);
- }
+ if(_traceLevels.network >= 2)
+ {
+ String s = "trying to establish tcp connection to " + toString();
+ _logger.trace(_traceLevels.networkCat, s);
+ }
+
+ javax.microedition.io.SocketConnection connection = null;
+ try
+ {
+ //
+ // If a connect timeout is specified, do the connect in a separate thread.
+ //
+ if(timeout >= 0)
+ {
+ ConnectThread ct = new ConnectThread(_url);
+ ct.start();
+ connection = (javax.microedition.io.SocketConnection)ct.getConnection(timeout == 0 ? 1 : timeout);
+ if(connection == null)
+ {
+ throw new Ice.ConnectTimeoutException();
+ }
+ }
+ else
+ {
+ connection = (javax.microedition.io.SocketConnection)javax.microedition.io.Connector.open(_url,
+ javax.microedition.io.Connector.READ_WRITE, true);
+ }
+
+ connection.setSocketOption(javax.microedition.io.SocketConnection.DELAY, 0);
+ }
catch(javax.microedition.io.ConnectionNotFoundException ex)
{
- if(connection != null)
- {
- try
- {
- connection.close();
- }
- catch(java.io.IOException e)
- {
- }
- }
+ if(connection != null)
+ {
+ try
+ {
+ connection.close();
+ }
+ catch(java.io.IOException e)
+ {
+ }
+ }
Ice.ConnectFailedException se;
- if(Network.connectionRefused(ex))
- {
- se = new Ice.ConnectionRefusedException();
- }
- else
- {
- se = new Ice.ConnectFailedException();
- }
+ if(Network.connectionRefused(ex))
+ {
+ se = new Ice.ConnectionRefusedException();
+ }
+ else
+ {
+ se = new Ice.ConnectFailedException();
+ }
se.initCause(ex);
throw se;
}
- catch(java.io.IOException ex)
- {
- if(connection != null)
- {
- try
- {
- connection.close();
- }
- catch(java.io.IOException e)
- {
- }
- }
- Ice.SocketException e = new Ice.SocketException();
- e.initCause(ex);
- throw e;
- }
- catch(RuntimeException ex)
- {
- if(connection != null)
- {
- try
- {
- connection.close();
- }
- catch(java.io.IOException e)
- {
- }
- }
- throw ex;
- }
-
- if(_traceLevels.network >= 1)
- {
- String s = "tcp connection established\n" + Network.toString(connection);
- _logger.trace(_traceLevels.networkCat, s);
- }
-
- return new Transceiver(_instance, connection);
+ catch(java.io.IOException ex)
+ {
+ if(connection != null)
+ {
+ try
+ {
+ connection.close();
+ }
+ catch(java.io.IOException e)
+ {
+ }
+ }
+ Ice.SocketException e = new Ice.SocketException();
+ e.initCause(ex);
+ throw e;
+ }
+ catch(RuntimeException ex)
+ {
+ if(connection != null)
+ {
+ try
+ {
+ connection.close();
+ }
+ catch(java.io.IOException e)
+ {
+ }
+ }
+ throw ex;
+ }
+
+ if(_traceLevels.network >= 1)
+ {
+ String s = "tcp connection established\n" + Network.toString(connection);
+ _logger.trace(_traceLevels.networkCat, s);
+ }
+
+ return new Transceiver(_instance, connection);
}
public String
toString()
{
- return _url;
+ return _url;
}
//
@@ -192,7 +192,7 @@ final class Connector
_traceLevels = instance.traceLevels();
_logger = instance.initializationData().logger;
- _url = "socket://" + host + ':' + port;
+ _url = "socket://" + host + ':' + port;
}
private Instance _instance;
diff --git a/javae/midp/IceInternal/InetSocketAddress.java b/javae/midp/IceInternal/InetSocketAddress.java
index 2d7b090c2ab..d1f1d368495 100644
--- a/javae/midp/IceInternal/InetSocketAddress.java
+++ b/javae/midp/IceInternal/InetSocketAddress.java
@@ -13,53 +13,53 @@ class InetSocketAddress
{
InetSocketAddress(String address, int port)
{
- _addr = address;
- _port = port;
+ _addr = address;
+ _port = port;
}
String
getAddress()
{
- return _addr;
+ return _addr;
}
String
getHostName()
{
- String result = System.getProperty("microedition.hostname");
- if(result == null || result.length() == 0)
- {
- return "localhost";
- }
- else
- {
- return result;
- }
+ String result = System.getProperty("microedition.hostname");
+ if(result == null || result.length() == 0)
+ {
+ return "localhost";
+ }
+ else
+ {
+ return result;
+ }
}
int
getPort()
{
- return _port;
+ return _port;
}
public int
hashCode()
{
- return 5 * _addr.hashCode() + _port;
+ return 5 * _addr.hashCode() + _port;
}
public String
toString()
{
- return _addr + ":" + _port;
+ return _addr + ":" + _port;
}
public boolean
equals(Object rhs)
{
- InetSocketAddress addr = (InetSocketAddress)rhs;
- return _addr.equals(addr._addr) && _port == addr._port;
+ InetSocketAddress addr = (InetSocketAddress)rhs;
+ return _addr.equals(addr._addr) && _port == addr._port;
}
private String _addr;
diff --git a/javae/midp/IceInternal/Network.java b/javae/midp/IceInternal/Network.java
index cc332d1a952..9b74a76c6a5 100644
--- a/javae/midp/IceInternal/Network.java
+++ b/javae/midp/IceInternal/Network.java
@@ -19,15 +19,15 @@ public final class Network
// actively refuses a connection. Unfortunately, our only
// choice is to search the exception message for
// distinguishing phrases.
- //
- // TODO: Confirm actual message under MIDP
+ //
+ // TODO: Confirm actual message under MIDP
//
String msg = ex.getMessage();
if(msg != null)
{
- msg = msg.toLowerCase();
+ msg = msg.toLowerCase();
final String[] msgs =
{
"connection refused" // ECONNREFUSED
@@ -48,87 +48,87 @@ public final class Network
public static String
getLocalHost(boolean numeric)
{
- String result = System.getProperty("microedition.hostname");
- if(result == null)
- {
- result = "127.0.0.1";
- }
- return result;
+ String result = System.getProperty("microedition.hostname");
+ if(result == null)
+ {
+ result = "127.0.0.1";
+ }
+ return result;
}
public static byte[]
getLocalAddress()
{
- byte[] b = new byte[4];
- b[0] = 127;
- b[1] = 0;
- b[2] = 0;
- b[3] = 1;
- return b;
+ byte[] b = new byte[4];
+ b[0] = 127;
+ b[1] = 0;
+ b[2] = 0;
+ b[3] = 1;
+ return b;
}
public static String
toString(javax.microedition.io.SocketConnection connection)
{
- if(connection == null)
- {
- return "<closed>";
- }
-
- try
- {
- String localAddr = connection.getLocalAddress();
- int localPort = connection.getLocalPort();
- String remoteAddr = connection.getAddress();
- int remotePort = connection.getPort();
-
- return addressesToString(localAddr, localPort, remoteAddr, remotePort);
- }
- catch(java.io.IOException ex)
- {
- return "<closed>";
- }
+ if(connection == null)
+ {
+ return "<closed>";
+ }
+
+ try
+ {
+ String localAddr = connection.getLocalAddress();
+ int localPort = connection.getLocalPort();
+ String remoteAddr = connection.getAddress();
+ int remotePort = connection.getPort();
+
+ return addressesToString(localAddr, localPort, remoteAddr, remotePort);
+ }
+ catch(java.io.IOException ex)
+ {
+ return "<closed>";
+ }
}
public static String
toString(javax.microedition.io.ServerSocketConnection connection)
{
- if(connection == null)
- {
- return "<closed>";
- }
-
- try
- {
- return connection.getLocalAddress() + ":" + connection.getLocalPort();
- }
- catch(java.io.IOException ex)
- {
- return "<closed>";
- }
+ if(connection == null)
+ {
+ return "<closed>";
+ }
+
+ try
+ {
+ return connection.getLocalAddress() + ":" + connection.getLocalPort();
+ }
+ catch(java.io.IOException ex)
+ {
+ return "<closed>";
+ }
}
public static String
addressesToString(String localAddr, int localPort, String remoteAddr, int remotePort)
{
- StringBuffer s = new StringBuffer();
- s.append("local address = ");
- s.append(localAddr);
- s.append(':');
- s.append(localPort);
- if(remoteAddr == null || remoteAddr.length() == 0)
- {
- s.append("\nremote address = <not connected>");
- }
- else
- {
- s.append("\nremote address = ");
- s.append(remoteAddr);
- s.append(':');
- s.append(remotePort);
- }
-
- return s.toString();
+ StringBuffer s = new StringBuffer();
+ s.append("local address = ");
+ s.append(localAddr);
+ s.append(':');
+ s.append(localPort);
+ if(remoteAddr == null || remoteAddr.length() == 0)
+ {
+ s.append("\nremote address = <not connected>");
+ }
+ else
+ {
+ s.append("\nremote address = ");
+ s.append(remoteAddr);
+ s.append(':');
+ s.append(remotePort);
+ }
+
+ return s.toString();
}
//
@@ -137,78 +137,78 @@ public final class Network
public static byte[]
addrStringToIP(String str)
{
- if(str.length() < "1.1.1.1".length())
- {
- return null;
- }
-
- //
- // Copy to an array because it will make a few of the following operations more convenient.
- //
- char[] stringChars = str.toCharArray();
- StringBuffer[] octetStr = new StringBuffer[4];
-
- //
- // We need 4 octets so we are looking for three periods, if we don't have them we might as well return a
- // null, indicating failure.
- //
- int dotCount = 0;
- for(int i = 0; i < stringChars.length; ++i)
- {
- if(stringChars[i] == '.')
- {
- ++dotCount;
- if(dotCount > 3)
- {
- //
- // Too many periods to be an IP address, treat as a hostname.
- //
- return null;
- }
- }
- else if(!Character.isDigit(stringChars[i]))
- {
- return null;
- }
- else
- {
- if(octetStr[dotCount] == null)
- {
- octetStr[dotCount] = new StringBuffer(3);
- }
- octetStr[dotCount].append(stringChars[i]);
- if(octetStr[dotCount].length() > 3)
- {
- return null;
- }
- }
- }
-
- //
- // We didn't find enough periods for this to be an IP address.
- //
- if(dotCount != 3)
- {
- return null;
- }
-
- byte[] ip = new byte[octetStr.length];
- for(int i = 0; i < octetStr.length; ++i)
- {
- try
- {
- Integer s = Integer.valueOf(octetStr[i].toString());
- if(s.intValue() < 0 || s.intValue() > 255)
- {
- return null;
- }
- ip[i] = s.byteValue();
- }
- catch(NumberFormatException ex)
- {
- return null;
- }
- }
- return ip;
+ if(str.length() < "1.1.1.1".length())
+ {
+ return null;
+ }
+
+ //
+ // Copy to an array because it will make a few of the following operations more convenient.
+ //
+ char[] stringChars = str.toCharArray();
+ StringBuffer[] octetStr = new StringBuffer[4];
+
+ //
+ // We need 4 octets so we are looking for three periods, if we don't have them we might as well return a
+ // null, indicating failure.
+ //
+ int dotCount = 0;
+ for(int i = 0; i < stringChars.length; ++i)
+ {
+ if(stringChars[i] == '.')
+ {
+ ++dotCount;
+ if(dotCount > 3)
+ {
+ //
+ // Too many periods to be an IP address, treat as a hostname.
+ //
+ return null;
+ }
+ }
+ else if(!Character.isDigit(stringChars[i]))
+ {
+ return null;
+ }
+ else
+ {
+ if(octetStr[dotCount] == null)
+ {
+ octetStr[dotCount] = new StringBuffer(3);
+ }
+ octetStr[dotCount].append(stringChars[i]);
+ if(octetStr[dotCount].length() > 3)
+ {
+ return null;
+ }
+ }
+ }
+
+ //
+ // We didn't find enough periods for this to be an IP address.
+ //
+ if(dotCount != 3)
+ {
+ return null;
+ }
+
+ byte[] ip = new byte[octetStr.length];
+ for(int i = 0; i < octetStr.length; ++i)
+ {
+ try
+ {
+ Integer s = Integer.valueOf(octetStr[i].toString());
+ if(s.intValue() < 0 || s.intValue() > 255)
+ {
+ return null;
+ }
+ ip[i] = s.byteValue();
+ }
+ catch(NumberFormatException ex)
+ {
+ return null;
+ }
+ }
+ return ip;
}
}
diff --git a/javae/midp/IceInternal/TcpEndpoint.java b/javae/midp/IceInternal/TcpEndpoint.java
index 4573a94016f..7639d2561a3 100644
--- a/javae/midp/IceInternal/TcpEndpoint.java
+++ b/javae/midp/IceInternal/TcpEndpoint.java
@@ -50,8 +50,8 @@ final class TcpEndpoint implements Endpoint
if(option.length() != 2 || option.charAt(0) != '-')
{
Ice.EndpointParseException e = new Ice.EndpointParseException();
- e.str = "tcp " + str;
- throw e;
+ e.str = "tcp " + str;
+ throw e;
}
String argument = null;
@@ -67,8 +67,8 @@ final class TcpEndpoint implements Endpoint
if(argument == null)
{
Ice.EndpointParseException e = new Ice.EndpointParseException();
- e.str = "tcp " + str;
- throw e;
+ e.str = "tcp " + str;
+ throw e;
}
_host = argument;
@@ -80,8 +80,8 @@ final class TcpEndpoint implements Endpoint
if(argument == null)
{
Ice.EndpointParseException e = new Ice.EndpointParseException();
- e.str = "tcp " + str;
- throw e;
+ e.str = "tcp " + str;
+ throw e;
}
try
@@ -91,15 +91,15 @@ final class TcpEndpoint implements Endpoint
catch(NumberFormatException ex)
{
Ice.EndpointParseException e = new Ice.EndpointParseException();
- e.str = "tcp " + str;
- throw e;
+ e.str = "tcp " + str;
+ throw e;
}
- if(_port < 0 || _port > 65535)
+ if(_port < 0 || _port > 65535)
{
Ice.EndpointParseException e = new Ice.EndpointParseException();
- e.str = "tcp " + str;
- throw e;
+ e.str = "tcp " + str;
+ throw e;
}
break;
@@ -110,8 +110,8 @@ final class TcpEndpoint implements Endpoint
if(argument == null)
{
Ice.EndpointParseException e = new Ice.EndpointParseException();
- e.str = "tcp " + str;
- throw e;
+ e.str = "tcp " + str;
+ throw e;
}
try
@@ -121,24 +121,24 @@ final class TcpEndpoint implements Endpoint
catch(NumberFormatException ex)
{
Ice.EndpointParseException e = new Ice.EndpointParseException();
- e.str = "tcp " + str;
- throw e;
+ e.str = "tcp " + str;
+ throw e;
}
break;
}
- case 'z':
- {
- // Ignore compression flag.
- break;
- }
+ case 'z':
+ {
+ // Ignore compression flag.
+ break;
+ }
default:
{
Ice.EndpointParseException e = new Ice.EndpointParseException();
- e.str = "tcp " + str;
- throw e;
+ e.str = "tcp " + str;
+ throw e;
}
}
}
@@ -159,7 +159,7 @@ final class TcpEndpoint implements Endpoint
_host = s.readString();
_port = s.readInt();
_timeout = s.readInt();
- boolean compress = s.readBool();
+ boolean compress = s.readBool();
s.endReadEncaps();
calcHashValue();
}
@@ -175,7 +175,7 @@ final class TcpEndpoint implements Endpoint
s.writeString(_host);
s.writeInt(_port);
s.writeInt(_timeout);
- s.writeBool(false);
+ s.writeBool(false);
s.endWriteEncaps();
}
@@ -359,47 +359,47 @@ final class TcpEndpoint implements Endpoint
return 1;
}
- byte[] myIP = IPAddr();
- if(myIP != null)
- {
- byte[] otherIP = p.IPAddr();
- if(otherIP != null)
- {
- if(IceUtil.Debug.ASSERT)
- {
- IceUtil.Debug.Assert(myIP.length == otherIP.length);
- }
- for(int i = 0; i < otherIP.length; i++)
- {
- if(myIP[i] < otherIP[i])
- {
- return -1;
- }
- else if(otherIP[i] < myIP[i])
- {
- return 1;
- }
- }
- }
- }
-
- //
- // At this point the best we can do is a lexical compare.
- //
+ byte[] myIP = IPAddr();
+ if(myIP != null)
+ {
+ byte[] otherIP = p.IPAddr();
+ if(otherIP != null)
+ {
+ if(IceUtil.Debug.ASSERT)
+ {
+ IceUtil.Debug.Assert(myIP.length == otherIP.length);
+ }
+ for(int i = 0; i < otherIP.length; i++)
+ {
+ if(myIP[i] < otherIP[i])
+ {
+ return -1;
+ }
+ else if(otherIP[i] < myIP[i])
+ {
+ return 1;
+ }
+ }
+ }
+ }
+
+ //
+ // At this point the best we can do is a lexical compare.
+ //
return _host.compareTo(p._host);
}
private byte[]
IPAddr()
{
- if(_ip == null && !_parsed)
- {
- _parsed = true;
- _ip = Network.addrStringToIP(_host);
- }
- return _ip;
+ if(_ip == null && !_parsed)
+ {
+ _parsed = true;
+ _ip = Network.addrStringToIP(_host);
+ }
+ return _ip;
}
-
+
private void
calcHashValue()
{
diff --git a/javae/midp/IceInternal/Transceiver.java b/javae/midp/IceInternal/Transceiver.java
index 8e795682bf9..14855ccbe7e 100644
--- a/javae/midp/IceInternal/Transceiver.java
+++ b/javae/midp/IceInternal/Transceiver.java
@@ -17,146 +17,146 @@ final public class Transceiver
//
private class ReadThread extends Thread
{
- ReadThread(BasicStream stream, int timeout)
- {
- _stream = stream;
- }
-
- public void
- run()
- {
- try
- {
- readImpl(_stream);
- }
- catch(RuntimeException ex)
- {
- _ex = ex;
- }
-
- synchronized(this)
- {
- _done = true;
- notifyAll();
- }
- }
-
- public void
- read()
- {
- long absoluteTimeout = System.currentTimeMillis() + _timeout;
- long interval = _timeout;
-
- synchronized(this)
- {
- //
- // The _done flag protects against the situation where the read thread has completed before we get
- // this far in this call.
- //
- while(_ex == null && !_done)
- {
- try
- {
- wait(interval);
- break;
- }
- catch(InterruptedException ex)
- {
- //
- // Reduce the wait interval by the amount of time already waited.
- //
- interval = absoluteTimeout - System.currentTimeMillis();
- if(interval <= 0)
- {
- throw new Ice.TimeoutException();
- }
- continue;
- }
- }
-
- if(_ex != null)
- {
- throw _ex;
- }
- }
- }
-
- int _timeout;
- BasicStream _stream;
- java.lang.RuntimeException _ex = null;
- boolean _done = false;
+ ReadThread(BasicStream stream, int timeout)
+ {
+ _stream = stream;
+ }
+
+ public void
+ run()
+ {
+ try
+ {
+ readImpl(_stream);
+ }
+ catch(RuntimeException ex)
+ {
+ _ex = ex;
+ }
+
+ synchronized(this)
+ {
+ _done = true;
+ notifyAll();
+ }
+ }
+
+ public void
+ read()
+ {
+ long absoluteTimeout = System.currentTimeMillis() + _timeout;
+ long interval = _timeout;
+
+ synchronized(this)
+ {
+ //
+ // The _done flag protects against the situation where the read thread has completed before we get
+ // this far in this call.
+ //
+ while(_ex == null && !_done)
+ {
+ try
+ {
+ wait(interval);
+ break;
+ }
+ catch(InterruptedException ex)
+ {
+ //
+ // Reduce the wait interval by the amount of time already waited.
+ //
+ interval = absoluteTimeout - System.currentTimeMillis();
+ if(interval <= 0)
+ {
+ throw new Ice.TimeoutException();
+ }
+ continue;
+ }
+ }
+
+ if(_ex != null)
+ {
+ throw _ex;
+ }
+ }
+ }
+
+ int _timeout;
+ BasicStream _stream;
+ java.lang.RuntimeException _ex = null;
+ boolean _done = false;
}
private class WriteThread extends Thread
{
- WriteThread(BasicStream stream, int timeout)
- {
- _stream = stream;
- }
-
- public void
- run()
- {
- try
- {
- writeImpl(_stream);
- }
- catch(RuntimeException ex)
- {
- _ex = ex;
- }
-
- synchronized(this)
- {
- _done = true;
- notifyAll();
- }
- }
-
- public void
- write()
- {
- long absoluteTimeout = System.currentTimeMillis() + _timeout;
- long interval = _timeout;
-
- synchronized(this)
- {
- //
- // The _done flag protects against the situation where the write thread has completed before we get
- // this far in this call.
- //
- while(_ex == null && !_done)
- {
- try
- {
- wait(interval);
- break;
- }
- catch(InterruptedException ex)
- {
- //
- // Reduce the wait interval by the amount of time already waited.
- //
- interval = absoluteTimeout - System.currentTimeMillis();
- if(interval <= 0)
- {
- throw new Ice.TimeoutException();
- }
- continue;
- }
- }
-
- if(_ex != null)
- {
- throw _ex;
- }
- }
- }
-
- int _timeout;
- BasicStream _stream;
- java.lang.RuntimeException _ex = null;
- boolean _done = false;
+ WriteThread(BasicStream stream, int timeout)
+ {
+ _stream = stream;
+ }
+
+ public void
+ run()
+ {
+ try
+ {
+ writeImpl(_stream);
+ }
+ catch(RuntimeException ex)
+ {
+ _ex = ex;
+ }
+
+ synchronized(this)
+ {
+ _done = true;
+ notifyAll();
+ }
+ }
+
+ public void
+ write()
+ {
+ long absoluteTimeout = System.currentTimeMillis() + _timeout;
+ long interval = _timeout;
+
+ synchronized(this)
+ {
+ //
+ // The _done flag protects against the situation where the write thread has completed before we get
+ // this far in this call.
+ //
+ while(_ex == null && !_done)
+ {
+ try
+ {
+ wait(interval);
+ break;
+ }
+ catch(InterruptedException ex)
+ {
+ //
+ // Reduce the wait interval by the amount of time already waited.
+ //
+ interval = absoluteTimeout - System.currentTimeMillis();
+ if(interval <= 0)
+ {
+ throw new Ice.TimeoutException();
+ }
+ continue;
+ }
+ }
+
+ if(_ex != null)
+ {
+ throw _ex;
+ }
+ }
+ }
+
+ int _timeout;
+ BasicStream _stream;
+ java.lang.RuntimeException _ex = null;
+ boolean _done = false;
}
public void
@@ -168,111 +168,111 @@ final public class Transceiver
_logger.trace(_traceLevels.networkCat, s);
}
- synchronized(this)
- {
- if(IceUtil.Debug.ASSERT)
- {
- IceUtil.Debug.Assert(_connection != null);
- }
- try
- {
- _connection.close();
- }
- catch(java.io.IOException ex)
- {
- Ice.SocketException se = new Ice.SocketException();
- se.initCause(ex);
- throw se;
- }
- finally
- {
- _connection = null;
- }
- }
+ synchronized(this)
+ {
+ if(IceUtil.Debug.ASSERT)
+ {
+ IceUtil.Debug.Assert(_connection != null);
+ }
+ try
+ {
+ _connection.close();
+ }
+ catch(java.io.IOException ex)
+ {
+ Ice.SocketException se = new Ice.SocketException();
+ se.initCause(ex);
+ throw se;
+ }
+ finally
+ {
+ _connection = null;
+ }
+ }
}
public void
shutdownWrite()
{
- try
- {
- _out.close();
- }
- catch(java.io.IOException ex)
- {
- //
- // Ignore.
- //
- }
+ try
+ {
+ _out.close();
+ }
+ catch(java.io.IOException ex)
+ {
+ //
+ // Ignore.
+ //
+ }
}
public void
shutdownReadWrite()
{
- if(_traceLevels.network >= 2)
- {
- String s = "shutting down tcp connection for reading and writing " + toString();
- _logger.trace(_traceLevels.networkCat, s);
- }
-
- if(IceUtil.Debug.ASSERT)
- {
- IceUtil.Debug.Assert(_connection != null);
- }
-
- try
- {
- _in.close();
- }
- catch(java.io.IOException ex)
- {
- //
- // Ignore.
- //
- }
-
- try
- {
- _out.close();
- }
- catch(java.io.IOException ex)
- {
- //
- // Ignore.
- //
- }
-
- _shutdown = true;
+ if(_traceLevels.network >= 2)
+ {
+ String s = "shutting down tcp connection for reading and writing " + toString();
+ _logger.trace(_traceLevels.networkCat, s);
+ }
+
+ if(IceUtil.Debug.ASSERT)
+ {
+ IceUtil.Debug.Assert(_connection != null);
+ }
+
+ try
+ {
+ _in.close();
+ }
+ catch(java.io.IOException ex)
+ {
+ //
+ // Ignore.
+ //
+ }
+
+ try
+ {
+ _out.close();
+ }
+ catch(java.io.IOException ex)
+ {
+ //
+ // Ignore.
+ //
+ }
+
+ _shutdown = true;
}
public void
write(BasicStream stream, int timeout)
{
- if(timeout == 0)
- {
- //
- // 0 means "don't block" but a zero timeout doesn't mean
- // anything. We'll translate it to something ludicrously
- // short to provide a non-blocking affect.
- //
- timeout = 1;
- }
-
- if(timeout < 0)
- {
- writeImpl(stream);
- }
- else
- {
- WriteThread t = new WriteThread(stream, timeout);
- t.start();
-
- //
- // This blocks until either an exception is thrown by
- // writeImpl() or the timeout expires.
- //
- t.write();
- }
+ if(timeout == 0)
+ {
+ //
+ // 0 means "don't block" but a zero timeout doesn't mean
+ // anything. We'll translate it to something ludicrously
+ // short to provide a non-blocking affect.
+ //
+ timeout = 1;
+ }
+
+ if(timeout < 0)
+ {
+ writeImpl(stream);
+ }
+ else
+ {
+ WriteThread t = new WriteThread(stream, timeout);
+ t.start();
+
+ //
+ // This blocks until either an exception is thrown by
+ // writeImpl() or the timeout expires.
+ //
+ t.write();
+ }
}
protected void
@@ -280,140 +280,140 @@ final public class Transceiver
{
ByteBuffer buf = stream.prepareWrite();
- byte[] data = buf.array();
- int chunkSize = WRITE_CHUNK;
-
- while(buf.hasRemaining() && !_shutdown)
- {
- int pos = buf.position();
- try
- {
- if(IceUtil.Debug.ASSERT)
- {
- IceUtil.Debug.Assert(_connection != null);
- }
-
- int rem = buf.remaining();
- if(chunkSize > 0 && chunkSize < rem)
- {
- rem = chunkSize;
- }
- _out.write(data, pos, rem);
- _out.flush();
- buf.position(pos + rem);
-
- if(_traceLevels.network >= 3)
- {
- String s = "sent " + rem + " of " + buf.limit() + " bytes via tcp " + toString();
- _logger.trace(_traceLevels.networkCat, s);
- }
- }
- catch(java.io.InterruptedIOException ex)
- {
- buf.position(pos + ex.bytesTransferred);
- }
- catch(java.io.IOException ex)
- {
- Ice.SocketException se = new Ice.SocketException();
- se.initCause(ex);
- throw se;
- }
- }
-
- if(_shutdown && buf.hasRemaining())
- {
- throw new Ice.ConnectionLostException();
- }
+ byte[] data = buf.array();
+ int chunkSize = WRITE_CHUNK;
+
+ while(buf.hasRemaining() && !_shutdown)
+ {
+ int pos = buf.position();
+ try
+ {
+ if(IceUtil.Debug.ASSERT)
+ {
+ IceUtil.Debug.Assert(_connection != null);
+ }
+
+ int rem = buf.remaining();
+ if(chunkSize > 0 && chunkSize < rem)
+ {
+ rem = chunkSize;
+ }
+ _out.write(data, pos, rem);
+ _out.flush();
+ buf.position(pos + rem);
+
+ if(_traceLevels.network >= 3)
+ {
+ String s = "sent " + rem + " of " + buf.limit() + " bytes via tcp " + toString();
+ _logger.trace(_traceLevels.networkCat, s);
+ }
+ }
+ catch(java.io.InterruptedIOException ex)
+ {
+ buf.position(pos + ex.bytesTransferred);
+ }
+ catch(java.io.IOException ex)
+ {
+ Ice.SocketException se = new Ice.SocketException();
+ se.initCause(ex);
+ throw se;
+ }
+ }
+
+ if(_shutdown && buf.hasRemaining())
+ {
+ throw new Ice.ConnectionLostException();
+ }
}
public void
read(BasicStream stream, int timeout)
{
- if(timeout == 0)
- {
- //
- // 0 means "don't block" but a zero timeout doesn't mean
- // anything. We'll translate it to something ludicrously
- // short to provide a non-blocking affect.
- //
- timeout = 1;
- }
-
- if(timeout < 0)
- {
- readImpl(stream);
- }
- else
- {
- ReadThread t = new ReadThread(stream, timeout);
- t.start();
-
- //
- // This blocks until either an exception is thrown by
- // readImpl() or the timeout expires.
- //
- t.read();
- }
+ if(timeout == 0)
+ {
+ //
+ // 0 means "don't block" but a zero timeout doesn't mean
+ // anything. We'll translate it to something ludicrously
+ // short to provide a non-blocking affect.
+ //
+ timeout = 1;
+ }
+
+ if(timeout < 0)
+ {
+ readImpl(stream);
+ }
+ else
+ {
+ ReadThread t = new ReadThread(stream, timeout);
+ t.start();
+
+ //
+ // This blocks until either an exception is thrown by
+ // readImpl() or the timeout expires.
+ //
+ t.read();
+ }
}
protected void
readImpl(BasicStream stream)
{
- ByteBuffer buf = stream.prepareRead();
-
- int remaining = 0;
- if(_traceLevels.network >= 3)
- {
- remaining = buf.remaining();
- }
-
- byte[] data = buf.array();
-
- while(buf.hasRemaining() && !_shutdown)
- {
- int pos = buf.position();
- try
- {
- if(IceUtil.Debug.ASSERT)
- {
- IceUtil.Debug.Assert(_connection != null);
- }
- int ret = _in.read(data, pos, buf.remaining());
-
- if(ret == -1)
- {
- throw new Ice.ConnectionLostException();
- }
-
- if(ret > 0)
- {
- if(_traceLevels.network >= 3)
- {
- String s = "received " + ret + " of " + remaining + " bytes via tcp " + toString();
- _logger.trace(_traceLevels.networkCat, s);
- }
- buf.position(pos + ret);
- }
- }
- catch(java.io.InterruptedIOException ex)
- {
- if(ex.bytesTransferred > 0)
- {
- buf.position(pos + ex.bytesTransferred);
- }
- }
- catch(java.io.IOException ex)
- {
+ ByteBuffer buf = stream.prepareRead();
+
+ int remaining = 0;
+ if(_traceLevels.network >= 3)
+ {
+ remaining = buf.remaining();
+ }
+
+ byte[] data = buf.array();
+
+ while(buf.hasRemaining() && !_shutdown)
+ {
+ int pos = buf.position();
+ try
+ {
+ if(IceUtil.Debug.ASSERT)
+ {
+ IceUtil.Debug.Assert(_connection != null);
+ }
+ int ret = _in.read(data, pos, buf.remaining());
+
+ if(ret == -1)
+ {
+ throw new Ice.ConnectionLostException();
+ }
+
+ if(ret > 0)
+ {
+ if(_traceLevels.network >= 3)
+ {
+ String s = "received " + ret + " of " + remaining + " bytes via tcp " + toString();
+ _logger.trace(_traceLevels.networkCat, s);
+ }
+ buf.position(pos + ret);
+ }
+ }
+ catch(java.io.InterruptedIOException ex)
+ {
+ if(ex.bytesTransferred > 0)
+ {
+ buf.position(pos + ex.bytesTransferred);
+ }
+ }
+ catch(java.io.IOException ex)
+ {
Ice.ConnectionLostException se = new Ice.ConnectionLostException();
se.initCause(ex);
throw se;
- }
- }
+ }
+ }
- if(_shutdown)
- {
- throw new Ice.ConnectionLostException();
- }
+ if(_shutdown)
+ {
+ throw new Ice.ConnectionLostException();
+ }
}
public String
@@ -437,26 +437,26 @@ final public class Transceiver
_traceLevels = instance.traceLevels();
_logger = instance.initializationData().logger;
_desc = Network.toString(_connection);
- try
- {
- _in = _connection.openInputStream();
- _out = _connection.openOutputStream();
- }
- catch(java.io.IOException ex)
- {
- try
- {
- _connection.close();
- }
- catch(java.io.IOException e)
- {
- }
- _connection = null;
- Ice.SocketException se = new Ice.SocketException();
- se.initCause(ex);
- throw se;
- }
- _shutdown = false;
+ try
+ {
+ _in = _connection.openInputStream();
+ _out = _connection.openOutputStream();
+ }
+ catch(java.io.IOException ex)
+ {
+ try
+ {
+ _connection.close();
+ }
+ catch(java.io.IOException e)
+ {
+ }
+ _connection = null;
+ Ice.SocketException se = new Ice.SocketException();
+ se.initCause(ex);
+ throw se;
+ }
+ _shutdown = false;
}
protected synchronized void
diff --git a/javae/slice/IceE/Locator.ice b/javae/slice/IceE/Locator.ice
index 086f2d3a0cd..1018140af1e 100644
--- a/javae/slice/IceE/Locator.ice
+++ b/javae/slice/IceE/Locator.ice
@@ -91,7 +91,7 @@ interface Locator
*
**/
["nonmutating", "cpp:const"] idempotent Object* findObjectById(Ice::Identity id)
- throws ObjectNotFoundException;
+ throws ObjectNotFoundException;
/**
*
@@ -107,7 +107,7 @@ interface Locator
*
**/
["nonmutating", "cpp:const"] idempotent Object* findAdapterById(string id)
- throws AdapterNotFoundException;
+ throws AdapterNotFoundException;
/**
*
@@ -152,7 +152,7 @@ interface LocatorRegistry
*
**/
idempotent void setAdapterDirectProxy(string id, Object* proxy)
- throws AdapterNotFoundException, AdapterAlreadyActiveException;
+ throws AdapterNotFoundException, AdapterAlreadyActiveException;
/**
*
@@ -180,7 +180,7 @@ interface LocatorRegistry
*
**/
["amd"] idempotent void setReplicatedAdapterDirectProxy(string adapterId, string replicaGroupId, Object* proxy)
- throws AdapterNotFoundException, AdapterAlreadyActiveException, InvalidReplicaGroupIdException;
+ throws AdapterNotFoundException, AdapterAlreadyActiveException, InvalidReplicaGroupIdException;
};
};
diff --git a/javae/src/Ice/Communicator.java b/javae/src/Ice/Communicator.java
index fb22df234c2..5f650aee2ac 100644
--- a/javae/src/Ice/Communicator.java
+++ b/javae/src/Ice/Communicator.java
@@ -14,25 +14,25 @@ public final class Communicator
public void
destroy()
{
- _instance.destroy();
+ _instance.destroy();
}
public void
shutdown()
{
- _instance.objectAdapterFactory().shutdown();
+ _instance.objectAdapterFactory().shutdown();
}
public void
waitForShutdown()
{
- _instance.objectAdapterFactory().waitForShutdown();
+ _instance.objectAdapterFactory().waitForShutdown();
}
public boolean
isShutdown()
{
- return _instance.objectAdapterFactory().isShutdown();
+ return _instance.objectAdapterFactory().isShutdown();
}
public Ice.ObjectPrx
@@ -68,19 +68,19 @@ public final class Communicator
public ObjectAdapter
createObjectAdapter(String name)
{
- return createObjectAdapterWithEndpoints(name, getProperties().getProperty(name + ".Endpoints"));
+ return createObjectAdapterWithEndpoints(name, getProperties().getProperty(name + ".Endpoints"));
}
public ObjectAdapter
createObjectAdapterWithEndpoints(String name, String endpoints)
{
- return _instance.objectAdapterFactory().createObjectAdapter(name, endpoints, null);
+ return _instance.objectAdapterFactory().createObjectAdapter(name, endpoints, null);
}
public ObjectAdapter
createObjectAdapterWithRouter(String name, RouterPrx router)
{
- return _instance.objectAdapterFactory().createObjectAdapter(name, "", router);
+ return _instance.objectAdapterFactory().createObjectAdapter(name, "", router);
}
public Properties
@@ -137,15 +137,15 @@ public final class Communicator
void
finishSetup(StringSeqHolder args)
{
- try
- {
- _instance.finishSetup(args);
- }
- catch(RuntimeException ex)
- {
- _instance.destroy();
- throw ex;
- }
+ try
+ {
+ _instance.finishSetup(args);
+ }
+ catch(RuntimeException ex)
+ {
+ _instance.destroy();
+ throw ex;
+ }
}
//
diff --git a/javae/src/Ice/Connection.java b/javae/src/Ice/Connection.java
index a8ff932cacd..7d4604f08df 100644
--- a/javae/src/Ice/Connection.java
+++ b/javae/src/Ice/Connection.java
@@ -15,38 +15,38 @@ public final class Connection
synchronized public void
waitForValidation()
{
- while(_state == StateNotValidated)
- {
- try
- {
- wait();
- }
- catch(InterruptedException ex)
- {
- }
- }
-
- if(_state >= StateClosing)
- {
- if(IceUtil.Debug.ASSERT)
- {
- IceUtil.Debug.Assert(_exception != null);
- }
- throw _exception;
- }
+ while(_state == StateNotValidated)
+ {
+ try
+ {
+ wait();
+ }
+ catch(InterruptedException ex)
+ {
+ }
+ }
+
+ if(_state >= StateClosing)
+ {
+ if(IceUtil.Debug.ASSERT)
+ {
+ IceUtil.Debug.Assert(_exception != null);
+ }
+ throw _exception;
+ }
}
public synchronized void
activate()
{
- setState(StateActive);
+ setState(StateActive);
}
public synchronized void
hold()
{
- setState(StateHolding);
+ setState(StateHolding);
}
// DestructionReason.
@@ -56,444 +56,444 @@ public final class Connection
public synchronized void
destroy(int reason)
{
- switch(reason)
- {
- case ObjectAdapterDeactivated:
- {
- setState(StateClosing, new ObjectAdapterDeactivatedException());
- break;
- }
-
- case CommunicatorDestroyed:
- {
- setState(StateClosing, new CommunicatorDestroyedException());
- break;
- }
- }
+ switch(reason)
+ {
+ case ObjectAdapterDeactivated:
+ {
+ setState(StateClosing, new ObjectAdapterDeactivatedException());
+ break;
+ }
+
+ case CommunicatorDestroyed:
+ {
+ setState(StateClosing, new CommunicatorDestroyedException());
+ break;
+ }
+ }
}
public synchronized void
close(boolean force)
{
- if(force)
- {
- setState(StateClosed, new ForcedCloseConnectionException());
- }
- else
- {
- //
- // If we do a graceful shutdown, then we wait until all
- // outstanding requests have been completed. Otherwise,
- // the CloseConnectionException will cause all outstanding
- // requests to be retried, regardless of whether the
- // server has processed them or not.
- //
- while(!_requests.isEmpty())
- {
- try
- {
- wait();
- }
- catch(InterruptedException ex)
- {
- }
- }
-
- setState(StateClosing, new CloseConnectionException());
- }
+ if(force)
+ {
+ setState(StateClosed, new ForcedCloseConnectionException());
+ }
+ else
+ {
+ //
+ // If we do a graceful shutdown, then we wait until all
+ // outstanding requests have been completed. Otherwise,
+ // the CloseConnectionException will cause all outstanding
+ // requests to be retried, regardless of whether the
+ // server has processed them or not.
+ //
+ while(!_requests.isEmpty())
+ {
+ try
+ {
+ wait();
+ }
+ catch(InterruptedException ex)
+ {
+ }
+ }
+
+ setState(StateClosing, new CloseConnectionException());
+ }
}
public synchronized boolean
isDestroyed()
{
- return _state >= StateClosing;
+ return _state >= StateClosing;
}
public boolean
isFinished()
{
- Thread threadPerConnection = null;
-
- synchronized(this)
- {
- if(_transceiver != null || _dispatchCount != 0 ||
- (_threadPerConnection != null && _threadPerConnection.isAlive()))
- {
- return false;
- }
-
- if(IceUtil.Debug.ASSERT)
- {
- IceUtil.Debug.Assert(_state == StateClosed);
- }
-
- threadPerConnection = _threadPerConnection;
- _threadPerConnection = null;
- }
-
- if(threadPerConnection != null)
- {
- while(true)
- {
- try
- {
- threadPerConnection.join();
- break;
- }
- catch(InterruptedException ex)
- {
- }
- }
- }
-
- return true;
+ Thread threadPerConnection = null;
+
+ synchronized(this)
+ {
+ if(_transceiver != null || _dispatchCount != 0 ||
+ (_threadPerConnection != null && _threadPerConnection.isAlive()))
+ {
+ return false;
+ }
+
+ if(IceUtil.Debug.ASSERT)
+ {
+ IceUtil.Debug.Assert(_state == StateClosed);
+ }
+
+ threadPerConnection = _threadPerConnection;
+ _threadPerConnection = null;
+ }
+
+ if(threadPerConnection != null)
+ {
+ while(true)
+ {
+ try
+ {
+ threadPerConnection.join();
+ break;
+ }
+ catch(InterruptedException ex)
+ {
+ }
+ }
+ }
+
+ return true;
}
public synchronized void
throwException()
{
if(_exception != null)
- {
- IceUtil.Debug.Assert(_state >= StateClosing);
- throw _exception;
- }
+ {
+ IceUtil.Debug.Assert(_state >= StateClosing);
+ throw _exception;
+ }
}
public synchronized void
waitUntilHolding()
{
- while(_state < StateHolding || _dispatchCount > 0)
- {
- try
- {
- wait();
- }
- catch(InterruptedException ex)
- {
- }
+ while(_state < StateHolding || _dispatchCount > 0)
+ {
+ try
+ {
+ wait();
+ }
+ catch(InterruptedException ex)
+ {
+ }
}
}
public void
waitUntilFinished()
{
- Thread threadPerConnection = null;
-
- synchronized(this)
- {
- //
- // We wait indefinitely until connection closing has been
- // initiated. We also wait indefinitely until all outstanding
- // requests are completed. Otherwise we couldn't guarantee
- // that there are no outstanding calls when deactivate() is
- // called on the servant locators.
- //
- while(_state < StateClosing || _dispatchCount > 0)
- {
- try
- {
- wait();
- }
- catch(InterruptedException ex)
- {
- }
- }
-
- //
- // Now we must wait until close() has been called on the
- // transceiver.
- //
- while(_transceiver != null)
- {
- try
- {
- if(_state != StateClosed && _endpoint.timeout() >= 0)
- {
- long absoluteWaitTime = _stateTime + _endpoint.timeout();
- long waitTime = absoluteWaitTime - System.currentTimeMillis();
-
- if(waitTime > 0)
- {
- //
- // We must wait a bit longer until we close this
- // connection.
- //
- wait(waitTime);
- if(System.currentTimeMillis() >= absoluteWaitTime)
- {
- setState(StateClosed, new CloseTimeoutException());
- }
- }
- else
- {
- //
- // We already waited long enough, so let's close this
- // connection!
- //
- setState(StateClosed, new CloseTimeoutException());
- }
-
- //
- // No return here, we must still wait until
- // close() is called on the _transceiver.
- //
- }
- else
- {
- wait();
- }
- }
- catch(InterruptedException ex)
- {
- }
- }
-
- if(IceUtil.Debug.ASSERT)
- {
- IceUtil.Debug.Assert(_state == StateClosed);
- }
-
- threadPerConnection = _threadPerConnection;
- _threadPerConnection = null;
- }
-
- if(threadPerConnection != null)
- {
- while(true)
- {
- try
- {
- threadPerConnection.join();
- break;
- }
- catch(InterruptedException ex)
- {
- }
- }
- }
+ Thread threadPerConnection = null;
+
+ synchronized(this)
+ {
+ //
+ // We wait indefinitely until connection closing has been
+ // initiated. We also wait indefinitely until all outstanding
+ // requests are completed. Otherwise we couldn't guarantee
+ // that there are no outstanding calls when deactivate() is
+ // called on the servant locators.
+ //
+ while(_state < StateClosing || _dispatchCount > 0)
+ {
+ try
+ {
+ wait();
+ }
+ catch(InterruptedException ex)
+ {
+ }
+ }
+
+ //
+ // Now we must wait until close() has been called on the
+ // transceiver.
+ //
+ while(_transceiver != null)
+ {
+ try
+ {
+ if(_state != StateClosed && _endpoint.timeout() >= 0)
+ {
+ long absoluteWaitTime = _stateTime + _endpoint.timeout();
+ long waitTime = absoluteWaitTime - System.currentTimeMillis();
+
+ if(waitTime > 0)
+ {
+ //
+ // We must wait a bit longer until we close this
+ // connection.
+ //
+ wait(waitTime);
+ if(System.currentTimeMillis() >= absoluteWaitTime)
+ {
+ setState(StateClosed, new CloseTimeoutException());
+ }
+ }
+ else
+ {
+ //
+ // We already waited long enough, so let's close this
+ // connection!
+ //
+ setState(StateClosed, new CloseTimeoutException());
+ }
+
+ //
+ // No return here, we must still wait until
+ // close() is called on the _transceiver.
+ //
+ }
+ else
+ {
+ wait();
+ }
+ }
+ catch(InterruptedException ex)
+ {
+ }
+ }
+
+ if(IceUtil.Debug.ASSERT)
+ {
+ IceUtil.Debug.Assert(_state == StateClosed);
+ }
+
+ threadPerConnection = _threadPerConnection;
+ _threadPerConnection = null;
+ }
+
+ if(threadPerConnection != null)
+ {
+ while(true)
+ {
+ try
+ {
+ threadPerConnection.join();
+ break;
+ }
+ catch(InterruptedException ex)
+ {
+ }
+ }
+ }
}
public void
sendRequest(IceInternal.BasicStream os, IceInternal.Outgoing out)
throws IceInternal.LocalExceptionWrapper
{
- boolean requestSent = false;
- try
- {
- synchronized(_sendMonitor)
- {
- if(_transceiver == null)
- {
- if(IceUtil.Debug.ASSERT)
- {
- IceUtil.Debug.Assert(_exception != null);
-
- }
- throw new IceInternal.LocalExceptionWrapper(_exception, true);
- }
-
- int requestId = 0;
- if(out != null)
- {
- //
- // Create a new unique request ID.
- //
- requestId = _nextRequestId++;
- if(requestId <= 0)
- {
- _nextRequestId = 1;
- requestId = _nextRequestId++;
- }
-
- //
- // Fill in the request ID.
- //
- os.pos(IceInternal.Protocol.headerSize);
- os.writeInt(requestId);
-
- _requests.put(requestId, out);
- }
-
- //
- // Fill in the message size.
- //
- os.pos(10);
- os.writeInt(os.size());
-
- //
- // Send the request.
- //
- IceInternal.TraceUtil.traceRequest("sending request", os, _logger, _traceLevels);
- _transceiver.write(os, _endpoint.timeout());
- requestSent = true;
-
- if(out == null)
- {
- return;
- }
-
- if(_blocking)
- {
- //
- // Re-use the stream for reading the reply.
- //
- os.reset();
-
- //
- // Read the reply.
- //
- MessageInfo info = new MessageInfo();
- readStreamAndParseMessage(os, info);
- if(info.invokeNum > 0)
- {
- Ice.Util.throwUnknownMessageException();
- }
- else if(info.requestId != requestId)
- {
- Ice.Util.throwUnknownRequestIdException();
- }
-
- out.finished(os);
- }
- else
- {
- //
- // Wait until the request has completed, or until the
- // request times out.
- //
- int tout = timeout();
- long expireTime = 0;
- if(tout > 0)
- {
- expireTime = System.currentTimeMillis() + tout;
- }
-
- while(out.state() == IceInternal.Outgoing.StateInProgress)
- {
- try
- {
- if(tout > 0)
- {
- long now = System.currentTimeMillis();
- if(now < expireTime)
- {
- _sendMonitor.wait(expireTime - now);
- }
-
- //
- // Make sure we woke up because of timeout and not another response.
- //
- if(out.state() == IceInternal.Outgoing.StateInProgress &&
- System.currentTimeMillis() > expireTime)
- {
- throw new TimeoutException();
- }
- }
- else
- {
- _sendMonitor.wait();
- }
- }
- catch(InterruptedException ex)
- {
- }
- }
- }
- }
- }
- catch(LocalException ex)
- {
- synchronized(this)
- {
- setState(StateClosed, ex);
- if(IceUtil.Debug.ASSERT)
- {
- IceUtil.Debug.Assert(_exception != null);
- }
- if(!requestSent)
- {
- throw _exception;
- }
- }
-
- //
- // If the request was already sent, we don't throw
- // directly but instead we set the Outgoing object
- // exception with finished(). Throwing directly would
- // break "at-most-once" (see also comment in
- // Outgoing.invoke())
- //
- synchronized(_sendMonitor)
- {
- if(_blocking)
- {
- out.finished(ex);
- }
- else
- {
- // Wait for the connection thread to propagate the exception
- // to the Outgoing object.
- while(out.state() == IceInternal.Outgoing.StateInProgress)
- {
- try
- {
- _sendMonitor.wait();
- }
- catch(java.lang.InterruptedException e)
- {
- }
- }
- }
- }
- }
+ boolean requestSent = false;
+ try
+ {
+ synchronized(_sendMonitor)
+ {
+ if(_transceiver == null)
+ {
+ if(IceUtil.Debug.ASSERT)
+ {
+ IceUtil.Debug.Assert(_exception != null);
+
+ }
+ throw new IceInternal.LocalExceptionWrapper(_exception, true);
+ }
+
+ int requestId = 0;
+ if(out != null)
+ {
+ //
+ // Create a new unique request ID.
+ //
+ requestId = _nextRequestId++;
+ if(requestId <= 0)
+ {
+ _nextRequestId = 1;
+ requestId = _nextRequestId++;
+ }
+
+ //
+ // Fill in the request ID.
+ //
+ os.pos(IceInternal.Protocol.headerSize);
+ os.writeInt(requestId);
+
+ _requests.put(requestId, out);
+ }
+
+ //
+ // Fill in the message size.
+ //
+ os.pos(10);
+ os.writeInt(os.size());
+
+ //
+ // Send the request.
+ //
+ IceInternal.TraceUtil.traceRequest("sending request", os, _logger, _traceLevels);
+ _transceiver.write(os, _endpoint.timeout());
+ requestSent = true;
+
+ if(out == null)
+ {
+ return;
+ }
+
+ if(_blocking)
+ {
+ //
+ // Re-use the stream for reading the reply.
+ //
+ os.reset();
+
+ //
+ // Read the reply.
+ //
+ MessageInfo info = new MessageInfo();
+ readStreamAndParseMessage(os, info);
+ if(info.invokeNum > 0)
+ {
+ Ice.Util.throwUnknownMessageException();
+ }
+ else if(info.requestId != requestId)
+ {
+ Ice.Util.throwUnknownRequestIdException();
+ }
+
+ out.finished(os);
+ }
+ else
+ {
+ //
+ // Wait until the request has completed, or until the
+ // request times out.
+ //
+ int tout = timeout();
+ long expireTime = 0;
+ if(tout > 0)
+ {
+ expireTime = System.currentTimeMillis() + tout;
+ }
+
+ while(out.state() == IceInternal.Outgoing.StateInProgress)
+ {
+ try
+ {
+ if(tout > 0)
+ {
+ long now = System.currentTimeMillis();
+ if(now < expireTime)
+ {
+ _sendMonitor.wait(expireTime - now);
+ }
+
+ //
+ // Make sure we woke up because of timeout and not another response.
+ //
+ if(out.state() == IceInternal.Outgoing.StateInProgress &&
+ System.currentTimeMillis() > expireTime)
+ {
+ throw new TimeoutException();
+ }
+ }
+ else
+ {
+ _sendMonitor.wait();
+ }
+ }
+ catch(InterruptedException ex)
+ {
+ }
+ }
+ }
+ }
+ }
+ catch(LocalException ex)
+ {
+ synchronized(this)
+ {
+ setState(StateClosed, ex);
+ if(IceUtil.Debug.ASSERT)
+ {
+ IceUtil.Debug.Assert(_exception != null);
+ }
+ if(!requestSent)
+ {
+ throw _exception;
+ }
+ }
+
+ //
+ // If the request was already sent, we don't throw
+ // directly but instead we set the Outgoing object
+ // exception with finished(). Throwing directly would
+ // break "at-most-once" (see also comment in
+ // Outgoing.invoke())
+ //
+ synchronized(_sendMonitor)
+ {
+ if(_blocking)
+ {
+ out.finished(ex);
+ }
+ else
+ {
+ // Wait for the connection thread to propagate the exception
+ // to the Outgoing object.
+ while(out.state() == IceInternal.Outgoing.StateInProgress)
+ {
+ try
+ {
+ _sendMonitor.wait();
+ }
+ catch(java.lang.InterruptedException e)
+ {
+ }
+ }
+ }
+ }
+ }
}
public synchronized void
prepareBatchRequest(IceInternal.BasicStream os)
{
- while(_batchStreamInUse && _exception == null)
- {
- try
- {
- wait();
- }
- catch(InterruptedException ex)
- {
- }
- }
+ while(_batchStreamInUse && _exception == null)
+ {
+ try
+ {
+ wait();
+ }
+ catch(InterruptedException ex)
+ {
+ }
+ }
if(_exception != null)
{
throw _exception;
}
- if(IceUtil.Debug.ASSERT)
- {
- IceUtil.Debug.Assert(_state > StateNotValidated);
- IceUtil.Debug.Assert(_state < StateClosing);
- }
+ if(IceUtil.Debug.ASSERT)
+ {
+ IceUtil.Debug.Assert(_state > StateNotValidated);
+ IceUtil.Debug.Assert(_state < StateClosing);
+ }
if(_batchStream.isEmpty())
{
- try
- {
- _batchStream.writeBlob(IceInternal.Protocol.requestBatchHdr);
- }
- catch(LocalException ex)
- {
- setState(StateClosed, ex);
- throw ex;
- }
+ try
+ {
+ _batchStream.writeBlob(IceInternal.Protocol.requestBatchHdr);
+ }
+ catch(LocalException ex)
+ {
+ setState(StateClosed, ex);
+ throw ex;
+ }
}
_batchStreamInUse = true;
_batchMarker = _batchStream.size();
- _batchStream.swap(os);
+ _batchStream.swap(os);
- //
- // The batch stream now belongs to the caller, until
- // finishBatchRequest() or abortBatchRequest() is called.
- //
+ //
+ // The batch stream now belongs to the caller, until
+ // finishBatchRequest() or abortBatchRequest() is called.
+ //
}
public void
@@ -554,10 +554,10 @@ public final class Connection
//
// Notify about the batch stream not being in use anymore.
//
- if(IceUtil.Debug.ASSERT)
- {
- IceUtil.Debug.Assert(_batchStreamInUse);
- }
+ if(IceUtil.Debug.ASSERT)
+ {
+ IceUtil.Debug.Assert(_batchStreamInUse);
+ }
_batchStreamInUse = false;
notifyAll();
}
@@ -628,107 +628,107 @@ public final class Connection
private void
flushBatchRequestsInternal(boolean ignoreInUse)
{
- synchronized(this)
- {
+ synchronized(this)
+ {
if(!ignoreInUse)
{
- while(_batchStreamInUse && _exception == null)
- {
- try
- {
- wait();
- }
- catch(InterruptedException ex)
- {
- }
- }
- }
-
- if(_exception != null)
- {
- throw _exception;
- }
-
- if(_batchStream.isEmpty())
- {
- return; // Nothing to do.
- }
-
- if(IceUtil.Debug.ASSERT)
- {
- IceUtil.Debug.Assert(_state > StateNotValidated);
- IceUtil.Debug.Assert(_state < StateClosing);
- }
-
- //
- // Fill in the message size.
- //
- _batchStream.pos(10);
- _batchStream.writeInt(_batchStream.size());
-
- //
- // Fill in the number of requests in the batch.
- //
- _batchStream.writeInt(_batchRequestNum);
-
- //
- // Compression not supported.
- //
- _batchStream.pos(9);
- _batchStream.writeByte((byte)(0));
-
- //
- // Prevent that new batch requests are added while we are
- // flushing.
- //
- _batchStreamInUse = true;
- }
-
- try
- {
- synchronized(_sendMonitor)
- {
- if(_transceiver == null) // Has the transceiver already been closed?
- {
- if(IceUtil.Debug.ASSERT)
- {
- IceUtil.Debug.Assert(_exception != null);
- }
- throw _exception; // The exception is immutable at this point.
- }
-
- //
- // Send the batch request.
- //
- IceInternal.TraceUtil.traceBatchRequest("sending batch request", _batchStream, _logger, _traceLevels);
- _transceiver.write(_batchStream, _endpoint.timeout());
- }
- }
- catch(LocalException ex)
- {
- synchronized(this)
- {
- setState(StateClosed, ex);
- if(IceUtil.Debug.ASSERT)
- {
- IceUtil.Debug.Assert(_exception != null);
- }
-
- //
- // Since batch requests are all oneways, we
- // must report the exception to the caller.
- //
- throw _exception;
- }
- }
-
- synchronized(this)
- {
- //
- // Reset the batch stream, and notify that flushing is over.
- //
+ while(_batchStreamInUse && _exception == null)
+ {
+ try
+ {
+ wait();
+ }
+ catch(InterruptedException ex)
+ {
+ }
+ }
+ }
+
+ if(_exception != null)
+ {
+ throw _exception;
+ }
+
+ if(_batchStream.isEmpty())
+ {
+ return; // Nothing to do.
+ }
+
+ if(IceUtil.Debug.ASSERT)
+ {
+ IceUtil.Debug.Assert(_state > StateNotValidated);
+ IceUtil.Debug.Assert(_state < StateClosing);
+ }
+
+ //
+ // Fill in the message size.
+ //
+ _batchStream.pos(10);
+ _batchStream.writeInt(_batchStream.size());
+
+ //
+ // Fill in the number of requests in the batch.
+ //
+ _batchStream.writeInt(_batchRequestNum);
+
+ //
+ // Compression not supported.
+ //
+ _batchStream.pos(9);
+ _batchStream.writeByte((byte)(0));
+
+ //
+ // Prevent that new batch requests are added while we are
+ // flushing.
+ //
+ _batchStreamInUse = true;
+ }
+
+ try
+ {
+ synchronized(_sendMonitor)
+ {
+ if(_transceiver == null) // Has the transceiver already been closed?
+ {
+ if(IceUtil.Debug.ASSERT)
+ {
+ IceUtil.Debug.Assert(_exception != null);
+ }
+ throw _exception; // The exception is immutable at this point.
+ }
+
+ //
+ // Send the batch request.
+ //
+ IceInternal.TraceUtil.traceBatchRequest("sending batch request", _batchStream, _logger, _traceLevels);
+ _transceiver.write(_batchStream, _endpoint.timeout());
+ }
+ }
+ catch(LocalException ex)
+ {
+ synchronized(this)
+ {
+ setState(StateClosed, ex);
+ if(IceUtil.Debug.ASSERT)
+ {
+ IceUtil.Debug.Assert(_exception != null);
+ }
+
+ //
+ // Since batch requests are all oneways, we
+ // must report the exception to the caller.
+ //
+ throw _exception;
+ }
+ }
+
+ synchronized(this)
+ {
+ //
+ // Reset the batch stream, and notify that flushing is over.
+ //
resetBatch(!ignoreInUse);
- }
+ }
}
private void
@@ -754,96 +754,96 @@ public final class Connection
public void
sendResponse(IceInternal.BasicStream os)
{
- try
- {
- synchronized(_sendMonitor)
- {
- if(_transceiver == null) // Has the transceiver already been closed?
- {
- if(IceUtil.Debug.ASSERT)
- {
- IceUtil.Debug.Assert(_exception != null);
- }
- throw _exception; // The exception is immutable at this point.
- }
-
- //
- // Compression not supported.
- //
- os.pos(9);
- os.writeByte((byte)(0));
-
- //
- // Fill in the message size.
- //
- os.pos(10);
- os.writeInt(os.size());
-
- //
- // Send the reply.
- //
- IceInternal.TraceUtil.traceReply("sending reply", os, _logger, _traceLevels);
- _transceiver.write(os, _endpoint.timeout());
- }
- }
- catch(LocalException ex)
- {
- synchronized(this)
- {
- setState(StateClosed, ex);
- }
- }
-
- synchronized(this)
- {
- if(IceUtil.Debug.ASSERT)
- {
- IceUtil.Debug.Assert(_state > StateNotValidated);
- }
-
- try
- {
- if(--_dispatchCount == 0)
- {
- notifyAll();
- }
-
- if(_state == StateClosing && _dispatchCount == 0)
- {
- initiateShutdown();
- }
- }
- catch(LocalException ex)
- {
- setState(StateClosed, ex);
- }
- }
+ try
+ {
+ synchronized(_sendMonitor)
+ {
+ if(_transceiver == null) // Has the transceiver already been closed?
+ {
+ if(IceUtil.Debug.ASSERT)
+ {
+ IceUtil.Debug.Assert(_exception != null);
+ }
+ throw _exception; // The exception is immutable at this point.
+ }
+
+ //
+ // Compression not supported.
+ //
+ os.pos(9);
+ os.writeByte((byte)(0));
+
+ //
+ // Fill in the message size.
+ //
+ os.pos(10);
+ os.writeInt(os.size());
+
+ //
+ // Send the reply.
+ //
+ IceInternal.TraceUtil.traceReply("sending reply", os, _logger, _traceLevels);
+ _transceiver.write(os, _endpoint.timeout());
+ }
+ }
+ catch(LocalException ex)
+ {
+ synchronized(this)
+ {
+ setState(StateClosed, ex);
+ }
+ }
+
+ synchronized(this)
+ {
+ if(IceUtil.Debug.ASSERT)
+ {
+ IceUtil.Debug.Assert(_state > StateNotValidated);
+ }
+
+ try
+ {
+ if(--_dispatchCount == 0)
+ {
+ notifyAll();
+ }
+
+ if(_state == StateClosing && _dispatchCount == 0)
+ {
+ initiateShutdown();
+ }
+ }
+ catch(LocalException ex)
+ {
+ setState(StateClosed, ex);
+ }
+ }
}
public synchronized void
sendNoResponse()
{
- if(IceUtil.Debug.ASSERT)
- {
- IceUtil.Debug.Assert(_state > StateNotValidated);
- }
-
- try
- {
- if(--_dispatchCount == 0)
- {
- notifyAll();
- }
-
- if(_state == StateClosing && _dispatchCount == 0)
- {
- initiateShutdown();
- }
- }
- catch(LocalException ex)
- {
- setState(StateClosed, ex);
- }
+ if(IceUtil.Debug.ASSERT)
+ {
+ IceUtil.Debug.Assert(_state > StateNotValidated);
+ }
+
+ try
+ {
+ if(--_dispatchCount == 0)
+ {
+ notifyAll();
+ }
+
+ if(_state == StateClosing && _dispatchCount == 0)
+ {
+ initiateShutdown();
+ }
+ }
+ catch(LocalException ex)
+ {
+ setState(StateClosed, ex);
+ }
}
public IceInternal.Endpoint
@@ -857,44 +857,44 @@ public final class Connection
setAdapter(ObjectAdapter adapter)
{
if(_blocking)
- {
- FeatureNotSupportedException ex = new FeatureNotSupportedException();
- ex.unsupportedFeature = "setAdapter with blocking connection";
- throw ex;
- }
-
- //
- // Wait for all the incoming to be dispatched (to be consistent
- // with IceE).
- //
- while(_dispatchCount > 0)
- {
- try
- {
- wait();
- }
- catch(InterruptedException ex)
- {
- }
- }
-
- if(_exception != null)
- {
- throw _exception;
- }
-
- if(IceUtil.Debug.ASSERT)
- {
- IceUtil.Debug.Assert(_state < StateClosing);
- }
-
- _in.setAdapter(adapter);
+ {
+ FeatureNotSupportedException ex = new FeatureNotSupportedException();
+ ex.unsupportedFeature = "setAdapter with blocking connection";
+ throw ex;
+ }
+
+ //
+ // Wait for all the incoming to be dispatched (to be consistent
+ // with IceE).
+ //
+ while(_dispatchCount > 0)
+ {
+ try
+ {
+ wait();
+ }
+ catch(InterruptedException ex)
+ {
+ }
+ }
+
+ if(_exception != null)
+ {
+ throw _exception;
+ }
+
+ if(IceUtil.Debug.ASSERT)
+ {
+ IceUtil.Debug.Assert(_state < StateClosing);
+ }
+
+ _in.setAdapter(adapter);
}
public synchronized ObjectAdapter
getAdapter()
{
- return _in.getAdapter();
+ return _in.getAdapter();
}
public synchronized ObjectPrx
@@ -914,91 +914,91 @@ public final class Connection
public String
type()
{
- return _type; // No mutex lock, _type is immutable.
+ return _type; // No mutex lock, _type is immutable.
}
public int
timeout()
{
- return _endpoint.timeout(); // No mutex protection necessary, _endpoint is immutable.
+ return _endpoint.timeout(); // No mutex protection necessary, _endpoint is immutable.
}
public String
toString()
{
- return _desc; // No mutex lock, _desc is immutable.
+ return _desc; // No mutex lock, _desc is immutable.
}
public Connection(IceInternal.Instance instance, IceInternal.Transceiver transceiver,
- IceInternal.Endpoint endpoint, ObjectAdapter adapter)
+ IceInternal.Endpoint endpoint, ObjectAdapter adapter)
{
_instance = instance;
_transceiver = transceiver;
- _desc = transceiver.toString();
+ _desc = transceiver.toString();
_type = transceiver.type();
_endpoint = endpoint;
_logger = instance.initializationData().logger; // Cached for better performance.
_traceLevels = instance.traceLevels(); // Cached for better performance.
- _warn = _instance.initializationData().properties.getPropertyAsInt("Ice.Warn.Connections") > 0 ? true : false;
+ _warn = _instance.initializationData().properties.getPropertyAsInt("Ice.Warn.Connections") > 0 ? true : false;
_nextRequestId = 1;
_batchAutoFlush = _instance.initializationData().properties.getPropertyAsIntWithDefault(
"Ice.BatchAutoFlush", 1) > 0 ? true : false;
_batchStream = new IceInternal.BasicStream(instance, _batchAutoFlush);
- _batchStreamInUse = false;
- _batchRequestNum = 0;
+ _batchStreamInUse = false;
+ _batchRequestNum = 0;
_dispatchCount = 0;
_state = StateNotValidated;
- _stateTime = System.currentTimeMillis();
- _blocking = _instance.initializationData().properties.getPropertyAsInt("Ice.Blocking") > 0 && adapter == null;
- _stream = new IceInternal.BasicStream(_instance);
- _in = new IceInternal.Incoming(_instance, this, _stream, adapter);
-
- if(_blocking)
- {
- validate();
- }
- else
- {
- try
- {
- //
- // If we are in thread per connection mode, create the thread
- // for this connection.
- //
- _threadPerConnection = new ThreadPerConnection(this);
- _threadPerConnection.start();
- }
- catch(java.lang.Exception ex)
- {
- ex.printStackTrace();
- String s = "cannot create thread for connection:\n";;
- s += ex.toString();
- _logger.error(s);
-
- try
- {
- _transceiver.close();
- }
- catch(LocalException e)
- {
- // Here we ignore any exceptions in close().
- }
-
- Ice.SyscallException e = new Ice.SyscallException();
- e.initCause(ex);
- throw e;
- }
- }
+ _stateTime = System.currentTimeMillis();
+ _blocking = _instance.initializationData().properties.getPropertyAsInt("Ice.Blocking") > 0 && adapter == null;
+ _stream = new IceInternal.BasicStream(_instance);
+ _in = new IceInternal.Incoming(_instance, this, _stream, adapter);
+
+ if(_blocking)
+ {
+ validate();
+ }
+ else
+ {
+ try
+ {
+ //
+ // If we are in thread per connection mode, create the thread
+ // for this connection.
+ //
+ _threadPerConnection = new ThreadPerConnection(this);
+ _threadPerConnection.start();
+ }
+ catch(java.lang.Exception ex)
+ {
+ ex.printStackTrace();
+ String s = "cannot create thread for connection:\n";;
+ s += ex.toString();
+ _logger.error(s);
+
+ try
+ {
+ _transceiver.close();
+ }
+ catch(LocalException e)
+ {
+ // Here we ignore any exceptions in close().
+ }
+
+ Ice.SyscallException e = new Ice.SyscallException();
+ e.initCause(ex);
+ throw e;
+ }
+ }
}
protected synchronized void
finalize()
throws Throwable
{
- IceUtil.Debug.FinalizerAssert(_state == StateClosed);
- IceUtil.Debug.FinalizerAssert(_transceiver == null);
- IceUtil.Debug.FinalizerAssert(_dispatchCount == 0);
- IceUtil.Debug.FinalizerAssert(_threadPerConnection == null);
+ IceUtil.Debug.FinalizerAssert(_state == StateClosed);
+ IceUtil.Debug.FinalizerAssert(_transceiver == null);
+ IceUtil.Debug.FinalizerAssert(_dispatchCount == 0);
+ IceUtil.Debug.FinalizerAssert(_threadPerConnection == null);
}
private static final int StateNotValidated = 0;
@@ -1010,153 +1010,153 @@ public final class Connection
private void
validate()
{
- boolean active;
-
- synchronized(this)
- {
- if(IceUtil.Debug.ASSERT)
- {
- IceUtil.Debug.Assert(_state == StateNotValidated || _state == StateClosed);
- }
- if(_state == StateClosed)
- {
- if(IceUtil.Debug.ASSERT)
- {
- IceUtil.Debug.Assert(_exception != null);
- }
- throw _exception;
- }
-
- if(_in.getAdapter() != null)
- {
- active = true; // The server side has the active role for connection validation.
- }
- else
- {
- active = false; // The client side has the passive role for connection validation.
- }
- }
-
- try
- {
- int timeout;
- IceInternal.DefaultsAndOverrides defaultsAndOverrides = _instance.defaultsAndOverrides();
- if(defaultsAndOverrides.overrideConnectTimeout)
- {
- timeout = defaultsAndOverrides.overrideConnectTimeoutValue;
- }
- else
- {
- timeout = _endpoint.timeout();
- }
-
- if(active)
- {
- synchronized(_sendMonitor)
- {
- IceInternal.BasicStream os = new IceInternal.BasicStream(_instance);
- os.writeBlob(IceInternal.Protocol.magic);
- os.writeByte(IceInternal.Protocol.protocolMajor);
- os.writeByte(IceInternal.Protocol.protocolMinor);
- os.writeByte(IceInternal.Protocol.encodingMajor);
- os.writeByte(IceInternal.Protocol.encodingMinor);
- os.writeByte(IceInternal.Protocol.validateConnectionMsg);
- os.writeByte((byte)0); // Compression status (always zero for validate connection).
- os.writeInt(IceInternal.Protocol.headerSize); // Message size.
- IceInternal.TraceUtil.traceHeader("sending validate connection", os, _logger, _traceLevels);
- try
- {
- _transceiver.write(os, timeout);
- }
- catch(Ice.TimeoutException ex)
- {
- throw new Ice.ConnectTimeoutException();
- }
- }
- }
- else
- {
- IceInternal.BasicStream is = new IceInternal.BasicStream(_instance);
- is.resize(IceInternal.Protocol.headerSize, true);
- is.pos(0);
- try
- {
- _transceiver.read(is, timeout);
- }
- catch(Ice.TimeoutException ex)
- {
- throw new Ice.ConnectTimeoutException();
- }
- if(IceUtil.Debug.ASSERT)
- {
- IceUtil.Debug.Assert(is.pos() == IceInternal.Protocol.headerSize);
- }
- is.pos(0);
- byte[] m = is.readBlob(4);
- if(m[0] != IceInternal.Protocol.magic[0] || m[1] != IceInternal.Protocol.magic[1] ||
- m[2] != IceInternal.Protocol.magic[2] || m[3] != IceInternal.Protocol.magic[3])
- {
+ boolean active;
+
+ synchronized(this)
+ {
+ if(IceUtil.Debug.ASSERT)
+ {
+ IceUtil.Debug.Assert(_state == StateNotValidated || _state == StateClosed);
+ }
+ if(_state == StateClosed)
+ {
+ if(IceUtil.Debug.ASSERT)
+ {
+ IceUtil.Debug.Assert(_exception != null);
+ }
+ throw _exception;
+ }
+
+ if(_in.getAdapter() != null)
+ {
+ active = true; // The server side has the active role for connection validation.
+ }
+ else
+ {
+ active = false; // The client side has the passive role for connection validation.
+ }
+ }
+
+ try
+ {
+ int timeout;
+ IceInternal.DefaultsAndOverrides defaultsAndOverrides = _instance.defaultsAndOverrides();
+ if(defaultsAndOverrides.overrideConnectTimeout)
+ {
+ timeout = defaultsAndOverrides.overrideConnectTimeoutValue;
+ }
+ else
+ {
+ timeout = _endpoint.timeout();
+ }
+
+ if(active)
+ {
+ synchronized(_sendMonitor)
+ {
+ IceInternal.BasicStream os = new IceInternal.BasicStream(_instance);
+ os.writeBlob(IceInternal.Protocol.magic);
+ os.writeByte(IceInternal.Protocol.protocolMajor);
+ os.writeByte(IceInternal.Protocol.protocolMinor);
+ os.writeByte(IceInternal.Protocol.encodingMajor);
+ os.writeByte(IceInternal.Protocol.encodingMinor);
+ os.writeByte(IceInternal.Protocol.validateConnectionMsg);
+ os.writeByte((byte)0); // Compression status (always zero for validate connection).
+ os.writeInt(IceInternal.Protocol.headerSize); // Message size.
+ IceInternal.TraceUtil.traceHeader("sending validate connection", os, _logger, _traceLevels);
+ try
+ {
+ _transceiver.write(os, timeout);
+ }
+ catch(Ice.TimeoutException ex)
+ {
+ throw new Ice.ConnectTimeoutException();
+ }
+ }
+ }
+ else
+ {
+ IceInternal.BasicStream is = new IceInternal.BasicStream(_instance);
+ is.resize(IceInternal.Protocol.headerSize, true);
+ is.pos(0);
+ try
+ {
+ _transceiver.read(is, timeout);
+ }
+ catch(Ice.TimeoutException ex)
+ {
+ throw new Ice.ConnectTimeoutException();
+ }
+ if(IceUtil.Debug.ASSERT)
+ {
+ IceUtil.Debug.Assert(is.pos() == IceInternal.Protocol.headerSize);
+ }
+ is.pos(0);
+ byte[] m = is.readBlob(4);
+ if(m[0] != IceInternal.Protocol.magic[0] || m[1] != IceInternal.Protocol.magic[1] ||
+ m[2] != IceInternal.Protocol.magic[2] || m[3] != IceInternal.Protocol.magic[3])
+ {
Ice.Util.throwBadMagicException(m);
- }
- byte pMajor = is.readByte();
- byte pMinor = is.readByte();
- if(pMajor != IceInternal.Protocol.protocolMajor)
- {
+ }
+ byte pMajor = is.readByte();
+ byte pMinor = is.readByte();
+ if(pMajor != IceInternal.Protocol.protocolMajor)
+ {
Ice.Util.throwUnsupportedProtocolException(pMajor, pMinor);
- }
- byte eMajor = is.readByte();
- byte eMinor = is.readByte();
- if(eMajor != IceInternal.Protocol.encodingMajor)
- {
+ }
+ byte eMajor = is.readByte();
+ byte eMinor = is.readByte();
+ if(eMajor != IceInternal.Protocol.encodingMajor)
+ {
Ice.Util.throwUnsupportedEncodingException(eMajor, eMinor);
- }
- byte messageType = is.readByte();
- if(messageType != IceInternal.Protocol.validateConnectionMsg)
- {
- Ice.Util.throwConnectionNotValidatedException();
- }
- byte compress = is.readByte(); // Ignore compression status for validate connection.
- int size = is.readInt();
- if(size != IceInternal.Protocol.headerSize)
- {
- Ice.Util.throwIllegalMessageSizeException();
- }
- IceInternal.TraceUtil.traceHeader("received validate connection", is, _logger, _traceLevels);
- }
- }
- catch(LocalException ex)
- {
- synchronized(this)
- {
- setState(StateClosed, ex);
- if(IceUtil.Debug.ASSERT)
- {
- IceUtil.Debug.Assert(_exception != null);
- }
- throw _exception;
- }
- }
-
- synchronized(this)
- {
- //
- // We start out in holding state.
- //
- setState(StateHolding);
- }
+ }
+ byte messageType = is.readByte();
+ if(messageType != IceInternal.Protocol.validateConnectionMsg)
+ {
+ Ice.Util.throwConnectionNotValidatedException();
+ }
+ byte compress = is.readByte(); // Ignore compression status for validate connection.
+ int size = is.readInt();
+ if(size != IceInternal.Protocol.headerSize)
+ {
+ Ice.Util.throwIllegalMessageSizeException();
+ }
+ IceInternal.TraceUtil.traceHeader("received validate connection", is, _logger, _traceLevels);
+ }
+ }
+ catch(LocalException ex)
+ {
+ synchronized(this)
+ {
+ setState(StateClosed, ex);
+ if(IceUtil.Debug.ASSERT)
+ {
+ IceUtil.Debug.Assert(_exception != null);
+ }
+ throw _exception;
+ }
+ }
+
+ synchronized(this)
+ {
+ //
+ // We start out in holding state.
+ //
+ setState(StateHolding);
+ }
}
private void
setState(int state, LocalException ex)
{
- //
- // If setState() is called with an exception, then only closed
- // and closing states are permissible.
- //
- if(IceUtil.Debug.ASSERT)
- {
- IceUtil.Debug.Assert(state == StateClosing || state == StateClosed);
- }
+ //
+ // If setState() is called with an exception, then only closed
+ // and closing states are permissible.
+ //
+ if(IceUtil.Debug.ASSERT)
+ {
+ IceUtil.Debug.Assert(state == StateClosing || state == StateClosed);
+ }
if(_state == state) // Don't switch twice.
{
@@ -1165,48 +1165,48 @@ public final class Connection
if(_exception == null)
{
- _exception = ex;
+ _exception = ex;
if(_warn)
{
- //
- // We don't warn if we are not validated.
- //
- if(_state > StateNotValidated)
- {
- //
- // Don't warn about certain expected exceptions.
- //
- if(!(_exception instanceof CloseConnectionException ||
- _exception instanceof ForcedCloseConnectionException ||
- _exception instanceof CommunicatorDestroyedException ||
- _exception instanceof ObjectAdapterDeactivatedException ||
- (_exception instanceof ConnectionLostException && _state == StateClosing)))
- {
- warning("connection exception", _exception);
- }
- }
- }
- }
-
- //
- // We must set the new state before we notify requests of any
- // exceptions. Otherwise new requests may retry on a
- // connection that is not yet marked as closed or closing.
- //
+ //
+ // We don't warn if we are not validated.
+ //
+ if(_state > StateNotValidated)
+ {
+ //
+ // Don't warn about certain expected exceptions.
+ //
+ if(!(_exception instanceof CloseConnectionException ||
+ _exception instanceof ForcedCloseConnectionException ||
+ _exception instanceof CommunicatorDestroyedException ||
+ _exception instanceof ObjectAdapterDeactivatedException ||
+ (_exception instanceof ConnectionLostException && _state == StateClosing)))
+ {
+ warning("connection exception", _exception);
+ }
+ }
+ }
+ }
+
+ //
+ // We must set the new state before we notify requests of any
+ // exceptions. Otherwise new requests may retry on a
+ // connection that is not yet marked as closed or closing.
+ //
setState(state);
}
private void
setState(int state)
{
- //
- // Skip graceful shutdown if we are destroyed before validation.
- //
- if(_state == StateNotValidated && state == StateClosing)
- {
- state = StateClosed;
- }
+ //
+ // Skip graceful shutdown if we are destroyed before validation.
+ //
+ if(_state == StateNotValidated && state == StateClosing)
+ {
+ state = StateClosed;
+ }
if(_state == state) // Don't switch twice.
{
@@ -1215,21 +1215,21 @@ public final class Connection
switch(state)
{
- case StateNotValidated:
- {
- if(IceUtil.Debug.ASSERT)
- {
- IceUtil.Debug.Assert(false);
- }
- break;
- }
+ case StateNotValidated:
+ {
+ if(IceUtil.Debug.ASSERT)
+ {
+ IceUtil.Debug.Assert(false);
+ }
+ break;
+ }
case StateActive:
{
- //
- // Can only switch from holding or not validated to
- // active.
- //
+ //
+ // Can only switch from holding or not validated to
+ // active.
+ //
if(_state != StateHolding && _state != StateNotValidated)
{
return;
@@ -1239,12 +1239,12 @@ public final class Connection
case StateHolding:
{
- //
- // Can only switch from active or not validated to
- // holding.
- //
- if(_state != StateActive && _state != StateNotValidated)
- {
+ //
+ // Can only switch from active or not validated to
+ // holding.
+ //
+ if(_state != StateActive && _state != StateNotValidated)
+ {
return;
}
break;
@@ -1252,60 +1252,60 @@ public final class Connection
case StateClosing:
{
- //
- // Can't change back from closed.
- //
+ //
+ // Can't change back from closed.
+ //
if(_state == StateClosed)
{
return;
}
break;
}
-
+
case StateClosed:
{
- //
- // We shutdown both for reading and writing. This will
- // unblock and read call with an exception. The thread
- // per connection then closes the transceiver.
- //
- _transceiver.shutdownReadWrite();
-
- //
- // In blocking mode, we close the transceiver now.
- //
- if(_blocking)
- {
- synchronized(_sendMonitor)
- {
- try
- {
- _transceiver.close();
- }
- catch(Ice.LocalException ex)
- {
- }
- _transceiver = null;
- }
- }
- break;
+ //
+ // We shutdown both for reading and writing. This will
+ // unblock and read call with an exception. The thread
+ // per connection then closes the transceiver.
+ //
+ _transceiver.shutdownReadWrite();
+
+ //
+ // In blocking mode, we close the transceiver now.
+ //
+ if(_blocking)
+ {
+ synchronized(_sendMonitor)
+ {
+ try
+ {
+ _transceiver.close();
+ }
+ catch(Ice.LocalException ex)
+ {
+ }
+ _transceiver = null;
+ }
+ }
+ break;
}
}
_state = state;
- _stateTime = System.currentTimeMillis();
+ _stateTime = System.currentTimeMillis();
- notifyAll();
+ notifyAll();
if(_state == StateClosing && _dispatchCount == 0)
{
try
{
initiateShutdown();
- if(_blocking)
- {
- setState(StateClosed);
- }
+ if(_blocking)
+ {
+ setState(StateClosed);
+ }
}
catch(LocalException ex)
{
@@ -1317,433 +1317,433 @@ public final class Connection
private void
initiateShutdown()
{
- if(IceUtil.Debug.ASSERT)
- {
- IceUtil.Debug.Assert(_state == StateClosing);
- IceUtil.Debug.Assert(_dispatchCount == 0);
- }
-
- synchronized(_sendMonitor)
- {
- //
- // Before we shut down, we send a close connection
- // message.
- //
- IceInternal.BasicStream os = new IceInternal.BasicStream(_instance);
- os.writeBlob(IceInternal.Protocol.magic);
- os.writeByte(IceInternal.Protocol.protocolMajor);
- os.writeByte(IceInternal.Protocol.protocolMinor);
- os.writeByte(IceInternal.Protocol.encodingMajor);
- os.writeByte(IceInternal.Protocol.encodingMinor);
- os.writeByte(IceInternal.Protocol.closeConnectionMsg);
- os.writeByte((byte)0); // Compression not supported.
- os.writeInt(IceInternal.Protocol.headerSize); // Message size.
-
- //
- // Send the message.
- //
- IceInternal.TraceUtil.traceHeader("sending close connection", os, _logger, _traceLevels);
- _transceiver.write(os, _endpoint.timeout());
- //
- // The CloseConnection message should be sufficient. Closing the write
- // end of the socket is probably an artifact of how things were done
- // in IIOP. In fact, shutting down the write end of the socket causes
- // problems on Windows by preventing the peer from using the socket.
- // For example, the peer is no longer able to continue writing a large
- // message after the socket is shutdown.
- //
- //_transceiver.shutdownWrite();
- }
+ if(IceUtil.Debug.ASSERT)
+ {
+ IceUtil.Debug.Assert(_state == StateClosing);
+ IceUtil.Debug.Assert(_dispatchCount == 0);
+ }
+
+ synchronized(_sendMonitor)
+ {
+ //
+ // Before we shut down, we send a close connection
+ // message.
+ //
+ IceInternal.BasicStream os = new IceInternal.BasicStream(_instance);
+ os.writeBlob(IceInternal.Protocol.magic);
+ os.writeByte(IceInternal.Protocol.protocolMajor);
+ os.writeByte(IceInternal.Protocol.protocolMinor);
+ os.writeByte(IceInternal.Protocol.encodingMajor);
+ os.writeByte(IceInternal.Protocol.encodingMinor);
+ os.writeByte(IceInternal.Protocol.closeConnectionMsg);
+ os.writeByte((byte)0); // Compression not supported.
+ os.writeInt(IceInternal.Protocol.headerSize); // Message size.
+
+ //
+ // Send the message.
+ //
+ IceInternal.TraceUtil.traceHeader("sending close connection", os, _logger, _traceLevels);
+ _transceiver.write(os, _endpoint.timeout());
+ //
+ // The CloseConnection message should be sufficient. Closing the write
+ // end of the socket is probably an artifact of how things were done
+ // in IIOP. In fact, shutting down the write end of the socket causes
+ // problems on Windows by preventing the peer from using the socket.
+ // For example, the peer is no longer able to continue writing a large
+ // message after the socket is shutdown.
+ //
+ //_transceiver.shutdownWrite();
+ }
}
private static class MessageInfo
{
- int invokeNum;
- int requestId;
+ int invokeNum;
+ int requestId;
}
private void
readStreamAndParseMessage(IceInternal.BasicStream stream, MessageInfo info)
{
- //
- // Read the header.
- //
- stream.resize(IceInternal.Protocol.headerSize, true);
- stream.pos(0);
- _transceiver.read(stream, _blocking ? _endpoint.timeout() : -1);
-
- int pos = stream.pos();
- if(IceUtil.Debug.ASSERT)
- {
- IceUtil.Debug.Assert(pos >= IceInternal.Protocol.headerSize);
- }
- stream.pos(0);
- byte[] m = stream.readBlob(4);
- if(m[0] != IceInternal.Protocol.magic[0] || m[1] != IceInternal.Protocol.magic[1] ||
- m[2] != IceInternal.Protocol.magic[2] || m[3] != IceInternal.Protocol.magic[3])
- {
+ //
+ // Read the header.
+ //
+ stream.resize(IceInternal.Protocol.headerSize, true);
+ stream.pos(0);
+ _transceiver.read(stream, _blocking ? _endpoint.timeout() : -1);
+
+ int pos = stream.pos();
+ if(IceUtil.Debug.ASSERT)
+ {
+ IceUtil.Debug.Assert(pos >= IceInternal.Protocol.headerSize);
+ }
+ stream.pos(0);
+ byte[] m = stream.readBlob(4);
+ if(m[0] != IceInternal.Protocol.magic[0] || m[1] != IceInternal.Protocol.magic[1] ||
+ m[2] != IceInternal.Protocol.magic[2] || m[3] != IceInternal.Protocol.magic[3])
+ {
Ice.Util.throwBadMagicException(m);
- }
- byte pMajor = stream.readByte();
- byte pMinor = stream.readByte();
- if(pMajor != IceInternal.Protocol.protocolMajor)
- {
+ }
+ byte pMajor = stream.readByte();
+ byte pMinor = stream.readByte();
+ if(pMajor != IceInternal.Protocol.protocolMajor)
+ {
Ice.Util.throwUnsupportedProtocolException(pMajor, pMinor);
- }
- byte eMajor = stream.readByte();
- byte eMinor = stream.readByte();
- if(eMajor != IceInternal.Protocol.encodingMajor)
- {
+ }
+ byte eMajor = stream.readByte();
+ byte eMinor = stream.readByte();
+ if(eMajor != IceInternal.Protocol.encodingMajor)
+ {
Ice.Util.throwUnsupportedEncodingException(eMajor, eMinor);
- }
- byte messageType = stream.readByte();
- byte compress = stream.readByte();
- if(compress == (byte)2)
- {
- FeatureNotSupportedException ex = new FeatureNotSupportedException();
- ex.unsupportedFeature = "compression";
- throw ex;
- }
-
- int size = stream.readInt();
- if(size < IceInternal.Protocol.headerSize)
- {
- Ice.Util.throwIllegalMessageSizeException();
- }
- if(size > _instance.messageSizeMax())
- {
- throw new MemoryLimitException();
- }
- if(size > stream.size())
- {
- stream.resize(size, true);
- }
- stream.pos(pos);
-
- //
- // Read the rest of the message.
- //
- if(pos != stream.size())
- {
- _transceiver.read(stream, _blocking ? _endpoint.timeout() : -1);
- }
-
- if(IceUtil.Debug.ASSERT)
- {
- IceUtil.Debug.Assert(stream.pos() == stream.size());
- }
- stream.pos(IceInternal.Protocol.headerSize);
-
- switch(messageType)
- {
- case IceInternal.Protocol.closeConnectionMsg:
- {
- IceInternal.TraceUtil.traceHeader("received close connection", stream, _logger, _traceLevels);
- throw new CloseConnectionException();
- }
-
- case IceInternal.Protocol.replyMsg:
- {
- IceInternal.TraceUtil.traceReply("received reply", stream, _logger, _traceLevels);
- info.requestId = stream.readInt();
- break;
- }
-
- case IceInternal.Protocol.requestMsg:
- {
- IceInternal.TraceUtil.traceRequest("received request", stream, _logger, _traceLevels);
- info.requestId = stream.readInt();
- info.invokeNum = 1;
- break;
- }
-
- case IceInternal.Protocol.requestBatchMsg:
- {
- IceInternal.TraceUtil.traceBatchRequest("received batch request", stream, _logger, _traceLevels);
- info.invokeNum = stream.readInt();
- if(info.invokeNum < 0)
- {
- info.invokeNum = 0;
- Ice.Util.throwNegativeSizeException();
- }
- break;
- }
-
- case IceInternal.Protocol.validateConnectionMsg:
- {
- IceInternal.TraceUtil.traceHeader("received validate connection", stream, _logger, _traceLevels);
- if(_warn)
- {
- _logger.warning("ignoring unexpected validate connection message:\n" + _desc);
- }
- break;
- }
-
- default:
- {
- IceInternal.TraceUtil.traceHeader("received unexpected message\n" +
- "(invalid, closing connection)", stream, _logger,
- _traceLevels);
- Ice.Util.throwUnknownMessageException();
- }
- }
+ }
+ byte messageType = stream.readByte();
+ byte compress = stream.readByte();
+ if(compress == (byte)2)
+ {
+ FeatureNotSupportedException ex = new FeatureNotSupportedException();
+ ex.unsupportedFeature = "compression";
+ throw ex;
+ }
+
+ int size = stream.readInt();
+ if(size < IceInternal.Protocol.headerSize)
+ {
+ Ice.Util.throwIllegalMessageSizeException();
+ }
+ if(size > _instance.messageSizeMax())
+ {
+ throw new MemoryLimitException();
+ }
+ if(size > stream.size())
+ {
+ stream.resize(size, true);
+ }
+ stream.pos(pos);
+
+ //
+ // Read the rest of the message.
+ //
+ if(pos != stream.size())
+ {
+ _transceiver.read(stream, _blocking ? _endpoint.timeout() : -1);
+ }
+
+ if(IceUtil.Debug.ASSERT)
+ {
+ IceUtil.Debug.Assert(stream.pos() == stream.size());
+ }
+ stream.pos(IceInternal.Protocol.headerSize);
+
+ switch(messageType)
+ {
+ case IceInternal.Protocol.closeConnectionMsg:
+ {
+ IceInternal.TraceUtil.traceHeader("received close connection", stream, _logger, _traceLevels);
+ throw new CloseConnectionException();
+ }
+
+ case IceInternal.Protocol.replyMsg:
+ {
+ IceInternal.TraceUtil.traceReply("received reply", stream, _logger, _traceLevels);
+ info.requestId = stream.readInt();
+ break;
+ }
+
+ case IceInternal.Protocol.requestMsg:
+ {
+ IceInternal.TraceUtil.traceRequest("received request", stream, _logger, _traceLevels);
+ info.requestId = stream.readInt();
+ info.invokeNum = 1;
+ break;
+ }
+
+ case IceInternal.Protocol.requestBatchMsg:
+ {
+ IceInternal.TraceUtil.traceBatchRequest("received batch request", stream, _logger, _traceLevels);
+ info.invokeNum = stream.readInt();
+ if(info.invokeNum < 0)
+ {
+ info.invokeNum = 0;
+ Ice.Util.throwNegativeSizeException();
+ }
+ break;
+ }
+
+ case IceInternal.Protocol.validateConnectionMsg:
+ {
+ IceInternal.TraceUtil.traceHeader("received validate connection", stream, _logger, _traceLevels);
+ if(_warn)
+ {
+ _logger.warning("ignoring unexpected validate connection message:\n" + _desc);
+ }
+ break;
+ }
+
+ default:
+ {
+ IceInternal.TraceUtil.traceHeader("received unexpected message\n" +
+ "(invalid, closing connection)", stream, _logger,
+ _traceLevels);
+ Ice.Util.throwUnknownMessageException();
+ }
+ }
}
public void
run()
{
- //
- // The thread-per-connection must validate and activate this connection,
- // and not in the connection factory. Please see the comments in the
- // connection factory for details.
- //
- try
- {
- validate();
- }
- catch(LocalException ex)
- {
- synchronized(this)
- {
- if(IceUtil.Debug.ASSERT)
- {
- IceUtil.Debug.Assert(_state == StateClosed);
- }
-
- //
- // We must make sure that nobody is sending when
- // we close the transceiver.
- //
- synchronized(_sendMonitor)
- {
- try
- {
- _transceiver.close();
- }
- catch(LocalException e)
- {
- // Here we ignore any exceptions in close().
- }
-
- _transceiver = null;
- notifyAll();
- }
- }
- return;
- }
-
- activate();
-
- boolean closed = false;
-
- MessageInfo info = new MessageInfo();
-
- while(!closed)
- {
- info.requestId = 0;
- info.invokeNum = 0;
- _in.os().reset();
- _in.is().reset();
-
- //
- // Read and parse the next message. We don't need to lock the
- // send monitor here as we have the guarantee that
- // _transceiver won't be set to 0 by another thread, the
- // thread per connection is the only thread that can set
- // _transceiver to 0.
- //
- try
- {
- readStreamAndParseMessage(_stream, info);
- }
- catch(Ice.LocalException ex)
- {
- synchronized(this)
- {
- setState(StateClosed, ex);
- }
- }
-
- synchronized(this)
- {
- if(_state != StateClosed)
- {
- if(info.invokeNum > 0) // We received a request or a batch request
- {
- if(_state == StateClosing)
- {
- IceInternal.TraceUtil.traceRequest(
- "received " + (info.invokeNum > 1 ? "batch request" : "request") + " during closing\n"+
- "(ignored by server, client will retry)", _stream, _logger, _traceLevels);
- info.invokeNum = 0;
- }
- _dispatchCount += info.invokeNum;
- }
- else if(info.requestId > 0)
- {
- try
- {
- synchronized(_sendMonitor)
- {
- IceInternal.Outgoing out = (IceInternal.Outgoing)_requests.remove(info.requestId);
- if(out != null)
- {
- out.finished(_stream);
- _sendMonitor.notifyAll(); // Wake up threads waiting in sendRequest()
- }
- else
- {
- Ice.Util.throwUnknownRequestIdException();
- }
- }
- }
- catch(Ice.LocalException ex)
- {
- setState(StateClosed, ex);
- }
- }
- }
-
- while(_state == StateHolding)
- {
- try
- {
- wait();
- }
- catch(InterruptedException ex)
- {
- }
- }
-
- if(_state == StateClosed)
- {
- //
- // We must make sure that nobody is sending when we close
- // the transceiver.
- //
- synchronized(_sendMonitor)
- {
- try
- {
- _transceiver.close();
- }
- catch(LocalException ex)
- {
- }
-
- _transceiver = null;
- notifyAll();
- }
-
- //
- // We cannot simply return here. We have to make sure
- // that all requests are notified about the closed
- // connection below.
- //
- closed = true;
- }
-
- if(_state == StateClosed || _state == StateClosing)
- {
- synchronized(_sendMonitor)
- {
- java.util.Enumeration i = _requests.elements();
- while(i.hasMoreElements())
- {
- IceInternal.IntMap.Entry e = (IceInternal.IntMap.Entry)i.nextElement();
- IceInternal.Outgoing out = (IceInternal.Outgoing)e.getValue();
- out.finished(_exception); // The exception is immutable at this point.
- }
- _requests.clear();
- _sendMonitor.notifyAll(); // Wake up threads waiting in sendRequest()
- }
- }
- }
-
- //
- // Method invocation (or multiple invocations for batch messages)
- // must be done outside the thread synchronization, so that nested
- // calls are possible.
- //
- try
- {
- for(; info.invokeNum > 0; --info.invokeNum)
- {
- //
- // Prepare the response if necessary.
- //
- final boolean response = info.requestId != 0;
- if(response)
- {
- if(IceUtil.Debug.ASSERT)
- {
- // No further invocations if a response is expected.
- IceUtil.Debug.Assert(info.invokeNum == 1);
- }
-
- //
- // Add the reply header and request id.
- //
- IceInternal.BasicStream os = _in.os();
- os.writeBlob(IceInternal.Protocol.replyHdr);
- os.writeInt(info.requestId);
- }
-
- _in.invoke(response, info.requestId);
- }
- }
- catch(LocalException ex)
- {
- synchronized(this)
- {
- setState(StateClosed, ex);
- }
- }
- catch(IceUtil.AssertionError ex) // Upon assertion, we print the stack trace.
- {
- synchronized(this)
- {
- UnknownException uex = new UnknownException();
- uex.unknown = ex.toString();
- _logger.error(uex.unknown);
- setState(StateClosed, uex);
- }
- }
- catch(java.lang.Exception ex)
- {
- synchronized(this)
- {
- UnknownException uex = new UnknownException();
- uex.unknown = ex.toString();
- setState(StateClosed, uex);
- }
- }
-
- //
- // If invoke() above raised an exception, and therefore
- // neither sendResponse() nor sendNoResponse() has been
- // called, then we must decrement _dispatchCount here.
- //
- if(info.invokeNum > 0)
- {
- synchronized(this)
- {
- if(IceUtil.Debug.ASSERT)
- {
- IceUtil.Debug.Assert(_dispatchCount > 0);
- }
- _dispatchCount -= info.invokeNum;
- if(IceUtil.Debug.ASSERT)
- {
- IceUtil.Debug.Assert(_dispatchCount >= 0);
- }
- if(_dispatchCount == 0)
- {
- notifyAll();
- }
- }
- }
- }
+ //
+ // The thread-per-connection must validate and activate this connection,
+ // and not in the connection factory. Please see the comments in the
+ // connection factory for details.
+ //
+ try
+ {
+ validate();
+ }
+ catch(LocalException ex)
+ {
+ synchronized(this)
+ {
+ if(IceUtil.Debug.ASSERT)
+ {
+ IceUtil.Debug.Assert(_state == StateClosed);
+ }
+
+ //
+ // We must make sure that nobody is sending when
+ // we close the transceiver.
+ //
+ synchronized(_sendMonitor)
+ {
+ try
+ {
+ _transceiver.close();
+ }
+ catch(LocalException e)
+ {
+ // Here we ignore any exceptions in close().
+ }
+
+ _transceiver = null;
+ notifyAll();
+ }
+ }
+ return;
+ }
+
+ activate();
+
+ boolean closed = false;
+
+ MessageInfo info = new MessageInfo();
+
+ while(!closed)
+ {
+ info.requestId = 0;
+ info.invokeNum = 0;
+ _in.os().reset();
+ _in.is().reset();
+
+ //
+ // Read and parse the next message. We don't need to lock the
+ // send monitor here as we have the guarantee that
+ // _transceiver won't be set to 0 by another thread, the
+ // thread per connection is the only thread that can set
+ // _transceiver to 0.
+ //
+ try
+ {
+ readStreamAndParseMessage(_stream, info);
+ }
+ catch(Ice.LocalException ex)
+ {
+ synchronized(this)
+ {
+ setState(StateClosed, ex);
+ }
+ }
+
+ synchronized(this)
+ {
+ if(_state != StateClosed)
+ {
+ if(info.invokeNum > 0) // We received a request or a batch request
+ {
+ if(_state == StateClosing)
+ {
+ IceInternal.TraceUtil.traceRequest(
+ "received " + (info.invokeNum > 1 ? "batch request" : "request") + " during closing\n"+
+ "(ignored by server, client will retry)", _stream, _logger, _traceLevels);
+ info.invokeNum = 0;
+ }
+ _dispatchCount += info.invokeNum;
+ }
+ else if(info.requestId > 0)
+ {
+ try
+ {
+ synchronized(_sendMonitor)
+ {
+ IceInternal.Outgoing out = (IceInternal.Outgoing)_requests.remove(info.requestId);
+ if(out != null)
+ {
+ out.finished(_stream);
+ _sendMonitor.notifyAll(); // Wake up threads waiting in sendRequest()
+ }
+ else
+ {
+ Ice.Util.throwUnknownRequestIdException();
+ }
+ }
+ }
+ catch(Ice.LocalException ex)
+ {
+ setState(StateClosed, ex);
+ }
+ }
+ }
+
+ while(_state == StateHolding)
+ {
+ try
+ {
+ wait();
+ }
+ catch(InterruptedException ex)
+ {
+ }
+ }
+
+ if(_state == StateClosed)
+ {
+ //
+ // We must make sure that nobody is sending when we close
+ // the transceiver.
+ //
+ synchronized(_sendMonitor)
+ {
+ try
+ {
+ _transceiver.close();
+ }
+ catch(LocalException ex)
+ {
+ }
+
+ _transceiver = null;
+ notifyAll();
+ }
+
+ //
+ // We cannot simply return here. We have to make sure
+ // that all requests are notified about the closed
+ // connection below.
+ //
+ closed = true;
+ }
+
+ if(_state == StateClosed || _state == StateClosing)
+ {
+ synchronized(_sendMonitor)
+ {
+ java.util.Enumeration i = _requests.elements();
+ while(i.hasMoreElements())
+ {
+ IceInternal.IntMap.Entry e = (IceInternal.IntMap.Entry)i.nextElement();
+ IceInternal.Outgoing out = (IceInternal.Outgoing)e.getValue();
+ out.finished(_exception); // The exception is immutable at this point.
+ }
+ _requests.clear();
+ _sendMonitor.notifyAll(); // Wake up threads waiting in sendRequest()
+ }
+ }
+ }
+
+ //
+ // Method invocation (or multiple invocations for batch messages)
+ // must be done outside the thread synchronization, so that nested
+ // calls are possible.
+ //
+ try
+ {
+ for(; info.invokeNum > 0; --info.invokeNum)
+ {
+ //
+ // Prepare the response if necessary.
+ //
+ final boolean response = info.requestId != 0;
+ if(response)
+ {
+ if(IceUtil.Debug.ASSERT)
+ {
+ // No further invocations if a response is expected.
+ IceUtil.Debug.Assert(info.invokeNum == 1);
+ }
+
+ //
+ // Add the reply header and request id.
+ //
+ IceInternal.BasicStream os = _in.os();
+ os.writeBlob(IceInternal.Protocol.replyHdr);
+ os.writeInt(info.requestId);
+ }
+
+ _in.invoke(response, info.requestId);
+ }
+ }
+ catch(LocalException ex)
+ {
+ synchronized(this)
+ {
+ setState(StateClosed, ex);
+ }
+ }
+ catch(IceUtil.AssertionError ex) // Upon assertion, we print the stack trace.
+ {
+ synchronized(this)
+ {
+ UnknownException uex = new UnknownException();
+ uex.unknown = ex.toString();
+ _logger.error(uex.unknown);
+ setState(StateClosed, uex);
+ }
+ }
+ catch(java.lang.Exception ex)
+ {
+ synchronized(this)
+ {
+ UnknownException uex = new UnknownException();
+ uex.unknown = ex.toString();
+ setState(StateClosed, uex);
+ }
+ }
+
+ //
+ // If invoke() above raised an exception, and therefore
+ // neither sendResponse() nor sendNoResponse() has been
+ // called, then we must decrement _dispatchCount here.
+ //
+ if(info.invokeNum > 0)
+ {
+ synchronized(this)
+ {
+ if(IceUtil.Debug.ASSERT)
+ {
+ IceUtil.Debug.Assert(_dispatchCount > 0);
+ }
+ _dispatchCount -= info.invokeNum;
+ if(IceUtil.Debug.ASSERT)
+ {
+ IceUtil.Debug.Assert(_dispatchCount >= 0);
+ }
+ if(_dispatchCount == 0)
+ {
+ notifyAll();
+ }
+ }
+ }
+ }
}
public void
@@ -1763,57 +1763,57 @@ public final class Connection
public IceInternal.Outgoing
getOutgoing(IceInternal.Reference reference, String operation, OperationMode mode, java.util.Hashtable context)
{
- IceInternal.Outgoing out;
-
- synchronized(_outgoingCacheMutex)
- {
- if(_outgoingCache == null)
- {
- out = new IceInternal.Outgoing(this, reference, operation, mode, context);
- }
- else
- {
- out = _outgoingCache;
- _outgoingCache = _outgoingCache.next;
- out.reset(reference, operation, mode, context);
- out.next = null;
- }
- }
-
- return out;
+ IceInternal.Outgoing out;
+
+ synchronized(_outgoingCacheMutex)
+ {
+ if(_outgoingCache == null)
+ {
+ out = new IceInternal.Outgoing(this, reference, operation, mode, context);
+ }
+ else
+ {
+ out = _outgoingCache;
+ _outgoingCache = _outgoingCache.next;
+ out.reset(reference, operation, mode, context);
+ out.next = null;
+ }
+ }
+
+ return out;
}
public void
reclaimOutgoing(IceInternal.Outgoing out)
{
- synchronized(_outgoingCacheMutex)
- {
- out.next = _outgoingCache;
- _outgoingCache = out;
- }
+ synchronized(_outgoingCacheMutex)
+ {
+ out.next = _outgoingCache;
+ _outgoingCache = out;
+ }
}
private class ThreadPerConnection extends Thread
{
- ThreadPerConnection(Connection connection)
- {
- _connection = connection;
- }
-
- public void
- run()
- {
- try
- {
- _connection.run();
- }
- catch(Exception ex)
- {
- _connection.error("exception in thread per connection", ex);
- }
- }
-
- Connection _connection;
+ ThreadPerConnection(Connection connection)
+ {
+ _connection = connection;
+ }
+
+ public void
+ run()
+ {
+ try
+ {
+ _connection.run();
+ }
+ catch(Exception ex)
+ {
+ _connection.error("exception in thread per connection", ex);
+ }
+ }
+
+ Connection _connection;
}
private Thread _threadPerConnection;
diff --git a/javae/src/Ice/Current.java b/javae/src/Ice/Current.java
index 3b034391293..fff79ea66c1 100644
--- a/javae/src/Ice/Current.java
+++ b/javae/src/Ice/Current.java
@@ -25,75 +25,75 @@ public final class Current
}
public Current(ObjectAdapter adapter, Connection con, Identity id, String facet, String operation,
- OperationMode mode, java.util.Hashtable ctx, int requestId)
+ OperationMode mode, java.util.Hashtable ctx, int requestId)
{
- this.adapter = adapter;
- this.con = con;
- this.id = id;
- this.facet = facet;
- this.operation = operation;
- this.mode = mode;
- this.ctx = ctx;
- this.requestId = requestId;
+ this.adapter = adapter;
+ this.con = con;
+ this.id = id;
+ this.facet = facet;
+ this.operation = operation;
+ this.mode = mode;
+ this.ctx = ctx;
+ this.requestId = requestId;
}
public boolean
equals(java.lang.Object rhs)
{
- Current _r = null;
- try
- {
- _r = (Current)rhs;
- }
- catch(ClassCastException ex)
- {
- }
+ Current _r = null;
+ try
+ {
+ _r = (Current)rhs;
+ }
+ catch(ClassCastException ex)
+ {
+ }
- if(_r != null)
- {
- if(adapter != _r.adapter && adapter != null && !adapter.equals(_r.adapter))
- {
- return false;
- }
- if(con != _r.con && con != null && !con.equals(_r.con))
- {
- return false;
- }
- if(id != _r.id && id != null && !id.equals(_r.id))
- {
- return false;
- }
- if(facet != _r.facet && facet != null && !facet.equals(_r.facet))
- {
- return false;
- }
- if(operation != _r.operation && operation != null && !operation.equals(_r.operation))
- {
- return false;
- }
- if(mode != _r.mode && mode != null && !mode.equals(_r.mode))
- {
- return false;
- }
- if(ctx != _r.ctx && ctx != null && !IceUtil.Hashtable.equals(ctx, _r.ctx))
- {
- return false;
- }
- if(requestId != _r.requestId)
- {
- return false;
- }
+ if(_r != null)
+ {
+ if(adapter != _r.adapter && adapter != null && !adapter.equals(_r.adapter))
+ {
+ return false;
+ }
+ if(con != _r.con && con != null && !con.equals(_r.con))
+ {
+ return false;
+ }
+ if(id != _r.id && id != null && !id.equals(_r.id))
+ {
+ return false;
+ }
+ if(facet != _r.facet && facet != null && !facet.equals(_r.facet))
+ {
+ return false;
+ }
+ if(operation != _r.operation && operation != null && !operation.equals(_r.operation))
+ {
+ return false;
+ }
+ if(mode != _r.mode && mode != null && !mode.equals(_r.mode))
+ {
+ return false;
+ }
+ if(ctx != _r.ctx && ctx != null && !IceUtil.Hashtable.equals(ctx, _r.ctx))
+ {
+ return false;
+ }
+ if(requestId != _r.requestId)
+ {
+ return false;
+ }
- return true;
- }
+ return true;
+ }
- return false;
+ return false;
}
public java.lang.Object
ice_clone()
- throws IceUtil.CloneException
+ throws IceUtil.CloneException
{
- return new Current(adapter, con, id, facet, operation, mode, ctx, requestId);
+ return new Current(adapter, con, id, facet, operation, mode, ctx, requestId);
}
}
diff --git a/javae/src/Ice/DispatchStatus.java b/javae/src/Ice/DispatchStatus.java
index 8c6a8262a93..d5b0d242497 100644
--- a/javae/src/Ice/DispatchStatus.java
+++ b/javae/src/Ice/DispatchStatus.java
@@ -25,23 +25,23 @@ public final class DispatchStatus
public static DispatchStatus
convert(int val)
{
- if(IceUtil.Debug.ASSERT)
- {
- IceUtil.Debug.Assert(val < 2);
- }
+ if(IceUtil.Debug.ASSERT)
+ {
+ IceUtil.Debug.Assert(val < 2);
+ }
return __values[val];
}
public int
value()
{
- return __value;
+ return __value;
}
private
DispatchStatus(int val)
{
- __value = val;
- __values[val] = this;
+ __value = val;
+ __values[val] = this;
}
}
diff --git a/javae/src/Ice/InitializationData.java b/javae/src/Ice/InitializationData.java
index 59e20cab46e..71d9db5d25f 100644
--- a/javae/src/Ice/InitializationData.java
+++ b/javae/src/Ice/InitializationData.java
@@ -18,10 +18,10 @@ public final class InitializationData
public java.lang.Object
ice_clone()
{
- InitializationData clone = new InitializationData();
- clone.properties = properties;
- clone.logger = logger;
- return clone;
+ InitializationData clone = new InitializationData();
+ clone.properties = properties;
+ clone.logger = logger;
+ return clone;
}
diff --git a/javae/src/Ice/LocalException.java b/javae/src/Ice/LocalException.java
index b03f7845827..07c933a656b 100644
--- a/javae/src/Ice/LocalException.java
+++ b/javae/src/Ice/LocalException.java
@@ -17,37 +17,37 @@ public abstract class LocalException extends RuntimeException
public Throwable
getCause()
{
- return _cause;
+ return _cause;
}
public Throwable
initCause(Throwable cause)
{
- if(_cause != null)
- {
- throw new IllegalStateException();
- }
+ if(_cause != null)
+ {
+ throw new IllegalStateException();
+ }
- _cause = cause;
+ _cause = cause;
- return this;
+ return this;
}
public void
printStackTrace()
{
- super.printStackTrace();
- if(_cause != null)
- {
- System.err.println("\nCaused by:");
- _cause.printStackTrace();
- }
+ super.printStackTrace();
+ if(_cause != null)
+ {
+ System.err.println("\nCaused by:");
+ _cause.printStackTrace();
+ }
}
public String
toString()
{
- return ice_name();
+ return ice_name();
}
private Throwable _cause;
diff --git a/javae/src/Ice/LocalObjectHolder.java b/javae/src/Ice/LocalObjectHolder.java
new file mode 100644
index 00000000000..357bdbaa5ce
--- /dev/null
+++ b/javae/src/Ice/LocalObjectHolder.java
@@ -0,0 +1,26 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2007 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice-E is licensed to you under the terms described in the
+// ICEE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package Ice;
+
+public final class LocalObjectHolder
+{
+ public
+ LocalObjectHolder()
+ {
+ }
+
+ public
+ LocalObjectHolder(java.lang.Object value)
+ {
+ this.value = value;
+ }
+
+ public java.lang.Object value;
+}
diff --git a/javae/src/Ice/ObjectAdapter.java b/javae/src/Ice/ObjectAdapter.java
index e58b3c1e09c..13798a0727d 100644
--- a/javae/src/Ice/ObjectAdapter.java
+++ b/javae/src/Ice/ObjectAdapter.java
@@ -14,123 +14,123 @@ public final class ObjectAdapter
public String
getName()
{
- //
+ //
// No mutex lock necessary, _name is immutable.
- //
+ //
return _name;
}
public synchronized Communicator
getCommunicator()
{
- checkForDeactivation();
-
- return _communicator;
+ checkForDeactivation();
+
+ return _communicator;
}
public void
activate()
{
- IceInternal.LocatorInfo locatorInfo = null;
- boolean printAdapterReady = false;
-
- synchronized(this)
- {
- checkForDeactivation();
-
- //
- // If the one off initializations of the adapter are already
- // done, we just need to activate the incoming connection
- // factories and we're done.
- //
- if(_activateOneOffDone)
- {
- final int sz = _incomingConnectionFactories.size();
- java.util.Enumeration e = _incomingConnectionFactories.elements();
- while(e.hasMoreElements())
- {
- IceInternal.IncomingConnectionFactory factory =
- (IceInternal.IncomingConnectionFactory)e.nextElement();
- factory.activate();
- }
- return;
- }
-
- //
- // One off initializations of the adapter: update the
- // locator registry and print the "adapter ready"
- // message. We set the _waitForActivate flag to prevent
- // deactivation from other threads while these one off
- // initializations are done.
- //
- _waitForActivate = true;
-
- locatorInfo = _locatorInfo;
- final Properties properties = _instance.initializationData().properties;
- printAdapterReady = properties.getPropertyAsInt("Ice.PrintAdapterReady") > 0;
- }
-
- try
- {
- Ice.Identity dummy = new Ice.Identity();
- dummy.name = "dummy";
- updateLocatorRegistry(locatorInfo, createDirectProxy(dummy));
- }
- catch(Ice.LocalException ex)
- {
- //
- // If we couldn't update the locator registry, we let the
- // exception go through and don't activate the adapter to
- // allow to user code to retry activating the adapter
- // later.
- //
- synchronized(this)
- {
- _waitForActivate = false;
- notifyAll();
- }
- throw ex;
- }
-
- if(printAdapterReady)
- {
- System.out.println(_name + " ready");
- }
-
- synchronized(this)
- {
- if(IceUtil.Debug.ASSERT)
- {
- IceUtil.Debug.Assert(!_deactivated); // Not possible if _waitForActivate = true;
- }
-
- //
- // Signal threads waiting for the activation.
- //
- _waitForActivate = false;
- notifyAll();
-
- _activateOneOffDone = true;
-
- final int sz = _incomingConnectionFactories.size();
- java.util.Enumeration e = _incomingConnectionFactories.elements();
- while(e.hasMoreElements())
- {
- IceInternal.IncomingConnectionFactory factory =
- (IceInternal.IncomingConnectionFactory)e.nextElement();
- factory.activate();
- }
- }
+ IceInternal.LocatorInfo locatorInfo = null;
+ boolean printAdapterReady = false;
+
+ synchronized(this)
+ {
+ checkForDeactivation();
+
+ //
+ // If the one off initializations of the adapter are already
+ // done, we just need to activate the incoming connection
+ // factories and we're done.
+ //
+ if(_activateOneOffDone)
+ {
+ final int sz = _incomingConnectionFactories.size();
+ java.util.Enumeration e = _incomingConnectionFactories.elements();
+ while(e.hasMoreElements())
+ {
+ IceInternal.IncomingConnectionFactory factory =
+ (IceInternal.IncomingConnectionFactory)e.nextElement();
+ factory.activate();
+ }
+ return;
+ }
+
+ //
+ // One off initializations of the adapter: update the
+ // locator registry and print the "adapter ready"
+ // message. We set the _waitForActivate flag to prevent
+ // deactivation from other threads while these one off
+ // initializations are done.
+ //
+ _waitForActivate = true;
+
+ locatorInfo = _locatorInfo;
+ final Properties properties = _instance.initializationData().properties;
+ printAdapterReady = properties.getPropertyAsInt("Ice.PrintAdapterReady") > 0;
+ }
+
+ try
+ {
+ Ice.Identity dummy = new Ice.Identity();
+ dummy.name = "dummy";
+ updateLocatorRegistry(locatorInfo, createDirectProxy(dummy));
+ }
+ catch(Ice.LocalException ex)
+ {
+ //
+ // If we couldn't update the locator registry, we let the
+ // exception go through and don't activate the adapter to
+ // allow to user code to retry activating the adapter
+ // later.
+ //
+ synchronized(this)
+ {
+ _waitForActivate = false;
+ notifyAll();
+ }
+ throw ex;
+ }
+
+ if(printAdapterReady)
+ {
+ System.out.println(_name + " ready");
+ }
+
+ synchronized(this)
+ {
+ if(IceUtil.Debug.ASSERT)
+ {
+ IceUtil.Debug.Assert(!_deactivated); // Not possible if _waitForActivate = true;
+ }
+
+ //
+ // Signal threads waiting for the activation.
+ //
+ _waitForActivate = false;
+ notifyAll();
+
+ _activateOneOffDone = true;
+
+ final int sz = _incomingConnectionFactories.size();
+ java.util.Enumeration e = _incomingConnectionFactories.elements();
+ while(e.hasMoreElements())
+ {
+ IceInternal.IncomingConnectionFactory factory =
+ (IceInternal.IncomingConnectionFactory)e.nextElement();
+ factory.activate();
+ }
+ }
}
public synchronized void
hold()
{
- checkForDeactivation();
-
- java.util.Enumeration e = _incomingConnectionFactories.elements();
- while(e.hasMoreElements())
- {
+ checkForDeactivation();
+
+ java.util.Enumeration e = _incomingConnectionFactories.elements();
+ while(e.hasMoreElements())
+ {
IceInternal.IncomingConnectionFactory factory =
(IceInternal.IncomingConnectionFactory)e.nextElement();
factory.hold();
@@ -140,50 +140,50 @@ public final class ObjectAdapter
public synchronized void
waitForHold()
{
- checkForDeactivation();
-
- java.util.Enumeration e = _incomingConnectionFactories.elements();
- while(e.hasMoreElements())
- {
- IceInternal.IncomingConnectionFactory factory =
- (IceInternal.IncomingConnectionFactory)e.nextElement();
- factory.waitUntilHolding();
- }
+ checkForDeactivation();
+
+ java.util.Enumeration e = _incomingConnectionFactories.elements();
+ while(e.hasMoreElements())
+ {
+ IceInternal.IncomingConnectionFactory factory =
+ (IceInternal.IncomingConnectionFactory)e.nextElement();
+ factory.waitUntilHolding();
+ }
}
public void
deactivate()
{
- java.util.Vector incomingConnectionFactories;
- IceInternal.OutgoingConnectionFactory outgoingConnectionFactory;
- IceInternal.LocatorInfo locatorInfo;
-
- synchronized(this)
- {
- //
- // Ignore deactivation requests if the object adapter has
- // already been deactivated.
- //
- if(_deactivated)
- {
- return;
- }
-
- //
- //
- // Wait for activation to complete. This is necessary to not
- // get out of order locator updates.
- //
- while(_waitForActivate)
- {
- try
- {
- wait();
- }
- catch(InterruptedException ex)
- {
- }
- }
+ java.util.Vector incomingConnectionFactories;
+ IceInternal.OutgoingConnectionFactory outgoingConnectionFactory;
+ IceInternal.LocatorInfo locatorInfo;
+
+ synchronized(this)
+ {
+ //
+ // Ignore deactivation requests if the object adapter has
+ // already been deactivated.
+ //
+ if(_deactivated)
+ {
+ return;
+ }
+
+ //
+ //
+ // Wait for activation to complete. This is necessary to not
+ // get out of order locator updates.
+ //
+ while(_waitForActivate)
+ {
+ try
+ {
+ wait();
+ }
+ catch(InterruptedException ex)
+ {
+ }
+ }
if(_routerInfo != null)
{
@@ -197,56 +197,56 @@ public final class ObjectAdapter
//
_routerInfo.setAdapter(null);
}
-
- //
- // No clone call with J2ME.
- //
- //incomingConnectionFactories = (java.util.Vector)_incomingConnectionFactories.clone();
- incomingConnectionFactories = new java.util.Vector(_incomingConnectionFactories.size());
+
+ //
+ // No clone call with J2ME.
+ //
+ //incomingConnectionFactories = (java.util.Vector)_incomingConnectionFactories.clone();
+ incomingConnectionFactories = new java.util.Vector(_incomingConnectionFactories.size());
java.util.Enumeration e = _incomingConnectionFactories.elements();
while(e.hasMoreElements())
{
incomingConnectionFactories.addElement(e.nextElement());
}
- outgoingConnectionFactory = _instance.outgoingConnectionFactory();
- locatorInfo = _locatorInfo;
-
- _deactivated = true;
-
- notifyAll();
- }
-
- try
- {
- updateLocatorRegistry(locatorInfo, null);
- }
- catch(Ice.LocalException ex)
- {
- //
- // We can't throw exceptions in deactivate so we ignore
- // failures to update the locator registry.
- //
- }
-
- //
- // Must be called outside the thread synchronization, because
- // Connection::destroy() might block when sending a
- // CloseConnection message.
- //
- java.util.Enumeration e = incomingConnectionFactories.elements();
- while(e.hasMoreElements())
- {
- IceInternal.IncomingConnectionFactory factory =
- (IceInternal.IncomingConnectionFactory)e.nextElement();
- factory.destroy();
- }
-
- //
- // Must be called outside the thread synchronization, because
- // changing the object adapter might block if there are still
- // requests being dispatched.
- //
- outgoingConnectionFactory.removeAdapter(this);
+ outgoingConnectionFactory = _instance.outgoingConnectionFactory();
+ locatorInfo = _locatorInfo;
+
+ _deactivated = true;
+
+ notifyAll();
+ }
+
+ try
+ {
+ updateLocatorRegistry(locatorInfo, null);
+ }
+ catch(Ice.LocalException ex)
+ {
+ //
+ // We can't throw exceptions in deactivate so we ignore
+ // failures to update the locator registry.
+ //
+ }
+
+ //
+ // Must be called outside the thread synchronization, because
+ // Connection::destroy() might block when sending a
+ // CloseConnection message.
+ //
+ java.util.Enumeration e = incomingConnectionFactories.elements();
+ while(e.hasMoreElements())
+ {
+ IceInternal.IncomingConnectionFactory factory =
+ (IceInternal.IncomingConnectionFactory)e.nextElement();
+ factory.destroy();
+ }
+
+ //
+ // Must be called outside the thread synchronization, because
+ // changing the object adapter might block if there are still
+ // requests being dispatched.
+ //
+ outgoingConnectionFactory.removeAdapter(this);
}
public void
@@ -389,9 +389,9 @@ public final class ObjectAdapter
public synchronized ObjectPrx
addFacet(Ice.Object object, Identity ident, String facet)
{
- checkForDeactivation();
- checkIdentity(ident);
-
+ checkForDeactivation();
+ checkIdentity(ident);
+
//
// Create a copy of the Identity argument, in case the caller
// reuses it.
@@ -400,7 +400,7 @@ public final class ObjectAdapter
id.category = ident.category;
id.name = ident.name;
- _servantManager.addServant(object, id, facet);
+ _servantManager.addServant(object, id, facet);
return newProxy(id, facet);
}
@@ -430,19 +430,19 @@ public final class ObjectAdapter
public synchronized Ice.Object
removeFacet(Identity ident, String facet)
{
- checkForDeactivation();
+ checkForDeactivation();
checkIdentity(ident);
- return _servantManager.removeServant(ident, facet);
+ return _servantManager.removeServant(ident, facet);
}
public synchronized java.util.Hashtable
removeAllFacets(Identity ident)
{
- checkForDeactivation();
+ checkForDeactivation();
checkIdentity(ident);
- return _servantManager.removeAllFacets(ident);
+ return _servantManager.removeAllFacets(ident);
}
public Ice.Object
@@ -454,7 +454,7 @@ public final class ObjectAdapter
public synchronized Ice.Object
findFacet(Identity ident, String facet)
{
- checkForDeactivation();
+ checkForDeactivation();
checkIdentity(ident);
return _servantManager.findServant(ident, facet);
@@ -463,7 +463,7 @@ public final class ObjectAdapter
public synchronized java.util.Hashtable
findAllFacets(Identity ident)
{
- checkForDeactivation();
+ checkForDeactivation();
checkIdentity(ident);
return _servantManager.findAllFacets(ident);
@@ -472,7 +472,7 @@ public final class ObjectAdapter
public synchronized Ice.Object
findByProxy(ObjectPrx proxy)
{
- checkForDeactivation();
+ checkForDeactivation();
IceInternal.Reference ref = ((ObjectPrxHelperBase)proxy).__reference();
return findFacet(ref.getIdentity(), ref.getFacet());
@@ -481,7 +481,7 @@ public final class ObjectAdapter
public synchronized ObjectPrx
createProxy(Identity ident)
{
- checkForDeactivation();
+ checkForDeactivation();
checkIdentity(ident);
return newProxy(ident, "");
@@ -490,7 +490,7 @@ public final class ObjectAdapter
public synchronized ObjectPrx
createDirectProxy(Identity ident)
{
- checkForDeactivation();
+ checkForDeactivation();
checkIdentity(ident);
return newDirectProxy(ident, "");
@@ -499,7 +499,7 @@ public final class ObjectAdapter
public synchronized ObjectPrx
createIndirectProxy(Identity ident)
{
- checkForDeactivation();
+ checkForDeactivation();
checkIdentity(ident);
return newIndirectProxy(ident, "", _id);
@@ -508,7 +508,7 @@ public final class ObjectAdapter
public synchronized ObjectPrx
createReverseProxy(Identity ident)
{
- checkForDeactivation();
+ checkForDeactivation();
checkIdentity(ident);
//
@@ -516,7 +516,7 @@ public final class ObjectAdapter
//
java.util.Vector connections = new java.util.Vector();
java.util.Enumeration e = _incomingConnectionFactories.elements();
- while(e.hasMoreElements())
+ while(e.hasMoreElements())
{
IceInternal.IncomingConnectionFactory factory =
(IceInternal.IncomingConnectionFactory)e.nextElement();
@@ -542,70 +542,70 @@ public final class ObjectAdapter
public synchronized void
setLocator(LocatorPrx locator)
{
- checkForDeactivation();
+ checkForDeactivation();
- _locatorInfo = _instance.locatorManager().get(locator);
+ _locatorInfo = _instance.locatorManager().get(locator);
}
public void
flushBatchRequests()
{
- java.util.Vector f;
- synchronized(this)
- {
- //
- // No clone() call with J2ME.
- //
- //f = (java.util.Vector)_incomingConnectionFactories.clone();
- f = new java.util.Vector(_incomingConnectionFactories.size());
+ java.util.Vector f;
+ synchronized(this)
+ {
+ //
+ // No clone() call with J2ME.
+ //
+ //f = (java.util.Vector)_incomingConnectionFactories.clone();
+ f = new java.util.Vector(_incomingConnectionFactories.size());
java.util.Enumeration e = _incomingConnectionFactories.elements();
while(e.hasMoreElements())
{
f.addElement(e.nextElement());
}
- }
- java.util.Enumeration i = f.elements();
- while(i.hasMoreElements())
- {
- ((IceInternal.IncomingConnectionFactory)i.nextElement()).flushBatchRequests();
- }
+ }
+ java.util.Enumeration i = f.elements();
+ while(i.hasMoreElements())
+ {
+ ((IceInternal.IncomingConnectionFactory)i.nextElement()).flushBatchRequests();
+ }
}
public synchronized void
incDirectCount()
{
- checkForDeactivation();
+ checkForDeactivation();
- if(IceUtil.Debug.ASSERT)
- {
- IceUtil.Debug.Assert(_directCount >= 0);
- }
- ++_directCount;
+ if(IceUtil.Debug.ASSERT)
+ {
+ IceUtil.Debug.Assert(_directCount >= 0);
+ }
+ ++_directCount;
}
public synchronized void
decDirectCount()
{
- // No check for deactivation here!
-
- if(IceUtil.Debug.ASSERT)
- {
- IceUtil.Debug.Assert(_instance != null); // Must not be called after waitForDeactivate().
- IceUtil.Debug.Assert(_directCount > 0);
- }
- if(--_directCount == 0)
- {
- notifyAll();
- }
+ // No check for deactivation here!
+
+ if(IceUtil.Debug.ASSERT)
+ {
+ IceUtil.Debug.Assert(_instance != null); // Must not be called after waitForDeactivate().
+ IceUtil.Debug.Assert(_directCount > 0);
+ }
+ if(--_directCount == 0)
+ {
+ notifyAll();
+ }
}
public IceInternal.ServantManager
getServantManager()
- {
- //
- // No mutex lock necessary, _servantManager is immutable.
- //
- return _servantManager;
+ {
+ //
+ // No mutex lock necessary, _servantManager is immutable.
+ //
+ return _servantManager;
}
//
@@ -613,23 +613,23 @@ public final class ObjectAdapter
//
public
ObjectAdapter(IceInternal.Instance instance, Communicator communicator,
- IceInternal.ObjectAdapterFactory objectAdapterFactory, String name, String endpointInfo,
- RouterPrx router)
+ IceInternal.ObjectAdapterFactory objectAdapterFactory, String name, String endpointInfo,
+ RouterPrx router)
{
- _deactivated = false;
+ _deactivated = false;
_instance = instance;
- _communicator = communicator;
- _objectAdapterFactory = objectAdapterFactory;
- _servantManager = new IceInternal.ServantManager(instance, name);
- _activateOneOffDone = false;
+ _communicator = communicator;
+ _objectAdapterFactory = objectAdapterFactory;
+ _servantManager = new IceInternal.ServantManager(instance, name);
+ _activateOneOffDone = false;
_name = name;
- _id = instance.initializationData().properties.getProperty(name + ".AdapterId");
- _replicaGroupId = instance.initializationData().properties.getProperty(name + ".ReplicaGroupId");
- _directCount = 0;
- _waitForActivate = false;
- _destroying = false;
- _destroyed = false;
-
+ _id = instance.initializationData().properties.getProperty(name + ".AdapterId");
+ _replicaGroupId = instance.initializationData().properties.getProperty(name + ".ReplicaGroupId");
+ _directCount = 0;
+ _waitForActivate = false;
+ _destroying = false;
+ _destroyed = false;
+
try
{
if(router == null)
@@ -663,25 +663,25 @@ public final class ObjectAdapter
{
_routerEndpoints.addElement(endpoints[i]);
}
-
+
IceUtil.Arrays.sort(_routerEndpoints); // Must be sorted.
- //
- // Remove duplicate endpoints, so we have a list of unique
- // endpoints.
- //
- for(int i = 0; i < _routerEndpoints.size()-1; )
- {
+ //
+ // Remove duplicate endpoints, so we have a list of unique
+ // endpoints.
+ //
+ for(int i = 0; i < _routerEndpoints.size()-1; )
+ {
java.lang.Object o1 = _routerEndpoints.elementAt(i);
java.lang.Object o2 = _routerEndpoints.elementAt(i + 1);
if(o1.equals(o2))
{
_routerEndpoints.removeElementAt(i);
}
- else
- {
- ++i;
- }
- }
+ else
+ {
+ ++i;
+ }
+ }
//
// Associate this object adapter with the router. This way,
@@ -697,53 +697,53 @@ public final class ObjectAdapter
//
_instance.outgoingConnectionFactory().setRouterInfo(_routerInfo);
}
- }
- else
- {
- //
- // Parse the endpoints, but don't store them in the adapter.
- // The connection factory might change it, for example, to
- // fill in the real port number.
- //
- java.util.Vector endpoints = parseEndpoints(endpointInfo);
- for(int i = 0; i < endpoints.size(); ++i)
- {
- IceInternal.Endpoint endp = (IceInternal.Endpoint)endpoints.elementAt(i);
+ }
+ else
+ {
+ //
+ // Parse the endpoints, but don't store them in the adapter.
+ // The connection factory might change it, for example, to
+ // fill in the real port number.
+ //
+ java.util.Vector endpoints = parseEndpoints(endpointInfo);
+ for(int i = 0; i < endpoints.size(); ++i)
+ {
+ IceInternal.Endpoint endp = (IceInternal.Endpoint)endpoints.elementAt(i);
_incomingConnectionFactories.addElement(
- new IceInternal.IncomingConnectionFactory(instance, endp, this));
+ new IceInternal.IncomingConnectionFactory(instance, endp, this));
}
- if(endpoints.size() == 0)
- {
- IceInternal.TraceLevels tl = _instance.traceLevels();
- if(tl.network >= 2)
- {
- _instance.initializationData().logger.trace(tl.networkCat,
- "created adapter `" + name + "' without endpoints");
- }
- }
-
- //
- // Parse published endpoints. These are used in proxies
- // instead of the connection factory endpoints.
- //
- String endpts = _instance.initializationData().properties.getProperty(name + ".PublishedEndpoints");
- _publishedEndpoints = parseEndpoints(endpts);
- }
-
- String locator = _instance.initializationData().properties.getProperty(name + ".Locator");
- if(locator.length() > 0)
- {
- setLocator(LocatorPrxHelper.uncheckedCast(_instance.proxyFactory().stringToProxy(locator)));
- }
- else
- {
- setLocator(_instance.referenceFactory().getDefaultLocator());
- }
+ if(endpoints.size() == 0)
+ {
+ IceInternal.TraceLevels tl = _instance.traceLevels();
+ if(tl.network >= 2)
+ {
+ _instance.initializationData().logger.trace(tl.networkCat,
+ "created adapter `" + name + "' without endpoints");
+ }
+ }
+
+ //
+ // Parse published endpoints. These are used in proxies
+ // instead of the connection factory endpoints.
+ //
+ String endpts = _instance.initializationData().properties.getProperty(name + ".PublishedEndpoints");
+ _publishedEndpoints = parseEndpoints(endpts);
+ }
+
+ String locator = _instance.initializationData().properties.getProperty(name + ".Locator");
+ if(locator.length() > 0)
+ {
+ setLocator(LocatorPrxHelper.uncheckedCast(_instance.proxyFactory().stringToProxy(locator)));
+ }
+ else
+ {
+ setLocator(_instance.referenceFactory().getDefaultLocator());
+ }
}
catch(LocalException ex)
{
- deactivate();
- waitForDeactivate();
+ deactivate();
+ waitForDeactivate();
throw ex;
}
}
@@ -752,40 +752,40 @@ public final class ObjectAdapter
finalize()
throws Throwable
{
- if(!_deactivated)
- {
- _instance.initializationData().logger.warning("object adapter `" + _name + "' has not been deactivated");
- }
- else if(!_destroyed)
- {
- _instance.initializationData().logger.warning("object adapter `" + _name +
- "' has not been destroyed");
- }
- else
- {
- //IceUtil.Debug.FinalizerAssert(_servantManager == null); // Not cleared, it needs to be immutable.
- IceUtil.Debug.FinalizerAssert(_communicator == null);
- IceUtil.Debug.FinalizerAssert(_incomingConnectionFactories == null);
- IceUtil.Debug.FinalizerAssert(_directCount == 0);
- IceUtil.Debug.FinalizerAssert(!_waitForActivate);
- }
+ if(!_deactivated)
+ {
+ _instance.initializationData().logger.warning("object adapter `" + _name + "' has not been deactivated");
+ }
+ else if(!_destroyed)
+ {
+ _instance.initializationData().logger.warning("object adapter `" + _name +
+ "' has not been destroyed");
+ }
+ else
+ {
+ //IceUtil.Debug.FinalizerAssert(_servantManager == null); // Not cleared, it needs to be immutable.
+ IceUtil.Debug.FinalizerAssert(_communicator == null);
+ IceUtil.Debug.FinalizerAssert(_incomingConnectionFactories == null);
+ IceUtil.Debug.FinalizerAssert(_directCount == 0);
+ IceUtil.Debug.FinalizerAssert(!_waitForActivate);
+ }
}
private ObjectPrx
newProxy(Identity ident, String facet)
{
- if(_id.length() == 0)
- {
- return newDirectProxy(ident, facet);
- }
- else if(_replicaGroupId.length() == 0)
- {
- return newIndirectProxy(ident, facet, _id);
- }
- else
- {
- return newIndirectProxy(ident, facet, _replicaGroupId);
- }
+ if(_id.length() == 0)
+ {
+ return newDirectProxy(ident, facet);
+ }
+ else if(_replicaGroupId.length() == 0)
+ {
+ return newIndirectProxy(ident, facet, _id);
+ }
+ else
+ {
+ return newIndirectProxy(ident, facet, _replicaGroupId);
+ }
}
private ObjectPrx
@@ -793,27 +793,27 @@ public final class ObjectAdapter
{
IceInternal.Endpoint[] endpoints;
- //
- // Use the published endpoints, otherwise use the endpoints from all
- // incoming connection factories.
- //
- int sz = _publishedEndpoints.size();
- if(sz > 0)
- {
- endpoints = new IceInternal.Endpoint[sz + _routerEndpoints.size()];
- _publishedEndpoints.copyInto(endpoints);
- }
- else
- {
- sz = _incomingConnectionFactories.size();
- endpoints = new IceInternal.Endpoint[sz + _routerEndpoints.size()];
- for(int i = 0; i < sz; ++i)
- {
- IceInternal.IncomingConnectionFactory factory =
- (IceInternal.IncomingConnectionFactory)_incomingConnectionFactories.elementAt(i);
- endpoints[i] = factory.endpoint();
- }
- }
+ //
+ // Use the published endpoints, otherwise use the endpoints from all
+ // incoming connection factories.
+ //
+ int sz = _publishedEndpoints.size();
+ if(sz > 0)
+ {
+ endpoints = new IceInternal.Endpoint[sz + _routerEndpoints.size()];
+ _publishedEndpoints.copyInto(endpoints);
+ }
+ else
+ {
+ sz = _incomingConnectionFactories.size();
+ endpoints = new IceInternal.Endpoint[sz + _routerEndpoints.size()];
+ for(int i = 0; i < sz; ++i)
+ {
+ IceInternal.IncomingConnectionFactory factory =
+ (IceInternal.IncomingConnectionFactory)_incomingConnectionFactories.elementAt(i);
+ endpoints[i] = factory.endpoint();
+ }
+ }
//
// Now we also add the endpoints of the router's server proxy, if
@@ -822,7 +822,7 @@ public final class ObjectAdapter
//
for(int i = 0; i < _routerEndpoints.size(); ++i)
{
- endpoints[sz + i] = (IceInternal.Endpoint)_routerEndpoints.elementAt(i);
+ endpoints[sz + i] = (IceInternal.Endpoint)_routerEndpoints.elementAt(i);
}
//
@@ -830,7 +830,7 @@ public final class ObjectAdapter
//
Connection[] connections = new Connection[0];
IceInternal.Reference reference =
- _instance.referenceFactory().create(ident, null, facet, IceInternal.Reference.ModeTwoway, false, endpoints,
+ _instance.referenceFactory().create(ident, null, facet, IceInternal.Reference.ModeTwoway, false, endpoints,
null);
return _instance.proxyFactory().referenceToProxy(reference);
}
@@ -838,27 +838,27 @@ public final class ObjectAdapter
private ObjectPrx
newIndirectProxy(Identity ident, String facet, String id)
{
- //
- // Create a reference with the adapter id and return a
- // proxy for the reference.
- //
- IceInternal.Endpoint[] endpoints = new IceInternal.Endpoint[0];
- Connection[] connections = new Connection[0];
- IceInternal.Reference reference =
- _instance.referenceFactory().create(ident, null, facet, IceInternal.Reference.ModeTwoway, false, id, null,
- _locatorInfo);
- return _instance.proxyFactory().referenceToProxy(reference);
+ //
+ // Create a reference with the adapter id and return a
+ // proxy for the reference.
+ //
+ IceInternal.Endpoint[] endpoints = new IceInternal.Endpoint[0];
+ Connection[] connections = new Connection[0];
+ IceInternal.Reference reference =
+ _instance.referenceFactory().create(ident, null, facet, IceInternal.Reference.ModeTwoway, false, id, null,
+ _locatorInfo);
+ return _instance.proxyFactory().referenceToProxy(reference);
}
private void
checkForDeactivation()
{
- if(_deactivated)
- {
+ if(_deactivated)
+ {
ObjectAdapterDeactivatedException ex = new ObjectAdapterDeactivatedException();
- ex.name = _name;
- throw ex;
- }
+ ex.name = _name;
+ throw ex;
+ }
}
private static void
@@ -873,10 +873,10 @@ public final class ObjectAdapter
}
catch(IceUtil.CloneException ex)
{
- if(IceUtil.Debug.ASSERT)
- {
- IceUtil.Debug.Assert(false);
- }
+ if(IceUtil.Debug.ASSERT)
+ {
+ IceUtil.Debug.Assert(false);
+ }
}
throw e;
}
@@ -892,108 +892,108 @@ public final class ObjectAdapter
{
endpts = endpts.toLowerCase();
- int beg;
- int end = 0;
+ int beg;
+ int end = 0;
- final String delim = " \t\n\r";
+ final String delim = " \t\n\r";
- java.util.Vector endpoints = new java.util.Vector();
- while(end < endpts.length())
- {
- beg = IceUtil.StringUtil.findFirstNotOf(endpts, delim, end);
- if(beg == -1)
- {
- break;
- }
+ java.util.Vector endpoints = new java.util.Vector();
+ while(end < endpts.length())
+ {
+ beg = IceUtil.StringUtil.findFirstNotOf(endpts, delim, end);
+ if(beg == -1)
+ {
+ break;
+ }
- end = endpts.indexOf(':', beg);
- if(end == -1)
- {
- end = endpts.length();
- }
+ end = endpts.indexOf(':', beg);
+ if(end == -1)
+ {
+ end = endpts.length();
+ }
- if(end == beg)
- {
- ++end;
- continue;
- }
+ if(end == beg)
+ {
+ ++end;
+ continue;
+ }
- String s = endpts.substring(beg, end);
- IceInternal.Endpoint endp = _instance.endpointFactory().create(s);
- if(endp == null)
- {
- Ice.EndpointParseException e = new Ice.EndpointParseException();
- e.str = s;
- throw e;
- }
- endpoints.addElement(endp);
+ String s = endpts.substring(beg, end);
+ IceInternal.Endpoint endp = _instance.endpointFactory().create(s);
+ if(endp == null)
+ {
+ Ice.EndpointParseException e = new Ice.EndpointParseException();
+ e.str = s;
+ throw e;
+ }
+ endpoints.addElement(endp);
- ++end;
- }
+ ++end;
+ }
- return endpoints;
+ return endpoints;
}
private void
updateLocatorRegistry(IceInternal.LocatorInfo locatorInfo, Ice.ObjectPrx proxy)
{
- if(_id.length() == 0)
- {
- return; // Nothing to update.
- }
-
- //
- // We must get and call on the locator registry outside the
- // thread synchronization to avoid deadlocks. (we can't make
- // remote calls within the OA synchronization because the
- // remote call will indirectly call isLocal() on this OA with
- // the OA factory locked).
- //
- // TODO: This might throw if we can't connect to the
- // locator. Shall we raise a special exception for the
- // activate operation instead of a non obvious network
- // exception?
- //
- LocatorRegistryPrx locatorRegistry = locatorInfo != null ? locatorInfo.getLocatorRegistry() : null;
- if(locatorRegistry == null)
- {
- return;
- }
-
- if(_id.length() > 0)
- {
- try
- {
- if(_replicaGroupId.length() == 0)
- {
- locatorRegistry.setAdapterDirectProxy(_id, proxy);
- }
- else
- {
- locatorRegistry.setReplicatedAdapterDirectProxy(_id, _replicaGroupId, proxy);
- }
- }
- catch(AdapterNotFoundException ex)
- {
- NotRegisteredException ex1 = new NotRegisteredException();
- ex1.kindOfObject = "object adapter";
- ex1.id = _id;
- throw ex1;
- }
- catch(InvalidReplicaGroupIdException ex)
- {
- NotRegisteredException ex1 = new NotRegisteredException();
- ex1.kindOfObject = "replica group";
- ex1.id = _replicaGroupId;
- throw ex1;
- }
- catch(AdapterAlreadyActiveException ex)
- {
- ObjectAdapterIdInUseException ex1 = new ObjectAdapterIdInUseException();
- ex1.id = _id;
- throw ex1;
- }
- }
+ if(_id.length() == 0)
+ {
+ return; // Nothing to update.
+ }
+
+ //
+ // We must get and call on the locator registry outside the
+ // thread synchronization to avoid deadlocks. (we can't make
+ // remote calls within the OA synchronization because the
+ // remote call will indirectly call isLocal() on this OA with
+ // the OA factory locked).
+ //
+ // TODO: This might throw if we can't connect to the
+ // locator. Shall we raise a special exception for the
+ // activate operation instead of a non obvious network
+ // exception?
+ //
+ LocatorRegistryPrx locatorRegistry = locatorInfo != null ? locatorInfo.getLocatorRegistry() : null;
+ if(locatorRegistry == null)
+ {
+ return;
+ }
+
+ if(_id.length() > 0)
+ {
+ try
+ {
+ if(_replicaGroupId.length() == 0)
+ {
+ locatorRegistry.setAdapterDirectProxy(_id, proxy);
+ }
+ else
+ {
+ locatorRegistry.setReplicatedAdapterDirectProxy(_id, _replicaGroupId, proxy);
+ }
+ }
+ catch(AdapterNotFoundException ex)
+ {
+ NotRegisteredException ex1 = new NotRegisteredException();
+ ex1.kindOfObject = "object adapter";
+ ex1.id = _id;
+ throw ex1;
+ }
+ catch(InvalidReplicaGroupIdException ex)
+ {
+ NotRegisteredException ex1 = new NotRegisteredException();
+ ex1.kindOfObject = "replica group";
+ ex1.id = _replicaGroupId;
+ throw ex1;
+ }
+ catch(AdapterAlreadyActiveException ex)
+ {
+ ObjectAdapterIdInUseException ex1 = new ObjectAdapterIdInUseException();
+ ex1.id = _id;
+ throw ex1;
+ }
+ }
}
private boolean _deactivated;
diff --git a/javae/src/Ice/ObjectImpl.java b/javae/src/Ice/ObjectImpl.java
index 855f92a966b..0db8985dc64 100644
--- a/javae/src/Ice/ObjectImpl.java
+++ b/javae/src/Ice/ObjectImpl.java
@@ -20,20 +20,20 @@ public abstract class ObjectImpl implements Object
ice_clone()
throws IceUtil.CloneException
{
- try
- {
- ObjectImpl obj = (ObjectImpl)getClass().newInstance();
- obj.__copyFrom(this);
- return obj;
- }
- catch(java.lang.IllegalAccessException ex)
- {
- throw new IceUtil.CloneException(ex.getMessage());
- }
- catch(java.lang.InstantiationException ex)
- {
- throw new IceUtil.CloneException(ex.getMessage());
- }
+ try
+ {
+ ObjectImpl obj = (ObjectImpl)getClass().newInstance();
+ obj.__copyFrom(this);
+ return obj;
+ }
+ catch(java.lang.IllegalAccessException ex)
+ {
+ throw new IceUtil.CloneException(ex.getMessage());
+ }
+ catch(java.lang.InstantiationException ex)
+ {
+ throw new IceUtil.CloneException(ex.getMessage());
+ }
}
public int
@@ -174,10 +174,10 @@ public abstract class ObjectImpl implements Object
}
}
- if(IceUtil.Debug.ASSERT)
- {
- IceUtil.Debug.Assert(false);
- }
+ if(IceUtil.Debug.ASSERT)
+ {
+ IceUtil.Debug.Assert(false);
+ }
throw new OperationNotExistException(current.id, current.facet, current.operation);
}
@@ -189,44 +189,44 @@ public abstract class ObjectImpl implements Object
private static String
operationModeToString(OperationMode mode)
{
- if(mode == Ice.OperationMode.Normal)
- {
- return "::Ice::Normal";
- }
- if(mode == Ice.OperationMode.Nonmutating)
- {
- return "::Ice::Nonmutating";
- }
+ if(mode == Ice.OperationMode.Normal)
+ {
+ return "::Ice::Normal";
+ }
+ if(mode == Ice.OperationMode.Nonmutating)
+ {
+ return "::Ice::Nonmutating";
+ }
- if(mode == Ice.OperationMode.Idempotent)
- {
- return "::Ice::Idempotent";
- }
+ if(mode == Ice.OperationMode.Idempotent)
+ {
+ return "::Ice::Idempotent";
+ }
- return "???";
+ return "???";
}
protected static void
__checkMode(OperationMode expected, OperationMode received)
{
- if(expected != received)
- {
- if(expected == Ice.OperationMode.Idempotent
- && received == Ice.OperationMode.Nonmutating)
- {
- //
- // Fine: typically an old client still using the
+ if(expected != received)
+ {
+ if(expected == Ice.OperationMode.Idempotent
+ && received == Ice.OperationMode.Nonmutating)
+ {
+ //
+ // Fine: typically an old client still using the
// deprecated nonmutating keyword
- //
- }
- else
- {
- Ice.MarshalException ex = new Ice.MarshalException();
- ex.reason = "unexpected operation mode. expected = "
- + operationModeToString(expected) + " received = "
- + operationModeToString(received);
- throw ex;
- }
- }
+ //
+ }
+ else
+ {
+ Ice.MarshalException ex = new Ice.MarshalException();
+ ex.reason = "unexpected operation mode. expected = "
+ + operationModeToString(expected) + " received = "
+ + operationModeToString(received);
+ throw ex;
+ }
+ }
}
}
diff --git a/javae/src/Ice/ObjectPrxHelper.java b/javae/src/Ice/ObjectPrxHelper.java
index 2b538b4d64c..b1192047971 100644
--- a/javae/src/Ice/ObjectPrxHelper.java
+++ b/javae/src/Ice/ObjectPrxHelper.java
@@ -14,82 +14,82 @@ public class ObjectPrxHelper extends ObjectPrxHelperBase
public static ObjectPrx
checkedCast(Ice.ObjectPrx b)
{
- return b;
+ return b;
}
public static ObjectPrx
checkedCast(Ice.ObjectPrx b, java.util.Hashtable ctx)
{
- return b;
+ return b;
}
public static ObjectPrx
checkedCast(Ice.ObjectPrx b, String f)
{
- ObjectPrx d = null;
- if(b != null)
- {
- Ice.ObjectPrx bb = b.ice_facet(f);
- try
- {
- boolean ok = bb.ice_isA("::Ice::Object");
- if(IceUtil.Debug.ASSERT)
- {
- IceUtil.Debug.Assert(ok);
- }
- ObjectPrxHelper h = new ObjectPrxHelper();
- h.__copyFrom(bb);
- d = h;
- }
- catch(Ice.FacetNotExistException ex)
- {
- }
- }
- return d;
+ ObjectPrx d = null;
+ if(b != null)
+ {
+ Ice.ObjectPrx bb = b.ice_facet(f);
+ try
+ {
+ boolean ok = bb.ice_isA("::Ice::Object");
+ if(IceUtil.Debug.ASSERT)
+ {
+ IceUtil.Debug.Assert(ok);
+ }
+ ObjectPrxHelper h = new ObjectPrxHelper();
+ h.__copyFrom(bb);
+ d = h;
+ }
+ catch(Ice.FacetNotExistException ex)
+ {
+ }
+ }
+ return d;
}
public static ObjectPrx
checkedCast(Ice.ObjectPrx b, String f, java.util.Hashtable ctx)
{
- ObjectPrx d = null;
- if(b != null)
- {
- Ice.ObjectPrx bb = b.ice_facet(f);
- try
- {
- boolean ok = bb.ice_isA("::Ice::Object", ctx);
- if(IceUtil.Debug.ASSERT)
- {
- IceUtil.Debug.Assert(ok);
- }
- ObjectPrxHelper h = new ObjectPrxHelper();
- h.__copyFrom(bb);
- d = h;
- }
- catch(Ice.FacetNotExistException ex)
- {
- }
- }
- return d;
+ ObjectPrx d = null;
+ if(b != null)
+ {
+ Ice.ObjectPrx bb = b.ice_facet(f);
+ try
+ {
+ boolean ok = bb.ice_isA("::Ice::Object", ctx);
+ if(IceUtil.Debug.ASSERT)
+ {
+ IceUtil.Debug.Assert(ok);
+ }
+ ObjectPrxHelper h = new ObjectPrxHelper();
+ h.__copyFrom(bb);
+ d = h;
+ }
+ catch(Ice.FacetNotExistException ex)
+ {
+ }
+ }
+ return d;
}
public static ObjectPrx
uncheckedCast(Ice.ObjectPrx b)
{
- return b;
+ return b;
}
public static ObjectPrx
uncheckedCast(Ice.ObjectPrx b, String f)
{
- ObjectPrx d = null;
- if(b != null)
- {
- Ice.ObjectPrx bb = b.ice_facet(f);
- ObjectPrxHelper h = new ObjectPrxHelper();
- h.__copyFrom(bb);
- d = h;
- }
- return d;
+ ObjectPrx d = null;
+ if(b != null)
+ {
+ Ice.ObjectPrx bb = b.ice_facet(f);
+ ObjectPrxHelper h = new ObjectPrxHelper();
+ h.__copyFrom(bb);
+ d = h;
+ }
+ return d;
}
}
diff --git a/javae/src/Ice/ObjectPrxHelperBase.java b/javae/src/Ice/ObjectPrxHelperBase.java
index ba752d9ca84..68af5658fe2 100644
--- a/javae/src/Ice/ObjectPrxHelperBase.java
+++ b/javae/src/Ice/ObjectPrxHelperBase.java
@@ -70,7 +70,7 @@ public class ObjectPrxHelperBase implements ObjectPrx
Connection __connection = null;
try
{
- __checkTwowayOnly("ice_isA");
+ __checkTwowayOnly("ice_isA");
__connection = ice_getConnection();
IceInternal.Outgoing __og = __connection.getOutgoing(_reference, "ice_isA", OperationMode.Nonmutating,
__context);
@@ -91,14 +91,14 @@ public class ObjectPrxHelperBase implements ObjectPrx
IceInternal.BasicStream __is = __og.stream();
if(!__ok)
{
- try
- {
+ try
+ {
__is.throwException();
- }
- catch(UserException __ex)
- {
- throw new Ice.UnknownUserException(__ex.ice_name());
- }
+ }
+ catch(UserException __ex)
+ {
+ throw new Ice.UnknownUserException(__ex.ice_name());
+ }
}
return __is.readBool();
}
@@ -138,7 +138,7 @@ public class ObjectPrxHelperBase implements ObjectPrx
Connection __connection = null;
try
{
- __connection = ice_getConnection();
+ __connection = ice_getConnection();
IceInternal.Outgoing __og = __connection.getOutgoing(_reference, "ice_ping", OperationMode.Nonmutating,
__context);
try
@@ -149,14 +149,14 @@ public class ObjectPrxHelperBase implements ObjectPrx
IceInternal.BasicStream __is = __og.stream();
if(!__ok)
{
- try
- {
+ try
+ {
__is.throwException();
- }
- catch(UserException __ex)
- {
- throw new Ice.UnknownUserException(__ex.ice_name());
- }
+ }
+ catch(UserException __ex)
+ {
+ throw new Ice.UnknownUserException(__ex.ice_name());
+ }
}
}
catch(LocalException __ex)
@@ -196,8 +196,8 @@ public class ObjectPrxHelperBase implements ObjectPrx
Connection __connection = null;
try
{
- __checkTwowayOnly("ice_ids");
- __connection = ice_getConnection();
+ __checkTwowayOnly("ice_ids");
+ __connection = ice_getConnection();
IceInternal.Outgoing __og = __connection.getOutgoing(_reference, "ice_ids", OperationMode.Nonmutating,
__context);
try
@@ -208,14 +208,14 @@ public class ObjectPrxHelperBase implements ObjectPrx
IceInternal.BasicStream __is = __og.stream();
if(!__ok)
{
- try
- {
+ try
+ {
__is.throwException();
- }
- catch(UserException __ex)
- {
- throw new Ice.UnknownUserException(__ex.ice_name());
- }
+ }
+ catch(UserException __ex)
+ {
+ throw new Ice.UnknownUserException(__ex.ice_name());
+ }
}
return __is.readStringSeq();
}
@@ -255,8 +255,8 @@ public class ObjectPrxHelperBase implements ObjectPrx
Connection __connection = null;
try
{
- __checkTwowayOnly("ice_id");
- __connection = ice_getConnection();
+ __checkTwowayOnly("ice_id");
+ __connection = ice_getConnection();
IceInternal.Outgoing __og = __connection.getOutgoing(_reference, "ice_id", OperationMode.Nonmutating,
__context);
try
@@ -267,14 +267,14 @@ public class ObjectPrxHelperBase implements ObjectPrx
IceInternal.BasicStream __is = __og.stream();
if(!__ok)
{
- try
- {
+ try
+ {
__is.throwException();
- }
- catch(UserException __ex)
- {
- throw new Ice.UnknownUserException(__ex.ice_name());
- }
+ }
+ catch(UserException __ex)
+ {
+ throw new Ice.UnknownUserException(__ex.ice_name());
+ }
}
return __is.readString();
}
@@ -308,10 +308,10 @@ public class ObjectPrxHelperBase implements ObjectPrx
public final ObjectPrx
ice_identity(Identity newIdentity)
{
- if(newIdentity.equals(""))
- {
- throw new Ice.IllegalIdentityException();
- }
+ if(newIdentity.equals(""))
+ {
+ throw new Ice.IllegalIdentityException();
+ }
if(newIdentity.equals(_reference.getIdentity()))
{
return this;
@@ -330,7 +330,7 @@ public class ObjectPrxHelperBase implements ObjectPrx
public final ObjectPrx
ice_newIdentity(Identity newIdentity)
{
- return ice_identity(newIdentity);
+ return ice_identity(newIdentity);
}
public final java.util.Hashtable
@@ -342,9 +342,9 @@ public class ObjectPrxHelperBase implements ObjectPrx
public final ObjectPrx
ice_context(java.util.Hashtable newContext)
{
- ObjectPrxHelperBase proxy = new ObjectPrxHelperBase();
- proxy.setup(_reference.changeContext(newContext));
- return proxy;
+ ObjectPrxHelperBase proxy = new ObjectPrxHelperBase();
+ proxy.setup(_reference.changeContext(newContext));
+ return proxy;
}
/**
@@ -353,7 +353,7 @@ public class ObjectPrxHelperBase implements ObjectPrx
public final ObjectPrx
ice_newContext(java.util.Hashtable newContext)
{
- return ice_context(newContext);
+ return ice_context(newContext);
}
public final String
@@ -388,7 +388,7 @@ public class ObjectPrxHelperBase implements ObjectPrx
public final ObjectPrx
ice_newFacet(String newFacet)
{
- return ice_facet(newFacet);
+ return ice_facet(newFacet);
}
public final String
@@ -441,8 +441,8 @@ public class ObjectPrxHelperBase implements ObjectPrx
public final Ice.RouterPrx
ice_getRouter()
{
- IceInternal.RouterInfo ri = _reference.getRouterInfo();
- return ri != null ? ri.getRouter() : null;
+ IceInternal.RouterInfo ri = _reference.getRouterInfo();
+ return ri != null ? ri.getRouter() : null;
}
public final ObjectPrx
@@ -464,8 +464,8 @@ public class ObjectPrxHelperBase implements ObjectPrx
public final Ice.LocatorPrx
ice_getLocator()
{
- IceInternal.LocatorInfo ri = _reference.getLocatorInfo();
- return ri != null ? ri.getLocator() : null;
+ IceInternal.LocatorInfo ri = _reference.getLocatorInfo();
+ return ri != null ? ri.getLocator() : null;
}
public final ObjectPrx
@@ -503,7 +503,7 @@ public class ObjectPrxHelperBase implements ObjectPrx
public final boolean
ice_isTwoway()
{
- return _reference.getMode() == IceInternal.Reference.ModeTwoway;
+ return _reference.getMode() == IceInternal.Reference.ModeTwoway;
}
public final ObjectPrx
@@ -525,7 +525,7 @@ public class ObjectPrxHelperBase implements ObjectPrx
public final boolean
ice_isOneway()
{
- return _reference.getMode() == IceInternal.Reference.ModeOneway;
+ return _reference.getMode() == IceInternal.Reference.ModeOneway;
}
public final ObjectPrx
@@ -547,7 +547,7 @@ public class ObjectPrxHelperBase implements ObjectPrx
public final boolean
ice_isBatchOneway()
{
- return _reference.getMode() == IceInternal.Reference.ModeBatchOneway;
+ return _reference.getMode() == IceInternal.Reference.ModeBatchOneway;
}
public final ObjectPrx
@@ -569,7 +569,7 @@ public class ObjectPrxHelperBase implements ObjectPrx
public final boolean
ice_isDatagram()
{
- return _reference.getMode() == IceInternal.Reference.ModeDatagram;
+ return _reference.getMode() == IceInternal.Reference.ModeDatagram;
}
public final ObjectPrx
@@ -591,7 +591,7 @@ public class ObjectPrxHelperBase implements ObjectPrx
public final boolean
ice_isBatchDatagram()
{
- return _reference.getMode() == IceInternal.Reference.ModeBatchDatagram;
+ return _reference.getMode() == IceInternal.Reference.ModeBatchDatagram;
}
public final ObjectPrx
@@ -622,28 +622,28 @@ public class ObjectPrxHelperBase implements ObjectPrx
public synchronized final Connection
ice_getConnection()
{
- if(_connection == null)
- {
- _connection = _reference.getConnection();
+ if(_connection == null)
+ {
+ _connection = _reference.getConnection();
//
// If this proxy is for a non-local object, and we are
// using a router, then add this proxy to the router info
// object.
//
- try
- {
- IceInternal.RoutableReference rr = (IceInternal.RoutableReference)_reference;
- if(rr != null && rr.getRouterInfo() != null)
- {
- rr.getRouterInfo().addProxy(this);
- }
- }
- catch(ClassCastException e)
- {
- }
- }
- return _connection;
+ try
+ {
+ IceInternal.RoutableReference rr = (IceInternal.RoutableReference)_reference;
+ if(rr != null && rr.getRouterInfo() != null)
+ {
+ rr.getRouterInfo().addProxy(this);
+ }
+ }
+ catch(ClassCastException e)
+ {
+ }
+ }
+ return _connection;
}
public synchronized final Connection
@@ -683,96 +683,96 @@ public class ObjectPrxHelperBase implements ObjectPrx
// called upon initialization.
//
- if(IceUtil.Debug.ASSERT)
- {
- IceUtil.Debug.Assert(_reference == null);
- IceUtil.Debug.Assert(_connection == null);
- }
+ if(IceUtil.Debug.ASSERT)
+ {
+ IceUtil.Debug.Assert(_reference == null);
+ IceUtil.Debug.Assert(_connection == null);
+ }
_reference = ref;
- _connection = con;
+ _connection = con;
}
public final int
__handleException(Connection connection, LocalException ex, int cnt)
{
- //
- // Only _connection needs to be mutex protected here.
- //
- synchronized(this)
- {
+ //
+ // Only _connection needs to be mutex protected here.
+ //
+ synchronized(this)
+ {
if(connection == _connection)
{
_connection = null;
}
- }
-
- IceInternal.ProxyFactory proxyFactory = _reference.getInstance().proxyFactory();
- if(proxyFactory != null)
- {
- return proxyFactory.checkRetryAfterException(ex, _reference, cnt);
- }
- else
- {
- //
+ }
+
+ IceInternal.ProxyFactory proxyFactory = _reference.getInstance().proxyFactory();
+ if(proxyFactory != null)
+ {
+ return proxyFactory.checkRetryAfterException(ex, _reference, cnt);
+ }
+ else
+ {
+ //
// The communicator is already destroyed, so we cannot
// retry.
- //
- throw ex;
- }
+ //
+ throw ex;
+ }
}
public final void
__handleExceptionWrapper(Connection connection, IceInternal.LocalExceptionWrapper ex)
{
synchronized(this)
- {
+ {
if(connection == _connection)
{
_connection = null;
}
- }
+ }
- if(!ex.retry())
- {
- throw ex.get();
- }
+ if(!ex.retry())
+ {
+ throw ex.get();
+ }
}
public final int
__handleExceptionWrapperRelaxed(Connection connection, IceInternal.LocalExceptionWrapper ex, int cnt)
{
if(!ex.retry())
- {
- return __handleException(connection, ex.get(), cnt);
- }
- else
- {
- synchronized(this)
- {
+ {
+ return __handleException(connection, ex.get(), cnt);
+ }
+ else
+ {
+ synchronized(this)
+ {
if(connection == _connection)
{
_connection = null;
}
- }
- return cnt;
- }
+ }
+ return cnt;
+ }
}
public final void
__checkTwowayOnly(String name)
{
- //
- // No mutex lock necessary, there is nothing mutable in this
- // operation.
- //
+ //
+ // No mutex lock necessary, there is nothing mutable in this
+ // operation.
+ //
if(!ice_isTwoway())
- {
- TwowayOnlyException ex = new TwowayOnlyException();
- ex.operation = name;
- throw ex;
- }
+ {
+ TwowayOnlyException ex = new TwowayOnlyException();
+ ex.operation = name;
+ throw ex;
+ }
}
//
@@ -786,11 +786,11 @@ public class ObjectPrxHelperBase implements ObjectPrx
// upon initial initialization.
//
- if(IceUtil.Debug.ASSERT)
- {
- IceUtil.Debug.Assert(_reference == null);
- IceUtil.Debug.Assert(_connection == null);
- }
+ if(IceUtil.Debug.ASSERT)
+ {
+ IceUtil.Debug.Assert(_reference == null);
+ IceUtil.Debug.Assert(_connection == null);
+ }
_reference = ref;
}
diff --git a/javae/src/Ice/OperationMode.java b/javae/src/Ice/OperationMode.java
index 8a3ba98660e..b914d23dd98 100644
--- a/javae/src/Ice/OperationMode.java
+++ b/javae/src/Ice/OperationMode.java
@@ -26,53 +26,53 @@ public final class OperationMode
public static OperationMode
convert(int val)
{
- if(IceUtil.Debug.ASSERT)
- {
- IceUtil.Debug.Assert(val < 3);
- }
- return __values[val];
+ if(IceUtil.Debug.ASSERT)
+ {
+ IceUtil.Debug.Assert(val < 3);
+ }
+ return __values[val];
}
public int
value()
{
- return __value;
+ return __value;
}
public String
toString()
{
- return __T[__value];
+ return __T[__value];
}
private
OperationMode(int val)
{
- __value = val;
- __values[val] = this;
+ __value = val;
+ __values[val] = this;
}
public void
__write(IceInternal.BasicStream __os)
{
- __os.writeByte((byte)__value);
+ __os.writeByte((byte)__value);
}
public static OperationMode
__read(IceInternal.BasicStream __is)
{
- int __v = __is.readByte();
- if(__v < 0 || __v >= 3)
- {
- throw new Ice.MarshalException();
- }
- return OperationMode.convert(__v);
+ int __v = __is.readByte();
+ if(__v < 0 || __v >= 3)
+ {
+ throw new Ice.MarshalException();
+ }
+ return OperationMode.convert(__v);
}
final static private String[] __T =
{
- "Normal",
- "Nonmutating",
- "Idempotent"
+ "Normal",
+ "Nonmutating",
+ "Idempotent"
};
}
diff --git a/javae/src/Ice/UserException.java b/javae/src/Ice/UserException.java
index 5998402184d..5bc7a1b78e5 100644
--- a/javae/src/Ice/UserException.java
+++ b/javae/src/Ice/UserException.java
@@ -17,7 +17,7 @@ public abstract class UserException extends Exception
public String
toString()
{
- return ice_name();
+ return ice_name();
}
public abstract void
diff --git a/javae/src/Ice/Util.java b/javae/src/Ice/Util.java
index a45291c55b0..c65ac9fea92 100644
--- a/javae/src/Ice/Util.java
+++ b/javae/src/Ice/Util.java
@@ -32,14 +32,14 @@ public final class Util
public static Properties
createProperties(String[] args)
{
- StringSeqHolder argsH = new StringSeqHolder(args);
+ StringSeqHolder argsH = new StringSeqHolder(args);
return createProperties(argsH);
}
public static Properties
createProperties(String[] args, Properties defaults)
{
- StringSeqHolder argsH = new StringSeqHolder(args);
+ StringSeqHolder argsH = new StringSeqHolder(args);
return createProperties(argsH, defaults);
}
@@ -47,28 +47,28 @@ public final class Util
initialize(StringSeqHolder args)
{
InitializationData initData = new InitializationData();
- return initialize(args, initData);
+ return initialize(args, initData);
}
public static Communicator
initialize(String[] args)
{
StringSeqHolder argsH = new StringSeqHolder(args);
- return initialize(argsH);
+ return initialize(argsH);
}
public static Communicator
initialize(StringSeqHolder args, InitializationData initData)
{
- if(initData == null)
- {
- initData = new InitializationData();
- }
- else
- {
- initData = (InitializationData)initData.ice_clone();
- }
- initData.properties = createProperties(args, initData.properties);
+ if(initData == null)
+ {
+ initData = new InitializationData();
+ }
+ else
+ {
+ initData = (InitializationData)initData.ice_clone();
+ }
+ initData.properties = createProperties(args, initData.properties);
Communicator result = new Communicator(initData);
result.finishSetup(args);
@@ -79,22 +79,22 @@ public final class Util
initialize(String[] args, InitializationData initData)
{
StringSeqHolder argsH = new StringSeqHolder(args);
- return initialize(argsH, initData);
+ return initialize(argsH, initData);
}
public static Communicator
initialize(InitializationData initData)
{
- if(initData == null)
- {
- initData = new InitializationData();
- }
- else
- {
- initData = (InitializationData)initData.ice_clone();
- }
+ if(initData == null)
+ {
+ initData = new InitializationData();
+ }
+ else
+ {
+ initData = (InitializationData)initData.ice_clone();
+ }
- Communicator result = new Communicator(initData);
+ Communicator result = new Communicator(initData);
result.finishSetup(new StringSeqHolder(new String[0]));
return result;
}
@@ -114,7 +114,7 @@ public final class Util
public static synchronized String
generateUUID()
{
- if(_localAddress == null)
+ if(_localAddress == null)
{
byte[] ip = IceInternal.Network.getLocalAddress();
_localAddress = "";
@@ -128,69 +128,69 @@ public final class Util
_localAddress += Integer.toHexString(n);
}
}
-
+
return _localAddress + ":" + IceUtil.UUID.create();
}
public static int
proxyIdentityCompare(ObjectPrx lhs, ObjectPrx rhs)
{
- if(lhs == null && rhs == null)
- {
- return 0;
- }
- else if(lhs == null && rhs != null)
- {
- return -1;
- }
- else if(lhs != null && rhs == null)
- {
- return 1;
- }
- else
- {
- Identity lhsIdentity = lhs.ice_getIdentity();
- Identity rhsIdentity = rhs.ice_getIdentity();
- int n;
- if((n = lhsIdentity.name.compareTo(rhsIdentity.name)) != 0)
- {
- return n;
- }
- return lhsIdentity.category.compareTo(rhsIdentity.category);
- }
+ if(lhs == null && rhs == null)
+ {
+ return 0;
+ }
+ else if(lhs == null && rhs != null)
+ {
+ return -1;
+ }
+ else if(lhs != null && rhs == null)
+ {
+ return 1;
+ }
+ else
+ {
+ Identity lhsIdentity = lhs.ice_getIdentity();
+ Identity rhsIdentity = rhs.ice_getIdentity();
+ int n;
+ if((n = lhsIdentity.name.compareTo(rhsIdentity.name)) != 0)
+ {
+ return n;
+ }
+ return lhsIdentity.category.compareTo(rhsIdentity.category);
+ }
}
public static int
proxyIdentityAndFacetCompare(ObjectPrx lhs, ObjectPrx rhs)
{
- if(lhs == null && rhs == null)
- {
- return 0;
- }
- else if(lhs == null && rhs != null)
- {
- return -1;
- }
- else if(lhs != null && rhs == null)
- {
- return 1;
- }
- else
- {
- Identity lhsIdentity = lhs.ice_getIdentity();
- Identity rhsIdentity = rhs.ice_getIdentity();
- int n;
- if((n = lhsIdentity.name.compareTo(rhsIdentity.name)) != 0)
- {
- return n;
- }
- if((n = lhsIdentity.category.compareTo(rhsIdentity.category)) != 0)
- {
- return n;
- }
-
- String lhsFacet = lhs.ice_getFacet();
- String rhsFacet = rhs.ice_getFacet();
+ if(lhs == null && rhs == null)
+ {
+ return 0;
+ }
+ else if(lhs == null && rhs != null)
+ {
+ return -1;
+ }
+ else if(lhs != null && rhs == null)
+ {
+ return 1;
+ }
+ else
+ {
+ Identity lhsIdentity = lhs.ice_getIdentity();
+ Identity rhsIdentity = rhs.ice_getIdentity();
+ int n;
+ if((n = lhsIdentity.name.compareTo(rhsIdentity.name)) != 0)
+ {
+ return n;
+ }
+ if((n = lhsIdentity.category.compareTo(rhsIdentity.category)) != 0)
+ {
+ return n;
+ }
+
+ String lhsFacet = lhs.ice_getFacet();
+ String rhsFacet = rhs.ice_getFacet();
if(lhsFacet == null && rhsFacet == null)
{
return 0;
@@ -204,7 +204,7 @@ public final class Util
return 1;
}
return lhsFacet.compareTo(rhsFacet);
- }
+ }
}
public static void
diff --git a/javae/src/IceInternal/BasicStream.java b/javae/src/IceInternal/BasicStream.java
index 212981e1cdf..1236ad19e31 100644
--- a/javae/src/IceInternal/BasicStream.java
+++ b/javae/src/IceInternal/BasicStream.java
@@ -31,19 +31,19 @@ public class BasicStream
allocate(1500);
_capacity = _buf.capacity();
_limit = 0;
- if(IceUtil.Debug.ASSERT)
- {
- IceUtil.Debug.Assert(_buf.limit() == _capacity);
- }
+ if(IceUtil.Debug.ASSERT)
+ {
+ IceUtil.Debug.Assert(_buf.limit() == _capacity);
+ }
_readEncapsStack = null;
_writeEncapsStack = null;
- _messageSizeMax = _instance.messageSizeMax(); // Cached for efficiency.
+ _messageSizeMax = _instance.messageSizeMax(); // Cached for efficiency.
- _seqDataStack = null;
+ _seqDataStack = null;
- _shrinkCounter = 0;
+ _shrinkCounter = 0;
}
//
@@ -52,25 +52,25 @@ public class BasicStream
public void
reset()
{
- if(_limit > 0 && _limit * 2 < _capacity)
- {
- //
- // If twice the size of the stream is less than the capacity
- // for more than two consecutive times, we shrink the buffer.
- // This is to avoid holding on too much memory if it's not
- // needed anymore.
- //
- if(++_shrinkCounter > 2)
- {
- allocate(_limit);
- _capacity = _buf.capacity();
- _shrinkCounter = 0;
- }
- }
- else
- {
- _shrinkCounter = 0;
- }
+ if(_limit > 0 && _limit * 2 < _capacity)
+ {
+ //
+ // If twice the size of the stream is less than the capacity
+ // for more than two consecutive times, we shrink the buffer.
+ // This is to avoid holding on too much memory if it's not
+ // needed anymore.
+ //
+ if(++_shrinkCounter > 2)
+ {
+ allocate(_limit);
+ _capacity = _buf.capacity();
+ _shrinkCounter = 0;
+ }
+ }
+ else
+ {
+ _shrinkCounter = 0;
+ }
_limit = 0;
_buf.limit(_capacity);
_buf.position(0);
@@ -87,10 +87,10 @@ public class BasicStream
public void
swap(BasicStream other)
{
- if(IceUtil.Debug.ASSERT)
- {
- IceUtil.Debug.Assert(_instance == other._instance);
- }
+ if(IceUtil.Debug.ASSERT)
+ {
+ IceUtil.Debug.Assert(_instance == other._instance);
+ }
ByteBuffer tmpBuf = other._buf;
other._buf = _buf;
@@ -112,21 +112,21 @@ public class BasicStream
other._writeEncapsStack = _writeEncapsStack;
_writeEncapsStack = tmpWrite;
- int tmpReadSlice = other._readSlice;
- other._readSlice = _readSlice;
- _readSlice = tmpReadSlice;
+ int tmpReadSlice = other._readSlice;
+ other._readSlice = _readSlice;
+ _readSlice = tmpReadSlice;
- int tmpWriteSlice = other._writeSlice;
- other._writeSlice = _writeSlice;
- _writeSlice = tmpWriteSlice;
+ int tmpWriteSlice = other._writeSlice;
+ other._writeSlice = _writeSlice;
+ _writeSlice = tmpWriteSlice;
- SeqData tmpSeqDataStack = other._seqDataStack;
- other._seqDataStack = _seqDataStack;
- _seqDataStack = tmpSeqDataStack;
+ SeqData tmpSeqDataStack = other._seqDataStack;
+ other._seqDataStack = _seqDataStack;
+ _seqDataStack = tmpSeqDataStack;
- int tmpShrinkCounter = other._shrinkCounter;
- other._shrinkCounter = _shrinkCounter;
- _shrinkCounter = tmpShrinkCounter;
+ int tmpShrinkCounter = other._shrinkCounter;
+ other._shrinkCounter = _shrinkCounter;
+ _shrinkCounter = tmpShrinkCounter;
boolean tmpUnlimited = other._unlimited;
other._unlimited = _unlimited;
@@ -229,33 +229,33 @@ public class BasicStream
public void
startSeq(int numElements, int minSize)
{
- if(numElements == 0) // Optimization to avoid pushing a useless stack frame.
- {
- return;
- }
-
- //
- // Push the current sequence details on the stack.
- //
- SeqData sd = new SeqData(numElements, minSize);
- sd.previous = _seqDataStack;
- _seqDataStack = sd;
-
- int bytesLeft = _buf.remaining();
- if(_seqDataStack.previous == null) // Outermost sequence
- {
- //
- // The sequence must fit within the message.
- //
- if(numElements * minSize > bytesLeft)
- {
- Ice.Util.throwUnmarshalOutOfBoundsException();
- }
- }
- else // Nested sequence
- {
- checkSeq(bytesLeft);
- }
+ if(numElements == 0) // Optimization to avoid pushing a useless stack frame.
+ {
+ return;
+ }
+
+ //
+ // Push the current sequence details on the stack.
+ //
+ SeqData sd = new SeqData(numElements, minSize);
+ sd.previous = _seqDataStack;
+ _seqDataStack = sd;
+
+ int bytesLeft = _buf.remaining();
+ if(_seqDataStack.previous == null) // Outermost sequence
+ {
+ //
+ // The sequence must fit within the message.
+ //
+ if(numElements * minSize > bytesLeft)
+ {
+ Ice.Util.throwUnmarshalOutOfBoundsException();
+ }
+ }
+ else // Nested sequence
+ {
+ checkSeq(bytesLeft);
+ }
}
//
@@ -267,82 +267,82 @@ public class BasicStream
public void
checkSeq()
{
- checkSeq(_buf.remaining());
+ checkSeq(_buf.remaining());
}
public void
checkSeq(int bytesLeft)
{
- int size = 0;
- SeqData sd = _seqDataStack;
- do
- {
- size += (sd.numElements - 1) * sd.minSize;
- sd = sd.previous;
- }
- while(sd != null);
+ int size = 0;
+ SeqData sd = _seqDataStack;
+ do
+ {
+ size += (sd.numElements - 1) * sd.minSize;
+ sd = sd.previous;
+ }
+ while(sd != null);
- if(size > bytesLeft)
- {
- Ice.Util.throwUnmarshalOutOfBoundsException();
- }
+ if(size > bytesLeft)
+ {
+ Ice.Util.throwUnmarshalOutOfBoundsException();
+ }
}
public void
checkFixedSeq(int numElements, int elemSize)
{
- int bytesLeft = _buf.remaining();
- if(_seqDataStack == null) // Outermost sequence
- {
- //
- // The sequence must fit within the message.
- //
- if(numElements * elemSize > bytesLeft)
- {
- Ice.Util.throwUnmarshalOutOfBoundsException();
- }
- }
- else // Nested sequence
- {
- checkSeq(bytesLeft - numElements * elemSize);
- }
+ int bytesLeft = _buf.remaining();
+ if(_seqDataStack == null) // Outermost sequence
+ {
+ //
+ // The sequence must fit within the message.
+ //
+ if(numElements * elemSize > bytesLeft)
+ {
+ Ice.Util.throwUnmarshalOutOfBoundsException();
+ }
+ }
+ else // Nested sequence
+ {
+ checkSeq(bytesLeft - numElements * elemSize);
+ }
}
public void
endSeq(int sz)
{
- if(sz == 0) // Pop only if something was pushed previously.
- {
- return;
- }
+ if(sz == 0) // Pop only if something was pushed previously.
+ {
+ return;
+ }
- //
- // Pop the sequence stack.
- //
- SeqData oldSeqData = _seqDataStack;
- if(IceUtil.Debug.ASSERT)
- {
- IceUtil.Debug.Assert(oldSeqData != null);
- }
- _seqDataStack = oldSeqData.previous;
+ //
+ // Pop the sequence stack.
+ //
+ SeqData oldSeqData = _seqDataStack;
+ if(IceUtil.Debug.ASSERT)
+ {
+ IceUtil.Debug.Assert(oldSeqData != null);
+ }
+ _seqDataStack = oldSeqData.previous;
}
public void
endElement()
{
- if(IceUtil.Debug.ASSERT)
- {
- IceUtil.Debug.Assert(_seqDataStack != null);
- }
- --_seqDataStack.numElements;
+ if(IceUtil.Debug.ASSERT)
+ {
+ IceUtil.Debug.Assert(_seqDataStack != null);
+ }
+ --_seqDataStack.numElements;
}
public void
startWriteEncaps()
{
- WriteEncaps curr = new WriteEncaps();
- curr.next = _writeEncapsStack;
- _writeEncapsStack = curr;
+ WriteEncaps curr = new WriteEncaps();
+ curr.next = _writeEncapsStack;
+ _writeEncapsStack = curr;
_writeEncapsStack.start = _buf.position();
writeInt(0); // Placeholder for the encapsulation length.
@@ -353,51 +353,51 @@ public class BasicStream
public void
endWriteEncaps()
{
- if(IceUtil.Debug.ASSERT)
- {
- IceUtil.Debug.Assert(_writeEncapsStack != null);
- }
+ if(IceUtil.Debug.ASSERT)
+ {
+ IceUtil.Debug.Assert(_writeEncapsStack != null);
+ }
int start = _writeEncapsStack.start;
int sz = _buf.position() - start; // Size includes size and version.
- _buf.putInt(start, sz);
+ _buf.putInt(start, sz);
- _writeEncapsStack = _writeEncapsStack.next;
+ _writeEncapsStack = _writeEncapsStack.next;
}
public void
startReadEncaps()
{
- ReadEncaps curr = new ReadEncaps();
- curr.next = _readEncapsStack;
- _readEncapsStack = curr;
+ ReadEncaps curr = new ReadEncaps();
+ curr.next = _readEncapsStack;
+ _readEncapsStack = curr;
_readEncapsStack.start = _buf.position();
-
- //
- // I don't use readSize() and writeSize() for encapsulations,
- // because when creating an encapsulation, I must know in
- // advance how many bytes the size information will require in
- // the data stream. If I use an Int, it is always 4 bytes. For
- // readSize()/writeSize(), it could be 1 or 5 bytes.
- //
+
+ //
+ // I don't use readSize() and writeSize() for encapsulations,
+ // because when creating an encapsulation, I must know in
+ // advance how many bytes the size information will require in
+ // the data stream. If I use an Int, it is always 4 bytes. For
+ // readSize()/writeSize(), it could be 1 or 5 bytes.
+ //
int sz = readInt();
- if(sz < 0)
- {
- Ice.Util.throwNegativeSizeException();
- }
+ if(sz < 0)
+ {
+ Ice.Util.throwNegativeSizeException();
+ }
- if(sz - 4 > _buf.limit())
- {
- Ice.Util.throwUnmarshalOutOfBoundsException();
- }
- _readEncapsStack.sz = sz;
+ if(sz - 4 > _buf.limit())
+ {
+ Ice.Util.throwUnmarshalOutOfBoundsException();
+ }
+ _readEncapsStack.sz = sz;
byte eMajor = readByte();
byte eMinor = readByte();
- if(eMajor != Protocol.encodingMajor || eMinor > Protocol.encodingMinor)
- {
+ if(eMajor != Protocol.encodingMajor || eMinor > Protocol.encodingMinor)
+ {
Ice.Util.throwUnsupportedEncodingException(eMajor, eMinor);
- }
+ }
_readEncapsStack.encodingMajor = eMajor;
_readEncapsStack.encodingMinor = eMinor;
}
@@ -405,10 +405,10 @@ public class BasicStream
public void
endReadEncaps()
{
- if(IceUtil.Debug.ASSERT)
- {
- IceUtil.Debug.Assert(_readEncapsStack != null);
- }
+ if(IceUtil.Debug.ASSERT)
+ {
+ IceUtil.Debug.Assert(_readEncapsStack != null);
+ }
int start = _readEncapsStack.start;
int sz = _readEncapsStack.sz;
try
@@ -420,27 +420,27 @@ public class BasicStream
Ice.Util.throwUnmarshalOutOfBoundsException();
}
- _readEncapsStack = _readEncapsStack.next;
+ _readEncapsStack = _readEncapsStack.next;
}
public int
getReadEncapsSize()
{
- if(IceUtil.Debug.ASSERT)
- {
- IceUtil.Debug.Assert(_readEncapsStack != null);
- }
- return _readEncapsStack.sz - 6;
+ if(IceUtil.Debug.ASSERT)
+ {
+ IceUtil.Debug.Assert(_readEncapsStack != null);
+ }
+ return _readEncapsStack.sz - 6;
}
public void
skipEncaps()
{
int sz = readInt();
- if(sz < 0)
- {
- Ice.Util.throwNegativeSizeException();
- }
+ if(sz < 0)
+ {
+ Ice.Util.throwNegativeSizeException();
+ }
try
{
_buf.position(_buf.position() + sz - 4);
@@ -467,10 +467,10 @@ public class BasicStream
public void startReadSlice()
{
int sz = readInt();
- if(sz < 0)
- {
- Ice.Util.throwNegativeSizeException();
- }
+ if(sz < 0)
+ {
+ Ice.Util.throwNegativeSizeException();
+ }
_readSlice = _buf.position();
}
@@ -481,10 +481,10 @@ public class BasicStream
public void skipSlice()
{
int sz = readInt();
- if(sz < 0)
- {
- Ice.Util.throwNegativeSizeException();
- }
+ if(sz < 0)
+ {
+ Ice.Util.throwNegativeSizeException();
+ }
try
{
_buf.position(_buf.position() + sz - 4);
@@ -498,17 +498,17 @@ public class BasicStream
public void
writeSize(int v)
{
- if(v > 254)
- {
- expand(5);
- _buf.put((byte)-1);
- _buf.putInt(v);
- }
- else
- {
- expand(1);
- _buf.put((byte)v);
- }
+ if(v > 254)
+ {
+ expand(5);
+ _buf.put((byte)-1);
+ _buf.putInt(v);
+ }
+ else
+ {
+ expand(1);
+ _buf.put((byte)v);
+ }
}
public int
@@ -516,20 +516,20 @@ public class BasicStream
{
try
{
- byte b = _buf.get();
- if(b == -1)
- {
- int v = _buf.getInt();
- if(v < 0)
- {
- Ice.Util.throwNegativeSizeException();
- }
- return v;
- }
- else
- {
- return (int)(b < 0 ? b + 256 : b);
- }
+ byte b = _buf.get();
+ if(b == -1)
+ {
+ int v = _buf.getInt();
+ if(v < 0)
+ {
+ Ice.Util.throwNegativeSizeException();
+ }
+ return v;
+ }
+ else
+ {
+ return (int)(b < 0 ? b + 256 : b);
+ }
}
catch(ByteBuffer.UnderflowException ex)
{
@@ -578,16 +578,16 @@ public class BasicStream
public void
writeByteSeq(byte[] v)
{
- if(v == null)
- {
- writeSize(0);
- }
- else
- {
- writeSize(v.length);
- expand(v.length);
- _buf.put(v);
- }
+ if(v == null)
+ {
+ writeSize(0);
+ }
+ else
+ {
+ writeSize(v.length);
+ expand(v.length);
+ _buf.put(v);
+ }
}
public byte
@@ -607,11 +607,11 @@ public class BasicStream
public byte[]
readByteSeq()
{
-
+
try
{
final int sz = readSize();
- checkFixedSeq(sz, 1);
+ checkFixedSeq(sz, 1);
byte[] v = new byte[sz];
_buf.get(v);
return v;
@@ -633,19 +633,19 @@ public class BasicStream
public void
writeBoolSeq(boolean[] v)
{
- if(v == null)
- {
- writeSize(0);
- }
- else
- {
- writeSize(v.length);
- expand(v.length);
- for(int i = 0; i < v.length; i++)
- {
- _buf.put(v[i] ? (byte)1 : (byte)0);
- }
- }
+ if(v == null)
+ {
+ writeSize(0);
+ }
+ else
+ {
+ writeSize(v.length);
+ expand(v.length);
+ for(int i = 0; i < v.length; i++)
+ {
+ _buf.put(v[i] ? (byte)1 : (byte)0);
+ }
+ }
}
public boolean
@@ -668,7 +668,7 @@ public class BasicStream
try
{
final int sz = readSize();
- checkFixedSeq(sz, 1);
+ checkFixedSeq(sz, 1);
boolean[] v = new boolean[sz];
for(int i = 0; i < sz; i++)
{
@@ -693,16 +693,16 @@ public class BasicStream
public void
writeShortSeq(short[] v)
{
- if(v == null)
- {
- writeSize(0);
- }
- else
- {
- writeSize(v.length);
- expand(v.length * 2);
- _buf.putShortSeq(v);
- }
+ if(v == null)
+ {
+ writeSize(0);
+ }
+ else
+ {
+ writeSize(v.length);
+ expand(v.length * 2);
+ _buf.putShortSeq(v);
+ }
}
public short
@@ -725,7 +725,7 @@ public class BasicStream
try
{
final int sz = readSize();
- checkFixedSeq(sz, 2);
+ checkFixedSeq(sz, 2);
short[] v = new short[sz];
_buf.getShortSeq(v);
return v;
@@ -747,16 +747,16 @@ public class BasicStream
public void
writeIntSeq(int[] v)
{
- if(v == null)
- {
- writeSize(0);
- }
- else
- {
- writeSize(v.length);
- expand(v.length * 4);
- _buf.putIntSeq(v);
- }
+ if(v == null)
+ {
+ writeSize(0);
+ }
+ else
+ {
+ writeSize(v.length);
+ expand(v.length * 4);
+ _buf.putIntSeq(v);
+ }
}
public int
@@ -779,7 +779,7 @@ public class BasicStream
try
{
final int sz = readSize();
- checkFixedSeq(sz, 4);
+ checkFixedSeq(sz, 4);
int[] v = new int[sz];
_buf.getIntSeq(v);
return v;
@@ -801,16 +801,16 @@ public class BasicStream
public void
writeLongSeq(long[] v)
{
- if(v == null)
- {
- writeSize(0);
- }
- else
- {
- writeSize(v.length);
- expand(v.length * 8);
- _buf.putLongSeq(v);
- }
+ if(v == null)
+ {
+ writeSize(0);
+ }
+ else
+ {
+ writeSize(v.length);
+ expand(v.length * 8);
+ _buf.putLongSeq(v);
+ }
}
public long
@@ -833,7 +833,7 @@ public class BasicStream
try
{
final int sz = readSize();
- checkFixedSeq(sz, 8);
+ checkFixedSeq(sz, 8);
long[] v = new long[sz];
_buf.getLongSeq(v);
return v;
@@ -855,16 +855,16 @@ public class BasicStream
public void
writeFloatSeq(float[] v)
{
- if(v == null)
- {
- writeSize(0);
- }
- else
- {
- writeSize(v.length);
- expand(v.length * 4);
- _buf.putFloatSeq(v);
- }
+ if(v == null)
+ {
+ writeSize(0);
+ }
+ else
+ {
+ writeSize(v.length);
+ expand(v.length * 4);
+ _buf.putFloatSeq(v);
+ }
}
public float
@@ -887,7 +887,7 @@ public class BasicStream
try
{
final int sz = readSize();
- checkFixedSeq(sz, 4);
+ checkFixedSeq(sz, 4);
float[] v = new float[sz];
_buf.getFloatSeq(v);
return v;
@@ -909,16 +909,16 @@ public class BasicStream
public void
writeDoubleSeq(double[] v)
{
- if(v == null)
- {
- writeSize(0);
- }
- else
- {
- writeSize(v.length);
- expand(v.length * 8);
- _buf.putDoubleSeq(v);
- }
+ if(v == null)
+ {
+ writeSize(0);
+ }
+ else
+ {
+ writeSize(v.length);
+ expand(v.length * 8);
+ _buf.putDoubleSeq(v);
+ }
}
public double
@@ -941,7 +941,7 @@ public class BasicStream
try
{
final int sz = readSize();
- checkFixedSeq(sz, 8);
+ checkFixedSeq(sz, 8);
double[] v = new double[sz];
_buf.getDoubleSeq(v);
return v;
@@ -965,10 +965,10 @@ public class BasicStream
final int len = v.length();
if(len > 0)
{
- byte[] arr = v.getBytes();
- writeSize(arr.length);
- expand(arr.length);
- _buf.put(arr);
+ byte[] arr = v.getBytes();
+ writeSize(arr.length);
+ expand(arr.length);
+ _buf.put(arr);
}
else
{
@@ -980,18 +980,18 @@ public class BasicStream
public void
writeStringSeq(String[] v)
{
- if(v == null)
- {
- writeSize(0);
- }
- else
- {
- writeSize(v.length);
- for(int i = 0; i < v.length; i++)
- {
- writeString(v[i]);
- }
- }
+ if(v == null)
+ {
+ writeSize(0);
+ }
+ else
+ {
+ writeSize(v.length);
+ for(int i = 0; i < v.length; i++)
+ {
+ writeString(v[i]);
+ }
+ }
}
public String
@@ -1031,13 +1031,13 @@ public class BasicStream
// Multi-byte character found - we must use
// conversion.
//
- // TODO: If the string contains garbage bytes
- // that won't correctly decode as UTF, the
- // behavior of this constructor is undefined. It
- // would be better to explicitly decode using
- // java.nio.charset.CharsetDecoder and to throw
- // MarshalException if the string won't decode.
- //
+ // TODO: If the string contains garbage bytes
+ // that won't correctly decode as UTF, the
+ // behavior of this constructor is undefined. It
+ // would be better to explicitly decode using
+ // java.nio.charset.CharsetDecoder and to throw
+ // MarshalException if the string won't decode.
+ //
return new String(_stringBytes, 0, len);
}
else
@@ -1059,15 +1059,15 @@ public class BasicStream
readStringSeq()
{
final int sz = readSize();
- startSeq(sz, 1);
+ startSeq(sz, 1);
String[] v = new String[sz];
for(int i = 0; i < sz; i++)
{
v[i] = readString();
- checkSeq();
- endElement();
+ checkSeq();
+ endElement();
}
- endSeq(sz);
+ endSeq(sz);
return v;
}
@@ -1087,7 +1087,7 @@ public class BasicStream
writeUserException(Ice.UserException v)
{
writeBool(false); // uses classes
- v.__write(this);
+ v.__write(this);
}
public void
@@ -1098,45 +1098,45 @@ public class BasicStream
String id = readString();
- for(;;)
- {
+ for(;;)
+ {
//
// Look for a factory for this ID.
//
- UserExceptionFactory factory = getUserExceptionFactory(id);
+ UserExceptionFactory factory = getUserExceptionFactory(id);
- if(factory != null)
- {
+ if(factory != null)
+ {
//
// Got factory -- get the factory to instantiate the
// exception, initialize the exception members, and
// throw the exception.
//
- try
- {
- factory.createAndThrow();
- }
- catch(Ice.UserException ex)
- {
- ex.__read(this, false);
- throw ex;
- }
- }
- else
- {
- skipSlice(); // Slice off what we don't understand.
- id = readString(); // Read type id for next slice.
- }
- }
-
- //
- // The only way out of the loop above is to find an exception
- // for which the receiver has a factory. If this does not
- // happen, sender and receiver disagree about the Slice
- // definitions they use. In that case, the receiver will
- // eventually fail to read another type ID and throw a
- // MarshalException.
- //
+ try
+ {
+ factory.createAndThrow();
+ }
+ catch(Ice.UserException ex)
+ {
+ ex.__read(this, false);
+ throw ex;
+ }
+ }
+ else
+ {
+ skipSlice(); // Slice off what we don't understand.
+ id = readString(); // Read type id for next slice.
+ }
+ }
+
+ //
+ // The only way out of the loop above is to find an exception
+ // for which the receiver has a factory. If this does not
+ // happen, sender and receiver disagree about the Slice
+ // definitions they use. In that case, the receiver will
+ // eventually fail to read another type ID and throw a
+ // MarshalException.
+ //
}
public int
@@ -1165,67 +1165,67 @@ public class BasicStream
private static class BufferedOutputStream extends java.io.OutputStream
{
- BufferedOutputStream(byte[] data)
- {
- _data = data;
- }
-
- public void
- close()
- throws java.io.IOException
- {
- }
-
- public void
- flush()
- throws java.io.IOException
- {
- }
-
- public void
- write(byte[] b)
- throws java.io.IOException
- {
- if(IceUtil.Debug.ASSERT)
- {
- IceUtil.Debug.Assert(_data.length - _pos >= b.length);
- }
- System.arraycopy(b, 0, _data, _pos, b.length);
- _pos += b.length;
- }
-
- public void
- write(byte[] b, int off, int len)
- throws java.io.IOException
- {
- if(IceUtil.Debug.ASSERT)
- {
- IceUtil.Debug.Assert(_data.length - _pos >= len);
- }
- System.arraycopy(b, off, _data, _pos, len);
- _pos += len;
- }
-
- public void
- write(int b)
- throws java.io.IOException
- {
- if(IceUtil.Debug.ASSERT)
- {
- IceUtil.Debug.Assert(_data.length - _pos >= 1);
- }
- _data[_pos] = (byte)b;
- ++_pos;
- }
-
- int
- pos()
- {
- return _pos;
- }
-
- private byte[] _data;
- private int _pos;
+ BufferedOutputStream(byte[] data)
+ {
+ _data = data;
+ }
+
+ public void
+ close()
+ throws java.io.IOException
+ {
+ }
+
+ public void
+ flush()
+ throws java.io.IOException
+ {
+ }
+
+ public void
+ write(byte[] b)
+ throws java.io.IOException
+ {
+ if(IceUtil.Debug.ASSERT)
+ {
+ IceUtil.Debug.Assert(_data.length - _pos >= b.length);
+ }
+ System.arraycopy(b, 0, _data, _pos, b.length);
+ _pos += b.length;
+ }
+
+ public void
+ write(byte[] b, int off, int len)
+ throws java.io.IOException
+ {
+ if(IceUtil.Debug.ASSERT)
+ {
+ IceUtil.Debug.Assert(_data.length - _pos >= len);
+ }
+ System.arraycopy(b, off, _data, _pos, len);
+ _pos += len;
+ }
+
+ public void
+ write(int b)
+ throws java.io.IOException
+ {
+ if(IceUtil.Debug.ASSERT)
+ {
+ IceUtil.Debug.Assert(_data.length - _pos >= 1);
+ }
+ _data[_pos] = (byte)b;
+ ++_pos;
+ }
+
+ int
+ pos()
+ {
+ return _pos;
+ }
+
+ private byte[] _data;
+ private int _pos;
}
private void
@@ -1247,10 +1247,10 @@ public class BasicStream
int pos = _buf.position();
_buf.position(0);
reallocate(newCapacity);
- if(IceUtil.Debug.ASSERT)
- {
- IceUtil.Debug.Assert(_buf != null);
- }
+ if(IceUtil.Debug.ASSERT)
+ {
+ IceUtil.Debug.Assert(_buf != null);
+ }
_capacity = _buf.capacity();
_buf.limit(_capacity);
_buf.position(pos);
@@ -1299,18 +1299,18 @@ public class BasicStream
{
UserExceptionFactory factory = null;
- synchronized(_factoryMutex)
- {
- factory = (UserExceptionFactory)_exceptionFactories.get(id);
- }
+ synchronized(_factoryMutex)
+ {
+ factory = (UserExceptionFactory)_exceptionFactories.get(id);
+ }
if(factory == null)
{
- /*
- TODO- LinkageError is not available in CLDC. The try/catch
- block has no meaning unless a replacement for checking if
- a class is instantiable or not.
-
+ /*
+ TODO- LinkageError is not available in CLDC. The try/catch
+ block has no meaning unless a replacement for checking if
+ a class is instantiable or not.
+
try
{
Class c = findClass(id);
@@ -1325,13 +1325,13 @@ public class BasicStream
e.initCause(ex);
throw e;
}
- */
+ */
- Class c = findClass(id);
- if(c != null)
- {
- factory = new DynamicUserExceptionFactory(c);
- }
+ Class c = findClass(id);
+ if(c != null)
+ {
+ factory = new DynamicUserExceptionFactory(c);
+ }
if(factory != null)
{
@@ -1396,14 +1396,14 @@ public class BasicStream
Class c = Class.forName(className);
//
// Ensure the class is instantiable.
- //
- // TODO- Need to check for abstract classes. CLDC
- // currently doesn't provide sufficient APIs for checking
- //
- if(!c.isInterface())
- {
- return c;
- }
+ //
+ // TODO- Need to check for abstract classes. CLDC
+ // currently doesn't provide sufficient APIs for checking
+ //
+ if(!c.isInterface())
+ {
+ return c;
+ }
}
catch(ClassNotFoundException ex)
{
@@ -1476,47 +1476,47 @@ public class BasicStream
private void
allocate(int size)
{
- ByteBuffer buf = null;
- try
- {
- buf = ByteBuffer.allocate(size);
- }
- catch(OutOfMemoryError ex)
- {
- Ice.MarshalException e = new Ice.MarshalException();
- e.reason = "OutOfMemoryError occurred while allocating a ByteBuffer";
- e.initCause(ex);
- throw e;
- }
- buf.order(ByteBuffer.LITTLE_ENDIAN);
- _buf = buf;
+ ByteBuffer buf = null;
+ try
+ {
+ buf = ByteBuffer.allocate(size);
+ }
+ catch(OutOfMemoryError ex)
+ {
+ Ice.MarshalException e = new Ice.MarshalException();
+ e.reason = "OutOfMemoryError occurred while allocating a ByteBuffer";
+ e.initCause(ex);
+ throw e;
+ }
+ buf.order(ByteBuffer.LITTLE_ENDIAN);
+ _buf = buf;
}
private void
reallocate(int size)
{
//
- // Limit buffer size to MessageSizeMax
- //
+ // Limit buffer size to MessageSizeMax
+ //
if(!_unlimited)
{
- size = size > _messageSizeMax ? _messageSizeMax : size;
+ size = size > _messageSizeMax ? _messageSizeMax : size;
}
- ByteBuffer old = _buf;
- if(IceUtil.Debug.ASSERT)
- {
- IceUtil.Debug.Assert(old != null);
- }
+ ByteBuffer old = _buf;
+ if(IceUtil.Debug.ASSERT)
+ {
+ IceUtil.Debug.Assert(old != null);
+ }
- allocate(size);
- if(IceUtil.Debug.ASSERT)
- {
- IceUtil.Debug.Assert(_buf != null);
- }
+ allocate(size);
+ if(IceUtil.Debug.ASSERT)
+ {
+ IceUtil.Debug.Assert(_buf != null);
+ }
- old.position(0);
- _buf.put(old);
+ old.position(0);
+ _buf.put(old);
}
private IceInternal.Instance _instance;
@@ -1529,7 +1529,7 @@ public class BasicStream
private static final class ReadEncaps
{
int start;
- int sz;
+ int sz;
byte encodingMajor;
byte encodingMinor;
@@ -1557,14 +1557,14 @@ public class BasicStream
private static final class SeqData
{
public SeqData(int numElements, int minSize)
- {
- this.numElements = numElements;
- this.minSize = minSize;
- }
-
- public int numElements;
- public int minSize;
- public SeqData previous;
+ {
+ this.numElements = numElements;
+ this.minSize = minSize;
+ }
+
+ public int numElements;
+ public int minSize;
+ public SeqData previous;
}
SeqData _seqDataStack;
diff --git a/javae/src/IceInternal/ByteBuffer.java b/javae/src/IceInternal/ByteBuffer.java
index 057bc6ac85d..5d1f4a7602d 100644
--- a/javae/src/IceInternal/ByteBuffer.java
+++ b/javae/src/IceInternal/ByteBuffer.java
@@ -14,7 +14,7 @@ public class ByteBuffer
public
ByteBuffer()
{
- _order = BIG_ENDIAN;
+ _order = BIG_ENDIAN;
}
public static final int BIG_ENDIAN = 0;
@@ -23,729 +23,729 @@ public class ByteBuffer
public int
order()
{
- return _order;
+ return _order;
}
public ByteBuffer
order(int bo)
{
- _order = bo;
- return this;
+ _order = bo;
+ return this;
}
public static ByteBuffer
allocate(int capacity)
{
- if(capacity < 0)
- {
- throw new IllegalArgumentException("capacity must be non-negative");
- }
- ByteBuffer ret = new ByteBuffer();
- ret._position = 0;
- ret._limit = capacity;
- ret._capacity = capacity;
- ret._bytes = new byte[capacity];
- return ret;
+ if(capacity < 0)
+ {
+ throw new IllegalArgumentException("capacity must be non-negative");
+ }
+ ByteBuffer ret = new ByteBuffer();
+ ret._position = 0;
+ ret._limit = capacity;
+ ret._capacity = capacity;
+ ret._bytes = new byte[capacity];
+ return ret;
}
public int
position()
{
- return _position;
+ return _position;
}
public ByteBuffer
position(int pos)
{
- if(pos < 0)
- {
- throw new IllegalArgumentException("position must be non-negative");
- }
- if(pos > _limit)
- {
- throw new IllegalArgumentException("position must be less than limit");
- }
- _position = pos;
- return this;
+ if(pos < 0)
+ {
+ throw new IllegalArgumentException("position must be non-negative");
+ }
+ if(pos > _limit)
+ {
+ throw new IllegalArgumentException("position must be less than limit");
+ }
+ _position = pos;
+ return this;
}
public int
limit()
{
- return _limit;
+ return _limit;
}
public ByteBuffer
limit(int newLimit)
{
- if(newLimit < 0)
- {
- throw new IllegalArgumentException("limit must be non-negative");
- }
- if(newLimit > _capacity)
- {
- throw new IllegalArgumentException("limit must be less than capacity");
- }
- _limit = newLimit;
- return this;
+ if(newLimit < 0)
+ {
+ throw new IllegalArgumentException("limit must be non-negative");
+ }
+ if(newLimit > _capacity)
+ {
+ throw new IllegalArgumentException("limit must be less than capacity");
+ }
+ _limit = newLimit;
+ return this;
}
public void
clear()
{
- _position = 0;
- _limit = _capacity;
+ _position = 0;
+ _limit = _capacity;
}
public int
remaining()
{
- return _limit - _position;
+ return _limit - _position;
}
public boolean
hasRemaining()
{
- return _position < _limit;
+ return _position < _limit;
}
public int
capacity()
{
- return _capacity;
+ return _capacity;
}
public byte[]
array()
{
- return _bytes;
+ return _bytes;
}
public ByteBuffer
put(ByteBuffer buf)
{
- int len = buf.remaining();
- checkOverflow(len);
- System.arraycopy(buf._bytes, buf._position, _bytes, _position, len);
- _position += len;
- return this;
+ int len = buf.remaining();
+ checkOverflow(len);
+ System.arraycopy(buf._bytes, buf._position, _bytes, _position, len);
+ _position += len;
+ return this;
}
public byte
get()
{
- checkUnderflow(1);
- return _bytes[_position++];
+ checkUnderflow(1);
+ return _bytes[_position++];
}
public ByteBuffer
get(byte[] b)
{
- return get(b, 0, b.length);
+ return get(b, 0, b.length);
}
public ByteBuffer
get(byte[] b, int offset, int length)
{
- if(offset < 0)
- {
- throw new IllegalArgumentException("offset must be non-negative");
- }
- if(offset + length > b.length)
- {
- throw new IllegalArgumentException("insufficient room beyond given offset in destination array");
- }
- checkUnderflow(length);
- System.arraycopy(_bytes, _position, b, offset, length);
- _position += length;
- return this;
+ if(offset < 0)
+ {
+ throw new IllegalArgumentException("offset must be non-negative");
+ }
+ if(offset + length > b.length)
+ {
+ throw new IllegalArgumentException("insufficient room beyond given offset in destination array");
+ }
+ checkUnderflow(length);
+ System.arraycopy(_bytes, _position, b, offset, length);
+ _position += length;
+ return this;
}
public ByteBuffer
put(byte b)
{
- checkOverflow(1);
- _bytes[_position++] = b;
- return this;
+ checkOverflow(1);
+ _bytes[_position++] = b;
+ return this;
}
public ByteBuffer
put(byte[] b)
{
- return put(b, 0, b.length);
+ return put(b, 0, b.length);
}
public ByteBuffer
put(byte[] b, int offset, int length)
{
- if(offset < 0)
- {
- throw new IllegalArgumentException("offset must be non-negative");
- }
- if(offset + length > b.length)
- {
- throw new IllegalArgumentException("insufficient data beyond given offset in source array");
- }
- checkOverflow(length);
- System.arraycopy(b, offset, _bytes, _position, length);
- _position += length;
- return this;
+ if(offset < 0)
+ {
+ throw new IllegalArgumentException("offset must be non-negative");
+ }
+ if(offset + length > b.length)
+ {
+ throw new IllegalArgumentException("insufficient data beyond given offset in source array");
+ }
+ checkOverflow(length);
+ System.arraycopy(b, offset, _bytes, _position, length);
+ _position += length;
+ return this;
}
public short
getShort()
{
- checkUnderflow(2);
- int high, low;
- if(_order == BIG_ENDIAN)
- {
- high = _bytes[_position++] & 0xff;
- low = _bytes[_position++] & 0xff;
- }
- else
- {
- low = _bytes[_position++] & 0xff;
- high = _bytes[_position++] & 0xff;
- }
- return (short)(high << 8 | low);
+ checkUnderflow(2);
+ int high, low;
+ if(_order == BIG_ENDIAN)
+ {
+ high = _bytes[_position++] & 0xff;
+ low = _bytes[_position++] & 0xff;
+ }
+ else
+ {
+ low = _bytes[_position++] & 0xff;
+ high = _bytes[_position++] & 0xff;
+ }
+ return (short)(high << 8 | low);
}
public void
getShortSeq(short[] seq)
{
- checkUnderflow(seq.length * 2);
- if(_order == BIG_ENDIAN)
- {
- for(int i = 0; i < seq.length; ++i)
- {
- int high = _bytes[_position++] & 0xff;
- int low = _bytes[_position++] & 0xff;
- seq[i] = (short)(high << 8 | low);
- }
- }
- else
- {
- for(int i = 0; i < seq.length; ++i)
- {
- int low = _bytes[_position++] & 0xff;
- int high = _bytes[_position++] & 0xff;
- seq[i] = (short)(high << 8 | low);
- }
- }
+ checkUnderflow(seq.length * 2);
+ if(_order == BIG_ENDIAN)
+ {
+ for(int i = 0; i < seq.length; ++i)
+ {
+ int high = _bytes[_position++] & 0xff;
+ int low = _bytes[_position++] & 0xff;
+ seq[i] = (short)(high << 8 | low);
+ }
+ }
+ else
+ {
+ for(int i = 0; i < seq.length; ++i)
+ {
+ int low = _bytes[_position++] & 0xff;
+ int high = _bytes[_position++] & 0xff;
+ seq[i] = (short)(high << 8 | low);
+ }
+ }
}
public ByteBuffer
putShort(short val)
{
- checkOverflow(2);
- if(_order == BIG_ENDIAN)
- {
- _bytes[_position++] = (byte)(val >>> 8);
- _bytes[_position++] = (byte)val;
- }
- else
- {
- _bytes[_position++] = (byte)val;
- _bytes[_position++] = (byte)(val >>> 8);
- }
- return this;
+ checkOverflow(2);
+ if(_order == BIG_ENDIAN)
+ {
+ _bytes[_position++] = (byte)(val >>> 8);
+ _bytes[_position++] = (byte)val;
+ }
+ else
+ {
+ _bytes[_position++] = (byte)val;
+ _bytes[_position++] = (byte)(val >>> 8);
+ }
+ return this;
}
public ByteBuffer
putShortSeq(short[] seq)
{
- checkOverflow(seq.length * 2);
- if(_order == BIG_ENDIAN)
- {
- for(int i = 0; i < seq.length; ++i)
- {
- _bytes[_position++] = (byte)(seq[i] >>> 8);
- _bytes[_position++] = (byte)seq[i];
- }
- }
- else
- {
- for(int i = 0; i < seq.length; ++i)
- {
- _bytes[_position++] = (byte)seq[i];
- _bytes[_position++] = (byte)(seq[i] >>> 8);
- }
- }
- return this;
+ checkOverflow(seq.length * 2);
+ if(_order == BIG_ENDIAN)
+ {
+ for(int i = 0; i < seq.length; ++i)
+ {
+ _bytes[_position++] = (byte)(seq[i] >>> 8);
+ _bytes[_position++] = (byte)seq[i];
+ }
+ }
+ else
+ {
+ for(int i = 0; i < seq.length; ++i)
+ {
+ _bytes[_position++] = (byte)seq[i];
+ _bytes[_position++] = (byte)(seq[i] >>> 8);
+ }
+ }
+ return this;
}
public int
getInt()
{
- checkUnderflow(4);
- int ret = 0;
- if(_order == BIG_ENDIAN)
- {
- for(int shift = 24; shift >= 0; shift -= 8)
- {
- ret |= (int)(_bytes[_position++] & 0xff) << shift;
- }
- }
- else
- {
- for(int shift = 0; shift < 32; shift += 8)
- {
- ret |= (int)(_bytes[_position++] & 0xff) << shift;
- }
- }
- return ret;
+ checkUnderflow(4);
+ int ret = 0;
+ if(_order == BIG_ENDIAN)
+ {
+ for(int shift = 24; shift >= 0; shift -= 8)
+ {
+ ret |= (int)(_bytes[_position++] & 0xff) << shift;
+ }
+ }
+ else
+ {
+ for(int shift = 0; shift < 32; shift += 8)
+ {
+ ret |= (int)(_bytes[_position++] & 0xff) << shift;
+ }
+ }
+ return ret;
}
public void
getIntSeq(int[] seq)
{
- checkUnderflow(seq.length * 4);
- if(_order == BIG_ENDIAN)
- {
- for(int i = 0; i < seq.length; ++i)
- {
- int val = 0;
- for(int shift = 24; shift >= 0; shift -= 8)
- {
- val |= (int)(_bytes[_position++] & 0xff) << shift;
- }
- seq[i] = val;
- }
- }
- else
- {
- for(int i = 0; i < seq.length; ++i)
- {
- int val = 0;
- for(int shift = 0; shift < 32; shift += 8)
- {
- val |= (int)(_bytes[_position++] & 0xff) << shift;
- }
- seq[i] = val;
- }
- }
+ checkUnderflow(seq.length * 4);
+ if(_order == BIG_ENDIAN)
+ {
+ for(int i = 0; i < seq.length; ++i)
+ {
+ int val = 0;
+ for(int shift = 24; shift >= 0; shift -= 8)
+ {
+ val |= (int)(_bytes[_position++] & 0xff) << shift;
+ }
+ seq[i] = val;
+ }
+ }
+ else
+ {
+ for(int i = 0; i < seq.length; ++i)
+ {
+ int val = 0;
+ for(int shift = 0; shift < 32; shift += 8)
+ {
+ val |= (int)(_bytes[_position++] & 0xff) << shift;
+ }
+ seq[i] = val;
+ }
+ }
}
public ByteBuffer
putInt(int val)
{
- putInt(_position, val);
- _position += 4;
- return this;
+ putInt(_position, val);
+ _position += 4;
+ return this;
}
public ByteBuffer
putInt(int pos, int val)
{
- if(pos < 0)
- {
- throw new IllegalArgumentException("position must be non-negative");
- }
- if(pos + 4 > _limit)
- {
- throw new IllegalArgumentException("position must be less than limit - 4");
- }
- if(_order == BIG_ENDIAN)
- {
- for(int shift = 24; shift >= 0; shift -= 8)
- {
- _bytes[pos++] = (byte)((val >> shift) & 0xff);
- }
- }
- else
- {
- for(int shift = 0; shift < 32; shift += 8)
- {
- _bytes[pos++] = (byte)((val >> shift) & 0xff);
- }
- }
- return this;
+ if(pos < 0)
+ {
+ throw new IllegalArgumentException("position must be non-negative");
+ }
+ if(pos + 4 > _limit)
+ {
+ throw new IllegalArgumentException("position must be less than limit - 4");
+ }
+ if(_order == BIG_ENDIAN)
+ {
+ for(int shift = 24; shift >= 0; shift -= 8)
+ {
+ _bytes[pos++] = (byte)((val >> shift) & 0xff);
+ }
+ }
+ else
+ {
+ for(int shift = 0; shift < 32; shift += 8)
+ {
+ _bytes[pos++] = (byte)((val >> shift) & 0xff);
+ }
+ }
+ return this;
}
public ByteBuffer
putIntSeq(int[] seq)
{
- checkOverflow(seq.length * 4);
- if(_order == BIG_ENDIAN)
- {
- for(int i = 0; i < seq.length; ++i)
- {
- int val = seq[i];
- for(int shift = 24; shift >= 0; shift -= 8)
- {
- _bytes[_position++] = (byte)((val >> shift) & 0xff);
- }
- }
- }
- else
- {
- for(int i = 0; i < seq.length; ++i)
- {
- int val = seq[i];
- for(int shift = 0; shift < 32; shift += 8)
- {
- _bytes[_position++] = (byte)((val >> shift) & 0xff);
- }
- }
- }
- return this;
+ checkOverflow(seq.length * 4);
+ if(_order == BIG_ENDIAN)
+ {
+ for(int i = 0; i < seq.length; ++i)
+ {
+ int val = seq[i];
+ for(int shift = 24; shift >= 0; shift -= 8)
+ {
+ _bytes[_position++] = (byte)((val >> shift) & 0xff);
+ }
+ }
+ }
+ else
+ {
+ for(int i = 0; i < seq.length; ++i)
+ {
+ int val = seq[i];
+ for(int shift = 0; shift < 32; shift += 8)
+ {
+ _bytes[_position++] = (byte)((val >> shift) & 0xff);
+ }
+ }
+ }
+ return this;
}
public long
getLong()
{
- checkUnderflow(8);
- long ret = 0;
- if(_order == BIG_ENDIAN)
- {
- for(int shift = 56; shift >= 0; shift -= 8)
- {
- ret |= (long)(_bytes[_position++] & 0xff) << shift;
- }
- }
- else
- {
- for(int shift = 0; shift < 64; shift += 8)
- {
- ret |= (long)(_bytes[_position++] & 0xff) << shift;
- }
- }
- return ret;
+ checkUnderflow(8);
+ long ret = 0;
+ if(_order == BIG_ENDIAN)
+ {
+ for(int shift = 56; shift >= 0; shift -= 8)
+ {
+ ret |= (long)(_bytes[_position++] & 0xff) << shift;
+ }
+ }
+ else
+ {
+ for(int shift = 0; shift < 64; shift += 8)
+ {
+ ret |= (long)(_bytes[_position++] & 0xff) << shift;
+ }
+ }
+ return ret;
}
public void
getLongSeq(long[] seq)
{
- checkUnderflow(seq.length * 8);
- for(int i = 0; i < seq.length; ++i)
- {
- if(_order == BIG_ENDIAN)
- {
- long val = 0;
- for(int shift = 56; shift >= 0; shift -= 8)
- {
- val |= (long)(_bytes[_position++] & 0xff) << shift;
- }
- seq[i] = val;
- }
- else
- {
- long val = 0;
- for(int shift = 0; shift < 64; shift += 8)
- {
- val |= (long)(_bytes[_position++] & 0xff) << shift;
- }
- seq[i] = val;
- }
- }
+ checkUnderflow(seq.length * 8);
+ for(int i = 0; i < seq.length; ++i)
+ {
+ if(_order == BIG_ENDIAN)
+ {
+ long val = 0;
+ for(int shift = 56; shift >= 0; shift -= 8)
+ {
+ val |= (long)(_bytes[_position++] & 0xff) << shift;
+ }
+ seq[i] = val;
+ }
+ else
+ {
+ long val = 0;
+ for(int shift = 0; shift < 64; shift += 8)
+ {
+ val |= (long)(_bytes[_position++] & 0xff) << shift;
+ }
+ seq[i] = val;
+ }
+ }
}
public ByteBuffer
putLong(long val)
{
- checkOverflow(8);
- if(_order == BIG_ENDIAN)
- {
- for(int shift = 56; shift >= 0; shift -= 8)
- {
- _bytes[_position++] = (byte)((val >> shift) & 0xff);
- }
- }
- else
- {
- for(int shift = 0; shift < 64; shift += 8)
- {
- _bytes[_position++] = (byte)((val >> shift) & 0xff);
- }
- }
- return this;
+ checkOverflow(8);
+ if(_order == BIG_ENDIAN)
+ {
+ for(int shift = 56; shift >= 0; shift -= 8)
+ {
+ _bytes[_position++] = (byte)((val >> shift) & 0xff);
+ }
+ }
+ else
+ {
+ for(int shift = 0; shift < 64; shift += 8)
+ {
+ _bytes[_position++] = (byte)((val >> shift) & 0xff);
+ }
+ }
+ return this;
}
public ByteBuffer
putLongSeq(long[] seq)
{
- checkOverflow(seq.length * 8);
- if(_order == BIG_ENDIAN)
- {
- for(int i = 0; i < seq.length; ++i)
- {
- long val = seq[i];
- for(int shift = 56; shift >= 0; shift -= 8)
- {
- _bytes[_position++] = (byte)((val >> shift) & 0xff);
- }
- }
- }
- else
- {
- for(int i = 0; i < seq.length; ++i)
- {
- long val = seq[i];
- for(int shift = 0; shift < 64; shift += 8)
- {
- _bytes[_position++] = (byte)((val >> shift) & 0xff);
- }
- }
- }
- return this;
+ checkOverflow(seq.length * 8);
+ if(_order == BIG_ENDIAN)
+ {
+ for(int i = 0; i < seq.length; ++i)
+ {
+ long val = seq[i];
+ for(int shift = 56; shift >= 0; shift -= 8)
+ {
+ _bytes[_position++] = (byte)((val >> shift) & 0xff);
+ }
+ }
+ }
+ else
+ {
+ for(int i = 0; i < seq.length; ++i)
+ {
+ long val = seq[i];
+ for(int shift = 0; shift < 64; shift += 8)
+ {
+ _bytes[_position++] = (byte)((val >> shift) & 0xff);
+ }
+ }
+ }
+ return this;
}
public float
getFloat()
{
- checkUnderflow(4);
- int bits = 0;
- if(_order == BIG_ENDIAN)
- {
- for(int shift = 24; shift >= 0; shift -= 8)
- {
- bits |= (int)(_bytes[_position++] & 0xff) << shift;
- }
- }
- else
- {
- for(int shift = 0; shift < 32; shift += 8)
- {
- bits |= (int)(_bytes[_position++] & 0xff) << shift;
- }
- }
- return Float.intBitsToFloat(bits);
+ checkUnderflow(4);
+ int bits = 0;
+ if(_order == BIG_ENDIAN)
+ {
+ for(int shift = 24; shift >= 0; shift -= 8)
+ {
+ bits |= (int)(_bytes[_position++] & 0xff) << shift;
+ }
+ }
+ else
+ {
+ for(int shift = 0; shift < 32; shift += 8)
+ {
+ bits |= (int)(_bytes[_position++] & 0xff) << shift;
+ }
+ }
+ return Float.intBitsToFloat(bits);
}
public void
getFloatSeq(float[] seq)
{
- checkUnderflow(seq.length * 4);
- if(_order == BIG_ENDIAN)
- {
- for(int i = 0; i < seq.length; ++i)
- {
- int bits = 0;
- for(int shift = 24; shift >= 0; shift -= 8)
- {
- bits |= (int)(_bytes[_position++] & 0xff) << shift;
- }
- seq[i] = Float.intBitsToFloat(bits);
- }
- }
- else
- {
- for(int i = 0; i < seq.length; ++i)
- {
- int bits = 0;
- for(int shift = 0; shift < 32; shift += 8)
- {
- bits |= (int)(_bytes[_position++] & 0xff) << shift;
- }
- seq[i] = Float.intBitsToFloat(bits);
- }
- }
+ checkUnderflow(seq.length * 4);
+ if(_order == BIG_ENDIAN)
+ {
+ for(int i = 0; i < seq.length; ++i)
+ {
+ int bits = 0;
+ for(int shift = 24; shift >= 0; shift -= 8)
+ {
+ bits |= (int)(_bytes[_position++] & 0xff) << shift;
+ }
+ seq[i] = Float.intBitsToFloat(bits);
+ }
+ }
+ else
+ {
+ for(int i = 0; i < seq.length; ++i)
+ {
+ int bits = 0;
+ for(int shift = 0; shift < 32; shift += 8)
+ {
+ bits |= (int)(_bytes[_position++] & 0xff) << shift;
+ }
+ seq[i] = Float.intBitsToFloat(bits);
+ }
+ }
}
public ByteBuffer
putFloat(float val)
{
- checkOverflow(4);
- int bits = Float.floatToIntBits(val);
- if(_order == BIG_ENDIAN)
- {
- for(int shift = 24; shift >= 0; shift -= 8)
- {
- _bytes[_position++] = (byte)((bits >> shift) & 0xff);
- }
- }
- else
- {
- for(int shift = 0; shift < 32; shift += 8)
- {
- _bytes[_position++] = (byte)((bits >> shift) & 0xff);
- }
- }
- return this;
+ checkOverflow(4);
+ int bits = Float.floatToIntBits(val);
+ if(_order == BIG_ENDIAN)
+ {
+ for(int shift = 24; shift >= 0; shift -= 8)
+ {
+ _bytes[_position++] = (byte)((bits >> shift) & 0xff);
+ }
+ }
+ else
+ {
+ for(int shift = 0; shift < 32; shift += 8)
+ {
+ _bytes[_position++] = (byte)((bits >> shift) & 0xff);
+ }
+ }
+ return this;
}
public ByteBuffer
putFloatSeq(float[] seq)
{
- checkOverflow(seq.length * 4);
- if(_order == BIG_ENDIAN)
- {
- for(int i = 0; i < seq.length; ++i)
- {
- int bits = Float.floatToIntBits(seq[i]);
- for(int shift = 24; shift >= 0; shift -= 8)
- {
- _bytes[_position++] = (byte)((bits >> shift) & 0xff);
- }
- }
- }
- else
- {
- for(int i = 0; i < seq.length; ++i)
- {
- int bits = Float.floatToIntBits(seq[i]);
- for(int shift = 0; shift < 32; shift += 8)
- {
- _bytes[_position++] = (byte)((bits >> shift) & 0xff);
- }
- }
- }
- return this;
+ checkOverflow(seq.length * 4);
+ if(_order == BIG_ENDIAN)
+ {
+ for(int i = 0; i < seq.length; ++i)
+ {
+ int bits = Float.floatToIntBits(seq[i]);
+ for(int shift = 24; shift >= 0; shift -= 8)
+ {
+ _bytes[_position++] = (byte)((bits >> shift) & 0xff);
+ }
+ }
+ }
+ else
+ {
+ for(int i = 0; i < seq.length; ++i)
+ {
+ int bits = Float.floatToIntBits(seq[i]);
+ for(int shift = 0; shift < 32; shift += 8)
+ {
+ _bytes[_position++] = (byte)((bits >> shift) & 0xff);
+ }
+ }
+ }
+ return this;
}
public double
getDouble()
{
- checkUnderflow(8);
- long bits = 0;
- if(_order == BIG_ENDIAN)
- {
- for(int shift = 56; shift >= 0; shift -= 8)
- {
- bits |= (long)(_bytes[_position++] & 0xff) << shift;
- }
- }
- else
- {
- for(int shift = 0; shift < 64; shift += 8)
- {
- bits |= (long)(_bytes[_position++] & 0xff) << shift;
- }
- }
- return Double.longBitsToDouble(bits);
+ checkUnderflow(8);
+ long bits = 0;
+ if(_order == BIG_ENDIAN)
+ {
+ for(int shift = 56; shift >= 0; shift -= 8)
+ {
+ bits |= (long)(_bytes[_position++] & 0xff) << shift;
+ }
+ }
+ else
+ {
+ for(int shift = 0; shift < 64; shift += 8)
+ {
+ bits |= (long)(_bytes[_position++] & 0xff) << shift;
+ }
+ }
+ return Double.longBitsToDouble(bits);
}
public void
getDoubleSeq(double[] seq)
{
- checkUnderflow(seq.length * 8);
- if(_order == BIG_ENDIAN)
- {
- for(int i = 0; i < seq.length; ++i)
- {
- long bits = 0;
- for(int shift = 56; shift >= 0; shift -= 8)
- {
- bits |= (long)(_bytes[_position++] & 0xff) << shift;
- }
- seq[i] = Double.longBitsToDouble(bits);
- }
- }
- else
- {
- for(int i = 0; i < seq.length; ++i)
- {
- long bits = 0;
- for(int shift = 0; shift < 64; shift += 8)
- {
- bits |= (long)(_bytes[_position++] & 0xff) << shift;
- }
- seq[i] = Double.longBitsToDouble(bits);
- }
- }
+ checkUnderflow(seq.length * 8);
+ if(_order == BIG_ENDIAN)
+ {
+ for(int i = 0; i < seq.length; ++i)
+ {
+ long bits = 0;
+ for(int shift = 56; shift >= 0; shift -= 8)
+ {
+ bits |= (long)(_bytes[_position++] & 0xff) << shift;
+ }
+ seq[i] = Double.longBitsToDouble(bits);
+ }
+ }
+ else
+ {
+ for(int i = 0; i < seq.length; ++i)
+ {
+ long bits = 0;
+ for(int shift = 0; shift < 64; shift += 8)
+ {
+ bits |= (long)(_bytes[_position++] & 0xff) << shift;
+ }
+ seq[i] = Double.longBitsToDouble(bits);
+ }
+ }
}
public ByteBuffer
putDouble(double val)
{
- checkOverflow(8);
- long bits = Double.doubleToLongBits(val);
- if(_order == BIG_ENDIAN)
- {
- for(int shift = 56; shift >= 0; shift -= 8)
- {
- _bytes[_position++] = (byte)((bits >> shift) & 0xff);
- }
- }
- else
- {
- for(int shift = 0; shift < 64; shift += 8)
- {
- _bytes[_position++] = (byte)((bits >> shift) & 0xff);
- }
- }
- return this;
+ checkOverflow(8);
+ long bits = Double.doubleToLongBits(val);
+ if(_order == BIG_ENDIAN)
+ {
+ for(int shift = 56; shift >= 0; shift -= 8)
+ {
+ _bytes[_position++] = (byte)((bits >> shift) & 0xff);
+ }
+ }
+ else
+ {
+ for(int shift = 0; shift < 64; shift += 8)
+ {
+ _bytes[_position++] = (byte)((bits >> shift) & 0xff);
+ }
+ }
+ return this;
}
public ByteBuffer
putDoubleSeq(double[] seq)
{
- checkOverflow(seq.length * 8);
- if(_order == BIG_ENDIAN)
- {
- for(int i = 0; i < seq.length; ++i)
- {
- long bits = Double.doubleToLongBits(seq[i]);
- for(int shift = 56; shift >= 0; shift -= 8)
- {
- _bytes[_position++] = (byte)((bits >> shift) & 0xff);
- }
- }
- }
- else
- {
- for(int i = 0; i < seq.length; ++i)
- {
- long bits = Double.doubleToLongBits(seq[i]);
- for(int shift = 0; shift < 64; shift += 8)
- {
- _bytes[_position++] = (byte)((bits >> shift) & 0xff);
- }
- }
- }
- return this;
+ checkOverflow(seq.length * 8);
+ if(_order == BIG_ENDIAN)
+ {
+ for(int i = 0; i < seq.length; ++i)
+ {
+ long bits = Double.doubleToLongBits(seq[i]);
+ for(int shift = 56; shift >= 0; shift -= 8)
+ {
+ _bytes[_position++] = (byte)((bits >> shift) & 0xff);
+ }
+ }
+ }
+ else
+ {
+ for(int i = 0; i < seq.length; ++i)
+ {
+ long bits = Double.doubleToLongBits(seq[i]);
+ for(int shift = 0; shift < 64; shift += 8)
+ {
+ _bytes[_position++] = (byte)((bits >> shift) & 0xff);
+ }
+ }
+ }
+ return this;
}
byte[]
rawBytes()
{
- return _bytes;
+ return _bytes;
}
byte[]
rawBytes(int offset, int len)
{
- if(offset + len > _limit)
- {
- throw new UnderflowException();
- }
- byte[] rc = new byte[len];
- System.arraycopy(_bytes, offset, rc, 0, len);
- return rc;
+ if(offset + len > _limit)
+ {
+ throw new UnderflowException();
+ }
+ byte[] rc = new byte[len];
+ System.arraycopy(_bytes, offset, rc, 0, len);
+ return rc;
}
private void
checkUnderflow(int size)
{
- if(_position + size > _limit)
- {
- throw new UnderflowException();
- }
+ if(_position + size > _limit)
+ {
+ throw new UnderflowException();
+ }
}
private void
checkOverflow(int size)
{
- if(_position + size > _limit)
- {
- throw new OverflowException();
- }
+ if(_position + size > _limit)
+ {
+ throw new OverflowException();
+ }
}
public static class UnderflowException extends RuntimeException
{
- public UnderflowException()
- {
- super("buffer underflow");
- }
+ public UnderflowException()
+ {
+ super("buffer underflow");
+ }
}
public static class OverflowException extends RuntimeException
{
- public OverflowException()
- {
- super("buffer overflow");
- }
+ public OverflowException()
+ {
+ super("buffer overflow");
+ }
}
private int _position;
diff --git a/javae/src/IceInternal/DefaultsAndOverrides.java b/javae/src/IceInternal/DefaultsAndOverrides.java
index 22922387243..3f36a16e785 100644
--- a/javae/src/IceInternal/DefaultsAndOverrides.java
+++ b/javae/src/IceInternal/DefaultsAndOverrides.java
@@ -13,47 +13,47 @@ public final class DefaultsAndOverrides
{
DefaultsAndOverrides(Ice.Properties properties)
{
- String value;
-
- defaultProtocol = properties.getPropertyWithDefault("Ice.Default.Protocol", "tcp");
+ String value;
+
+ defaultProtocol = properties.getPropertyWithDefault("Ice.Default.Protocol", "tcp");
- value = properties.getProperty("Ice.Default.Host");
- if(value.length() != 0)
- {
- defaultHost = value;
- }
- else
- {
- defaultHost = Network.getLocalHost(true);
- }
-
- defaultRouter = properties.getProperty("Ice.Default.Router");
-
- value = properties.getProperty("Ice.Override.Timeout");
- if(value.length() > 0)
- {
- overrideTimeout = true;
- overrideTimeoutValue = properties.getPropertyAsInt("Ice.Override.Timeout");
- }
- else
- {
- overrideTimeout = false;
- overrideTimeoutValue = -1;
- }
+ value = properties.getProperty("Ice.Default.Host");
+ if(value.length() != 0)
+ {
+ defaultHost = value;
+ }
+ else
+ {
+ defaultHost = Network.getLocalHost(true);
+ }
+
+ defaultRouter = properties.getProperty("Ice.Default.Router");
+
+ value = properties.getProperty("Ice.Override.Timeout");
+ if(value.length() > 0)
+ {
+ overrideTimeout = true;
+ overrideTimeoutValue = properties.getPropertyAsInt("Ice.Override.Timeout");
+ }
+ else
+ {
+ overrideTimeout = false;
+ overrideTimeoutValue = -1;
+ }
- value = properties.getProperty("Ice.Override.ConnectTimeout");
- if(value.length() > 0)
- {
- overrideConnectTimeout = true;
- overrideConnectTimeoutValue = properties.getPropertyAsInt("Ice.Override.ConnectTimeout");
- }
- else
- {
- overrideConnectTimeout = false;
- overrideConnectTimeoutValue = -1;
- }
+ value = properties.getProperty("Ice.Override.ConnectTimeout");
+ if(value.length() > 0)
+ {
+ overrideConnectTimeout = true;
+ overrideConnectTimeoutValue = properties.getPropertyAsInt("Ice.Override.ConnectTimeout");
+ }
+ else
+ {
+ overrideConnectTimeout = false;
+ overrideConnectTimeoutValue = -1;
+ }
- defaultLocator = properties.getProperty("Ice.Default.Locator");
+ defaultLocator = properties.getProperty("Ice.Default.Locator");
}
final public String defaultHost;
diff --git a/javae/src/IceInternal/DirectReference.java b/javae/src/IceInternal/DirectReference.java
index 5693b43f196..7b3ddd66b2c 100644
--- a/javae/src/IceInternal/DirectReference.java
+++ b/javae/src/IceInternal/DirectReference.java
@@ -13,16 +13,16 @@ public class DirectReference extends RoutableReference
{
public
DirectReference(Instance inst,
- Ice.Communicator com,
- Ice.Identity ident,
+ Ice.Communicator com,
+ Ice.Identity ident,
java.util.Hashtable context,
- String fs,
- int md,
- boolean sec,
- Endpoint[] endpts,
- RouterInfo rtrInfo)
+ String fs,
+ int md,
+ boolean sec,
+ Endpoint[] endpts,
+ RouterInfo rtrInfo)
{
- super(inst, com, ident, context, fs, md, sec, rtrInfo);
+ super(inst, com, ident, context, fs, md, sec, rtrInfo);
_endpoints = endpts;
}
@@ -55,125 +55,125 @@ public class DirectReference extends RoutableReference
public Reference
changeLocator(Ice.LocatorPrx newLocator)
{
- return this;
+ return this;
}
public Reference
changeTimeout(int newTimeout)
{
DirectReference r = (DirectReference)super.changeTimeout(newTimeout);
- if(r != this) // Also override the timeout on the endpoints if it was updated.
- {
- Endpoint[] newEndpoints = new Endpoint[_endpoints.length];
- for(int i = 0; i < _endpoints.length; i++)
- {
- newEndpoints[i] = _endpoints[i].timeout(newTimeout);
- }
- r._endpoints = newEndpoints;
- }
- return r;
+ if(r != this) // Also override the timeout on the endpoints if it was updated.
+ {
+ Endpoint[] newEndpoints = new Endpoint[_endpoints.length];
+ for(int i = 0; i < _endpoints.length; i++)
+ {
+ newEndpoints[i] = _endpoints[i].timeout(newTimeout);
+ }
+ r._endpoints = newEndpoints;
+ }
+ return r;
}
public void
streamWrite(BasicStream s)
- throws Ice.MarshalException
+ throws Ice.MarshalException
{
super.streamWrite(s);
- s.writeSize(_endpoints.length);
- if(_endpoints.length > 0)
- {
- for(int i = 0; i < _endpoints.length; i++)
- {
- _endpoints[i].streamWrite(s);
- }
- }
- else
- {
- s.writeString(""); // Adapter id.
- }
+ s.writeSize(_endpoints.length);
+ if(_endpoints.length > 0)
+ {
+ for(int i = 0; i < _endpoints.length; i++)
+ {
+ _endpoints[i].streamWrite(s);
+ }
+ }
+ else
+ {
+ s.writeString(""); // Adapter id.
+ }
}
public String
toString()
{
- //
- // WARNING: Certain features, such as proxy validation in Glacier2,
- // depend on the format of proxy strings. Changes to toString() and
- // methods called to generate parts of the reference string could break
- // these features. Please review for all features that depend on the
- // format of proxyToString() before changing this and related code.
- //
- StringBuffer s = new StringBuffer();
- s.append(super.toString());
-
- for(int i = 0; i < _endpoints.length; i++)
- {
- String endp = _endpoints[i].toString();
- if(endp != null && endp.length() > 0)
- {
- s.append(':');
- s.append(endp);
- }
- }
- return s.toString();
+ //
+ // WARNING: Certain features, such as proxy validation in Glacier2,
+ // depend on the format of proxy strings. Changes to toString() and
+ // methods called to generate parts of the reference string could break
+ // these features. Please review for all features that depend on the
+ // format of proxyToString() before changing this and related code.
+ //
+ StringBuffer s = new StringBuffer();
+ s.append(super.toString());
+
+ for(int i = 0; i < _endpoints.length; i++)
+ {
+ String endp = _endpoints[i].toString();
+ if(endp != null && endp.length() > 0)
+ {
+ s.append(':');
+ s.append(endp);
+ }
+ }
+ return s.toString();
}
public Ice.Connection
getConnection()
{
Endpoint[] endpts = super.getRoutedEndpoints();
- applyOverrides(endpts);
-
- if(endpts.length == 0)
- {
- endpts = _endpoints; // Endpoint overrides are already applied on these endpoints.
- }
- Endpoint[] filteredEndpoints = filterEndpoints(endpts);
- if(filteredEndpoints.length == 0)
- {
- Ice.NoEndpointException ex = new Ice.NoEndpointException();
- ex.proxy = toString();
- throw ex;
- }
-
- OutgoingConnectionFactory factory = getInstance().outgoingConnectionFactory();
- Ice.Connection connection = factory.create(filteredEndpoints);
-
- //
- // If we have a router, set the object adapter for this router
- // (if any) to the new connection, so that callbacks from the
- // router can be received over this new connection.
- //
- if(getRouterInfo() != null)
- {
- connection.setAdapter(getRouterInfo().getAdapter());
- }
-
- if(IceUtil.Debug.ASSERT)
- {
- IceUtil.Debug.Assert(connection != null);
- }
- return connection;
+ applyOverrides(endpts);
+
+ if(endpts.length == 0)
+ {
+ endpts = _endpoints; // Endpoint overrides are already applied on these endpoints.
+ }
+ Endpoint[] filteredEndpoints = filterEndpoints(endpts);
+ if(filteredEndpoints.length == 0)
+ {
+ Ice.NoEndpointException ex = new Ice.NoEndpointException();
+ ex.proxy = toString();
+ throw ex;
+ }
+
+ OutgoingConnectionFactory factory = getInstance().outgoingConnectionFactory();
+ Ice.Connection connection = factory.create(filteredEndpoints);
+
+ //
+ // If we have a router, set the object adapter for this router
+ // (if any) to the new connection, so that callbacks from the
+ // router can be received over this new connection.
+ //
+ if(getRouterInfo() != null)
+ {
+ connection.setAdapter(getRouterInfo().getAdapter());
+ }
+
+ if(IceUtil.Debug.ASSERT)
+ {
+ IceUtil.Debug.Assert(connection != null);
+ }
+ return connection;
}
public boolean
equals(java.lang.Object obj)
{
if(this == obj)
- {
- return true;
- }
- if(!(obj instanceof DirectReference))
- {
- return false;
- }
+ {
+ return true;
+ }
+ if(!(obj instanceof DirectReference))
+ {
+ return false;
+ }
DirectReference rhs = (DirectReference)obj;
if(!super.equals(rhs))
{
return false;
}
- return compare(_endpoints, rhs._endpoints);
+ return compare(_endpoints, rhs._endpoints);
}
protected
@@ -184,16 +184,16 @@ public class DirectReference extends RoutableReference
protected void
shallowCopy(DirectReference ref)
{
- super.shallowCopy(ref);
- ref._endpoints = _endpoints;
+ super.shallowCopy(ref);
+ ref._endpoints = _endpoints;
}
public java.lang.Object
ice_clone()
{
- DirectReference result = new DirectReference();
+ DirectReference result = new DirectReference();
shallowCopy(result);
- return result;
+ return result;
}
private Endpoint[] _endpoints;
diff --git a/javae/src/IceInternal/EndpointFactory.java b/javae/src/IceInternal/EndpointFactory.java
index 5ab40f72b55..eab1dce78a4 100644
--- a/javae/src/IceInternal/EndpointFactory.java
+++ b/javae/src/IceInternal/EndpointFactory.java
@@ -64,10 +64,10 @@ public final class EndpointFactory
Endpoint v;
short type = s.readShort();
- if(type == TcpEndpoint.TYPE)
- {
+ if(type == TcpEndpoint.TYPE)
+ {
return new TcpEndpoint(s);
- }
+ }
return new UnknownEndpoint(type, s);
}
diff --git a/javae/src/IceInternal/FixedReference.java b/javae/src/IceInternal/FixedReference.java
index dd3bb563575..6a5b6d031d1 100644
--- a/javae/src/IceInternal/FixedReference.java
+++ b/javae/src/IceInternal/FixedReference.java
@@ -13,14 +13,14 @@ public class FixedReference extends Reference
{
public
FixedReference(Instance inst,
- Ice.Communicator com,
- Ice.Identity ident,
+ Ice.Communicator com,
+ Ice.Identity ident,
java.util.Hashtable context,
- String fs,
- int md,
- Ice.Connection[] fixedConns)
+ String fs,
+ int md,
+ Ice.Connection[] fixedConns)
{
- super(inst, com, ident, context, fs, md, false);
+ super(inst, com, ident, context, fs, md, false);
_fixedConnections = fixedConns;
}
@@ -62,14 +62,14 @@ public class FixedReference extends Reference
public void
streamWrite(BasicStream s)
- throws Ice.MarshalException
+ throws Ice.MarshalException
{
throw new Ice.FixedProxyException();
}
public String
toString()
- throws Ice.MarshalException
+ throws Ice.MarshalException
{
throw new Ice.FixedProxyException();
}
@@ -148,26 +148,26 @@ public class FixedReference extends Reference
//
java.util.Vector secureConnections = new java.util.Vector();
- for(int i = connections.size(); i > 0; --i)
- {
- if(((Endpoint)connections.elementAt(i - 1)).secure())
- {
- secureConnections.addElement(connections.elementAt(i - 1));
- connections.removeElementAt(i - 1);
- }
- }
-
+ for(int i = connections.size(); i > 0; --i)
+ {
+ if(((Endpoint)connections.elementAt(i - 1)).secure())
+ {
+ secureConnections.addElement(connections.elementAt(i - 1));
+ connections.removeElementAt(i - 1);
+ }
+ }
+
if(getSecure())
{
connections = secureConnections;
}
else
{
- java.util.Enumeration e = secureConnections.elements();
- while(e.hasMoreElements())
- {
- connections.addElement(e.nextElement());
- }
+ java.util.Enumeration e = secureConnections.elements();
+ while(e.hasMoreElements())
+ {
+ connections.addElement(e.nextElement());
+ }
}
}
else if(connections.size() == 1)
@@ -185,34 +185,34 @@ public class FixedReference extends Reference
ex.proxy = ""; // No stringified representation for fixed proxies.
throw ex;
}
-
- Ice.Connection connection = (Ice.Connection)connections.elementAt(0);
- if(IceUtil.Debug.ASSERT)
- {
- IceUtil.Debug.Assert(connection != null);
- }
- connection.throwException();
- return connection;
+
+ Ice.Connection connection = (Ice.Connection)connections.elementAt(0);
+ if(IceUtil.Debug.ASSERT)
+ {
+ IceUtil.Debug.Assert(connection != null);
+ }
+ connection.throwException();
+ return connection;
}
public boolean
equals(java.lang.Object obj)
{
if(this == obj)
- {
- return true;
- }
- if(!(obj instanceof FixedReference))
- {
- return false;
- }
+ {
+ return true;
+ }
+ if(!(obj instanceof FixedReference))
+ {
+ return false;
+ }
FixedReference rhs = (FixedReference)obj;
if(!super.equals(rhs))
{
return false;
}
-
- return IceUtil.Arrays.equals(_fixedConnections, rhs._fixedConnections);
+
+ return IceUtil.Arrays.equals(_fixedConnections, rhs._fixedConnections);
}
protected
@@ -223,17 +223,17 @@ public class FixedReference extends Reference
protected void
shallowCopy(FixedReference ref)
{
- super.shallowCopy(ref);
- ref._fixedConnections = _fixedConnections;
- ref._rand = _rand;
+ super.shallowCopy(ref);
+ ref._fixedConnections = _fixedConnections;
+ ref._rand = _rand;
}
public java.lang.Object
ice_clone()
{
- FixedReference result = new FixedReference();
+ FixedReference result = new FixedReference();
shallowCopy(result);
- return result;
+ return result;
}
private Ice.Connection _fixedConnections[];
diff --git a/javae/src/IceInternal/Incoming.java b/javae/src/IceInternal/Incoming.java
index 1fc538a814e..c0bbc74c2e9 100644
--- a/javae/src/IceInternal/Incoming.java
+++ b/javae/src/IceInternal/Incoming.java
@@ -15,34 +15,34 @@ final public class Incoming
Incoming(Instance instance, Ice.Connection connection, BasicStream is, Ice.ObjectAdapter adapter)
{
_os = new BasicStream(instance);
- _is = is;
- _connection = connection;
+ _is = is;
+ _connection = connection;
- setAdapter(adapter);
+ setAdapter(adapter);
}
public void
setAdapter(Ice.ObjectAdapter adapter)
{
- _adapter = adapter;
- if(_adapter != null)
- {
- _servantManager = _adapter.getServantManager();
- if(_servantManager == null)
- {
- _adapter = null;
- }
- }
- else
- {
- _servantManager = null;
- }
+ _adapter = adapter;
+ if(_adapter != null)
+ {
+ _servantManager = _adapter.getServantManager();
+ if(_servantManager == null)
+ {
+ _adapter = null;
+ }
+ }
+ else
+ {
+ _servantManager = null;
+ }
}
public Ice.ObjectAdapter
getAdapter()
{
- return _adapter;
+ return _adapter;
}
public void
@@ -51,12 +51,12 @@ final public class Incoming
_current = new Ice.Current();
_current.id = new Ice.Identity();
_current.con = _connection;
- _current.adapter = _adapter;
- _current.requestId = requestId;
+ _current.adapter = _adapter;
+ _current.requestId = requestId;
- //
- // Read the current.
- //
+ //
+ // Read the current.
+ //
_current.id.__read(_is);
//
@@ -65,24 +65,24 @@ final public class Incoming
String[] facetPath = _is.readStringSeq();
if(facetPath.length > 0)
{
- if(facetPath.length > 1)
- {
- throw new Ice.MarshalException();
- }
+ if(facetPath.length > 1)
+ {
+ throw new Ice.MarshalException();
+ }
_current.facet = facetPath[0];
}
- else
- {
+ else
+ {
_current.facet = "";
- }
+ }
_current.operation = _is.readString();
_current.mode = Ice.OperationMode.convert(_is.readByte());
int sz = _is.readSize();
- if(sz > 0)
- {
- _current.ctx = new java.util.Hashtable();
- }
+ if(sz > 0)
+ {
+ _current.ctx = new java.util.Hashtable();
+ }
while(sz-- > 0)
{
String first = _is.readString();
@@ -94,99 +94,99 @@ final public class Incoming
if(response)
{
- if(IceUtil.Debug.ASSERT)
- {
- IceUtil.Debug.Assert(_os.size() == Protocol.headerSize + 4); // Reply status position.
- }
+ if(IceUtil.Debug.ASSERT)
+ {
+ IceUtil.Debug.Assert(_os.size() == Protocol.headerSize + 4); // Reply status position.
+ }
_os.writeByte(ReplyStatus.replyOK);
_os.startWriteEncaps();
}
- byte replyStatus = ReplyStatus.replyOK;
- Ice.DispatchStatus dispatchStatus = Ice.DispatchStatus.DispatchOK;
-
- //
- // Don't put the code above into the try block below. Exceptions
- // in the code above are considered fatal, and must propagate to
- // the caller of this operation.
- //
+ byte replyStatus = ReplyStatus.replyOK;
+ Ice.DispatchStatus dispatchStatus = Ice.DispatchStatus.DispatchOK;
+
+ //
+ // Don't put the code above into the try block below. Exceptions
+ // in the code above are considered fatal, and must propagate to
+ // the caller of this operation.
+ //
try
{
- Ice.Object servant = null;
- if(_servantManager != null)
- {
- servant = _servantManager.findServant(_current.id, _current.facet);
- }
-
- if(servant == null)
- {
- if(_servantManager != null && _servantManager.hasServant(_current.id))
- {
- replyStatus = ReplyStatus.replyFacetNotExist;
- }
- else
- {
- replyStatus = ReplyStatus.replyObjectNotExist;
- }
- }
- else
- {
- dispatchStatus = servant.__dispatch(this, _current);
+ Ice.Object servant = null;
+ if(_servantManager != null)
+ {
+ servant = _servantManager.findServant(_current.id, _current.facet);
+ }
+
+ if(servant == null)
+ {
+ if(_servantManager != null && _servantManager.hasServant(_current.id))
+ {
+ replyStatus = ReplyStatus.replyFacetNotExist;
+ }
+ else
+ {
+ replyStatus = ReplyStatus.replyObjectNotExist;
+ }
+ }
+ else
+ {
+ dispatchStatus = servant.__dispatch(this, _current);
if(dispatchStatus == Ice.DispatchStatus.DispatchUserException)
{
replyStatus = ReplyStatus.replyUserException;
}
- }
- }
- catch(Ice.RequestFailedException ex)
- {
- _is.endReadEncaps();
-
- if(ex.id == null)
- {
- ex.id = _current.id;
- }
-
- if(ex.facet == null)
- {
- ex.facet = _current.facet;
- }
-
- if(ex.operation == null || ex.operation.length() == 0)
- {
- ex.operation = _current.operation;
- }
-
- if(_os.instance().initializationData().properties.getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 1)
- {
- __warning(ex);
- }
+ }
+ }
+ catch(Ice.RequestFailedException ex)
+ {
+ _is.endReadEncaps();
+
+ if(ex.id == null)
+ {
+ ex.id = _current.id;
+ }
+
+ if(ex.facet == null)
+ {
+ ex.facet = _current.facet;
+ }
+
+ if(ex.operation == null || ex.operation.length() == 0)
+ {
+ ex.operation = _current.operation;
+ }
+
+ if(_os.instance().initializationData().properties.getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 1)
+ {
+ __warning(ex);
+ }
if(response)
{
_os.endWriteEncaps();
_os.resize(Protocol.headerSize + 4, false); // Reply status position.
- if(ex instanceof Ice.ObjectNotExistException)
- {
- _os.writeByte(ReplyStatus.replyObjectNotExist);
- }
- else if(ex instanceof Ice.FacetNotExistException)
- {
- _os.writeByte(ReplyStatus.replyFacetNotExist);
- }
- else if(ex instanceof Ice.OperationNotExistException)
- {
- _os.writeByte(ReplyStatus.replyOperationNotExist);
- }
- else
- {
- if(IceUtil.Debug.ASSERT)
- {
- IceUtil.Debug.Assert(false);
- }
- }
- ex.id.__write(_os);
+ if(ex instanceof Ice.ObjectNotExistException)
+ {
+ _os.writeByte(ReplyStatus.replyObjectNotExist);
+ }
+ else if(ex instanceof Ice.FacetNotExistException)
+ {
+ _os.writeByte(ReplyStatus.replyFacetNotExist);
+ }
+ else if(ex instanceof Ice.OperationNotExistException)
+ {
+ _os.writeByte(ReplyStatus.replyOperationNotExist);
+ }
+ else
+ {
+ if(IceUtil.Debug.ASSERT)
+ {
+ IceUtil.Debug.Assert(false);
+ }
+ }
+ ex.id.__write(_os);
//
// For compatibility with the old FacetPath.
@@ -201,178 +201,178 @@ final public class Incoming
_os.writeStringSeq(facetPath2);
}
- _os.writeString(ex.operation);
+ _os.writeString(ex.operation);
- _connection.sendResponse(_os);
- }
- else
- {
- _connection.sendNoResponse();
- }
+ _connection.sendResponse(_os);
+ }
+ else
+ {
+ _connection.sendNoResponse();
+ }
- return;
+ return;
}
catch(Ice.UnknownLocalException ex)
{
- _is.endReadEncaps();
+ _is.endReadEncaps();
- if(_os.instance().initializationData().properties.getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 0)
- {
- __warning(ex);
- }
+ if(_os.instance().initializationData().properties.getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 0)
+ {
+ __warning(ex);
+ }
if(response)
{
_os.endWriteEncaps();
_os.resize(Protocol.headerSize + 4, false); // Reply status position.
_os.writeByte(ReplyStatus.replyUnknownLocalException);
- _os.writeString(ex.unknown);
- _connection.sendResponse(_os);
- }
- else
- {
- _connection.sendNoResponse();
- }
-
- return;
+ _os.writeString(ex.unknown);
+ _connection.sendResponse(_os);
+ }
+ else
+ {
+ _connection.sendNoResponse();
+ }
+
+ return;
}
catch(Ice.UnknownUserException ex)
{
- _is.endReadEncaps();
+ _is.endReadEncaps();
- if(_os.instance().initializationData().properties.getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 0)
- {
- __warning(ex);
- }
+ if(_os.instance().initializationData().properties.getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 0)
+ {
+ __warning(ex);
+ }
if(response)
{
_os.endWriteEncaps();
_os.resize(Protocol.headerSize + 4, false); // Reply status position.
_os.writeByte(ReplyStatus.replyUnknownUserException);
- _os.writeString(ex.unknown);
- _connection.sendResponse(_os);
- }
- else
- {
- _connection.sendNoResponse();
- }
-
- return;
+ _os.writeString(ex.unknown);
+ _connection.sendResponse(_os);
+ }
+ else
+ {
+ _connection.sendNoResponse();
+ }
+
+ return;
}
catch(Ice.UnknownException ex)
{
- _is.endReadEncaps();
+ _is.endReadEncaps();
- if(_os.instance().initializationData().properties.getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 0)
- {
- __warning(ex);
- }
+ if(_os.instance().initializationData().properties.getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 0)
+ {
+ __warning(ex);
+ }
if(response)
{
_os.endWriteEncaps();
_os.resize(Protocol.headerSize + 4, false); // Reply status position.
_os.writeByte(ReplyStatus.replyUnknownException);
- _os.writeString(ex.unknown);
- _connection.sendResponse(_os);
- }
- else
- {
- _connection.sendNoResponse();
- }
-
- return;
+ _os.writeString(ex.unknown);
+ _connection.sendResponse(_os);
+ }
+ else
+ {
+ _connection.sendNoResponse();
+ }
+
+ return;
}
catch(Ice.LocalException ex)
{
- _is.endReadEncaps();
+ _is.endReadEncaps();
- if(_os.instance().initializationData().properties.getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 0)
- {
- __warning(ex);
- }
+ if(_os.instance().initializationData().properties.getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 0)
+ {
+ __warning(ex);
+ }
if(response)
{
_os.endWriteEncaps();
_os.resize(Protocol.headerSize + 4, false); // Reply status position.
_os.writeByte(ReplyStatus.replyUnknownLocalException);
- //_os.writeString(ex.toString());
- java.io.ByteArrayOutputStream sw = new java.io.ByteArrayOutputStream();
- java.io.PrintStream pw = new java.io.PrintStream(sw);
- pw.println(ex.toString());
- pw.flush();
- _os.writeString(sw.toString());
- _connection.sendResponse(_os);
- }
- else
- {
- _connection.sendNoResponse();
- }
-
- return;
+ //_os.writeString(ex.toString());
+ java.io.ByteArrayOutputStream sw = new java.io.ByteArrayOutputStream();
+ java.io.PrintStream pw = new java.io.PrintStream(sw);
+ pw.println(ex.toString());
+ pw.flush();
+ _os.writeString(sw.toString());
+ _connection.sendResponse(_os);
+ }
+ else
+ {
+ _connection.sendNoResponse();
+ }
+
+ return;
}
/* Not possible in Java - UserExceptions are checked exceptions
catch(Ice.UserException ex)
{
- // ...
- }
- */
+ // ...
+ }
+ */
catch(java.lang.Exception ex)
{
- _is.endReadEncaps();
+ _is.endReadEncaps();
- if(_os.instance().initializationData().properties.getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 0)
- {
- __warning(ex);
- }
+ if(_os.instance().initializationData().properties.getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 0)
+ {
+ __warning(ex);
+ }
if(response)
{
_os.endWriteEncaps();
_os.resize(Protocol.headerSize + 4, false); // Reply status position.
_os.writeByte(ReplyStatus.replyUnknownException);
- //_os.writeString(ex.toString());
- java.io.ByteArrayOutputStream sw = new java.io.ByteArrayOutputStream();
- java.io.PrintStream pw = new java.io.PrintStream(sw);
- pw.println(ex.toString());
- pw.flush();
- _os.writeString(sw.toString());
- _connection.sendResponse(_os);
- }
- else
- {
- _connection.sendNoResponse();
- }
-
- return;
+ //_os.writeString(ex.toString());
+ java.io.ByteArrayOutputStream sw = new java.io.ByteArrayOutputStream();
+ java.io.PrintStream pw = new java.io.PrintStream(sw);
+ pw.println(ex.toString());
+ pw.flush();
+ _os.writeString(sw.toString());
+ _connection.sendResponse(_os);
+ }
+ else
+ {
+ _connection.sendNoResponse();
+ }
+
+ return;
}
-
- //
- // Don't put the code below into the try block above. Exceptions
- // in the code below are considered fatal, and must propagate to
- // the caller of this operation.
- //
-
- _is.endReadEncaps();
-
- if(response)
- {
- _os.endWriteEncaps();
-
+
+ //
+ // Don't put the code below into the try block above. Exceptions
+ // in the code below are considered fatal, and must propagate to
+ // the caller of this operation.
+ //
+
+ _is.endReadEncaps();
+
+ if(response)
+ {
+ _os.endWriteEncaps();
+
if(replyStatus != ReplyStatus.replyOK && replyStatus != ReplyStatus.replyUserException)
{
- if(IceUtil.Debug.ASSERT)
- {
- IceUtil.Debug.Assert(replyStatus == ReplyStatus.replyObjectNotExist ||
+ if(IceUtil.Debug.ASSERT)
+ {
+ IceUtil.Debug.Assert(replyStatus == ReplyStatus.replyObjectNotExist ||
replyStatus == ReplyStatus.replyFacetNotExist);
- }
-
- _os.resize(Protocol.headerSize + 4, false); // Reply status position.
- _os.writeByte(replyStatus);
-
- _current.id.__write(_os);
+ }
+
+ _os.resize(Protocol.headerSize + 4, false); // Reply status position.
+ _os.writeByte(replyStatus);
+
+ _current.id.__write(_os);
//
// For compatibility with the old FacetPath.
@@ -387,22 +387,22 @@ final public class Incoming
_os.writeStringSeq(facetPath2);
}
- _os.writeString(_current.operation);
- }
- else
- {
- int save = _os.pos();
- _os.pos(Protocol.headerSize + 4); // Reply status position.
- _os.writeByte(replyStatus);
- _os.pos(save);
- }
-
- _connection.sendResponse(_os);
- }
- else
- {
- _connection.sendNoResponse();
- }
+ _os.writeString(_current.operation);
+ }
+ else
+ {
+ int save = _os.pos();
+ _os.pos(Protocol.headerSize + 4); // Reply status position.
+ _os.writeByte(replyStatus);
+ _os.pos(save);
+ }
+
+ _connection.sendResponse(_os);
+ }
+ else
+ {
+ _connection.sendNoResponse();
+ }
}
public BasicStream
@@ -420,19 +420,19 @@ final public class Incoming
final private void
__warning(java.lang.Exception ex)
{
- if(IceUtil.Debug.ASSERT)
- {
- IceUtil.Debug.Assert(_os != null);
- }
-
- StringBuffer sb = new StringBuffer();
- sb.append("dispatch exception:");
- sb.append("\nidentity: " + _os.instance().identityToString(_current.id));
- sb.append("\nfacet: " + IceUtil.StringUtil.escapeString(_current.facet, ""));
- sb.append("\noperation: " + _current.operation);
- sb.append("\n");
- sb.append(ex.toString());
- _os.instance().initializationData().logger.warning(sb.toString());
+ if(IceUtil.Debug.ASSERT)
+ {
+ IceUtil.Debug.Assert(_os != null);
+ }
+
+ StringBuffer sb = new StringBuffer();
+ sb.append("dispatch exception:");
+ sb.append("\nidentity: " + _os.instance().identityToString(_current.id));
+ sb.append("\nfacet: " + IceUtil.StringUtil.escapeString(_current.facet, ""));
+ sb.append("\noperation: " + _current.operation);
+ sb.append("\n");
+ sb.append(ex.toString());
+ _os.instance().initializationData().logger.warning(sb.toString());
}
//
diff --git a/javae/src/IceInternal/IncomingConnectionFactory.java b/javae/src/IceInternal/IncomingConnectionFactory.java
index 1a328a9422e..32b82d6e14c 100644
--- a/javae/src/IceInternal/IncomingConnectionFactory.java
+++ b/javae/src/IceInternal/IncomingConnectionFactory.java
@@ -32,114 +32,114 @@ public final class IncomingConnectionFactory
public void
waitUntilHolding()
{
- java.util.Vector connections = null;
-
- synchronized(this)
- {
- //
- // First we wait until the connection factory itself is in holding
- // state.
- //
- while(_state < StateHolding)
- {
- try
- {
- wait();
- }
- catch(InterruptedException ex)
- {
- }
- }
-
- //
- // We want to wait until all connections are in holding state
- // outside the thread synchronization.
- //
-
- //
- // No clone call with J2Me.
- //
- //connections = (java.util.Vector)_connections.clone();
- connections = new java.util.Vector(_connections.size());
- java.util.Enumeration e = _connections.elements();
- while(e.hasMoreElements())
- {
- connections.addElement(e.nextElement());
- }
- }
-
- //
- // Now we wait until each connection is in holding state.
- //
- java.util.Enumeration e = connections.elements();
- while(e.hasMoreElements())
- {
- Ice.Connection connection = (Ice.Connection)e.nextElement();
- connection.waitUntilHolding();
- }
+ java.util.Vector connections = null;
+
+ synchronized(this)
+ {
+ //
+ // First we wait until the connection factory itself is in holding
+ // state.
+ //
+ while(_state < StateHolding)
+ {
+ try
+ {
+ wait();
+ }
+ catch(InterruptedException ex)
+ {
+ }
+ }
+
+ //
+ // We want to wait until all connections are in holding state
+ // outside the thread synchronization.
+ //
+
+ //
+ // No clone call with J2Me.
+ //
+ //connections = (java.util.Vector)_connections.clone();
+ connections = new java.util.Vector(_connections.size());
+ java.util.Enumeration e = _connections.elements();
+ while(e.hasMoreElements())
+ {
+ connections.addElement(e.nextElement());
+ }
+ }
+
+ //
+ // Now we wait until each connection is in holding state.
+ //
+ java.util.Enumeration e = connections.elements();
+ while(e.hasMoreElements())
+ {
+ Ice.Connection connection = (Ice.Connection)e.nextElement();
+ connection.waitUntilHolding();
+ }
}
public void
waitUntilFinished()
{
- Thread threadPerIncomingConnectionFactory = null;
- java.util.Vector connections;
-
- synchronized(this)
- {
- //
- // First we wait until the factory is destroyed. If we are using
- // an acceptor, we also wait for it to be closed.
- //
- while(_state != StateClosed || _acceptor != null)
- {
- try
- {
- wait();
- }
- catch(InterruptedException ex)
- {
- }
- }
-
- threadPerIncomingConnectionFactory = _threadPerIncomingConnectionFactory;
- _threadPerIncomingConnectionFactory = null;
-
- //
- // We want to wait until all connections are finished outside the
- // thread synchronization.
- //
- // For consistency with C#, we set _connections to null rather than to a
- // new empty list so that our finalizer does not try to invoke any
- // methods on member objects.
- //
- connections = _connections;
- _connections = null;
- }
-
- if(threadPerIncomingConnectionFactory != null)
- {
- while(true)
- {
- try
- {
- threadPerIncomingConnectionFactory.join();
- break;
- }
- catch(InterruptedException ex)
- {
- }
- }
- }
+ Thread threadPerIncomingConnectionFactory = null;
+ java.util.Vector connections;
+
+ synchronized(this)
+ {
+ //
+ // First we wait until the factory is destroyed. If we are using
+ // an acceptor, we also wait for it to be closed.
+ //
+ while(_state != StateClosed || _acceptor != null)
+ {
+ try
+ {
+ wait();
+ }
+ catch(InterruptedException ex)
+ {
+ }
+ }
+
+ threadPerIncomingConnectionFactory = _threadPerIncomingConnectionFactory;
+ _threadPerIncomingConnectionFactory = null;
+
+ //
+ // We want to wait until all connections are finished outside the
+ // thread synchronization.
+ //
+ // For consistency with C#, we set _connections to null rather than to a
+ // new empty list so that our finalizer does not try to invoke any
+ // methods on member objects.
+ //
+ connections = _connections;
+ _connections = null;
+ }
+
+ if(threadPerIncomingConnectionFactory != null)
+ {
+ while(true)
+ {
+ try
+ {
+ threadPerIncomingConnectionFactory.join();
+ break;
+ }
+ catch(InterruptedException ex)
+ {
+ }
+ }
+ }
if(connections != null)
{
- java.util.Enumeration p = connections.elements();
- while(p.hasMoreElements())
- {
- Ice.Connection connection = (Ice.Connection)p.nextElement();
- connection.waitUntilFinished();
- }
+ java.util.Enumeration p = connections.elements();
+ while(p.hasMoreElements())
+ {
+ Ice.Connection connection = (Ice.Connection)p.nextElement();
+ connection.waitUntilFinished();
+ }
}
}
@@ -153,11 +153,11 @@ public final class IncomingConnectionFactory
public synchronized Ice.Connection[]
connections()
{
- java.util.Vector connections = new java.util.Vector();
+ java.util.Vector connections = new java.util.Vector();
- //
- // Only copy connections which have not been destroyed.
- //
+ //
+ // Only copy connections which have not been destroyed.
+ //
java.util.Enumeration p = _connections.elements();
while(p.hasMoreElements())
{
@@ -177,17 +177,17 @@ public final class IncomingConnectionFactory
flushBatchRequests()
{
Ice.Connection[] c = connections(); // connections() is synchronized, so no need to synchronize here.
- for(int i = 0; i < c.length; i++)
- {
- try
- {
- c[i].flushBatchRequests();
- }
- catch(Ice.LocalException ex)
- {
- // Ignore.
- }
- }
+ for(int i = 0; i < c.length; i++)
+ {
+ try
+ {
+ c[i].flushBatchRequests();
+ }
+ catch(Ice.LocalException ex)
+ {
+ // Ignore.
+ }
+ }
}
public synchronized String
@@ -195,14 +195,14 @@ public final class IncomingConnectionFactory
{
if(_transceiver != null)
{
- return _transceiver.toString();
+ return _transceiver.toString();
}
- if(IceUtil.Debug.ASSERT)
- {
- IceUtil.Debug.Assert(_acceptor != null);
- }
- return _acceptor.toString();
+ if(IceUtil.Debug.ASSERT)
+ {
+ IceUtil.Debug.Assert(_acceptor != null);
+ }
+ return _acceptor.toString();
}
public
@@ -211,122 +211,122 @@ public final class IncomingConnectionFactory
_instance = instance;
_endpoint = endpoint;
_adapter = adapter;
- _warn = _instance.initializationData().properties.getPropertyAsInt("Ice.Warn.Connections") > 0 ? true : false;
+ _warn = _instance.initializationData().properties.getPropertyAsInt("Ice.Warn.Connections") > 0 ? true : false;
_state = StateHolding;
- DefaultsAndOverrides defaultsAndOverrides = _instance.defaultsAndOverrides();
- if(defaultsAndOverrides.overrideTimeout)
- {
- _endpoint = _endpoint.timeout(defaultsAndOverrides.overrideTimeoutValue);
- }
-
- EndpointHolder h = new EndpointHolder();
- h.value = _endpoint;
- _transceiver = _endpoint.serverTransceiver(h);
-
- try
- {
- if(_transceiver != null)
- {
- _endpoint = h.value;
-
- Ice.Connection connection = null;
-
- try
- {
- connection = new Ice.Connection(_instance, _transceiver, _endpoint, _adapter);
-
- //
- // Wait for the connection to be validated by the
- // connection thread. Once the connection has
- // been validated it will be activated also.
- //
- connection.waitForValidation();
- }
- catch(Ice.LocalException ex)
- {
- //
- // If a connection object was constructed, then
- // validate() must have raised the exception.
- //
- if(connection != null)
- {
- connection.waitUntilFinished(); // We must call waitUntilFinished() for cleanup.
- }
-
- return;
- }
-
- _connections.addElement(connection);
- }
- else
- {
- h.value = _endpoint;
- _acceptor = _endpoint.acceptor(h);
- _endpoint = h.value;
- if(IceUtil.Debug.ASSERT)
- {
- IceUtil.Debug.Assert(_acceptor != null);
- }
- _acceptor.listen();
-
- //
- // If we are in thread per connection mode, we also use
- // one thread per incoming connection factory, that
- // accepts new connections on this endpoint.
- //
- try
- {
- _threadPerIncomingConnectionFactory = new ThreadPerIncomingConnectionFactory(this);
- _threadPerIncomingConnectionFactory.start();
- }
- catch(java.lang.Exception ex)
- {
- error("cannot create thread for incoming connection factory", ex);
- throw ex;
- }
- }
- }
- catch(java.lang.Exception ex)
- {
-
- if(_acceptor != null)
- {
- try
- {
- _acceptor.close();
- }
- catch(Ice.LocalException e)
- {
- // Here we ignore any exceptions in close().
- }
- }
-
- //
- // Clean up for finalizer.
- //
- synchronized(this)
- {
- _state = StateClosed;
- _acceptor = null;
- _connections = null;
- _threadPerIncomingConnectionFactory = null;
- }
-
- Ice.SyscallException e = new Ice.SyscallException();
- e.initCause(ex);
- throw e;
- }
+ DefaultsAndOverrides defaultsAndOverrides = _instance.defaultsAndOverrides();
+ if(defaultsAndOverrides.overrideTimeout)
+ {
+ _endpoint = _endpoint.timeout(defaultsAndOverrides.overrideTimeoutValue);
+ }
+
+ EndpointHolder h = new EndpointHolder();
+ h.value = _endpoint;
+ _transceiver = _endpoint.serverTransceiver(h);
+
+ try
+ {
+ if(_transceiver != null)
+ {
+ _endpoint = h.value;
+
+ Ice.Connection connection = null;
+
+ try
+ {
+ connection = new Ice.Connection(_instance, _transceiver, _endpoint, _adapter);
+
+ //
+ // Wait for the connection to be validated by the
+ // connection thread. Once the connection has
+ // been validated it will be activated also.
+ //
+ connection.waitForValidation();
+ }
+ catch(Ice.LocalException ex)
+ {
+ //
+ // If a connection object was constructed, then
+ // validate() must have raised the exception.
+ //
+ if(connection != null)
+ {
+ connection.waitUntilFinished(); // We must call waitUntilFinished() for cleanup.
+ }
+
+ return;
+ }
+
+ _connections.addElement(connection);
+ }
+ else
+ {
+ h.value = _endpoint;
+ _acceptor = _endpoint.acceptor(h);
+ _endpoint = h.value;
+ if(IceUtil.Debug.ASSERT)
+ {
+ IceUtil.Debug.Assert(_acceptor != null);
+ }
+ _acceptor.listen();
+
+ //
+ // If we are in thread per connection mode, we also use
+ // one thread per incoming connection factory, that
+ // accepts new connections on this endpoint.
+ //
+ try
+ {
+ _threadPerIncomingConnectionFactory = new ThreadPerIncomingConnectionFactory(this);
+ _threadPerIncomingConnectionFactory.start();
+ }
+ catch(java.lang.Exception ex)
+ {
+ error("cannot create thread for incoming connection factory", ex);
+ throw ex;
+ }
+ }
+ }
+ catch(java.lang.Exception ex)
+ {
+
+ if(_acceptor != null)
+ {
+ try
+ {
+ _acceptor.close();
+ }
+ catch(Ice.LocalException e)
+ {
+ // Here we ignore any exceptions in close().
+ }
+ }
+
+ //
+ // Clean up for finalizer.
+ //
+ synchronized(this)
+ {
+ _state = StateClosed;
+ _acceptor = null;
+ _connections = null;
+ _threadPerIncomingConnectionFactory = null;
+ }
+
+ Ice.SyscallException e = new Ice.SyscallException();
+ e.initCause(ex);
+ throw e;
+ }
}
protected synchronized void
finalize()
throws Throwable
{
- IceUtil.Debug.FinalizerAssert(_state == StateClosed);
- IceUtil.Debug.FinalizerAssert(_acceptor == null);
- IceUtil.Debug.FinalizerAssert(_connections == null);
- IceUtil.Debug.FinalizerAssert(_threadPerIncomingConnectionFactory == null);
+ IceUtil.Debug.FinalizerAssert(_state == StateClosed);
+ IceUtil.Debug.FinalizerAssert(_acceptor == null);
+ IceUtil.Debug.FinalizerAssert(_connections == null);
+ IceUtil.Debug.FinalizerAssert(_threadPerIncomingConnectionFactory == null);
}
private static final int StateActive = 0;
@@ -377,14 +377,14 @@ public final class IncomingConnectionFactory
case StateClosed:
{
- if(_acceptor != null)
- {
- //
- // Connect to our own acceptor, which unblocks our
- // thread per incoming connection factory stuck in accept().
- //
- _acceptor.connectToSelf();
- }
+ if(_acceptor != null)
+ {
+ //
+ // Connect to our own acceptor, which unblocks our
+ // thread per incoming connection factory stuck in accept().
+ //
+ _acceptor.connectToSelf();
+ }
java.util.Enumeration p = _connections.elements();
while(p.hasMoreElements())
@@ -392,12 +392,12 @@ public final class IncomingConnectionFactory
Ice.Connection connection = (Ice.Connection)p.nextElement();
connection.destroy(Ice.Connection.ObjectAdapterDeactivated);
}
- break;
+ break;
}
}
_state = state;
- notifyAll();
+ notifyAll();
}
public void
@@ -410,127 +410,127 @@ public final class IncomingConnectionFactory
public void
error(String msg, Exception ex)
{
- String s = msg + ":\n" + toString() + ex.toString();
- _instance.initializationData().logger.error(s);
+ String s = msg + ":\n" + toString() + ex.toString();
+ _instance.initializationData().logger.error(s);
}
public void
run()
{
- if(IceUtil.Debug.ASSERT)
- {
- IceUtil.Debug.Assert(_acceptor != null);
- }
-
- while(true)
- {
- //
- // We must accept new connections outside the thread
- // synchronization, because we use blocking accept.
- //
- Transceiver transceiver = null;
- try
- {
- transceiver = _acceptor.accept(-1);
- }
- catch(Ice.SocketException ex)
- {
- // Do not ignore SocketException in Java.
- throw ex;
- }
- catch(Ice.TimeoutException ex)
- {
- // Ignore timeouts.
- }
- catch(Ice.LocalException ex)
- {
- // Warn about other Ice local exceptions.
- if(_warn)
- {
- warning(ex);
- }
- }
-
- Ice.Connection connection = null;
-
- synchronized(this)
- {
- while(_state == StateHolding)
- {
- try
- {
- wait();
- }
- catch(InterruptedException ex)
- {
- }
- }
-
- if(_state == StateClosed)
- {
- if(transceiver != null)
- {
- try
- {
- transceiver.close();
- }
- catch(Ice.LocalException ex)
- {
- // Here we ignore any exceptions in close().
- }
- }
-
- try
- {
- _acceptor.close();
- }
- catch(Ice.LocalException ex)
- {
- _acceptor = null;
- notifyAll();
- throw ex;
- }
-
- _acceptor = null;
- notifyAll();
- return;
- }
-
- if(IceUtil.Debug.ASSERT)
- {
- IceUtil.Debug.Assert(_state == StateActive);
- }
-
- //
- // Reap connections for which destruction has completed.
- //
- java.util.Enumeration p = _connections.elements();
- for(int i = _connections.size(); i > 0; --i)
- {
- Ice.Connection con = (Ice.Connection)_connections.elementAt(i - 1);
- if(con.isFinished())
- {
- _connections.removeElementAt(i - 1);
- }
- }
-
- //
- // Create a connection object for the connection.
- //
- if(transceiver != null)
- {
- try
- {
- connection = new Ice.Connection(_instance, transceiver, _endpoint, _adapter);
- }
- catch(Ice.LocalException ex)
- {
- return;
- }
-
- _connections.addElement(connection);
- }
- }
+ if(IceUtil.Debug.ASSERT)
+ {
+ IceUtil.Debug.Assert(_acceptor != null);
+ }
+
+ while(true)
+ {
+ //
+ // We must accept new connections outside the thread
+ // synchronization, because we use blocking accept.
+ //
+ Transceiver transceiver = null;
+ try
+ {
+ transceiver = _acceptor.accept(-1);
+ }
+ catch(Ice.SocketException ex)
+ {
+ // Do not ignore SocketException in Java.
+ throw ex;
+ }
+ catch(Ice.TimeoutException ex)
+ {
+ // Ignore timeouts.
+ }
+ catch(Ice.LocalException ex)
+ {
+ // Warn about other Ice local exceptions.
+ if(_warn)
+ {
+ warning(ex);
+ }
+ }
+
+ Ice.Connection connection = null;
+
+ synchronized(this)
+ {
+ while(_state == StateHolding)
+ {
+ try
+ {
+ wait();
+ }
+ catch(InterruptedException ex)
+ {
+ }
+ }
+
+ if(_state == StateClosed)
+ {
+ if(transceiver != null)
+ {
+ try
+ {
+ transceiver.close();
+ }
+ catch(Ice.LocalException ex)
+ {
+ // Here we ignore any exceptions in close().
+ }
+ }
+
+ try
+ {
+ _acceptor.close();
+ }
+ catch(Ice.LocalException ex)
+ {
+ _acceptor = null;
+ notifyAll();
+ throw ex;
+ }
+
+ _acceptor = null;
+ notifyAll();
+ return;
+ }
+
+ if(IceUtil.Debug.ASSERT)
+ {
+ IceUtil.Debug.Assert(_state == StateActive);
+ }
+
+ //
+ // Reap connections for which destruction has completed.
+ //
+ java.util.Enumeration p = _connections.elements();
+ for(int i = _connections.size(); i > 0; --i)
+ {
+ Ice.Connection con = (Ice.Connection)_connections.elementAt(i - 1);
+ if(con.isFinished())
+ {
+ _connections.removeElementAt(i - 1);
+ }
+ }
+
+ //
+ // Create a connection object for the connection.
+ //
+ if(transceiver != null)
+ {
+ try
+ {
+ connection = new Ice.Connection(_instance, transceiver, _endpoint, _adapter);
+ }
+ catch(Ice.LocalException ex)
+ {
+ return;
+ }
+
+ _connections.addElement(connection);
+ }
+ }
//
// In thread per connection mode, the connection's thread will
@@ -540,30 +540,30 @@ public final class IncomingConnectionFactory
// acceptor. Therefore we don't call validate() and activate()
// from the connection factory in thread per connection mode.
//
- }
+ }
}
private class ThreadPerIncomingConnectionFactory extends Thread
{
- ThreadPerIncomingConnectionFactory(IncomingConnectionFactory factory)
- {
- _factory = factory;
- }
-
- public void
- run()
- {
- try
- {
- _factory.run();
- }
- catch(Exception ex)
- {
- _factory.error("exception in thread per incoming connection factory", ex);
- }
- }
-
- IncomingConnectionFactory _factory;
+ ThreadPerIncomingConnectionFactory(IncomingConnectionFactory factory)
+ {
+ _factory = factory;
+ }
+
+ public void
+ run()
+ {
+ try
+ {
+ _factory.run();
+ }
+ catch(Exception ex)
+ {
+ _factory.error("exception in thread per incoming connection factory", ex);
+ }
+ }
+
+ IncomingConnectionFactory _factory;
}
private Thread _threadPerIncomingConnectionFactory;
diff --git a/javae/src/IceInternal/IndirectReference.java b/javae/src/IceInternal/IndirectReference.java
index b1e87b202e9..df9f19d84d3 100644
--- a/javae/src/IceInternal/IndirectReference.java
+++ b/javae/src/IceInternal/IndirectReference.java
@@ -13,19 +13,19 @@ public class IndirectReference extends RoutableReference
{
public
IndirectReference(Instance inst,
- Ice.Communicator com,
- Ice.Identity ident,
+ Ice.Communicator com,
+ Ice.Identity ident,
java.util.Hashtable context,
- String fs,
- int md,
- boolean sec,
- String adptid,
- RouterInfo rtrInfo,
- LocatorInfo locInfo)
+ String fs,
+ int md,
+ boolean sec,
+ String adptid,
+ RouterInfo rtrInfo,
+ LocatorInfo locInfo)
{
- super(inst, com, ident, context, fs, md, sec, rtrInfo);
+ super(inst, com, ident, context, fs, md, sec, rtrInfo);
_adapterId = adptid;
- _locatorInfo = locInfo;
+ _locatorInfo = locInfo;
}
public final String
@@ -61,183 +61,183 @@ public class IndirectReference extends RoutableReference
public Reference
changeLocator(Ice.LocatorPrx newLocator)
{
- LocatorInfo newLocatorInfo = getInstance().locatorManager().get(newLocator);
- if(_locatorInfo != null && newLocatorInfo != null && newLocatorInfo.equals(_locatorInfo))
- {
- return this;
- }
- IndirectReference r = (IndirectReference)getInstance().referenceFactory().copy(this);
- r._locatorInfo = newLocatorInfo;
- return r;
+ LocatorInfo newLocatorInfo = getInstance().locatorManager().get(newLocator);
+ if(_locatorInfo != null && newLocatorInfo != null && newLocatorInfo.equals(_locatorInfo))
+ {
+ return this;
+ }
+ IndirectReference r = (IndirectReference)getInstance().referenceFactory().copy(this);
+ r._locatorInfo = newLocatorInfo;
+ return r;
}
public void
streamWrite(BasicStream s)
- throws Ice.MarshalException
+ throws Ice.MarshalException
{
super.streamWrite(s);
- s.writeSize(0);
- s.writeString(_adapterId);
+ s.writeSize(0);
+ s.writeString(_adapterId);
}
public String
toString()
{
- //
- // WARNING: Certain features, such as proxy validation in Glacier2,
- // depend on the format of proxy strings. Changes to toString() and
- // methods called to generate parts of the reference string could break
- // these features. Please review for all features that depend on the
- // format of proxyToString() before changing this and related code.
- //
- String result = super.toString();
+ //
+ // WARNING: Certain features, such as proxy validation in Glacier2,
+ // depend on the format of proxy strings. Changes to toString() and
+ // methods called to generate parts of the reference string could break
+ // these features. Please review for all features that depend on the
+ // format of proxyToString() before changing this and related code.
+ //
+ String result = super.toString();
- if(_adapterId.length() == 0)
- {
- return result;
- }
+ if(_adapterId.length() == 0)
+ {
+ return result;
+ }
- StringBuffer s = new StringBuffer();
- s.append(result);
- s.append(" @ ");
+ StringBuffer s = new StringBuffer();
+ s.append(result);
+ s.append(" @ ");
- //
- // If the encoded adapter id string contains characters which
- // the reference parser uses as separators, then we enclose
- // the adapter id string in quotes.
- //
- String a = IceUtil.StringUtil.escapeString(_adapterId, null);
- if(IceUtil.StringUtil.findFirstOf(a, " \t\n\r") != -1)
- {
- s.append('"');
- s.append(a);
- s.append('"');
- }
- else
- {
- s.append(a);
- }
- return s.toString();
+ //
+ // If the encoded adapter id string contains characters which
+ // the reference parser uses as separators, then we enclose
+ // the adapter id string in quotes.
+ //
+ String a = IceUtil.StringUtil.escapeString(_adapterId, null);
+ if(IceUtil.StringUtil.findFirstOf(a, " \t\n\r") != -1)
+ {
+ s.append('"');
+ s.append(a);
+ s.append('"');
+ }
+ else
+ {
+ s.append(a);
+ }
+ return s.toString();
}
public Ice.Connection
getConnection()
{
- Ice.Connection connection;
+ Ice.Connection connection;
- while(true)
- {
- Endpoint[] endpts = super.getRoutedEndpoints();
- Ice.BooleanHolder cached = new Ice.BooleanHolder(false);
- if(endpts.length == 0 && _locatorInfo != null)
- {
- endpts = _locatorInfo.getEndpoints(this, cached);
- }
+ while(true)
+ {
+ Endpoint[] endpts = super.getRoutedEndpoints();
+ Ice.BooleanHolder cached = new Ice.BooleanHolder(false);
+ if(endpts.length == 0 && _locatorInfo != null)
+ {
+ endpts = _locatorInfo.getEndpoints(this, cached);
+ }
- applyOverrides(endpts);
+ applyOverrides(endpts);
- Endpoint[] filteredEndpoints = filterEndpoints(endpts);
- if(filteredEndpoints.length == 0)
- {
- Ice.NoEndpointException ex = new Ice.NoEndpointException();
- ex.proxy = toString();
- throw ex;
- }
+ Endpoint[] filteredEndpoints = filterEndpoints(endpts);
+ if(filteredEndpoints.length == 0)
+ {
+ Ice.NoEndpointException ex = new Ice.NoEndpointException();
+ ex.proxy = toString();
+ throw ex;
+ }
- try
- {
- OutgoingConnectionFactory factory = getInstance().outgoingConnectionFactory();
- connection = factory.create(filteredEndpoints);
- if(IceUtil.Debug.ASSERT)
- {
- IceUtil.Debug.Assert(connection != null);
- }
- }
- catch(Ice.LocalException ex)
- {
- if(getRouterInfo() == null)
- {
- if(IceUtil.Debug.ASSERT)
- {
- IceUtil.Debug.Assert(_locatorInfo != null);
- }
- _locatorInfo.clearCache(this);
+ try
+ {
+ OutgoingConnectionFactory factory = getInstance().outgoingConnectionFactory();
+ connection = factory.create(filteredEndpoints);
+ if(IceUtil.Debug.ASSERT)
+ {
+ IceUtil.Debug.Assert(connection != null);
+ }
+ }
+ catch(Ice.LocalException ex)
+ {
+ if(getRouterInfo() == null)
+ {
+ if(IceUtil.Debug.ASSERT)
+ {
+ IceUtil.Debug.Assert(_locatorInfo != null);
+ }
+ _locatorInfo.clearCache(this);
- if(cached.value)
- {
- TraceLevels traceLevels = getInstance().traceLevels();
- if(traceLevels.retry >= 2)
- {
- String s = "connection to cached endpoints failed\n" +
- "removing endpoints from cache and trying one more time\n" + ex;
- getInstance().initializationData().logger.trace(traceLevels.retryCat, s);
- }
-
- continue;
- }
- }
+ if(cached.value)
+ {
+ TraceLevels traceLevels = getInstance().traceLevels();
+ if(traceLevels.retry >= 2)
+ {
+ String s = "connection to cached endpoints failed\n" +
+ "removing endpoints from cache and trying one more time\n" + ex;
+ getInstance().initializationData().logger.trace(traceLevels.retryCat, s);
+ }
+
+ continue;
+ }
+ }
- throw ex;
- }
+ throw ex;
+ }
- break;
- }
+ break;
+ }
- //
- // If we have a router, set the object adapter for this router
- // (if any) to the new connection, so that callbacks from the
- // router can be received over this new connection.
- //
- if(getRouterInfo() != null)
- {
- connection.setAdapter(getRouterInfo().getAdapter());
- }
+ //
+ // If we have a router, set the object adapter for this router
+ // (if any) to the new connection, so that callbacks from the
+ // router can be received over this new connection.
+ //
+ if(getRouterInfo() != null)
+ {
+ connection.setAdapter(getRouterInfo().getAdapter());
+ }
- if(IceUtil.Debug.ASSERT)
- {
- IceUtil.Debug.Assert(connection != null);
- }
- return connection;
+ if(IceUtil.Debug.ASSERT)
+ {
+ IceUtil.Debug.Assert(connection != null);
+ }
+ return connection;
}
public synchronized int
hashCode()
{
if(_hashInitialized)
- {
- return _hashValue;
- }
- super.hashCode(); // Initializes _hashValue.
- int sz = _adapterId.length(); // Add hash of adapter ID to base hash.
- for(int i = 0; i < sz; i++)
- {
- _hashValue = 5 * _hashValue + (int)_adapterId.charAt(i);
- }
- return _hashValue;
+ {
+ return _hashValue;
+ }
+ super.hashCode(); // Initializes _hashValue.
+ int sz = _adapterId.length(); // Add hash of adapter ID to base hash.
+ for(int i = 0; i < sz; i++)
+ {
+ _hashValue = 5 * _hashValue + (int)_adapterId.charAt(i);
+ }
+ return _hashValue;
}
public boolean
equals(java.lang.Object obj)
{
if(this == obj)
- {
- return true;
- }
- if(!(obj instanceof IndirectReference))
- {
- return false;
- }
+ {
+ return true;
+ }
+ if(!(obj instanceof IndirectReference))
+ {
+ return false;
+ }
IndirectReference rhs = (IndirectReference)obj;
if(!super.equals(rhs))
{
return false;
}
- if(!_adapterId.equals(rhs._adapterId))
- {
- return false;
- }
- return _locatorInfo == null ? rhs._locatorInfo == null : _locatorInfo.equals(rhs._locatorInfo);
+ if(!_adapterId.equals(rhs._adapterId))
+ {
+ return false;
+ }
+ return _locatorInfo == null ? rhs._locatorInfo == null : _locatorInfo.equals(rhs._locatorInfo);
}
protected
@@ -248,17 +248,17 @@ public class IndirectReference extends RoutableReference
protected void
shallowCopy(IndirectReference ref)
{
- super.shallowCopy(ref);
- ref._adapterId = _adapterId;
- ref._locatorInfo = _locatorInfo;
+ super.shallowCopy(ref);
+ ref._adapterId = _adapterId;
+ ref._locatorInfo = _locatorInfo;
}
public java.lang.Object
ice_clone()
{
- IndirectReference result = new IndirectReference();
+ IndirectReference result = new IndirectReference();
shallowCopy(result);
- return result;
+ return result;
}
private String _adapterId;
diff --git a/javae/src/IceInternal/Instance.java b/javae/src/IceInternal/Instance.java
index 8d21ea0b3b7..ee5bf6ea5e8 100644
--- a/javae/src/IceInternal/Instance.java
+++ b/javae/src/IceInternal/Instance.java
@@ -14,36 +14,36 @@ public class Instance
public Ice.InitializationData
initializationData()
{
- //
- // No check for destruction. It must be possible to access the
- // initialization data after destruction.
- //
- // No mutex lock, immutable.
- //
+ //
+ // No check for destruction. It must be possible to access the
+ // initialization data after destruction.
+ //
+ // No mutex lock, immutable.
+ //
return _initData;
}
public TraceLevels
traceLevels()
{
- // No mutex lock, immutable.
+ // No mutex lock, immutable.
return _traceLevels;
}
public DefaultsAndOverrides
defaultsAndOverrides()
{
- // No mutex lock, immutable.
+ // No mutex lock, immutable.
return _defaultsAndOverrides;
}
public synchronized RouterManager
routerManager()
{
- if(_state == StateDestroyed)
- {
- throw new Ice.CommunicatorDestroyedException();
- }
+ if(_state == StateDestroyed)
+ {
+ throw new Ice.CommunicatorDestroyedException();
+ }
return _routerManager;
}
@@ -51,10 +51,10 @@ public class Instance
public synchronized LocatorManager
locatorManager()
{
- if(_state == StateDestroyed)
- {
- throw new Ice.CommunicatorDestroyedException();
- }
+ if(_state == StateDestroyed)
+ {
+ throw new Ice.CommunicatorDestroyedException();
+ }
return _locatorManager;
}
@@ -62,10 +62,10 @@ public class Instance
public synchronized ReferenceFactory
referenceFactory()
{
- if(_state == StateDestroyed)
- {
- throw new Ice.CommunicatorDestroyedException();
- }
+ if(_state == StateDestroyed)
+ {
+ throw new Ice.CommunicatorDestroyedException();
+ }
return _referenceFactory;
}
@@ -73,10 +73,10 @@ public class Instance
public synchronized ProxyFactory
proxyFactory()
{
- if(_state == StateDestroyed)
- {
- throw new Ice.CommunicatorDestroyedException();
- }
+ if(_state == StateDestroyed)
+ {
+ throw new Ice.CommunicatorDestroyedException();
+ }
return _proxyFactory;
}
@@ -84,10 +84,10 @@ public class Instance
public synchronized OutgoingConnectionFactory
outgoingConnectionFactory()
{
- if(_state == StateDestroyed)
- {
- throw new Ice.CommunicatorDestroyedException();
- }
+ if(_state == StateDestroyed)
+ {
+ throw new Ice.CommunicatorDestroyedException();
+ }
return _outgoingConnectionFactory;
}
@@ -95,10 +95,10 @@ public class Instance
public synchronized ObjectAdapterFactory
objectAdapterFactory()
{
- if(_state == StateDestroyed)
- {
- throw new Ice.CommunicatorDestroyedException();
- }
+ if(_state == StateDestroyed)
+ {
+ throw new Ice.CommunicatorDestroyedException();
+ }
return _objectAdapterFactory;
}
@@ -106,16 +106,16 @@ public class Instance
public int
threadPerConnectionStackSize()
{
- return _threadPerConnectionStackSize;
+ return _threadPerConnectionStackSize;
}
public synchronized EndpointFactory
endpointFactory()
{
- if(_state == StateDestroyed)
- {
- throw new Ice.CommunicatorDestroyedException();
- }
+ if(_state == StateDestroyed)
+ {
+ throw new Ice.CommunicatorDestroyedException();
+ }
return _endpointFactory;
}
@@ -124,28 +124,28 @@ public class Instance
messageSizeMax()
{
// No mutex lock, immutable.
- return _messageSizeMax;
+ return _messageSizeMax;
}
public void
flushBatchRequests()
{
- OutgoingConnectionFactory connectionFactory;
- ObjectAdapterFactory adapterFactory;
-
- synchronized(this)
- {
- if(_state == StateDestroyed)
- {
- throw new Ice.CommunicatorDestroyedException();
- }
-
- connectionFactory = _outgoingConnectionFactory;
- adapterFactory = _objectAdapterFactory;
- }
-
- connectionFactory.flushBatchRequests();
- adapterFactory.flushBatchRequests();
+ OutgoingConnectionFactory connectionFactory;
+ ObjectAdapterFactory adapterFactory;
+
+ synchronized(this)
+ {
+ if(_state == StateDestroyed)
+ {
+ throw new Ice.CommunicatorDestroyedException();
+ }
+
+ connectionFactory = _outgoingConnectionFactory;
+ adapterFactory = _objectAdapterFactory;
+ }
+
+ connectionFactory.flushBatchRequests();
+ adapterFactory.flushBatchRequests();
}
public Ice.Identity
@@ -244,10 +244,10 @@ public class Instance
try
{
- if(_initData.logger == null)
- {
- _initData.logger = new Ice.LoggerI(_initData.properties.getProperty("Ice.ProgramName"));
- }
+ if(_initData.logger == null)
+ {
+ _initData.logger = new Ice.LoggerI(_initData.properties.getProperty("Ice.ProgramName"));
+ }
validatePackages();
@@ -255,31 +255,31 @@ public class Instance
_defaultsAndOverrides = new DefaultsAndOverrides(_initData.properties);
- {
- final int defaultMessageSizeMax = 1024;
- int num = _initData.properties.getPropertyAsIntWithDefault("Ice.MessageSizeMax", defaultMessageSizeMax);
- if(num < 1)
- {
- _messageSizeMax = defaultMessageSizeMax * 1024; // Ignore non-sensical values.
- }
- else if(num > 0x7fffffff / 1024)
- {
- _messageSizeMax = 0x7fffffff;
- }
- else
- {
- _messageSizeMax = num * 1024; // Property is in kilobytes, _messageSizeMax in bytes
- }
- }
-
- {
- int stackSize = _initData.properties.getPropertyAsInt("Ice.ThreadPerConnection.StackSize");
- if(stackSize < 0)
- {
- stackSize = 0;
- }
- _threadPerConnectionStackSize = stackSize;
- }
+ {
+ final int defaultMessageSizeMax = 1024;
+ int num = _initData.properties.getPropertyAsIntWithDefault("Ice.MessageSizeMax", defaultMessageSizeMax);
+ if(num < 1)
+ {
+ _messageSizeMax = defaultMessageSizeMax * 1024; // Ignore non-sensical values.
+ }
+ else if(num > 0x7fffffff / 1024)
+ {
+ _messageSizeMax = 0x7fffffff;
+ }
+ else
+ {
+ _messageSizeMax = num * 1024; // Property is in kilobytes, _messageSizeMax in bytes
+ }
+ }
+
+ {
+ int stackSize = _initData.properties.getPropertyAsInt("Ice.ThreadPerConnection.StackSize");
+ if(stackSize < 0)
+ {
+ stackSize = 0;
+ }
+ _threadPerConnectionStackSize = stackSize;
+ }
_routerManager = new RouterManager();
@@ -315,28 +315,28 @@ public class Instance
IceUtil.Debug.FinalizerAssert(_locatorManager == null);
IceUtil.Debug.FinalizerAssert(_endpointFactory == null);
- //
- // Do not call parent's finalizer, CLDC Object does not have it.
- //
+ //
+ // Do not call parent's finalizer, CLDC Object does not have it.
+ //
}
public void
finishSetup(Ice.StringSeqHolder args)
{
- //
- // Get default router and locator proxies.
- //
- if(_defaultsAndOverrides.defaultRouter.length() > 0)
- {
- _referenceFactory.setDefaultRouter(Ice.RouterPrxHelper.uncheckedCast(
- _proxyFactory.stringToProxy(_defaultsAndOverrides.defaultRouter)));
- }
-
- if(_defaultsAndOverrides.defaultLocator.length() > 0)
- {
- _referenceFactory.setDefaultLocator(Ice.LocatorPrxHelper.uncheckedCast(
- _proxyFactory.stringToProxy(_defaultsAndOverrides.defaultLocator)));
- }
+ //
+ // Get default router and locator proxies.
+ //
+ if(_defaultsAndOverrides.defaultRouter.length() > 0)
+ {
+ _referenceFactory.setDefaultRouter(Ice.RouterPrxHelper.uncheckedCast(
+ _proxyFactory.stringToProxy(_defaultsAndOverrides.defaultRouter)));
+ }
+
+ if(_defaultsAndOverrides.defaultLocator.length() > 0)
+ {
+ _referenceFactory.setDefaultLocator(Ice.LocatorPrxHelper.uncheckedCast(
+ _proxyFactory.stringToProxy(_defaultsAndOverrides.defaultLocator)));
+ }
}
//
@@ -345,25 +345,25 @@ public class Instance
public void
destroy()
{
- synchronized(this)
- {
- //
- // If the _state is not StateActive then the instance is
- // either being destroyed, or has already been destroyed.
- //
- if(_state != StateActive)
- {
- return;
- }
-
- //
- // We cannot set state to StateDestroyed otherwise instance
- // methods called during the destroy process (such as
- // outgoingConnectionFactory() from
- // ObjectAdapterI::deactivate() will cause an exception.
- //
- _state = StateDestroyInProgress;
- }
+ synchronized(this)
+ {
+ //
+ // If the _state is not StateActive then the instance is
+ // either being destroyed, or has already been destroyed.
+ //
+ if(_state != StateActive)
+ {
+ return;
+ }
+
+ //
+ // We cannot set state to StateDestroyed otherwise instance
+ // methods called during the destroy process (such as
+ // outgoingConnectionFactory() from
+ // ObjectAdapterI::deactivate() will cause an exception.
+ //
+ _state = StateDestroyInProgress;
+ }
if(_objectAdapterFactory != null)
{
@@ -379,27 +379,27 @@ public class Instance
{
_objectAdapterFactory.destroy();
}
-
+
if(_outgoingConnectionFactory != null)
{
_outgoingConnectionFactory.waitUntilFinished();
}
-
- synchronized(this)
- {
- _objectAdapterFactory = null;
+
+ synchronized(this)
+ {
+ _objectAdapterFactory = null;
- _outgoingConnectionFactory = null;
+ _outgoingConnectionFactory = null;
if(_referenceFactory != null)
{
_referenceFactory.destroy();
_referenceFactory = null;
}
-
- // No destroy function defined.
- // _proxyFactory.destroy();
- _proxyFactory = null;
+
+ // No destroy function defined.
+ // _proxyFactory.destroy();
+ _proxyFactory = null;
if(_routerManager != null)
{
@@ -418,9 +418,9 @@ public class Instance
_endpointFactory.destroy();
_endpointFactory = null;
}
-
- _state = StateDestroyed;
- }
+
+ _state = StateDestroyed;
+ }
}
private void
diff --git a/javae/src/IceInternal/IntMap.java b/javae/src/IceInternal/IntMap.java
index a32ecba7410..f445154f519 100644
--- a/javae/src/IceInternal/IntMap.java
+++ b/javae/src/IceInternal/IntMap.java
@@ -142,11 +142,11 @@ public class IntMap
e = next;
}
- if(e != null)
- {
- return e.value;
- }
- return e;
+ if(e != null)
+ {
+ return e.value;
+ }
+ return e;
}
public void
@@ -299,10 +299,10 @@ public class IntMap
public Object
nextElement()
{
- if(IceUtil.Debug.ASSERT)
- {
- IceUtil.Debug.Assert(_modCount == _expectedModCount);
- }
+ if(IceUtil.Debug.ASSERT)
+ {
+ IceUtil.Debug.Assert(_modCount == _expectedModCount);
+ }
Entry e = _next;
if(e == null)
{
@@ -328,10 +328,10 @@ public class IntMap
{
throw new IllegalStateException();
}
- if(IceUtil.Debug.ASSERT)
- {
- IceUtil.Debug.Assert(_modCount == _expectedModCount);
- }
+ if(IceUtil.Debug.ASSERT)
+ {
+ IceUtil.Debug.Assert(_modCount == _expectedModCount);
+ }
int k = _current.key;
_current = null;
IntMap.this.remove(k);
diff --git a/javae/src/IceInternal/LocalExceptionWrapper.java b/javae/src/IceInternal/LocalExceptionWrapper.java
index 5905d220668..4bed7ce69e3 100644
--- a/javae/src/IceInternal/LocalExceptionWrapper.java
+++ b/javae/src/IceInternal/LocalExceptionWrapper.java
@@ -15,14 +15,14 @@ public class LocalExceptionWrapper extends Exception
LocalExceptionWrapper(Ice.LocalException ex, boolean retry)
{
_ex = ex;
- _retry = retry;
+ _retry = retry;
}
public
LocalExceptionWrapper(IceInternal.LocalExceptionWrapper ex)
{
_ex = ex.get();
- _retry = ex._retry;
+ _retry = ex._retry;
}
public Ice.LocalException
diff --git a/javae/src/IceInternal/LocatorInfo.java b/javae/src/IceInternal/LocatorInfo.java
index d1004e7a3c9..1f695b5809e 100644
--- a/javae/src/IceInternal/LocatorInfo.java
+++ b/javae/src/IceInternal/LocatorInfo.java
@@ -13,76 +13,76 @@ public final class LocatorInfo
{
LocatorInfo(Ice.LocatorPrx locator, LocatorTable table)
{
- _locator = locator;
- _table = table;
+ _locator = locator;
+ _table = table;
}
synchronized public void
destroy()
{
- _locatorRegistry = null;
- _table.clear();
+ _locatorRegistry = null;
+ _table.clear();
}
public boolean
equals(java.lang.Object obj)
{
- if(this == obj)
- {
- return true;
- }
+ if(this == obj)
+ {
+ return true;
+ }
- if(obj instanceof LocatorInfo)
- {
- return _locator.equals(((LocatorInfo)obj)._locator);
- }
+ if(obj instanceof LocatorInfo)
+ {
+ return _locator.equals(((LocatorInfo)obj)._locator);
+ }
- return false;
+ return false;
}
public Ice.LocatorPrx
getLocator()
{
- //
- // No synchronization necessary, _locator is immutable.
- //
- return _locator;
+ //
+ // No synchronization necessary, _locator is immutable.
+ //
+ return _locator;
}
public synchronized Ice.LocatorRegistryPrx
getLocatorRegistry()
{
- if(_locatorRegistry == null) // Lazy initialization
- {
- _locatorRegistry = _locator.getRegistry();
+ if(_locatorRegistry == null) // Lazy initialization
+ {
+ _locatorRegistry = _locator.getRegistry();
- //
- // The locator registry can't be located.
- //
- _locatorRegistry = Ice.LocatorRegistryPrxHelper.uncheckedCast(_locatorRegistry.ice_locator(null));
- }
-
- return _locatorRegistry;
+ //
+ // The locator registry can't be located.
+ //
+ _locatorRegistry = Ice.LocatorRegistryPrxHelper.uncheckedCast(_locatorRegistry.ice_locator(null));
+ }
+
+ return _locatorRegistry;
}
public Endpoint[]
getEndpoints(IndirectReference ref, Ice.BooleanHolder cached)
{
- Endpoint[] endpoints = null;
- Ice.ObjectPrx object = null;
- cached.value = true;
- String adapterId = ref.getAdapterId();
- Ice.Identity identity = ref.getIdentity();
-
- try
- {
- if(adapterId.length() > 0)
- {
- endpoints = _table.getAdapterEndpoints(adapterId);
- if(endpoints == null)
- {
- cached.value = false;
-
+ Endpoint[] endpoints = null;
+ Ice.ObjectPrx object = null;
+ cached.value = true;
+ String adapterId = ref.getAdapterId();
+ Ice.Identity identity = ref.getIdentity();
+
+ try
+ {
+ if(adapterId.length() > 0)
+ {
+ endpoints = _table.getAdapterEndpoints(adapterId);
+ if(endpoints == null)
+ {
+ cached.value = false;
+
if(ref.getInstance().traceLevels().location >= 1)
{
StringBuffer s = new StringBuffer();
@@ -92,28 +92,28 @@ public final class LocatorInfo
ref.getInstance().traceLevels().locationCat, s.toString());
}
- //
- // Search the adapter in the location service if we didn't
- // find it in the cache.
- //
- object = _locator.findAdapterById(adapterId);
- if(object != null)
- {
- endpoints = ((Ice.ObjectPrxHelperBase)object).__reference().getEndpoints();
-
- if(endpoints.length > 0)
- {
- _table.addAdapterEndpoints(adapterId, endpoints);
- }
- }
- }
- }
- else
- {
- boolean objectCached = true;
- object = _table.getProxy(identity);
- if(object == null)
- {
+ //
+ // Search the adapter in the location service if we didn't
+ // find it in the cache.
+ //
+ object = _locator.findAdapterById(adapterId);
+ if(object != null)
+ {
+ endpoints = ((Ice.ObjectPrxHelperBase)object).__reference().getEndpoints();
+
+ if(endpoints.length > 0)
+ {
+ _table.addAdapterEndpoints(adapterId, endpoints);
+ }
+ }
+ }
+ }
+ else
+ {
+ boolean objectCached = true;
+ object = _table.getProxy(identity);
+ if(object == null)
+ {
if(ref.getInstance().traceLevels().location >= 1)
{
StringBuffer s = new StringBuffer();
@@ -123,42 +123,42 @@ public final class LocatorInfo
ref.getInstance().traceLevels().locationCat, s.toString());
}
- objectCached = false;
- object = _locator.findObjectById(identity);
- }
-
- boolean endpointsCached = true;
- if(object != null)
- {
- Reference r = ((Ice.ObjectPrxHelperBase)object).__reference();
- if(r instanceof DirectReference)
- {
- endpointsCached = false;
- DirectReference odr = (DirectReference)r;
- endpoints = odr.getEndpoints();
- }
- else
- {
- IndirectReference oir = (IndirectReference)r;
- if(oir.getAdapterId().length() > 0)
- {
- Ice.BooleanHolder c = new Ice.BooleanHolder();
- endpoints = getEndpoints(oir, c);
- endpointsCached = c.value;
- }
- }
- }
-
- if(!objectCached && endpoints != null && endpoints.length > 0)
- {
- _table.addProxy(identity, object);
- }
+ objectCached = false;
+ object = _locator.findObjectById(identity);
+ }
+
+ boolean endpointsCached = true;
+ if(object != null)
+ {
+ Reference r = ((Ice.ObjectPrxHelperBase)object).__reference();
+ if(r instanceof DirectReference)
+ {
+ endpointsCached = false;
+ DirectReference odr = (DirectReference)r;
+ endpoints = odr.getEndpoints();
+ }
+ else
+ {
+ IndirectReference oir = (IndirectReference)r;
+ if(oir.getAdapterId().length() > 0)
+ {
+ Ice.BooleanHolder c = new Ice.BooleanHolder();
+ endpoints = getEndpoints(oir, c);
+ endpointsCached = c.value;
+ }
+ }
+ }
+
+ if(!objectCached && endpoints != null && endpoints.length > 0)
+ {
+ _table.addProxy(identity, object);
+ }
- cached.value = objectCached || endpointsCached;
- }
- }
- catch(Ice.AdapterNotFoundException ex)
- {
+ cached.value = objectCached || endpointsCached;
+ }
+ }
+ catch(Ice.AdapterNotFoundException ex)
+ {
if(ref.getInstance().traceLevels().location >= 1)
{
StringBuffer s = new StringBuffer();
@@ -168,13 +168,13 @@ public final class LocatorInfo
ref.getInstance().traceLevels().locationCat, s.toString());
}
- Ice.NotRegisteredException e = new Ice.NotRegisteredException();
- e.kindOfObject = "object adapter";
- e.id = adapterId;
- throw e;
- }
- catch(Ice.ObjectNotFoundException ex)
- {
+ Ice.NotRegisteredException e = new Ice.NotRegisteredException();
+ e.kindOfObject = "object adapter";
+ e.id = adapterId;
+ throw e;
+ }
+ catch(Ice.ObjectNotFoundException ex)
+ {
if(ref.getInstance().traceLevels().location >= 1)
{
StringBuffer s = new StringBuffer();
@@ -184,35 +184,35 @@ public final class LocatorInfo
ref.getInstance().traceLevels().locationCat, s.toString());
}
- Ice.NotRegisteredException e = new Ice.NotRegisteredException();
- e.kindOfObject = "object";
- e.id = ref.getInstance().identityToString(identity);
- throw e;
- }
- catch(Ice.NotRegisteredException ex)
- {
- throw ex;
- }
- catch(Ice.LocalException ex)
- {
- if(ref.getInstance().traceLevels().location >= 1)
- {
- StringBuffer s = new StringBuffer();
- s.append("couldn't contact the locator to retrieve adapter endpoints\n");
- if(adapterId.length() > 0)
- {
- s.append("adapter = " + adapterId + "\n");
- }
- else
- {
- s.append("object = " + ref.getInstance().identityToString(identity) + "\n");
- }
- s.append("reason = " + ex);
- ref.getInstance().initializationData().logger.trace(
- ref.getInstance().traceLevels().locationCat, s.toString());
- }
- throw ex;
- }
+ Ice.NotRegisteredException e = new Ice.NotRegisteredException();
+ e.kindOfObject = "object";
+ e.id = ref.getInstance().identityToString(identity);
+ throw e;
+ }
+ catch(Ice.NotRegisteredException ex)
+ {
+ throw ex;
+ }
+ catch(Ice.LocalException ex)
+ {
+ if(ref.getInstance().traceLevels().location >= 1)
+ {
+ StringBuffer s = new StringBuffer();
+ s.append("couldn't contact the locator to retrieve adapter endpoints\n");
+ if(adapterId.length() > 0)
+ {
+ s.append("adapter = " + adapterId + "\n");
+ }
+ else
+ {
+ s.append("object = " + ref.getInstance().identityToString(identity) + "\n");
+ }
+ s.append("reason = " + ex);
+ ref.getInstance().initializationData().logger.trace(
+ ref.getInstance().traceLevels().locationCat, s.toString());
+ }
+ throw ex;
+ }
if(ref.getInstance().traceLevels().location >= 1)
{
@@ -244,98 +244,98 @@ public final class LocatorInfo
}
}
- return endpoints == null ? new Endpoint[0] : endpoints;
+ return endpoints == null ? new Endpoint[0] : endpoints;
}
public void
clearObjectCache(IndirectReference ref)
{
- if(ref.getAdapterId().length() == 0)
- {
- Ice.ObjectPrx object = _table.removeProxy(ref.getIdentity());
- if(object != null)
- {
- if(((Ice.ObjectPrxHelperBase)object).__reference() instanceof IndirectReference)
- {
- IndirectReference oir = (IndirectReference)((Ice.ObjectPrxHelperBase)object).__reference();
- if(oir.getAdapterId().length() > 0)
- {
- clearCache(oir);
- }
- }
- else
- {
- if(ref.getInstance().traceLevels().location >= 2)
- {
- trace("removed endpoints from locator table",
- ref, ((Ice.ObjectPrxHelperBase)object).__reference().getEndpoints());
- }
- }
- }
- }
+ if(ref.getAdapterId().length() == 0)
+ {
+ Ice.ObjectPrx object = _table.removeProxy(ref.getIdentity());
+ if(object != null)
+ {
+ if(((Ice.ObjectPrxHelperBase)object).__reference() instanceof IndirectReference)
+ {
+ IndirectReference oir = (IndirectReference)((Ice.ObjectPrxHelperBase)object).__reference();
+ if(oir.getAdapterId().length() > 0)
+ {
+ clearCache(oir);
+ }
+ }
+ else
+ {
+ if(ref.getInstance().traceLevels().location >= 2)
+ {
+ trace("removed endpoints from locator table",
+ ref, ((Ice.ObjectPrxHelperBase)object).__reference().getEndpoints());
+ }
+ }
+ }
+ }
}
public void
clearCache(IndirectReference ref)
{
- if(ref.getAdapterId().length() > 0)
- {
- Endpoint[] endpoints = _table.removeAdapterEndpoints(ref.getAdapterId());
+ if(ref.getAdapterId().length() > 0)
+ {
+ Endpoint[] endpoints = _table.removeAdapterEndpoints(ref.getAdapterId());
- if(endpoints != null && ref.getInstance().traceLevels().location >= 2)
- {
- trace("removed endpoints from locator table\n", ref, endpoints);
- }
- }
- else
- {
- Ice.ObjectPrx object = _table.removeProxy(ref.getIdentity());
- if(object != null)
- {
- if(((Ice.ObjectPrxHelperBase)object).__reference() instanceof IndirectReference)
- {
- IndirectReference oir = (IndirectReference)((Ice.ObjectPrxHelperBase)object).__reference();
- if(oir.getAdapterId().length() > 0)
- {
- clearCache(oir);
- }
- }
- else
- {
- if(ref.getInstance().traceLevels().location >= 2)
- {
- trace("removed endpoints from locator table",
- ref, ((Ice.ObjectPrxHelperBase)object).__reference().getEndpoints());
- }
- }
- }
- }
+ if(endpoints != null && ref.getInstance().traceLevels().location >= 2)
+ {
+ trace("removed endpoints from locator table\n", ref, endpoints);
+ }
+ }
+ else
+ {
+ Ice.ObjectPrx object = _table.removeProxy(ref.getIdentity());
+ if(object != null)
+ {
+ if(((Ice.ObjectPrxHelperBase)object).__reference() instanceof IndirectReference)
+ {
+ IndirectReference oir = (IndirectReference)((Ice.ObjectPrxHelperBase)object).__reference();
+ if(oir.getAdapterId().length() > 0)
+ {
+ clearCache(oir);
+ }
+ }
+ else
+ {
+ if(ref.getInstance().traceLevels().location >= 2)
+ {
+ trace("removed endpoints from locator table",
+ ref, ((Ice.ObjectPrxHelperBase)object).__reference().getEndpoints());
+ }
+ }
+ }
+ }
}
private void
trace(String msg, IndirectReference ref, Endpoint[] endpoints)
{
- StringBuffer s = new StringBuffer();
- s.append(msg + "\n");
- if(ref.getAdapterId().length() > 0)
- {
- s.append("adapter = " + ref.getAdapterId() + "\n");
- }
- else
- {
- s.append("object = " + ref.getInstance().identityToString(ref.getIdentity()) + "\n");
- }
+ StringBuffer s = new StringBuffer();
+ s.append(msg + "\n");
+ if(ref.getAdapterId().length() > 0)
+ {
+ s.append("adapter = " + ref.getAdapterId() + "\n");
+ }
+ else
+ {
+ s.append("object = " + ref.getInstance().identityToString(ref.getIdentity()) + "\n");
+ }
- s.append("endpoints = ");
- final int sz = endpoints.length;
- for(int i = 0; i < sz; i++)
- {
- s.append(endpoints[i].toString());
- if(i + 1 < sz)
- s.append(":");
- }
+ s.append("endpoints = ");
+ final int sz = endpoints.length;
+ for(int i = 0; i < sz; i++)
+ {
+ s.append(endpoints[i].toString());
+ if(i + 1 < sz)
+ s.append(":");
+ }
- ref.getInstance().initializationData().logger.trace(ref.getInstance().traceLevels().locationCat, s.toString());
+ ref.getInstance().initializationData().logger.trace(ref.getInstance().traceLevels().locationCat, s.toString());
}
private /*final*/ Ice.LocatorPrx _locator;
diff --git a/javae/src/IceInternal/LocatorManager.java b/javae/src/IceInternal/LocatorManager.java
index 0c938e98179..6aeb582982d 100644
--- a/javae/src/IceInternal/LocatorManager.java
+++ b/javae/src/IceInternal/LocatorManager.java
@@ -18,14 +18,14 @@ public final class LocatorManager
synchronized void
destroy()
{
- java.util.Enumeration e = _table.elements();
+ java.util.Enumeration e = _table.elements();
while(e.hasMoreElements())
{
LocatorInfo info = (LocatorInfo)e.nextElement();
info.destroy();
}
_table.clear();
- _locatorTables.clear();
+ _locatorTables.clear();
}
//
@@ -40,31 +40,31 @@ public final class LocatorManager
return null;
}
- //
- // The locator can't be located.
- //
- Ice.LocatorPrx locator = Ice.LocatorPrxHelper.uncheckedCast(loc.ice_locator(null));
+ //
+ // The locator can't be located.
+ //
+ Ice.LocatorPrx locator = Ice.LocatorPrxHelper.uncheckedCast(loc.ice_locator(null));
- //
- // TODO: reap unused locator info objects?
- //
+ //
+ // TODO: reap unused locator info objects?
+ //
synchronized(this)
{
LocatorInfo info = (LocatorInfo)_table.get(locator);
if(info == null)
{
- //
- // Rely on locator identity for the adapter table. We want to
- // have only one table per locator (not one per locator
- // proxy).
- //
- LocatorTable table = (LocatorTable)_locatorTables.get(locator.ice_getIdentity());
- if(table == null)
- {
- table = new LocatorTable();
- _locatorTables.put(locator.ice_getIdentity(), table);
- }
+ //
+ // Rely on locator identity for the adapter table. We want to
+ // have only one table per locator (not one per locator
+ // proxy).
+ //
+ LocatorTable table = (LocatorTable)_locatorTables.get(locator.ice_getIdentity());
+ if(table == null)
+ {
+ table = new LocatorTable();
+ _locatorTables.put(locator.ice_getIdentity(), table);
+ }
info = new LocatorInfo(locator, table);
_table.put(locator, info);
diff --git a/javae/src/IceInternal/LocatorTable.java b/javae/src/IceInternal/LocatorTable.java
index 23e0dedaba9..6de45a282f1 100644
--- a/javae/src/IceInternal/LocatorTable.java
+++ b/javae/src/IceInternal/LocatorTable.java
@@ -18,44 +18,44 @@ final class LocatorTable
synchronized void
clear()
{
- _adapterEndpointsTable.clear();
- _objectTable.clear();
+ _adapterEndpointsTable.clear();
+ _objectTable.clear();
}
synchronized IceInternal.Endpoint[]
getAdapterEndpoints(String adapter)
{
- return (IceInternal.Endpoint[])_adapterEndpointsTable.get(adapter);
+ return (IceInternal.Endpoint[])_adapterEndpointsTable.get(adapter);
}
synchronized void
addAdapterEndpoints(String adapter, IceInternal.Endpoint[] endpoints)
{
- _adapterEndpointsTable.put(adapter, endpoints);
+ _adapterEndpointsTable.put(adapter, endpoints);
}
synchronized IceInternal.Endpoint[]
removeAdapterEndpoints(String adapter)
{
- return (IceInternal.Endpoint[])_adapterEndpointsTable.remove(adapter);
+ return (IceInternal.Endpoint[])_adapterEndpointsTable.remove(adapter);
}
synchronized Ice.ObjectPrx
getProxy(Ice.Identity id)
{
- return (Ice.ObjectPrx)_objectTable.get(id);
+ return (Ice.ObjectPrx)_objectTable.get(id);
}
synchronized void
addProxy(Ice.Identity id, Ice.ObjectPrx proxy)
{
- _objectTable.put(id, proxy);
+ _objectTable.put(id, proxy);
}
synchronized Ice.ObjectPrx
removeProxy(Ice.Identity id)
{
- return (Ice.ObjectPrx)_objectTable.remove(id);
+ return (Ice.ObjectPrx)_objectTable.remove(id);
}
private java.util.Hashtable _adapterEndpointsTable = new java.util.Hashtable();
diff --git a/javae/src/IceInternal/ObjectAdapterFactory.java b/javae/src/IceInternal/ObjectAdapterFactory.java
index 728a7acbf4d..67f96aeefde 100644
--- a/javae/src/IceInternal/ObjectAdapterFactory.java
+++ b/javae/src/IceInternal/ObjectAdapterFactory.java
@@ -17,97 +17,97 @@ public final class ObjectAdapterFactory
Ice.ObjectAdapter[] adapters = null;
synchronized(this)
- {
- //
- // Ignore shutdown requests if the object adapter factory has
- // already been shut down.
- //
- if(_instance == null)
- {
- return;
- }
-
- adapters = new Ice.ObjectAdapter[_adapters.size()];
- int i = 0;
- java.util.Enumeration e = _adapters.elements();
- while(e.hasMoreElements())
- {
- adapters[i++] = (Ice.ObjectAdapter)e.nextElement();
- }
-
- _instance = null;
- _communicator = null;
-
- notifyAll();
- }
-
- //
- // Deactivate outside the thread synchronization, to avoid
- // deadlocks.
- //
- for(int i = 0; i < adapters.length; ++i)
- {
- adapters[i].deactivate();
- }
+ {
+ //
+ // Ignore shutdown requests if the object adapter factory has
+ // already been shut down.
+ //
+ if(_instance == null)
+ {
+ return;
+ }
+
+ adapters = new Ice.ObjectAdapter[_adapters.size()];
+ int i = 0;
+ java.util.Enumeration e = _adapters.elements();
+ while(e.hasMoreElements())
+ {
+ adapters[i++] = (Ice.ObjectAdapter)e.nextElement();
+ }
+
+ _instance = null;
+ _communicator = null;
+
+ notifyAll();
+ }
+
+ //
+ // Deactivate outside the thread synchronization, to avoid
+ // deadlocks.
+ //
+ for(int i = 0; i < adapters.length; ++i)
+ {
+ adapters[i].deactivate();
+ }
}
public void
waitForShutdown()
{
- synchronized(this)
- {
- //
- // First we wait for the shutdown of the factory itself.
- //
- while(_instance != null)
- {
- try
- {
- wait();
- }
- catch(InterruptedException ex)
- {
- }
- }
-
- //
- // If some other thread is currently shutting down, we wait
- // until this thread is finished.
- //
- while(_waitForShutdown)
- {
- try
- {
- wait();
- }
- catch(InterruptedException ex)
- {
- }
- }
- _waitForShutdown = true;
- }
-
- //
- // Now we wait for deactivation of each object adapter.
- //
- if(_adapters != null)
- {
- java.util.Enumeration i = _adapters.elements();
- while(i.hasMoreElements())
- {
- Ice.ObjectAdapter adapter = (Ice.ObjectAdapter)i.nextElement();
- adapter.waitForDeactivate();
- }
- }
-
- synchronized(this)
- {
- //
- // Signal that waiting is complete.
- //
- _waitForShutdown = false;
- notifyAll();
- }
+ synchronized(this)
+ {
+ //
+ // First we wait for the shutdown of the factory itself.
+ //
+ while(_instance != null)
+ {
+ try
+ {
+ wait();
+ }
+ catch(InterruptedException ex)
+ {
+ }
+ }
+
+ //
+ // If some other thread is currently shutting down, we wait
+ // until this thread is finished.
+ //
+ while(_waitForShutdown)
+ {
+ try
+ {
+ wait();
+ }
+ catch(InterruptedException ex)
+ {
+ }
+ }
+ _waitForShutdown = true;
+ }
+
+ //
+ // Now we wait for deactivation of each object adapter.
+ //
+ if(_adapters != null)
+ {
+ java.util.Enumeration i = _adapters.elements();
+ while(i.hasMoreElements())
+ {
+ Ice.ObjectAdapter adapter = (Ice.ObjectAdapter)i.nextElement();
+ adapter.waitForDeactivate();
+ }
+ }
+
+ synchronized(this)
+ {
+ //
+ // Signal that waiting is complete.
+ //
+ _waitForShutdown = false;
+ notifyAll();
+ }
}
public synchronized boolean
@@ -156,15 +156,15 @@ public final class ObjectAdapterFactory
public synchronized Ice.ObjectAdapter
createObjectAdapter(String name, String endpoints, Ice.RouterPrx router)
{
- if(_instance == null)
- {
- throw new Ice.ObjectAdapterDeactivatedException();
- }
+ if(_instance == null)
+ {
+ throw new Ice.ObjectAdapterDeactivatedException();
+ }
Ice.ObjectAdapter adapter = (Ice.ObjectAdapter)_adapters.get(name);
if(adapter != null)
{
- throw new Ice.AlreadyRegisteredException("object adapter", name);
+ throw new Ice.AlreadyRegisteredException("object adapter", name);
}
adapter = new Ice.ObjectAdapter(_instance, _communicator, this, name, endpoints, router);
@@ -176,30 +176,30 @@ public final class ObjectAdapterFactory
removeObjectAdapter(String name)
{
if(_waitForShutdown || _adapters == null)
- {
- return;
- }
+ {
+ return;
+ }
- _adapters.remove(name);
+ _adapters.remove(name);
}
public void
flushBatchRequests()
{
- java.util.Vector a = new java.util.Vector();
+ java.util.Vector a = new java.util.Vector();
synchronized(this)
- {
- java.util.Enumeration i = _adapters.elements();
- while(i.hasMoreElements())
- {
- a.addElement(i.nextElement());
- }
- }
- java.util.Enumeration p = a.elements();
- while(p.hasMoreElements())
- {
- ((Ice.ObjectAdapter)p.nextElement()).flushBatchRequests();
- }
+ {
+ java.util.Enumeration i = _adapters.elements();
+ while(i.hasMoreElements())
+ {
+ a.addElement(i.nextElement());
+ }
+ }
+ java.util.Enumeration p = a.elements();
+ while(p.hasMoreElements())
+ {
+ ((Ice.ObjectAdapter)p.nextElement()).flushBatchRequests();
+ }
}
//
@@ -208,18 +208,18 @@ public final class ObjectAdapterFactory
ObjectAdapterFactory(Instance instance, Ice.Communicator communicator)
{
_instance = instance;
- _communicator = communicator;
- _waitForShutdown = false;
+ _communicator = communicator;
+ _waitForShutdown = false;
}
protected synchronized void
finalize()
throws Throwable
{
- IceUtil.Debug.FinalizerAssert(_instance == null);
- IceUtil.Debug.FinalizerAssert(_communicator == null);
- IceUtil.Debug.FinalizerAssert(_adapters == null);
- IceUtil.Debug.FinalizerAssert(!_waitForShutdown);
+ IceUtil.Debug.FinalizerAssert(_instance == null);
+ IceUtil.Debug.FinalizerAssert(_communicator == null);
+ IceUtil.Debug.FinalizerAssert(_adapters == null);
+ IceUtil.Debug.FinalizerAssert(!_waitForShutdown);
// Cannot call finalize on superclass. java.lang.Object.finalize() not available in CLDC.
}
diff --git a/javae/src/IceInternal/Outgoing.java b/javae/src/IceInternal/Outgoing.java
index a7ba0f70d9a..84e6608db76 100644
--- a/javae/src/IceInternal/Outgoing.java
+++ b/javae/src/IceInternal/Outgoing.java
@@ -13,7 +13,7 @@ public final class Outgoing
{
public
Outgoing(Ice.Connection connection, Reference ref, String operation, Ice.OperationMode mode,
- java.util.Hashtable context)
+ java.util.Hashtable context)
{
_connection = connection;
_reference = ref;
@@ -29,14 +29,14 @@ public final class Outgoing
public void
reset(Reference ref, String operation, Ice.OperationMode mode, java.util.Hashtable context)
{
- _reference = ref;
+ _reference = ref;
_state = StateUnsent;
_exception = null;
- if(IceUtil.Debug.ASSERT)
- {
- IceUtil.Debug.Assert(_stream != null);
- }
+ if(IceUtil.Debug.ASSERT)
+ {
+ IceUtil.Debug.Assert(_stream != null);
+ }
_stream.reset();
writeHeader(operation, mode, context);
@@ -47,37 +47,37 @@ public final class Outgoing
invoke()
throws LocalExceptionWrapper
{
- if(IceUtil.Debug.ASSERT)
- {
- IceUtil.Debug.Assert(_state == StateUnsent);
- }
+ if(IceUtil.Debug.ASSERT)
+ {
+ IceUtil.Debug.Assert(_state == StateUnsent);
+ }
_stream.endWriteEncaps();
- _state = StateInProgress;
+ _state = StateInProgress;
switch(_reference.getMode())
{
case Reference.ModeTwoway:
{
- //
- // We let all exceptions raised by sending directly
- // propagate to the caller, because they can be
- // retried without violating "at-most-once". In case
- // of such exceptions, the connection object does not
- // call back on this object, so we don't need to lock
- // the mutex, keep track of state, or save exceptions.
- //
- _connection.sendRequest(_stream, this);
+ //
+ // We let all exceptions raised by sending directly
+ // propagate to the caller, because they can be
+ // retried without violating "at-most-once". In case
+ // of such exceptions, the connection object does not
+ // call back on this object, so we don't need to lock
+ // the mutex, keep track of state, or save exceptions.
+ //
+ _connection.sendRequest(_stream, this);
if(_exception != null)
{
- //
- // TODO- what we want to do is fill in the
- // exception's stack trace, but there doesn't seem
- // to be a way to do this yet in CLDC.
- //
- //_exception.fillInStackTrace();
-
+ //
+ // TODO- what we want to do is fill in the
+ // exception's stack trace, but there doesn't seem
+ // to be a way to do this yet in CLDC.
+ //
+ //_exception.fillInStackTrace();
+
//
// A CloseConnectionException indicates graceful
// server shutdown, and is therefore always repeatable
@@ -86,11 +86,11 @@ public final class Outgoing
// guarantees that all outstanding requests can safely
// be repeated.
//
- // An ObjectNotExistException can always be retried as
- // well without violating "at-most-once".
- //
+ // An ObjectNotExistException can always be retried as
+ // well without violating "at-most-once".
+ //
if(_exception instanceof Ice.CloseConnectionException ||
- _exception instanceof Ice.ObjectNotExistException)
+ _exception instanceof Ice.ObjectNotExistException)
{
throw _exception;
}
@@ -107,48 +107,48 @@ public final class Outgoing
{
return false;
}
-
- if(IceUtil.Debug.ASSERT)
- {
- IceUtil.Debug.Assert(_state == StateOK);
- }
+
+ if(IceUtil.Debug.ASSERT)
+ {
+ IceUtil.Debug.Assert(_state == StateOK);
+ }
break;
}
case Reference.ModeOneway:
{
- //
- // For oneway requests, the connection object
+ //
+ // For oneway requests, the connection object
// never calls back on this object. Therefore we don't
// need to lock the mutex or save exceptions. We simply
// let all exceptions from sending propagate to the
// caller, because such exceptions can be retried without
// violating "at-most-once".
- //
- _connection.sendRequest(_stream, null);
+ //
+ _connection.sendRequest(_stream, null);
break;
}
case Reference.ModeBatchOneway:
{
- //
- // For batch oneways the same rules as for
- // regular oneways (see comment above)
- // apply.
- //
+ //
+ // For batch oneways the same rules as for
+ // regular oneways (see comment above)
+ // apply.
+ //
_connection.finishBatchRequest(_stream);
break;
}
- case Reference.ModeDatagram:
- case Reference.ModeBatchDatagram:
- {
- if(IceUtil.Debug.ASSERT)
- {
- IceUtil.Debug.Assert(false);
- }
- return false;
- }
+ case Reference.ModeDatagram:
+ case Reference.ModeBatchDatagram:
+ {
+ if(IceUtil.Debug.ASSERT)
+ {
+ IceUtil.Debug.Assert(false);
+ }
+ return false;
+ }
}
return true;
@@ -158,116 +158,116 @@ public final class Outgoing
abort(Ice.LocalException ex)
throws LocalExceptionWrapper
{
- if(IceUtil.Debug.ASSERT)
- {
- IceUtil.Debug.Assert(_state == StateUnsent);
- }
-
- //
- // If we didn't finish a batch oneway request, we
- // must notify the connection about that we give up ownership
- // of the batch stream.
- //
- int mode = _reference.getMode();
- if(mode == Reference.ModeBatchOneway)
- {
- _connection.abortBatchRequest();
-
- //
- // If we abort a batch requests, we cannot retry, because
- // not only the batch request that caused the problem will
- // be aborted, but all other requests in the batch as
- // well.
- //
+ if(IceUtil.Debug.ASSERT)
+ {
+ IceUtil.Debug.Assert(_state == StateUnsent);
+ }
+
+ //
+ // If we didn't finish a batch oneway request, we
+ // must notify the connection about that we give up ownership
+ // of the batch stream.
+ //
+ int mode = _reference.getMode();
+ if(mode == Reference.ModeBatchOneway)
+ {
+ _connection.abortBatchRequest();
+
+ //
+ // If we abort a batch requests, we cannot retry, because
+ // not only the batch request that caused the problem will
+ // be aborted, but all other requests in the batch as
+ // well.
+ //
throw new LocalExceptionWrapper(ex, false);
- }
+ }
- throw ex;
+ throw ex;
}
public void
finished(BasicStream is)
{
- if(IceUtil.Debug.ASSERT)
- {
- IceUtil.Debug.Assert(_reference.getMode() == Reference.ModeTwoway); // Can only be called for twoways.
-
- IceUtil.Debug.Assert(_state <= StateInProgress);
- }
-
- //
- // Only swap the stream if the given stream is not this Outgoing object stream!
- //
- if(is != _stream)
- {
- _stream.swap(is);
- }
-
- byte replyStatus = _stream.readByte();
-
- switch(replyStatus)
- {
- case ReplyStatus.replyOK:
- {
- //
- // Input and output parameters are always sent in an
- // encapsulation, which makes it possible to forward
- // oneway requests as blobs.
- //
- _stream.startReadEncaps();
- _state = StateOK; // The state must be set last, in case there is an exception.
- break;
- }
-
- case ReplyStatus.replyUserException:
- {
- //
- // Input and output parameters are always sent in an
- // encapsulation, which makes it possible to forward
- // oneway requests as blobs.
- //
- _stream.startReadEncaps();
- _state = StateUserException; // The state must be set last, in case there is an exception.
- break;
- }
-
- case ReplyStatus.replyObjectNotExist:
- case ReplyStatus.replyFacetNotExist:
- case ReplyStatus.replyOperationNotExist:
- {
- Ice.RequestFailedException ex = null;
- switch(replyStatus)
- {
- case ReplyStatus.replyObjectNotExist:
- {
- ex = new Ice.ObjectNotExistException();
- break;
- }
-
- case ReplyStatus.replyFacetNotExist:
- {
- ex = new Ice.FacetNotExistException();
- break;
- }
-
- case ReplyStatus.replyOperationNotExist:
- {
- ex = new Ice.OperationNotExistException();
- break;
- }
-
- default:
- {
- if(IceUtil.Debug.ASSERT)
- {
- IceUtil.Debug.Assert(false);
- }
- break;
- }
- }
-
- ex.id = new Ice.Identity();
- ex.id.__read(_stream);
+ if(IceUtil.Debug.ASSERT)
+ {
+ IceUtil.Debug.Assert(_reference.getMode() == Reference.ModeTwoway); // Can only be called for twoways.
+
+ IceUtil.Debug.Assert(_state <= StateInProgress);
+ }
+
+ //
+ // Only swap the stream if the given stream is not this Outgoing object stream!
+ //
+ if(is != _stream)
+ {
+ _stream.swap(is);
+ }
+
+ byte replyStatus = _stream.readByte();
+
+ switch(replyStatus)
+ {
+ case ReplyStatus.replyOK:
+ {
+ //
+ // Input and output parameters are always sent in an
+ // encapsulation, which makes it possible to forward
+ // oneway requests as blobs.
+ //
+ _stream.startReadEncaps();
+ _state = StateOK; // The state must be set last, in case there is an exception.
+ break;
+ }
+
+ case ReplyStatus.replyUserException:
+ {
+ //
+ // Input and output parameters are always sent in an
+ // encapsulation, which makes it possible to forward
+ // oneway requests as blobs.
+ //
+ _stream.startReadEncaps();
+ _state = StateUserException; // The state must be set last, in case there is an exception.
+ break;
+ }
+
+ case ReplyStatus.replyObjectNotExist:
+ case ReplyStatus.replyFacetNotExist:
+ case ReplyStatus.replyOperationNotExist:
+ {
+ Ice.RequestFailedException ex = null;
+ switch(replyStatus)
+ {
+ case ReplyStatus.replyObjectNotExist:
+ {
+ ex = new Ice.ObjectNotExistException();
+ break;
+ }
+
+ case ReplyStatus.replyFacetNotExist:
+ {
+ ex = new Ice.FacetNotExistException();
+ break;
+ }
+
+ case ReplyStatus.replyOperationNotExist:
+ {
+ ex = new Ice.OperationNotExistException();
+ break;
+ }
+
+ default:
+ {
+ if(IceUtil.Debug.ASSERT)
+ {
+ IceUtil.Debug.Assert(false);
+ }
+ break;
+ }
+ }
+
+ ex.id = new Ice.Identity();
+ ex.id.__read(_stream);
//
// For compatibility with the old FacetPath.
@@ -275,86 +275,86 @@ public final class Outgoing
String[] facetPath = _stream.readStringSeq();
if(facetPath.length > 0)
{
- if(facetPath.length > 1)
- {
- throw new Ice.MarshalException();
- }
+ if(facetPath.length > 1)
+ {
+ throw new Ice.MarshalException();
+ }
ex.facet = facetPath[0];
}
- else
- {
- ex.facet = "";
- }
-
- ex.operation = _stream.readString();
- _exception = ex;
-
- _state = StateLocalException; // The state must be set last, in case there is an exception.
- break;
- }
-
- case ReplyStatus.replyUnknownException:
- case ReplyStatus.replyUnknownLocalException:
- case ReplyStatus.replyUnknownUserException:
- {
- Ice.UnknownException ex = null;
- switch(replyStatus)
- {
- case ReplyStatus.replyUnknownException:
- {
- ex = new Ice.UnknownException();
- break;
- }
-
- case ReplyStatus.replyUnknownLocalException:
- {
- ex = new Ice.UnknownLocalException();
- break;
- }
-
- case ReplyStatus.replyUnknownUserException:
- {
- ex = new Ice.UnknownUserException();
- break;
- }
-
- default:
- {
- if(IceUtil.Debug.ASSERT)
- {
- IceUtil.Debug.Assert(false);
- }
- break;
- }
- }
-
- ex.unknown = _stream.readString();
- _exception = ex;
-
- _state = StateLocalException; // The state must be set last, in case there is an exception.
- break;
- }
-
- default:
- {
- _exception = new Ice.ProtocolException("unknown reply status");
- _state = StateLocalException;
- break;
- }
- }
+ else
+ {
+ ex.facet = "";
+ }
+
+ ex.operation = _stream.readString();
+ _exception = ex;
+
+ _state = StateLocalException; // The state must be set last, in case there is an exception.
+ break;
+ }
+
+ case ReplyStatus.replyUnknownException:
+ case ReplyStatus.replyUnknownLocalException:
+ case ReplyStatus.replyUnknownUserException:
+ {
+ Ice.UnknownException ex = null;
+ switch(replyStatus)
+ {
+ case ReplyStatus.replyUnknownException:
+ {
+ ex = new Ice.UnknownException();
+ break;
+ }
+
+ case ReplyStatus.replyUnknownLocalException:
+ {
+ ex = new Ice.UnknownLocalException();
+ break;
+ }
+
+ case ReplyStatus.replyUnknownUserException:
+ {
+ ex = new Ice.UnknownUserException();
+ break;
+ }
+
+ default:
+ {
+ if(IceUtil.Debug.ASSERT)
+ {
+ IceUtil.Debug.Assert(false);
+ }
+ break;
+ }
+ }
+
+ ex.unknown = _stream.readString();
+ _exception = ex;
+
+ _state = StateLocalException; // The state must be set last, in case there is an exception.
+ break;
+ }
+
+ default:
+ {
+ _exception = new Ice.ProtocolException("unknown reply status");
+ _state = StateLocalException;
+ break;
+ }
+ }
}
public void
finished(Ice.LocalException ex)
{
- if(IceUtil.Debug.ASSERT)
- {
- IceUtil.Debug.Assert(_reference.getMode() == Reference.ModeTwoway); // Can only be called for twoways.
- IceUtil.Debug.Assert(_state <= StateInProgress);
- }
-
- _state = StateLocalException;
- _exception = ex;
+ if(IceUtil.Debug.ASSERT)
+ {
+ IceUtil.Debug.Assert(_reference.getMode() == Reference.ModeTwoway); // Can only be called for twoways.
+ IceUtil.Debug.Assert(_state <= StateInProgress);
+ }
+
+ _state = StateLocalException;
+ _exception = ex;
}
public BasicStream
@@ -381,15 +381,15 @@ public final class Outgoing
break;
}
- case Reference.ModeDatagram:
- case Reference.ModeBatchDatagram:
- {
- if(IceUtil.Debug.ASSERT)
- {
- IceUtil.Debug.Assert(false);
- }
- break;
- }
+ case Reference.ModeDatagram:
+ case Reference.ModeBatchDatagram:
+ {
+ if(IceUtil.Debug.ASSERT)
+ {
+ IceUtil.Debug.Assert(false);
+ }
+ break;
+ }
}
_reference.getIdentity().__write(_stream);
@@ -397,7 +397,7 @@ public final class Outgoing
//
// For compatibility with the old FacetPath.
//
- String facet = _reference.getFacet();
+ String facet = _reference.getFacet();
if(facet == null || facet.length() == 0)
{
_stream.writeStringSeq(null);
@@ -421,11 +421,11 @@ public final class Outgoing
_stream.writeSize(sz);
if(sz > 0)
{
- java.util.Enumeration e = context.keys();
+ java.util.Enumeration e = context.keys();
while(e.hasMoreElements())
{
- String key = (String)e.nextElement();
- String value = (String)context.get(key);
+ String key = (String)e.nextElement();
+ String value = (String)context.get(key);
_stream.writeString(key);
_stream.writeString(value);
}
diff --git a/javae/src/IceInternal/OutgoingConnectionFactory.java b/javae/src/IceInternal/OutgoingConnectionFactory.java
index dbcc87c6fb3..631031b834f 100644
--- a/javae/src/IceInternal/OutgoingConnectionFactory.java
+++ b/javae/src/IceInternal/OutgoingConnectionFactory.java
@@ -22,15 +22,15 @@ public final class OutgoingConnectionFactory
java.util.Enumeration p = _connections.elements();
while(p.hasMoreElements())
{
- java.util.Vector connectionList = (java.util.Vector)p.nextElement();
-
- java.util.Enumeration q = connectionList.elements();
- while(q.hasMoreElements())
- {
- Ice.Connection connection = (Ice.Connection)q.nextElement();
- connection.destroy(Ice.Connection.CommunicatorDestroyed);
- }
- }
+ java.util.Vector connectionList = (java.util.Vector)p.nextElement();
+
+ java.util.Enumeration q = connectionList.elements();
+ while(q.hasMoreElements())
+ {
+ Ice.Connection connection = (Ice.Connection)q.nextElement();
+ connection.destroy(Ice.Connection.CommunicatorDestroyed);
+ }
+ }
_destroyed = true;
notifyAll();
@@ -39,335 +39,335 @@ public final class OutgoingConnectionFactory
public void
waitUntilFinished()
{
- java.util.Hashtable connections;
-
- synchronized(this)
- {
- //
- // First we wait until the factory is destroyed. We also
- // wait until there are no pending connections
- // anymore. Only then we can be sure the _connections
- // contains all connections.
- //
- while(!_destroyed || !_pending.isEmpty())
- {
- try
- {
- wait();
- }
- catch(InterruptedException ex)
- {
- }
- }
-
- //
- // We want to wait until all connections are finished
- // outside the thread synchronization.
- //
- connections = _connections;
- _connections = null;
- }
-
- //
- // Now we wait for until the destruction of each connection is
- // finished.
- //
+ java.util.Hashtable connections;
+
+ synchronized(this)
+ {
+ //
+ // First we wait until the factory is destroyed. We also
+ // wait until there are no pending connections
+ // anymore. Only then we can be sure the _connections
+ // contains all connections.
+ //
+ while(!_destroyed || !_pending.isEmpty())
+ {
+ try
+ {
+ wait();
+ }
+ catch(InterruptedException ex)
+ {
+ }
+ }
+
+ //
+ // We want to wait until all connections are finished
+ // outside the thread synchronization.
+ //
+ connections = _connections;
+ _connections = null;
+ }
+
+ //
+ // Now we wait for until the destruction of each connection is
+ // finished.
+ //
java.util.Enumeration p = connections.elements();
while(p.hasMoreElements())
{
- java.util.Vector connectionList = (java.util.Vector)p.nextElement();
-
- java.util.Enumeration q = connectionList.elements();
- while(q.hasMoreElements())
- {
- Ice.Connection connection = (Ice.Connection)q.nextElement();
- connection.waitUntilFinished();
- }
+ java.util.Vector connectionList = (java.util.Vector)p.nextElement();
+
+ java.util.Enumeration q = connectionList.elements();
+ while(q.hasMoreElements())
+ {
+ Ice.Connection connection = (Ice.Connection)q.nextElement();
+ connection.waitUntilFinished();
+ }
}
}
public Ice.Connection
create(Endpoint[] endpts)
{
- if(IceUtil.Debug.ASSERT)
- {
- IceUtil.Debug.Assert(endpts.length > 0);
- }
- Endpoint[] endpoints = new Endpoint[endpts.length];
- System.arraycopy(endpts, 0, endpoints, 0, endpts.length);
+ if(IceUtil.Debug.ASSERT)
+ {
+ IceUtil.Debug.Assert(endpts.length > 0);
+ }
+ Endpoint[] endpoints = new Endpoint[endpts.length];
+ System.arraycopy(endpts, 0, endpoints, 0, endpts.length);
DefaultsAndOverrides defaultsAndOverrides = _instance.defaultsAndOverrides();
- synchronized(this)
- {
- if(_destroyed)
- {
- throw new Ice.CommunicatorDestroyedException();
- }
-
- //
- // Reap connections for which destruction has completed.
- //
- java.util.Enumeration p = _connections.keys();
- while(p.hasMoreElements())
- {
- java.lang.Object key = p.nextElement();
- java.util.Vector connectionList = (java.util.Vector)_connections.get(key);
-
- for(int i = connectionList.size(); i > 0 ; --i)
- {
- Ice.Connection con = (Ice.Connection)connectionList.elementAt(i - 1);
- if(con.isFinished())
- {
- connectionList.removeElementAt(i - 1);
- }
- }
-
- if(connectionList.isEmpty())
- {
- _connections.remove(key);
- }
- }
-
- //
- // Modify endpoints with overrides.
- //
- for(int i = 0; i < endpoints.length; i++)
- {
- if(defaultsAndOverrides.overrideTimeout)
- {
- endpoints[i] = endpoints[i].timeout(defaultsAndOverrides.overrideTimeoutValue);
- }
- }
-
- //
- // Search for existing connections.
- //
- for(int i = 0; i < endpoints.length; i++)
- {
- java.util.Vector connectionList = (java.util.Vector)_connections.get(endpoints[i]);
- if(connectionList != null)
- {
- java.util.Enumeration q = connectionList.elements();
-
- while(q.hasMoreElements())
- {
- Ice.Connection connection = (Ice.Connection)q.nextElement();
-
- //
- // Don't return connections for which destruction has
- // been initiated.
- //
- if(!connection.isDestroyed())
- {
- return connection;
- }
- }
- }
- }
-
- //
- // If some other thread is currently trying to establish a
- // connection to any of our endpoints, we wait until this
- // thread is finished.
- //
- boolean searchAgain = false;
- while(!_destroyed)
- {
- int i;
- for(i = 0; i < endpoints.length; i++)
- {
- if(_pending.contains(endpoints[i]))
- {
- break;
- }
- }
-
- if(i == endpoints.length)
- {
- break;
- }
-
- searchAgain = true;
-
- try
- {
- wait();
- }
- catch(InterruptedException ex)
- {
- }
- }
-
- if(_destroyed)
- {
- throw new Ice.CommunicatorDestroyedException();
- }
-
- //
- // Search for existing connections again if we waited
- // above, as new connections might have been added in the
- // meantime.
- //
- if(searchAgain)
- {
- for(int i = 0; i < endpoints.length; i++)
- {
- java.util.Vector connectionList = (java.util.Vector)_connections.get(endpoints[i]);
- if(connectionList != null)
- {
- java.util.Enumeration q = connectionList.elements();
-
- while(q.hasMoreElements())
- {
- Ice.Connection connection = (Ice.Connection)q.nextElement();
-
- //
- // Don't return connections for which destruction has
- // been initiated.
- //
- if(!connection.isDestroyed())
- {
- return connection;
- }
- }
- }
- }
- }
-
- //
- // No connection to any of our endpoints exists yet, so we
- // will try to create one. To avoid that other threads try
- // to create connections to the same endpoints, we add our
- // endpoints to _pending.
- //
- for(int i = 0; i < endpoints.length; i++)
- {
- _pending.put(endpoints[i], endpoints[i]);
- }
- }
-
- Ice.Connection connection = null;
- Ice.LocalException exception = null;
-
- for(int i = 0; i < endpoints.length; i++)
- {
- Endpoint endpoint = endpoints[i];
-
- try
- {
- Transceiver transceiver = endpoint.clientTransceiver();
- if(transceiver == null)
- {
- Connector connector = endpoint.connector();
- if(IceUtil.Debug.ASSERT)
- {
- IceUtil.Debug.Assert(connector != null);
- }
-
- int timeout;
- if(defaultsAndOverrides.overrideConnectTimeout)
- {
- timeout = defaultsAndOverrides.overrideConnectTimeoutValue;
- }
- // It is not necessary to check for overrideTimeout,
- // the endpoint has already been modified with this
- // override, if set.
- else
- {
- timeout = endpoint.timeout();
- }
-
- transceiver = connector.connect(timeout);
- if(IceUtil.Debug.ASSERT)
- {
- IceUtil.Debug.Assert(transceiver != null);
- }
- }
- connection = new Ice.Connection(_instance, transceiver, endpoint, null);
- //
- // Wait for the connection to be validated by the
- // connection thread. Once the connection has been
- // validated it will be activated also.
- //
- connection.waitForValidation();
- break;
- }
- catch(Ice.LocalException ex)
- {
- exception = ex;
-
- //
- // If a connection object was constructed, then validate()
- // must have raised the exception.
- //
- if(connection != null)
- {
- connection.waitUntilFinished(); // We must call waitUntilFinished() for cleanup.
- connection = null;
- }
- }
-
- TraceLevels traceLevels = _instance.traceLevels();
- if(traceLevels.retry >= 2)
- {
- StringBuffer s = new StringBuffer();
- s.append("connection to endpoint failed");
- if(i < endpoints.length - 1)
- {
- s.append(", trying next endpoint\n");
- }
- else
- {
- s.append(" and no more endpoints to try\n");
- }
- s.append(exception.toString());
- _instance.initializationData().logger.trace(traceLevels.retryCat, s.toString());
- }
- }
-
- synchronized(this)
- {
- //
- // Signal other threads that we are done with trying to
- // establish connections to our endpoints.
- //
- for(int i = 0; i < endpoints.length; i++)
- {
- _pending.remove(endpoints[i]);
- }
- notifyAll();
-
- if(connection == null)
- {
- if(IceUtil.Debug.ASSERT)
- {
- IceUtil.Debug.Assert(exception != null);
- }
- throw exception;
- }
- else
- {
- java.util.Vector connectionList = (java.util.Vector)_connections.get(connection.endpoint());
- if(connectionList == null)
- {
- connectionList = new java.util.Vector();
- _connections.put(connection.endpoint(), connectionList);
- }
- connectionList.addElement(connection);
-
- if(_destroyed)
- {
- connection.destroy(Ice.Connection.CommunicatorDestroyed);
- throw new Ice.CommunicatorDestroyedException();
- }
- }
- }
-
- if(IceUtil.Debug.ASSERT)
- {
- IceUtil.Debug.Assert(connection != null);
- }
+ synchronized(this)
+ {
+ if(_destroyed)
+ {
+ throw new Ice.CommunicatorDestroyedException();
+ }
+
+ //
+ // Reap connections for which destruction has completed.
+ //
+ java.util.Enumeration p = _connections.keys();
+ while(p.hasMoreElements())
+ {
+ java.lang.Object key = p.nextElement();
+ java.util.Vector connectionList = (java.util.Vector)_connections.get(key);
+
+ for(int i = connectionList.size(); i > 0 ; --i)
+ {
+ Ice.Connection con = (Ice.Connection)connectionList.elementAt(i - 1);
+ if(con.isFinished())
+ {
+ connectionList.removeElementAt(i - 1);
+ }
+ }
+
+ if(connectionList.isEmpty())
+ {
+ _connections.remove(key);
+ }
+ }
+
+ //
+ // Modify endpoints with overrides.
+ //
+ for(int i = 0; i < endpoints.length; i++)
+ {
+ if(defaultsAndOverrides.overrideTimeout)
+ {
+ endpoints[i] = endpoints[i].timeout(defaultsAndOverrides.overrideTimeoutValue);
+ }
+ }
+
+ //
+ // Search for existing connections.
+ //
+ for(int i = 0; i < endpoints.length; i++)
+ {
+ java.util.Vector connectionList = (java.util.Vector)_connections.get(endpoints[i]);
+ if(connectionList != null)
+ {
+ java.util.Enumeration q = connectionList.elements();
+
+ while(q.hasMoreElements())
+ {
+ Ice.Connection connection = (Ice.Connection)q.nextElement();
+
+ //
+ // Don't return connections for which destruction has
+ // been initiated.
+ //
+ if(!connection.isDestroyed())
+ {
+ return connection;
+ }
+ }
+ }
+ }
+
+ //
+ // If some other thread is currently trying to establish a
+ // connection to any of our endpoints, we wait until this
+ // thread is finished.
+ //
+ boolean searchAgain = false;
+ while(!_destroyed)
+ {
+ int i;
+ for(i = 0; i < endpoints.length; i++)
+ {
+ if(_pending.contains(endpoints[i]))
+ {
+ break;
+ }
+ }
+
+ if(i == endpoints.length)
+ {
+ break;
+ }
+
+ searchAgain = true;
+
+ try
+ {
+ wait();
+ }
+ catch(InterruptedException ex)
+ {
+ }
+ }
+
+ if(_destroyed)
+ {
+ throw new Ice.CommunicatorDestroyedException();
+ }
+
+ //
+ // Search for existing connections again if we waited
+ // above, as new connections might have been added in the
+ // meantime.
+ //
+ if(searchAgain)
+ {
+ for(int i = 0; i < endpoints.length; i++)
+ {
+ java.util.Vector connectionList = (java.util.Vector)_connections.get(endpoints[i]);
+ if(connectionList != null)
+ {
+ java.util.Enumeration q = connectionList.elements();
+
+ while(q.hasMoreElements())
+ {
+ Ice.Connection connection = (Ice.Connection)q.nextElement();
+
+ //
+ // Don't return connections for which destruction has
+ // been initiated.
+ //
+ if(!connection.isDestroyed())
+ {
+ return connection;
+ }
+ }
+ }
+ }
+ }
+
+ //
+ // No connection to any of our endpoints exists yet, so we
+ // will try to create one. To avoid that other threads try
+ // to create connections to the same endpoints, we add our
+ // endpoints to _pending.
+ //
+ for(int i = 0; i < endpoints.length; i++)
+ {
+ _pending.put(endpoints[i], endpoints[i]);
+ }
+ }
+
+ Ice.Connection connection = null;
+ Ice.LocalException exception = null;
+
+ for(int i = 0; i < endpoints.length; i++)
+ {
+ Endpoint endpoint = endpoints[i];
+
+ try
+ {
+ Transceiver transceiver = endpoint.clientTransceiver();
+ if(transceiver == null)
+ {
+ Connector connector = endpoint.connector();
+ if(IceUtil.Debug.ASSERT)
+ {
+ IceUtil.Debug.Assert(connector != null);
+ }
+
+ int timeout;
+ if(defaultsAndOverrides.overrideConnectTimeout)
+ {
+ timeout = defaultsAndOverrides.overrideConnectTimeoutValue;
+ }
+ // It is not necessary to check for overrideTimeout,
+ // the endpoint has already been modified with this
+ // override, if set.
+ else
+ {
+ timeout = endpoint.timeout();
+ }
+
+ transceiver = connector.connect(timeout);
+ if(IceUtil.Debug.ASSERT)
+ {
+ IceUtil.Debug.Assert(transceiver != null);
+ }
+ }
+ connection = new Ice.Connection(_instance, transceiver, endpoint, null);
+ //
+ // Wait for the connection to be validated by the
+ // connection thread. Once the connection has been
+ // validated it will be activated also.
+ //
+ connection.waitForValidation();
+ break;
+ }
+ catch(Ice.LocalException ex)
+ {
+ exception = ex;
+
+ //
+ // If a connection object was constructed, then validate()
+ // must have raised the exception.
+ //
+ if(connection != null)
+ {
+ connection.waitUntilFinished(); // We must call waitUntilFinished() for cleanup.
+ connection = null;
+ }
+ }
+
+ TraceLevels traceLevels = _instance.traceLevels();
+ if(traceLevels.retry >= 2)
+ {
+ StringBuffer s = new StringBuffer();
+ s.append("connection to endpoint failed");
+ if(i < endpoints.length - 1)
+ {
+ s.append(", trying next endpoint\n");
+ }
+ else
+ {
+ s.append(" and no more endpoints to try\n");
+ }
+ s.append(exception.toString());
+ _instance.initializationData().logger.trace(traceLevels.retryCat, s.toString());
+ }
+ }
+
+ synchronized(this)
+ {
+ //
+ // Signal other threads that we are done with trying to
+ // establish connections to our endpoints.
+ //
+ for(int i = 0; i < endpoints.length; i++)
+ {
+ _pending.remove(endpoints[i]);
+ }
+ notifyAll();
+
+ if(connection == null)
+ {
+ if(IceUtil.Debug.ASSERT)
+ {
+ IceUtil.Debug.Assert(exception != null);
+ }
+ throw exception;
+ }
+ else
+ {
+ java.util.Vector connectionList = (java.util.Vector)_connections.get(connection.endpoint());
+ if(connectionList == null)
+ {
+ connectionList = new java.util.Vector();
+ _connections.put(connection.endpoint(), connectionList);
+ }
+ connectionList.addElement(connection);
+
+ if(_destroyed)
+ {
+ connection.destroy(Ice.Connection.CommunicatorDestroyed);
+ throw new Ice.CommunicatorDestroyedException();
+ }
+ }
+ }
+
+ if(IceUtil.Debug.ASSERT)
+ {
+ IceUtil.Debug.Assert(connection != null);
+ }
return connection;
}
@@ -379,53 +379,53 @@ public final class OutgoingConnectionFactory
throw new Ice.CommunicatorDestroyedException();
}
- if(IceUtil.Debug.ASSERT)
- {
- IceUtil.Debug.Assert(routerInfo != null);
- }
-
- //
- // Search for connections to the router's client proxy
- // endpoints, and update the object adapter for such
- // connections, so that callbacks from the router can be
- // received over such connections.
- //
- Ice.ObjectAdapter adapter = routerInfo.getAdapter();
- DefaultsAndOverrides defaultsAndOverrides = _instance.defaultsAndOverrides();
- Endpoint[] endpoints = routerInfo.getClientEndpoints();
- for(int i = 0; i < endpoints.length; i++)
- {
- Endpoint endpoint = endpoints[i];
-
- //
- // Modify endpoints with overrides.
- //
- if(defaultsAndOverrides.overrideTimeout)
- {
- endpoint = endpoint.timeout(defaultsAndOverrides.overrideTimeoutValue);
- }
-
- java.util.Vector connectionList = (java.util.Vector)_connections.get(endpoints[i]);
- if(connectionList != null)
- {
- java.util.Enumeration p = connectionList.elements();
-
- while(p.hasMoreElements())
- {
- Ice.Connection connection = (Ice.Connection)p.nextElement();
- try
- {
- connection.setAdapter(adapter);
- }
- catch(Ice.LocalException ex)
- {
- //
- // Ignore, the connection is being closed or closed.
- //
- }
- }
- }
- }
+ if(IceUtil.Debug.ASSERT)
+ {
+ IceUtil.Debug.Assert(routerInfo != null);
+ }
+
+ //
+ // Search for connections to the router's client proxy
+ // endpoints, and update the object adapter for such
+ // connections, so that callbacks from the router can be
+ // received over such connections.
+ //
+ Ice.ObjectAdapter adapter = routerInfo.getAdapter();
+ DefaultsAndOverrides defaultsAndOverrides = _instance.defaultsAndOverrides();
+ Endpoint[] endpoints = routerInfo.getClientEndpoints();
+ for(int i = 0; i < endpoints.length; i++)
+ {
+ Endpoint endpoint = endpoints[i];
+
+ //
+ // Modify endpoints with overrides.
+ //
+ if(defaultsAndOverrides.overrideTimeout)
+ {
+ endpoint = endpoint.timeout(defaultsAndOverrides.overrideTimeoutValue);
+ }
+
+ java.util.Vector connectionList = (java.util.Vector)_connections.get(endpoints[i]);
+ if(connectionList != null)
+ {
+ java.util.Enumeration p = connectionList.elements();
+
+ while(p.hasMoreElements())
+ {
+ Ice.Connection connection = (Ice.Connection)p.nextElement();
+ try
+ {
+ connection.setAdapter(adapter);
+ }
+ catch(Ice.LocalException ex)
+ {
+ //
+ // Ignore, the connection is being closed or closed.
+ //
+ }
+ }
+ }
+ }
}
public synchronized void
@@ -433,67 +433,67 @@ public final class OutgoingConnectionFactory
{
if(_destroyed)
{
- return;
+ return;
}
java.util.Enumeration p = _connections.elements();
while(p.hasMoreElements())
{
- java.util.Vector connectionList = (java.util.Vector)p.nextElement();
-
- java.util.Enumeration q = connectionList.elements();
- while(q.hasMoreElements())
- {
- Ice.Connection connection = (Ice.Connection)q.nextElement();
- if(connection.getAdapter() == adapter)
- {
- try
- {
- connection.setAdapter(null);
- }
- catch(Ice.LocalException ex)
- {
- //
- // Ignore, the connection is being closed or closed.
- //
- }
- }
- }
- }
+ java.util.Vector connectionList = (java.util.Vector)p.nextElement();
+
+ java.util.Enumeration q = connectionList.elements();
+ while(q.hasMoreElements())
+ {
+ Ice.Connection connection = (Ice.Connection)q.nextElement();
+ if(connection.getAdapter() == adapter)
+ {
+ try
+ {
+ connection.setAdapter(null);
+ }
+ catch(Ice.LocalException ex)
+ {
+ //
+ // Ignore, the connection is being closed or closed.
+ //
+ }
+ }
+ }
+ }
}
public void
flushBatchRequests()
{
- java.util.Vector c = new java.util.Vector();
+ java.util.Vector c = new java.util.Vector();
synchronized(this)
- {
- java.util.Enumeration p = _connections.elements();
- while(p.hasMoreElements())
- {
- java.util.Vector connectionList = (java.util.Vector)p.nextElement();
- java.util.Enumeration q = connectionList.elements();
- while(q.hasMoreElements())
- {
- c.addElement(q.nextElement());
- }
- }
- }
-
- java.util.Enumeration p = c.elements();
- while(p.hasMoreElements())
- {
- Ice.Connection conn = (Ice.Connection)p.nextElement();
- try
- {
- conn.flushBatchRequests();
- }
- catch(Ice.LocalException ex)
- {
- // Ignore.
- }
- }
+ {
+ java.util.Enumeration p = _connections.elements();
+ while(p.hasMoreElements())
+ {
+ java.util.Vector connectionList = (java.util.Vector)p.nextElement();
+ java.util.Enumeration q = connectionList.elements();
+ while(q.hasMoreElements())
+ {
+ c.addElement(q.nextElement());
+ }
+ }
+ }
+
+ java.util.Enumeration p = c.elements();
+ while(p.hasMoreElements())
+ {
+ Ice.Connection conn = (Ice.Connection)p.nextElement();
+ try
+ {
+ conn.flushBatchRequests();
+ }
+ catch(Ice.LocalException ex)
+ {
+ // Ignore.
+ }
+ }
}
//
@@ -502,7 +502,7 @@ public final class OutgoingConnectionFactory
OutgoingConnectionFactory(Instance instance)
{
_instance = instance;
- _destroyed = false;
+ _destroyed = false;
}
protected synchronized void
@@ -510,11 +510,11 @@ public final class OutgoingConnectionFactory
throws Throwable
{
IceUtil.Debug.FinalizerAssert(_destroyed);
- IceUtil.Debug.FinalizerAssert(_connections == null);
+ IceUtil.Debug.FinalizerAssert(_connections == null);
- //
- // Cannot call parent's finalizer here. java.lang.Object in CLDC doesn't have a finalize call.
- //
+ //
+ // Cannot call parent's finalizer here. java.lang.Object in CLDC doesn't have a finalize call.
+ //
}
private /*final*/ Instance _instance;
diff --git a/javae/src/IceInternal/Protocol.java b/javae/src/IceInternal/Protocol.java
index 4ba85b1b513..f73dc9b13f1 100644
--- a/javae/src/IceInternal/Protocol.java
+++ b/javae/src/IceInternal/Protocol.java
@@ -28,7 +28,7 @@ final public class Protocol
//
// The magic number at the front of each message
//
- public final static byte magic[] = { 0x49, 0x63, 0x65, 0x50 }; // 'I', 'c', 'e', 'P'
+ public final static byte magic[] = { 0x49, 0x63, 0x65, 0x50 }; // 'I', 'c', 'e', 'P'
//
// The current Ice protocol and encoding version
@@ -49,10 +49,10 @@ final public class Protocol
public final static byte[] requestHdr =
{
- IceInternal.Protocol.magic[0],
- IceInternal.Protocol.magic[1],
- IceInternal.Protocol.magic[2],
- IceInternal.Protocol.magic[3],
+ IceInternal.Protocol.magic[0],
+ IceInternal.Protocol.magic[1],
+ IceInternal.Protocol.magic[2],
+ IceInternal.Protocol.magic[3],
IceInternal.Protocol.protocolMajor,
IceInternal.Protocol.protocolMinor,
IceInternal.Protocol.encodingMajor,
@@ -65,10 +65,10 @@ final public class Protocol
public final static byte[] requestBatchHdr =
{
- IceInternal.Protocol.magic[0],
- IceInternal.Protocol.magic[1],
- IceInternal.Protocol.magic[2],
- IceInternal.Protocol.magic[3],
+ IceInternal.Protocol.magic[0],
+ IceInternal.Protocol.magic[1],
+ IceInternal.Protocol.magic[2],
+ IceInternal.Protocol.magic[3],
IceInternal.Protocol.protocolMajor,
IceInternal.Protocol.protocolMinor,
IceInternal.Protocol.encodingMajor,
@@ -81,10 +81,10 @@ final public class Protocol
public final static byte[] replyHdr =
{
- IceInternal.Protocol.magic[0],
- IceInternal.Protocol.magic[1],
- IceInternal.Protocol.magic[2],
- IceInternal.Protocol.magic[3],
+ IceInternal.Protocol.magic[0],
+ IceInternal.Protocol.magic[1],
+ IceInternal.Protocol.magic[2],
+ IceInternal.Protocol.magic[3],
IceInternal.Protocol.protocolMajor,
IceInternal.Protocol.protocolMinor,
IceInternal.Protocol.encodingMajor,
diff --git a/javae/src/IceInternal/ProxyFactory.java b/javae/src/IceInternal/ProxyFactory.java
index 7383c515367..f82c3075501 100644
--- a/javae/src/IceInternal/ProxyFactory.java
+++ b/javae/src/IceInternal/ProxyFactory.java
@@ -162,8 +162,8 @@ public final class ProxyFactory
throw ex;
}
- ++cnt;
- IceUtil.Debug.Assert(cnt > 0);
+ ++cnt;
+ IceUtil.Debug.Assert(cnt > 0);
if(cnt > _retryIntervals.length)
{
@@ -175,7 +175,7 @@ public final class ProxyFactory
throw ex;
}
- int interval = _retryIntervals[cnt - 1];
+ int interval = _retryIntervals[cnt - 1];
if(traceLevels.retry >= 1)
{
@@ -212,44 +212,44 @@ public final class ProxyFactory
{
_instance = instance;
- String str = _instance.initializationData().properties.getPropertyWithDefault("Ice.RetryIntervals", "0");
+ String str = _instance.initializationData().properties.getPropertyWithDefault("Ice.RetryIntervals", "0");
String[] arr = IceUtil.StringUtil.split(str.trim(), " \t\n\r");
- if(arr.length > 0)
- {
- _retryIntervals = new int[arr.length];
+ if(arr.length > 0)
+ {
+ _retryIntervals = new int[arr.length];
- for(int i = 0; i < arr.length; i++)
- {
- int v;
+ for(int i = 0; i < arr.length; i++)
+ {
+ int v;
- try
- {
- v = Integer.parseInt(arr[i]);
- }
- catch(NumberFormatException ex)
- {
- v = 0;
- }
+ try
+ {
+ v = Integer.parseInt(arr[i]);
+ }
+ catch(NumberFormatException ex)
+ {
+ v = 0;
+ }
- //
- // If -1 is the first value, no retry and wait intervals.
- //
- if(i == 0 && v == -1)
- {
- _retryIntervals = new int[0];
- break;
- }
+ //
+ // If -1 is the first value, no retry and wait intervals.
+ //
+ if(i == 0 && v == -1)
+ {
+ _retryIntervals = new int[0];
+ break;
+ }
- _retryIntervals[i] = v > 0 ? v : 0;
- }
- }
- else
- {
- _retryIntervals = new int[1];
- _retryIntervals[0] = 0;
- }
+ _retryIntervals[i] = v > 0 ? v : 0;
+ }
+ }
+ else
+ {
+ _retryIntervals = new int[1];
+ _retryIntervals[0] = 0;
+ }
}
private Instance _instance;
diff --git a/javae/src/IceInternal/Reference.java b/javae/src/IceInternal/Reference.java
index a09a49a7205..f06c736c799 100644
--- a/javae/src/IceInternal/Reference.java
+++ b/javae/src/IceInternal/Reference.java
@@ -51,7 +51,7 @@ public abstract class Reference
public final java.util.Hashtable
getContext()
{
- return _context;
+ return _context;
}
public final Ice.Communicator getCommunicator()
@@ -82,98 +82,98 @@ public abstract class Reference
public final Reference
changeContext(java.util.Hashtable newContext)
{
- if(newContext == null)
- {
- newContext = _emptyContext;
- }
- Reference r = _instance.referenceFactory().copy(this);
- if(newContext.isEmpty())
- {
- r._context = _emptyContext;
- }
- else
- {
- java.util.Hashtable newTable = new java.util.Hashtable(newContext.size());
- java.util.Enumeration e = newContext.keys();
- while(e.hasMoreElements())
- {
- java.lang.Object key = e.nextElement();
- newTable.put(key, newContext.get(key));
- }
- r._context = newTable;
- }
- return r;
+ if(newContext == null)
+ {
+ newContext = _emptyContext;
+ }
+ Reference r = _instance.referenceFactory().copy(this);
+ if(newContext.isEmpty())
+ {
+ r._context = _emptyContext;
+ }
+ else
+ {
+ java.util.Hashtable newTable = new java.util.Hashtable(newContext.size());
+ java.util.Enumeration e = newContext.keys();
+ while(e.hasMoreElements())
+ {
+ java.lang.Object key = e.nextElement();
+ newTable.put(key, newContext.get(key));
+ }
+ r._context = newTable;
+ }
+ return r;
}
public final Reference
changeMode(int newMode)
{
if(newMode == _mode)
- {
- return this;
- }
- Reference r = _instance.referenceFactory().copy(this);
- r._mode = newMode;
- return r;
+ {
+ return this;
+ }
+ Reference r = _instance.referenceFactory().copy(this);
+ r._mode = newMode;
+ return r;
}
public final Reference
changeSecure(boolean newSecure)
{
if(newSecure == _secure)
- {
- return this;
- }
- Reference r = _instance.referenceFactory().copy(this);
- r._secure = newSecure;
- return r;
+ {
+ return this;
+ }
+ Reference r = _instance.referenceFactory().copy(this);
+ r._secure = newSecure;
+ return r;
}
public final Reference
changeIdentity(Ice.Identity newIdentity)
{
if(newIdentity.equals(_identity))
- {
- return this;
- }
- Reference r = _instance.referenceFactory().copy(this);
- try
- {
- r._identity = (Ice.Identity)newIdentity.ice_clone();
- }
- catch(IceUtil.CloneException ex)
- {
- if(IceUtil.Debug.ASSERT)
- {
- IceUtil.Debug.Assert(false);
- }
- }
- return r;
+ {
+ return this;
+ }
+ Reference r = _instance.referenceFactory().copy(this);
+ try
+ {
+ r._identity = (Ice.Identity)newIdentity.ice_clone();
+ }
+ catch(IceUtil.CloneException ex)
+ {
+ if(IceUtil.Debug.ASSERT)
+ {
+ IceUtil.Debug.Assert(false);
+ }
+ }
+ return r;
}
public final Reference
changeFacet(String newFacet)
{
if(newFacet.equals(_facet))
- {
- return this;
- }
- Reference r = _instance.referenceFactory().copy(this);
- r._facet = newFacet;
- return r;
+ {
+ return this;
+ }
+ Reference r = _instance.referenceFactory().copy(this);
+ r._facet = newFacet;
+ return r;
}
public Reference
changeTimeout(int newTimeout)
{
- if(_overrideTimeout && _timeout == newTimeout)
- {
- return this;
- }
+ if(_overrideTimeout && _timeout == newTimeout)
+ {
+ return this;
+ }
Reference r = getInstance().referenceFactory().copy(this);
- r._timeout = newTimeout;
- r._overrideTimeout = true;
- return r;
+ r._timeout = newTimeout;
+ r._overrideTimeout = true;
+ return r;
}
public abstract Reference changeAdapterId(String newAdapterId);
@@ -183,10 +183,10 @@ public abstract class Reference
public synchronized int
hashCode()
{
- if(_hashInitialized)
- {
- return _hashValue;
- }
+ if(_hashInitialized)
+ {
+ return _hashValue;
+ }
int h = _mode;
@@ -208,10 +208,10 @@ public abstract class Reference
h = 5 * h + (int)_facet.charAt(i);
}
- h = 5 * h + (getSecure() ? 1 : 0);
+ h = 5 * h + (getSecure() ? 1 : 0);
- _hashValue = h;
- _hashInitialized = true;
+ _hashValue = h;
+ _hashInitialized = true;
return h;
}
@@ -242,9 +242,9 @@ public abstract class Reference
s.writeByte((byte)_mode);
- s.writeBool(getSecure());
+ s.writeBool(getSecure());
- // Derived class writes the remainder of the reference.
+ // Derived class writes the remainder of the reference.
}
//
@@ -253,94 +253,94 @@ public abstract class Reference
public String
toString()
{
- //
- // WARNING: Certain features, such as proxy validation in Glacier2,
- // depend on the format of proxy strings. Changes to toString() and
- // methods called to generate parts of the reference string could break
- // these features. Please review for all features that depend on the
- // format of proxyToString() before changing this and related code.
- //
- StringBuffer s = new StringBuffer();
-
- //
- // If the encoded identity string contains characters which
- // the reference parser uses as separators, then we enclose
- // the identity string in quotes.
- //
- String id = _instance.identityToString(_identity);
- if(IceUtil.StringUtil.findFirstOf(id, " \t\n\r:@") != -1)
- {
- s.append('"');
- s.append(id);
- s.append('"');
- }
- else
- {
- s.append(id);
- }
-
- if(_facet.length() > 0)
- {
- //
- // If the encoded facet string contains characters which
- // the reference parser uses as separators, then we enclose
- // the facet string in quotes.
- //
- s.append(" -f ");
- String fs = IceUtil.StringUtil.escapeString(_facet, "");
- if(IceUtil.StringUtil.findFirstOf(fs, " \t\n\r:@") != -1)
- {
- s.append('"');
- s.append(fs);
- s.append('"');
- }
- else
- {
- s.append(fs);
- }
- }
-
- switch(_mode)
- {
- case ModeTwoway:
- {
- s.append(" -t");
- break;
- }
-
- case ModeOneway:
- {
- s.append(" -o");
- break;
- }
-
- case ModeBatchOneway:
- {
- s.append(" -O");
- break;
- }
-
- case ModeDatagram:
- {
- s.append(" -d");
- break;
- }
-
- case ModeBatchDatagram:
- {
- s.append(" -D");
- break;
- }
- }
-
- if(getSecure())
- {
- s.append(" -s");
- }
-
- return s.toString();
-
- // Derived class writes the remainder of the string.
+ //
+ // WARNING: Certain features, such as proxy validation in Glacier2,
+ // depend on the format of proxy strings. Changes to toString() and
+ // methods called to generate parts of the reference string could break
+ // these features. Please review for all features that depend on the
+ // format of proxyToString() before changing this and related code.
+ //
+ StringBuffer s = new StringBuffer();
+
+ //
+ // If the encoded identity string contains characters which
+ // the reference parser uses as separators, then we enclose
+ // the identity string in quotes.
+ //
+ String id = _instance.identityToString(_identity);
+ if(IceUtil.StringUtil.findFirstOf(id, " \t\n\r:@") != -1)
+ {
+ s.append('"');
+ s.append(id);
+ s.append('"');
+ }
+ else
+ {
+ s.append(id);
+ }
+
+ if(_facet.length() > 0)
+ {
+ //
+ // If the encoded facet string contains characters which
+ // the reference parser uses as separators, then we enclose
+ // the facet string in quotes.
+ //
+ s.append(" -f ");
+ String fs = IceUtil.StringUtil.escapeString(_facet, "");
+ if(IceUtil.StringUtil.findFirstOf(fs, " \t\n\r:@") != -1)
+ {
+ s.append('"');
+ s.append(fs);
+ s.append('"');
+ }
+ else
+ {
+ s.append(fs);
+ }
+ }
+
+ switch(_mode)
+ {
+ case ModeTwoway:
+ {
+ s.append(" -t");
+ break;
+ }
+
+ case ModeOneway:
+ {
+ s.append(" -o");
+ break;
+ }
+
+ case ModeBatchOneway:
+ {
+ s.append(" -O");
+ break;
+ }
+
+ case ModeDatagram:
+ {
+ s.append(" -d");
+ break;
+ }
+
+ case ModeBatchDatagram:
+ {
+ s.append(" -D");
+ break;
+ }
+ }
+
+ if(getSecure())
+ {
+ s.append(" -s");
+ }
+
+ return s.toString();
+
+ // Derived class writes the remainder of the string.
}
public abstract Ice.Connection getConnection();
@@ -348,9 +348,9 @@ public abstract class Reference
public boolean
equals(java.lang.Object obj)
{
- //
- // Note: if(this == obj) and type test are performed by each non-abstract derived class.
- //
+ //
+ // Note: if(this == obj) and type test are performed by each non-abstract derived class.
+ //
Reference r = (Reference)obj; // Guaranteed to succeed.
@@ -359,34 +359,34 @@ public abstract class Reference
return false;
}
- if(_secure != r._secure)
- {
- return false;
- }
+ if(_secure != r._secure)
+ {
+ return false;
+ }
if(!_identity.equals(r._identity))
{
return false;
}
- if(!IceUtil.Hashtable.equals(_context, r._context))
- {
- return false;
- }
+ if(!IceUtil.Hashtable.equals(_context, r._context))
+ {
+ return false;
+ }
if(!_facet.equals(r._facet))
{
return false;
}
- if(_overrideTimeout != r._overrideTimeout)
- {
- return false;
- }
- if(_overrideTimeout && _timeout != r._timeout)
- {
- return false;
- }
+ if(_overrideTimeout != r._overrideTimeout)
+ {
+ return false;
+ }
+ if(_overrideTimeout && _timeout != r._timeout)
+ {
+ return false;
+ }
return true;
}
@@ -394,25 +394,25 @@ public abstract class Reference
protected void
shallowCopy(Reference dest)
{
- dest._instance = _instance;
- dest._mode = _mode;
- dest._identity = _identity;
- dest._context = _context;
- dest._emptyContext = _emptyContext;
- dest._facet = _facet;
- dest._timeout = _timeout;
- dest._overrideTimeout = _overrideTimeout;
- dest._hashInitialized = false;
+ dest._instance = _instance;
+ dest._mode = _mode;
+ dest._identity = _identity;
+ dest._context = _context;
+ dest._emptyContext = _emptyContext;
+ dest._facet = _facet;
+ dest._timeout = _timeout;
+ dest._overrideTimeout = _overrideTimeout;
+ dest._hashInitialized = false;
}
public java.lang.Object
ice_clone()
{
- //
- // This should not be called. The cloning operation will be handled by descendents.
- //
- IceUtil.Debug.Assert(false);
- return null;
+ //
+ // This should not be called. The cloning operation will be handled by descendents.
+ //
+ IceUtil.Debug.Assert(false);
+ return null;
}
private Instance _instance;
@@ -439,9 +439,9 @@ public abstract class Reference
protected
Reference()
{
- //
- // Default constructor required for cloning operation.
- //
+ //
+ // Default constructor required for cloning operation.
+ //
}
protected
@@ -451,40 +451,40 @@ public abstract class Reference
java.util.Hashtable context,
String fac,
int md,
- boolean sec)
+ boolean sec)
{
//
// Validate string arguments.
//
- if(IceUtil.Debug.ASSERT)
- {
- IceUtil.Debug.Assert(ident.name != null);
- IceUtil.Debug.Assert(ident.category != null);
- IceUtil.Debug.Assert(fac != null);
- }
+ if(IceUtil.Debug.ASSERT)
+ {
+ IceUtil.Debug.Assert(ident.name != null);
+ IceUtil.Debug.Assert(ident.category != null);
+ IceUtil.Debug.Assert(fac != null);
+ }
_instance = inst;
_communicator = com;
_mode = md;
_secure = sec;
_identity = ident;
- _context = context == null ? _emptyContext : context;
+ _context = context == null ? _emptyContext : context;
_facet = fac;
- _overrideTimeout = false;
- _timeout = -1;
- _hashInitialized = false;
+ _overrideTimeout = false;
+ _timeout = -1;
+ _hashInitialized = false;
}
protected void
applyOverrides(Endpoint[] endpts)
{
- for(int i = 0; i < endpts.length; ++i)
- {
- if(_overrideTimeout)
- {
- endpts[i] = endpts[i].timeout(_timeout);
- }
- }
+ for(int i = 0; i < endpts.length; ++i)
+ {
+ if(_overrideTimeout)
+ {
+ endpts[i] = endpts[i].timeout(_timeout);
+ }
+ }
}
//
@@ -517,14 +517,14 @@ public abstract class Reference
{
//
// Filter out datagram endpoints.
- //
- for(int i = endpoints.size(); i > 0; --i)
- {
- if(((Endpoint)endpoints.elementAt(i - 1)).datagram())
- {
- endpoints.removeElementAt(i - 1);
- }
- }
+ //
+ for(int i = endpoints.size(); i > 0; --i)
+ {
+ if(((Endpoint)endpoints.elementAt(i - 1)).datagram())
+ {
+ endpoints.removeElementAt(i - 1);
+ }
+ }
break;
}
@@ -534,13 +534,13 @@ public abstract class Reference
//
// Filter out non-datagram endpoints.
//
- for(int i = endpoints.size(); i > 0; --i)
- {
- if(!((Endpoint)endpoints.elementAt(i - 1)).datagram())
- {
- endpoints.removeElementAt(i - 1);
- }
- }
+ for(int i = endpoints.size(); i > 0; --i)
+ {
+ if(!((Endpoint)endpoints.elementAt(i - 1)).datagram())
+ {
+ endpoints.removeElementAt(i - 1);
+ }
+ }
break;
}
}
@@ -576,25 +576,25 @@ public abstract class Reference
// endpoints preferred over secure endpoints.
//
java.util.Vector secureEndpoints = new java.util.Vector();
- for(int i = endpoints.size(); i > 0; --i)
- {
- if(((Endpoint)endpoints.elementAt(i - 1)).secure())
- {
- secureEndpoints.addElement(endpoints.elementAt(i - 1));
- endpoints.removeElementAt(i - 1);
- }
- }
+ for(int i = endpoints.size(); i > 0; --i)
+ {
+ if(((Endpoint)endpoints.elementAt(i - 1)).secure())
+ {
+ secureEndpoints.addElement(endpoints.elementAt(i - 1));
+ endpoints.removeElementAt(i - 1);
+ }
+ }
if(getSecure())
{
endpoints = secureEndpoints;
}
else
{
- java.util.Enumeration e = secureEndpoints.elements();
- while(e.hasMoreElements())
- {
- endpoints.addElement(e.nextElement());
- }
+ java.util.Enumeration e = secureEndpoints.elements();
+ while(e.hasMoreElements())
+ {
+ endpoints.addElement(e.nextElement());
+ }
}
}
else if(endpoints.size() == 1)
@@ -610,7 +610,7 @@ public abstract class Reference
// Copy the endpoints into an array.
//
Endpoint[] arr = new Endpoint[endpoints.size()];
- endpoints.copyInto(arr);
+ endpoints.copyInto(arr);
return arr;
}
diff --git a/javae/src/IceInternal/ReferenceFactory.java b/javae/src/IceInternal/ReferenceFactory.java
index 55871d2a857..e653242f7fd 100644
--- a/javae/src/IceInternal/ReferenceFactory.java
+++ b/javae/src/IceInternal/ReferenceFactory.java
@@ -16,7 +16,7 @@ public final class ReferenceFactory
java.util.Hashtable context,
String facet,
int mode,
- boolean secure,
+ boolean secure,
Endpoint[] endpoints,
RouterInfo routerInfo)
{
@@ -42,10 +42,10 @@ public final class ReferenceFactory
java.util.Hashtable context,
String facet,
int mode,
- boolean secure,
+ boolean secure,
String adapterId,
RouterInfo routerInfo,
- LocatorInfo locatorInfo)
+ LocatorInfo locatorInfo)
{
if(_instance == null)
{
@@ -61,7 +61,7 @@ public final class ReferenceFactory
// Create new reference
//
return new IndirectReference(_instance, _communicator, ident, context, facet, mode, secure, adapterId,
- routerInfo, locatorInfo);
+ routerInfo, locatorInfo);
}
public synchronized Reference
@@ -69,7 +69,7 @@ public final class ReferenceFactory
java.util.Hashtable context,
String facet,
int mode,
- Ice.Connection[] fixedConnections)
+ Ice.Connection[] fixedConnections)
{
if(_instance == null)
{
@@ -91,16 +91,16 @@ public final class ReferenceFactory
copy(Reference r)
{
if(_instance == null)
- {
- throw new Ice.CommunicatorDestroyedException();
- }
-
- Ice.Identity ident = r.getIdentity();
- if(ident.name.length() == 0 && ident.category.length() == 0)
- {
- return null;
- }
- return (Reference)r.ice_clone();
+ {
+ throw new Ice.CommunicatorDestroyedException();
+ }
+
+ Ice.Identity ident = r.getIdentity();
+ if(ident.name.length() == 0 && ident.category.length() == 0)
+ {
+ return null;
+ }
+ return (Reference)r.ice_clone();
}
public Reference
@@ -120,8 +120,8 @@ public final class ReferenceFactory
if(beg == -1)
{
Ice.ProxyParseException e = new Ice.ProxyParseException();
- e.str = s;
- throw e;
+ e.str = s;
+ throw e;
}
//
@@ -133,8 +133,8 @@ public final class ReferenceFactory
if(end == -1)
{
Ice.ProxyParseException e = new Ice.ProxyParseException();
- e.str = s;
- throw e;
+ e.str = s;
+ throw e;
}
else if(end == 0)
{
@@ -155,8 +155,8 @@ public final class ReferenceFactory
if(beg == end)
{
Ice.ProxyParseException e = new Ice.ProxyParseException();
- e.str = s;
- throw e;
+ e.str = s;
+ throw e;
}
//
@@ -164,7 +164,7 @@ public final class ReferenceFactory
//
Ice.Identity ident = _instance.stringToIdentity(idstr);
- IceUtil.Debug.Assert(ident.name != null);
+ IceUtil.Debug.Assert(ident.name != null);
if(ident.name.length() == 0)
{
//
@@ -197,8 +197,8 @@ public final class ReferenceFactory
String facet = "";
int mode = Reference.ModeTwoway;
- boolean secure = false;
- String adapter = "";
+ boolean secure = false;
+ String adapter = "";
while(true)
{
@@ -228,8 +228,8 @@ public final class ReferenceFactory
if(option.length() != 2 || option.charAt(0) != '-')
{
Ice.ProxyParseException e = new Ice.ProxyParseException();
- e.str = s;
- throw e;
+ e.str = s;
+ throw e;
}
//
@@ -249,8 +249,8 @@ public final class ReferenceFactory
if(end == -1)
{
Ice.ProxyParseException e = new Ice.ProxyParseException();
- e.str = s;
- throw e;
+ e.str = s;
+ throw e;
}
else if(end == 0)
{
@@ -281,16 +281,16 @@ public final class ReferenceFactory
if(argument == null)
{
Ice.ProxyParseException e = new Ice.ProxyParseException();
- e.str = s;
- throw e;
+ e.str = s;
+ throw e;
}
Ice.StringHolder facetH = new Ice.StringHolder();
if(!IceUtil.StringUtil.unescapeString(argument, 0, argument.length(), facetH))
{
Ice.ProxyParseException e = new Ice.ProxyParseException();
- e.str = s;
- throw e;
+ e.str = s;
+ throw e;
}
facet = facetH.value;
@@ -302,8 +302,8 @@ public final class ReferenceFactory
if(argument != null)
{
Ice.ProxyParseException e = new Ice.ProxyParseException();
- e.str = s;
- throw e;
+ e.str = s;
+ throw e;
}
mode = Reference.ModeTwoway;
break;
@@ -314,8 +314,8 @@ public final class ReferenceFactory
if(argument != null)
{
Ice.ProxyParseException e = new Ice.ProxyParseException();
- e.str = s;
- throw e;
+ e.str = s;
+ throw e;
}
mode = Reference.ModeOneway;
break;
@@ -326,8 +326,8 @@ public final class ReferenceFactory
if(argument != null)
{
Ice.ProxyParseException e = new Ice.ProxyParseException();
- e.str = s;
- throw e;
+ e.str = s;
+ throw e;
}
mode = Reference.ModeBatchOneway;
break;
@@ -338,8 +338,8 @@ public final class ReferenceFactory
if(argument != null)
{
Ice.ProxyParseException e = new Ice.ProxyParseException();
- e.str = s;
- throw e;
+ e.str = s;
+ throw e;
}
mode = Reference.ModeDatagram;
break;
@@ -350,8 +350,8 @@ public final class ReferenceFactory
if(argument != null)
{
Ice.ProxyParseException e = new Ice.ProxyParseException();
- e.str = s;
- throw e;
+ e.str = s;
+ throw e;
}
mode = Reference.ModeBatchDatagram;
break;
@@ -362,8 +362,8 @@ public final class ReferenceFactory
if(argument != null)
{
Ice.ProxyParseException e = new Ice.ProxyParseException();
- e.str = s;
- throw e;
+ e.str = s;
+ throw e;
}
secure = true;
break;
@@ -372,103 +372,103 @@ public final class ReferenceFactory
default:
{
Ice.ProxyParseException e = new Ice.ProxyParseException();
- e.str = s;
- throw e;
+ e.str = s;
+ throw e;
}
}
}
- RouterInfo routerInfo = _instance.routerManager().get(getDefaultRouter());
- LocatorInfo locatorInfo = _instance.locatorManager().get(getDefaultLocator());
+ RouterInfo routerInfo = _instance.routerManager().get(getDefaultRouter());
+ LocatorInfo locatorInfo = _instance.locatorManager().get(getDefaultLocator());
- if(beg == -1)
- {
- return create(ident, null, facet, mode, secure, "", routerInfo, locatorInfo);
- }
+ if(beg == -1)
+ {
+ return create(ident, null, facet, mode, secure, "", routerInfo, locatorInfo);
+ }
java.util.Vector endpoints = new java.util.Vector();
- if(s.charAt(beg) == ':')
- {
- java.util.Vector unknownEndpoints = new java.util.Vector();
- end = beg;
-
- while(end < s.length() && s.charAt(end) == ':')
- {
- beg = end + 1;
-
- end = s.indexOf(':', beg);
- if(end == -1)
- {
- end = s.length();
- }
-
- String es = s.substring(beg, end);
- Endpoint endp = _instance.endpointFactory().create(es);
- if(endp != null)
- {
- endpoints.addElement(endp);
- }
- else
- {
- unknownEndpoints.addElement(es);
- }
- }
- if(endpoints.size() == 0)
- {
- Ice.EndpointParseException e = new Ice.EndpointParseException();
- e.str = (String)unknownEndpoints.elementAt(0);
- throw e;
- }
- else if(unknownEndpoints.size() != 0 &&
- _instance.initializationData().properties.getPropertyAsIntWithDefault("Ice.Warn.Endpoints", 1) > 0)
- {
- String msg = "Proxy contains unknown endpoints:";
- java.util.Enumeration e = unknownEndpoints.elements();
- while(e.hasMoreElements())
- {
- msg += " `" + (String)e.nextElement() + "'";
- }
- _instance.initializationData().logger.warning(msg);
- }
-
- Endpoint[] endp = new Endpoint[endpoints.size()];
- endpoints.copyInto(endp);
- return create(ident, null, facet, mode, secure, endp, routerInfo);
- }
- else if(s.charAt(beg) == '@')
- {
- beg = IceUtil.StringUtil.findFirstNotOf(s, delim, beg + 1);
- if(beg == -1)
- {
- Ice.ProxyParseException e = new Ice.ProxyParseException();
- e.str = s;
- throw e;
- }
+ if(s.charAt(beg) == ':')
+ {
+ java.util.Vector unknownEndpoints = new java.util.Vector();
+ end = beg;
+
+ while(end < s.length() && s.charAt(end) == ':')
+ {
+ beg = end + 1;
+
+ end = s.indexOf(':', beg);
+ if(end == -1)
+ {
+ end = s.length();
+ }
+
+ String es = s.substring(beg, end);
+ Endpoint endp = _instance.endpointFactory().create(es);
+ if(endp != null)
+ {
+ endpoints.addElement(endp);
+ }
+ else
+ {
+ unknownEndpoints.addElement(es);
+ }
+ }
+ if(endpoints.size() == 0)
+ {
+ Ice.EndpointParseException e = new Ice.EndpointParseException();
+ e.str = (String)unknownEndpoints.elementAt(0);
+ throw e;
+ }
+ else if(unknownEndpoints.size() != 0 &&
+ _instance.initializationData().properties.getPropertyAsIntWithDefault("Ice.Warn.Endpoints", 1) > 0)
+ {
+ String msg = "Proxy contains unknown endpoints:";
+ java.util.Enumeration e = unknownEndpoints.elements();
+ while(e.hasMoreElements())
+ {
+ msg += " `" + (String)e.nextElement() + "'";
+ }
+ _instance.initializationData().logger.warning(msg);
+ }
+
+ Endpoint[] endp = new Endpoint[endpoints.size()];
+ endpoints.copyInto(endp);
+ return create(ident, null, facet, mode, secure, endp, routerInfo);
+ }
+ else if(s.charAt(beg) == '@')
+ {
+ beg = IceUtil.StringUtil.findFirstNotOf(s, delim, beg + 1);
+ if(beg == -1)
+ {
+ Ice.ProxyParseException e = new Ice.ProxyParseException();
+ e.str = s;
+ throw e;
+ }
String adapterstr = null;
- end = IceUtil.StringUtil.checkQuote(s, beg);
- if(end == -1)
- {
- Ice.ProxyParseException e = new Ice.ProxyParseException();
- e.str = s;
- throw e;
- }
- else if(end == 0)
- {
- end = IceUtil.StringUtil.findFirstOf(s, delim, beg);
- if(end == -1)
- {
- end = s.length();
- }
+ end = IceUtil.StringUtil.checkQuote(s, beg);
+ if(end == -1)
+ {
+ Ice.ProxyParseException e = new Ice.ProxyParseException();
+ e.str = s;
+ throw e;
+ }
+ else if(end == 0)
+ {
+ end = IceUtil.StringUtil.findFirstOf(s, delim, beg);
+ if(end == -1)
+ {
+ end = s.length();
+ }
adapterstr = s.substring(beg, end);
- }
- else
- {
- beg++; // Skip leading quote
+ }
+ else
+ {
+ beg++; // Skip leading quote
adapterstr = s.substring(beg, end);
end++; // Skip trailing quote
- }
+ }
if(end != s.length() && IceUtil.StringUtil.findFirstNotOf(s, delim, end) != -1)
{
@@ -477,21 +477,21 @@ public final class ReferenceFactory
throw e;
}
- Ice.StringHolder token = new Ice.StringHolder();
+ Ice.StringHolder token = new Ice.StringHolder();
if(!IceUtil.StringUtil.unescapeString(adapterstr, 0, adapterstr.length(), token) ||
token.value.length() == 0)
- {
- Ice.ProxyParseException e = new Ice.ProxyParseException();
- e.str = s;
- throw e;
- }
- adapter = token.value;
- return create(ident, null, facet, mode, secure, adapter, routerInfo, locatorInfo);
- }
-
- Ice.ProxyParseException ex = new Ice.ProxyParseException();
- ex.str = s;
- throw ex;
+ {
+ Ice.ProxyParseException e = new Ice.ProxyParseException();
+ e.str = s;
+ throw e;
+ }
+ adapter = token.value;
+ return create(ident, null, facet, mode, secure, adapter, routerInfo, locatorInfo);
+ }
+
+ Ice.ProxyParseException ex = new Ice.ProxyParseException();
+ ex.str = s;
+ throw ex;
}
public Reference
@@ -555,16 +555,16 @@ public final class ReferenceFactory
String facet;
if(facetPath.length > 0)
{
- if(facetPath.length > 1)
- {
- Ice.Util.throwProxyUnmarshalException();
- }
+ if(facetPath.length > 1)
+ {
+ Ice.Util.throwProxyUnmarshalException();
+ }
facet = facetPath[0];
}
- else
+ else
{
- facet = "";
- }
+ facet = "";
+ }
int mode = (int)s.readByte();
if(mode < 0 || mode > Reference.ModeLast)
@@ -572,30 +572,30 @@ public final class ReferenceFactory
Ice.Util.throwProxyUnmarshalException();
}
- boolean secure = s.readBool();
+ boolean secure = s.readBool();
Endpoint[] endpoints;
- String adapterId = "";
+ String adapterId = "";
RouterInfo routerInfo = _instance.routerManager().get(getDefaultRouter());
LocatorInfo locatorInfo = _instance.locatorManager().get(getDefaultLocator());
int sz = s.readSize();
- if(sz > 0)
- {
- endpoints = new Endpoint[sz];
- for(int i = 0; i < sz; i++)
- {
- endpoints[i] = _instance.endpointFactory().read(s);
- }
- return create(ident, null, facet, mode, secure, endpoints, routerInfo);
- }
- else
- {
- endpoints = new Endpoint[0];
- adapterId = s.readString();
- return create(ident, null, facet, mode, secure, adapterId, routerInfo, locatorInfo);
- }
+ if(sz > 0)
+ {
+ endpoints = new Endpoint[sz];
+ for(int i = 0; i < sz; i++)
+ {
+ endpoints[i] = _instance.endpointFactory().read(s);
+ }
+ return create(ident, null, facet, mode, secure, endpoints, routerInfo);
+ }
+ else
+ {
+ endpoints = new Endpoint[0];
+ adapterId = s.readString();
+ return create(ident, null, facet, mode, secure, adapterId, routerInfo, locatorInfo);
+ }
}
public synchronized void
@@ -628,7 +628,7 @@ public final class ReferenceFactory
ReferenceFactory(Instance instance, Ice.Communicator communicator)
{
_instance = instance;
- _communicator = communicator;
+ _communicator = communicator;
}
synchronized void
@@ -640,7 +640,7 @@ public final class ReferenceFactory
}
_instance = null;
- _communicator = null;
+ _communicator = null;
_defaultRouter = null;
_defaultLocator = null;
}
diff --git a/javae/src/IceInternal/RoutableReference.java b/javae/src/IceInternal/RoutableReference.java
index c43eb8012e8..ddcbe95d574 100644
--- a/javae/src/IceInternal/RoutableReference.java
+++ b/javae/src/IceInternal/RoutableReference.java
@@ -21,27 +21,27 @@ public abstract class RoutableReference extends Reference
getRoutedEndpoints()
{
if(_routerInfo != null)
- {
- //
- // If we route, we send everything to the router's client
- // proxy endpoints.
- //
- return _routerInfo.getClientEndpoints();
- }
- return new Endpoint[0];
+ {
+ //
+ // If we route, we send everything to the router's client
+ // proxy endpoints.
+ //
+ return _routerInfo.getClientEndpoints();
+ }
+ return new Endpoint[0];
}
public Reference
changeRouter(Ice.RouterPrx newRouter)
{
RouterInfo newRouterInfo = getInstance().routerManager().get(newRouter);
- if(newRouterInfo != null && _routerInfo != null && newRouterInfo.equals(_routerInfo))
- {
- return this;
- }
- RoutableReference r = (RoutableReference)getInstance().referenceFactory().copy(this);
- r._routerInfo = newRouterInfo;
- return r;
+ if(newRouterInfo != null && _routerInfo != null && newRouterInfo.equals(_routerInfo))
+ {
+ return this;
+ }
+ RoutableReference r = (RoutableReference)getInstance().referenceFactory().copy(this);
+ r._routerInfo = newRouterInfo;
+ return r;
}
public synchronized int
@@ -53,45 +53,45 @@ public abstract class RoutableReference extends Reference
public boolean
equals(java.lang.Object obj)
{
- //
- // Note: if(this == obj) and type test are performed by each non-abstract derived class.
- //
+ //
+ // Note: if(this == obj) and type test are performed by each non-abstract derived class.
+ //
if(!super.equals(obj))
{
return false;
}
RoutableReference rhs = (RoutableReference)obj; // Guaranteed to succeed.
- return _routerInfo == null ? rhs._routerInfo == null : _routerInfo.equals(rhs._routerInfo);
+ return _routerInfo == null ? rhs._routerInfo == null : _routerInfo.equals(rhs._routerInfo);
}
protected
RoutableReference()
{
- //
- // Required for cloning operations.
- //
+ //
+ // Required for cloning operations.
+ //
}
protected void
shallowCopy(RoutableReference ref)
{
- super.shallowCopy(ref);
- ref._routerInfo = _routerInfo;
+ super.shallowCopy(ref);
+ ref._routerInfo = _routerInfo;
}
protected
RoutableReference(Instance inst,
- Ice.Communicator com,
- Ice.Identity ident,
+ Ice.Communicator com,
+ Ice.Identity ident,
java.util.Hashtable context,
- String fac,
- int md,
- boolean secure,
- RouterInfo rtrInfo)
+ String fac,
+ int md,
+ boolean secure,
+ RouterInfo rtrInfo)
{
super(inst, com, ident, context, fac, md, secure);
- _routerInfo = rtrInfo;
+ _routerInfo = rtrInfo;
}
private RouterInfo _routerInfo; // Null if no router is used.
diff --git a/javae/src/IceInternal/RouterInfo.java b/javae/src/IceInternal/RouterInfo.java
index a6ead423c6a..b3de67f34c9 100644
--- a/javae/src/IceInternal/RouterInfo.java
+++ b/javae/src/IceInternal/RouterInfo.java
@@ -16,35 +16,35 @@ public final class RouterInfo
_router = router;
_identities = new java.util.Hashtable();
- if(IceUtil.Debug.ASSERT)
- {
- IceUtil.Debug.Assert(_router != null);
- }
+ if(IceUtil.Debug.ASSERT)
+ {
+ IceUtil.Debug.Assert(_router != null);
+ }
}
synchronized public void
destroy()
{
- _clientEndpoints = new Endpoint[0];
+ _clientEndpoints = new Endpoint[0];
_serverEndpoints = new Endpoint[0];
- _adapter = null;
- _identities.clear();
+ _adapter = null;
+ _identities.clear();
}
public boolean
equals(java.lang.Object obj)
{
- if(this == obj)
- {
- return true;
- }
+ if(this == obj)
+ {
+ return true;
+ }
- if(obj instanceof RouterInfo)
- {
- return _router.equals(((RouterInfo)obj)._router);
- }
+ if(obj instanceof RouterInfo)
+ {
+ return _router.equals(((RouterInfo)obj)._router);
+ }
- return false;
+ return false;
}
public Ice.RouterPrx
diff --git a/javae/src/IceInternal/RouterManager.java b/javae/src/IceInternal/RouterManager.java
index 949c2b14e04..522e56749f6 100644
--- a/javae/src/IceInternal/RouterManager.java
+++ b/javae/src/IceInternal/RouterManager.java
@@ -18,7 +18,7 @@ public final class RouterManager
synchronized void
destroy()
{
- java.util.Enumeration e = _table.elements();
+ java.util.Enumeration e = _table.elements();
while(e.hasMoreElements())
{
RouterInfo info = (RouterInfo)e.nextElement();
@@ -57,18 +57,18 @@ public final class RouterManager
public RouterInfo
erase(Ice.RouterPrx rtr)
{
- RouterInfo info = null;
- if(rtr != null)
- {
- // The router cannot be routed.
- Ice.RouterPrx router = Ice.RouterPrxHelper.uncheckedCast(rtr.ice_router(null));
+ RouterInfo info = null;
+ if(rtr != null)
+ {
+ // The router cannot be routed.
+ Ice.RouterPrx router = Ice.RouterPrxHelper.uncheckedCast(rtr.ice_router(null));
- synchronized(this)
- {
- info = (RouterInfo)_table.remove(router);
- }
- }
- return info;
+ synchronized(this)
+ {
+ info = (RouterInfo)_table.remove(router);
+ }
+ }
+ return info;
}
private java.util.Hashtable _table = new java.util.Hashtable();
diff --git a/javae/src/IceInternal/ServantManager.java b/javae/src/IceInternal/ServantManager.java
index e8b19246bf7..2d4deeb22d3 100644
--- a/javae/src/IceInternal/ServantManager.java
+++ b/javae/src/IceInternal/ServantManager.java
@@ -14,10 +14,10 @@ public final class ServantManager
public synchronized void
addServant(Ice.Object servant, Ice.Identity ident, String facet)
{
- if(IceUtil.Debug.ASSERT)
- {
- IceUtil.Debug.Assert(_instance != null); // Must not be called after destruction.
- }
+ if(IceUtil.Debug.ASSERT)
+ {
+ IceUtil.Debug.Assert(_instance != null); // Must not be called after destruction.
+ }
if(facet == null)
{
@@ -51,10 +51,10 @@ public final class ServantManager
public synchronized Ice.Object
removeServant(Ice.Identity ident, String facet)
{
- if(IceUtil.Debug.ASSERT)
- {
- IceUtil.Debug.Assert(_instance != null); // Must not be called after destruction.
- }
+ if(IceUtil.Debug.ASSERT)
+ {
+ IceUtil.Debug.Assert(_instance != null); // Must not be called after destruction.
+ }
if(facet == null)
{
@@ -64,42 +64,42 @@ public final class ServantManager
java.util.Hashtable m = (java.util.Hashtable)_servantMapMap.get(ident);
Ice.Object obj = null;
if(m == null || (obj = (Ice.Object)m.remove(facet)) == null)
- {
- Ice.NotRegisteredException ex = new Ice.NotRegisteredException();
- ex.id = _instance.identityToString(ident);
- ex.kindOfObject = "servant";
+ {
+ Ice.NotRegisteredException ex = new Ice.NotRegisteredException();
+ ex.id = _instance.identityToString(ident);
+ ex.kindOfObject = "servant";
if(facet.length() > 0)
{
ex.id += " -f " + IceUtil.StringUtil.escapeString(facet, "");
}
- throw ex;
- }
+ throw ex;
+ }
if(m.isEmpty())
{
_servantMapMap.remove(ident);
}
- return obj;
+ return obj;
}
public synchronized java.util.Hashtable
removeAllFacets(Ice.Identity ident)
{
- if(IceUtil.Debug.ASSERT)
- {
- IceUtil.Debug.Assert(_instance != null); // Must not be called after destruction.
- }
+ if(IceUtil.Debug.ASSERT)
+ {
+ IceUtil.Debug.Assert(_instance != null); // Must not be called after destruction.
+ }
java.util.Hashtable m = (java.util.Hashtable)_servantMapMap.get(ident);
if(m == null)
- {
- Ice.NotRegisteredException ex = new Ice.NotRegisteredException();
- ex.id = _instance.identityToString(ident);
- ex.kindOfObject = "servant";
- throw ex;
- }
+ {
+ Ice.NotRegisteredException ex = new Ice.NotRegisteredException();
+ ex.id = _instance.identityToString(ident);
+ ex.kindOfObject = "servant";
+ throw ex;
+ }
- _servantMapMap.remove(ident);
+ _servantMapMap.remove(ident);
return m;
}
@@ -107,16 +107,16 @@ public final class ServantManager
public synchronized Ice.Object
findServant(Ice.Identity ident, String facet)
{
- //
- // This assert is not valid if the adapter dispatch incoming
- // requests from bidir connections. This method might be called if
- // requests are received over the bidir connection after the
- // adapter was deactivated.
- //
- //if(IceUtil.Debug.ASSERT)
- //{
- // IceUtil.Debug.Assert(_instance != null); // Must not be called after destruction.
- //}
+ //
+ // This assert is not valid if the adapter dispatch incoming
+ // requests from bidir connections. This method might be called if
+ // requests are received over the bidir connection after the
+ // adapter was deactivated.
+ //
+ //if(IceUtil.Debug.ASSERT)
+ //{
+ // IceUtil.Debug.Assert(_instance != null); // Must not be called after destruction.
+ //}
if(facet == null)
{
@@ -136,23 +136,23 @@ public final class ServantManager
public synchronized java.util.Hashtable
findAllFacets(Ice.Identity ident)
{
- if(IceUtil.Debug.ASSERT)
- {
- IceUtil.Debug.Assert(_instance != null); // Must not be called after destruction.
- }
+ if(IceUtil.Debug.ASSERT)
+ {
+ IceUtil.Debug.Assert(_instance != null); // Must not be called after destruction.
+ }
java.util.Hashtable m = (java.util.Hashtable)_servantMapMap.get(ident);
if(m != null)
{
- java.util.Hashtable result = new java.util.Hashtable(m.size());
- java.util.Enumeration e = m.keys();
- while(e.hasMoreElements())
- {
- java.lang.Object key = e.nextElement();
- java.lang.Object value = m.get(key);
- result.put(key, value);
- }
- return result;
+ java.util.Hashtable result = new java.util.Hashtable(m.size());
+ java.util.Enumeration e = m.keys();
+ while(e.hasMoreElements())
+ {
+ java.lang.Object key = e.nextElement();
+ java.lang.Object value = m.get(key);
+ result.put(key, value);
+ }
+ return result;
}
return new java.util.Hashtable();
@@ -161,16 +161,16 @@ public final class ServantManager
public synchronized boolean
hasServant(Ice.Identity ident)
{
- //
- // This assert is not valid if the adapter dispatch incoming
- // requests from bidir connections. This method might be called if
- // requests are received over the bidir connection after the
- // adapter was deactivated.
- //
- //if(IceUtil.Debug.ASSERT)
- //{
- // IceUtil.Debug.Assert(_instance != null); // Must not be called after destruction.
- //}
+ //
+ // This assert is not valid if the adapter dispatch incoming
+ // requests from bidir connections. This method might be called if
+ // requests are received over the bidir connection after the
+ // adapter was deactivated.
+ //
+ //if(IceUtil.Debug.ASSERT)
+ //{
+ // IceUtil.Debug.Assert(_instance != null); // Must not be called after destruction.
+ //}
java.util.Hashtable m = (java.util.Hashtable)_servantMapMap.get(ident);
if(m == null)
@@ -179,10 +179,10 @@ public final class ServantManager
}
else
{
- if(IceUtil.Debug.ASSERT)
- {
- IceUtil.Debug.Assert(!m.isEmpty());
- }
+ if(IceUtil.Debug.ASSERT)
+ {
+ IceUtil.Debug.Assert(!m.isEmpty());
+ }
return true;
}
}
@@ -193,20 +193,20 @@ public final class ServantManager
public
ServantManager(Instance instance, String adapterName)
{
- _instance = instance;
- _adapterName = adapterName;
+ _instance = instance;
+ _adapterName = adapterName;
}
protected void
finalize()
throws Throwable
{
- //
- // Don't check whether destroy() has been called. It might have
- // not been called if the associated object adapter was not
- // properly deactivated.
- //
- //IceUtil.Debug.FinalizerAssert(_instance == null);
+ //
+ // Don't check whether destroy() has been called. It might have
+ // not been called if the associated object adapter was not
+ // properly deactivated.
+ //
+ //IceUtil.Debug.FinalizerAssert(_instance == null);
}
//
@@ -215,13 +215,13 @@ public final class ServantManager
public synchronized void
destroy()
{
- if(IceUtil.Debug.ASSERT)
- {
- IceUtil.Debug.Assert(_instance != null); // Must not be called after destruction.
- }
+ if(IceUtil.Debug.ASSERT)
+ {
+ IceUtil.Debug.Assert(_instance != null); // Must not be called after destruction.
+ }
- _servantMapMap.clear();
- _instance = null;
+ _servantMapMap.clear();
+ _instance = null;
}
private Instance _instance;
diff --git a/javae/src/IceInternal/TraceLevels.java b/javae/src/IceInternal/TraceLevels.java
index 018c6b49df4..847258c6180 100644
--- a/javae/src/IceInternal/TraceLevels.java
+++ b/javae/src/IceInternal/TraceLevels.java
@@ -16,16 +16,16 @@ public final class TraceLevels
networkCat = "Network";
protocolCat = "Protocol";
retryCat = "Retry";
- locationCat = "Locator";
- slicingCat = "Slicing";
+ locationCat = "Locator";
+ slicingCat = "Slicing";
final String keyBase = "Ice.Trace.";
network = properties.getPropertyAsInt(keyBase + networkCat);
- protocol = properties.getPropertyAsInt(keyBase + protocolCat);
+ protocol = properties.getPropertyAsInt(keyBase + protocolCat);
retry = properties.getPropertyAsInt(keyBase + retryCat);
- location = properties.getPropertyAsInt(keyBase + locationCat);
- slicing = properties.getPropertyAsInt(keyBase + slicingCat);
+ location = properties.getPropertyAsInt(keyBase + locationCat);
+ slicing = properties.getPropertyAsInt(keyBase + slicingCat);
}
final public int network;
diff --git a/javae/src/IceInternal/TraceUtil.java b/javae/src/IceInternal/TraceUtil.java
index 0e83e135486..e5134785420 100644
--- a/javae/src/IceInternal/TraceUtil.java
+++ b/javae/src/IceInternal/TraceUtil.java
@@ -19,8 +19,8 @@ public final class TraceUtil
int p = str.pos();
str.pos(0);
- java.io.OutputStream os = new java.io.ByteArrayOutputStream();
- java.io.PrintStream ps = new java.io.PrintStream(os);
+ java.io.OutputStream os = new java.io.ByteArrayOutputStream();
+ java.io.PrintStream ps = new java.io.PrintStream(os);
ps.print(heading);
printHeader(ps, str);
@@ -37,8 +37,8 @@ public final class TraceUtil
int p = str.pos();
str.pos(0);
- java.io.OutputStream os = new java.io.ByteArrayOutputStream();
- java.io.PrintStream ps = new java.io.PrintStream(os);
+ java.io.OutputStream os = new java.io.ByteArrayOutputStream();
+ java.io.PrintStream ps = new java.io.PrintStream(os);
ps.print(heading);
printHeader(ps, str);
@@ -63,15 +63,15 @@ public final class TraceUtil
int p = str.pos();
str.pos(0);
- java.io.OutputStream os = new java.io.ByteArrayOutputStream();
- java.io.PrintStream ps = new java.io.PrintStream(os);
+ java.io.OutputStream os = new java.io.ByteArrayOutputStream();
+ java.io.PrintStream ps = new java.io.PrintStream(os);
ps.print(heading);
printHeader(ps, str);
int batchRequestNum = str.readInt();
- ps.print("\nnumber of requests = " + batchRequestNum);
-
- for(int i = 0; i < batchRequestNum; ++i)
+ ps.print("\nnumber of requests = " + batchRequestNum);
+
+ for(int i = 0; i < batchRequestNum; ++i)
{
ps.print("\nrequest #" + i + ':');
printRequestHeader(ps, str);
@@ -91,8 +91,8 @@ public final class TraceUtil
int p = str.pos();
str.pos(0);
- java.io.OutputStream os = new java.io.ByteArrayOutputStream();
- java.io.PrintStream ps = new java.io.PrintStream(os);
+ java.io.OutputStream os = new java.io.ByteArrayOutputStream();
+ java.io.PrintStream ps = new java.io.PrintStream(os);
ps.print(heading);
printHeader(ps, str);
@@ -120,78 +120,78 @@ public final class TraceUtil
case ReplyStatus.replyFacetNotExist:
case ReplyStatus.replyOperationNotExist:
{
- switch(replyStatus)
- {
- case ReplyStatus.replyObjectNotExist:
- {
- ps.print("(object not exist)");
- break;
- }
-
- case ReplyStatus.replyFacetNotExist:
- {
- ps.print("(facet not exist)");
- break;
- }
-
- case ReplyStatus.replyOperationNotExist:
- {
- ps.print("(operation not exist)");
- break;
- }
-
- default:
- {
- if(IceUtil.Debug.ASSERT)
- {
- IceUtil.Debug.Assert(false);
- }
- break;
- }
- }
-
- printIdentityFacetOperation(ps, str);
- break;
+ switch(replyStatus)
+ {
+ case ReplyStatus.replyObjectNotExist:
+ {
+ ps.print("(object not exist)");
+ break;
+ }
+
+ case ReplyStatus.replyFacetNotExist:
+ {
+ ps.print("(facet not exist)");
+ break;
+ }
+
+ case ReplyStatus.replyOperationNotExist:
+ {
+ ps.print("(operation not exist)");
+ break;
+ }
+
+ default:
+ {
+ if(IceUtil.Debug.ASSERT)
+ {
+ IceUtil.Debug.Assert(false);
+ }
+ break;
+ }
+ }
+
+ printIdentityFacetOperation(ps, str);
+ break;
}
- case ReplyStatus.replyUnknownException:
- case ReplyStatus.replyUnknownLocalException:
- case ReplyStatus.replyUnknownUserException:
- {
- switch(replyStatus)
- {
- case ReplyStatus.replyUnknownException:
- {
- ps.print("(unknown exception)");
- break;
- }
-
- case ReplyStatus.replyUnknownLocalException:
- {
- ps.print("(unknown local exception)");
- break;
- }
-
- case ReplyStatus.replyUnknownUserException:
- {
- ps.print("(unknown user exception)");
- break;
- }
-
- default:
- {
- if(IceUtil.Debug.ASSERT)
- {
- IceUtil.Debug.Assert(false);
- }
- break;
- }
- }
-
- String unknown = str.readString();
- ps.print("\nunknown = " + unknown);
- break;
- }
+ case ReplyStatus.replyUnknownException:
+ case ReplyStatus.replyUnknownLocalException:
+ case ReplyStatus.replyUnknownUserException:
+ {
+ switch(replyStatus)
+ {
+ case ReplyStatus.replyUnknownException:
+ {
+ ps.print("(unknown exception)");
+ break;
+ }
+
+ case ReplyStatus.replyUnknownLocalException:
+ {
+ ps.print("(unknown local exception)");
+ break;
+ }
+
+ case ReplyStatus.replyUnknownUserException:
+ {
+ ps.print("(unknown user exception)");
+ break;
+ }
+
+ default:
+ {
+ if(IceUtil.Debug.ASSERT)
+ {
+ IceUtil.Debug.Assert(false);
+ }
+ break;
+ }
+ }
+
+ String unknown = str.readString();
+ ps.print("\nunknown = " + unknown);
+ break;
+ }
default:
{
@@ -277,157 +277,157 @@ public final class TraceUtil
private static void
printIdentityFacetOperation(java.io.PrintStream out, BasicStream stream)
{
- Ice.Identity identity = new Ice.Identity();
- identity.__read(stream);
- out.print("\nidentity = " + stream.instance().identityToString(identity));
-
- String[] facet = stream.readStringSeq();
- out.print("\nfacet = ");
- if(facet.length > 0)
- {
- out.print(IceUtil.StringUtil.escapeString(facet[0], ""));
- }
-
- String operation = stream.readString();
- out.print("\noperation = " + operation);
+ Ice.Identity identity = new Ice.Identity();
+ identity.__read(stream);
+ out.print("\nidentity = " + stream.instance().identityToString(identity));
+
+ String[] facet = stream.readStringSeq();
+ out.print("\nfacet = ");
+ if(facet.length > 0)
+ {
+ out.print(IceUtil.StringUtil.escapeString(facet[0], ""));
+ }
+
+ String operation = stream.readString();
+ out.print("\noperation = " + operation);
}
private static void
printRequestHeader(java.io.PrintStream out, BasicStream stream)
{
- printIdentityFacetOperation(out, stream);
-
- byte mode = stream.readByte();
- out.print("\nmode = " + (int)mode + ' ');
- switch(mode)
- {
- case Ice.OperationMode._Normal:
- {
- out.print("(normal)");
- break;
- }
-
- case Ice.OperationMode._Nonmutating:
- {
- out.print("(nonmutating)");
- break;
- }
-
- case Ice.OperationMode._Idempotent:
- {
- out.print("(idempotent)");
- break;
- }
-
- default:
- {
- out.print("(unknown)");
- break;
- }
- }
-
- int sz = stream.readSize();
- out.print("\ncontext = ");
- while(sz-- > 0)
- {
- String key = stream.readString();
- String value = stream.readString();
- out.print(key + '/'+ value);
- if(sz > 0)
- {
- out.print(", ");
- }
- }
+ printIdentityFacetOperation(out, stream);
+
+ byte mode = stream.readByte();
+ out.print("\nmode = " + (int)mode + ' ');
+ switch(mode)
+ {
+ case Ice.OperationMode._Normal:
+ {
+ out.print("(normal)");
+ break;
+ }
+
+ case Ice.OperationMode._Nonmutating:
+ {
+ out.print("(nonmutating)");
+ break;
+ }
+
+ case Ice.OperationMode._Idempotent:
+ {
+ out.print("(idempotent)");
+ break;
+ }
+
+ default:
+ {
+ out.print("(unknown)");
+ break;
+ }
+ }
+
+ int sz = stream.readSize();
+ out.print("\ncontext = ");
+ while(sz-- > 0)
+ {
+ String key = stream.readString();
+ String value = stream.readString();
+ out.print(key + '/'+ value);
+ if(sz > 0)
+ {
+ out.print(", ");
+ }
+ }
}
private static void
printHeader(java.io.PrintStream out, BasicStream stream)
{
- byte magic;
- magic = stream.readByte(); // Don't bother printing the magic number
- magic = stream.readByte();
- magic = stream.readByte();
- magic = stream.readByte();
-
- byte pMajor = stream.readByte();
- byte pMinor = stream.readByte();
+ byte magic;
+ magic = stream.readByte(); // Don't bother printing the magic number
+ magic = stream.readByte();
+ magic = stream.readByte();
+ magic = stream.readByte();
+
+ byte pMajor = stream.readByte();
+ byte pMinor = stream.readByte();
// out.print("\nprotocol version = " + (int)pMajor + "." + (int)pMinor);
- byte eMajor = stream.readByte();
- byte eMinor = stream.readByte();
+ byte eMajor = stream.readByte();
+ byte eMinor = stream.readByte();
// out.print("\nencoding version = " + (int)eMajor + "." + (int)eMinor);
- byte type = stream.readByte();
- out.print("\nmessage type = " + (int)type + ' ');
- switch(type)
- {
- case Protocol.requestMsg:
- {
- out.print("(request)");
- break;
- }
-
- case Protocol.requestBatchMsg:
- {
- out.print("(batch request)");
- break;
- }
-
- case Protocol.replyMsg:
- {
- out.print("(reply)");
- break;
- }
-
- case Protocol.closeConnectionMsg:
- {
- out.print("(close connection)");
- break;
- }
-
- case Protocol.validateConnectionMsg:
- {
- out.print("(validate connection)");
- break;
- }
-
- default:
- {
- out.print("(unknown)");
- break;
- }
- }
-
- byte compress = stream.readByte();
- out.print("\ncompression status = " + (int)compress + ' ');
- switch(compress)
- {
- case (byte)0:
- {
- out.print("(not compressed; do not compress response, if any)");
- break;
- }
-
- case (byte)1:
- {
- out.print("(not compressed; compress response, if any)");
- break;
- }
-
- case (byte)2:
- {
- out.print("(compressed; compress response, if any)");
- break;
- }
-
- default:
- {
- out.print("(unknown)");
- break;
- }
- }
-
- int size = stream.readInt();
- out.print("\nmessage size = " + size);
+ byte type = stream.readByte();
+ out.print("\nmessage type = " + (int)type + ' ');
+ switch(type)
+ {
+ case Protocol.requestMsg:
+ {
+ out.print("(request)");
+ break;
+ }
+
+ case Protocol.requestBatchMsg:
+ {
+ out.print("(batch request)");
+ break;
+ }
+
+ case Protocol.replyMsg:
+ {
+ out.print("(reply)");
+ break;
+ }
+
+ case Protocol.closeConnectionMsg:
+ {
+ out.print("(close connection)");
+ break;
+ }
+
+ case Protocol.validateConnectionMsg:
+ {
+ out.print("(validate connection)");
+ break;
+ }
+
+ default:
+ {
+ out.print("(unknown)");
+ break;
+ }
+ }
+
+ byte compress = stream.readByte();
+ out.print("\ncompression status = " + (int)compress + ' ');
+ switch(compress)
+ {
+ case (byte)0:
+ {
+ out.print("(not compressed; do not compress response, if any)");
+ break;
+ }
+
+ case (byte)1:
+ {
+ out.print("(not compressed; compress response, if any)");
+ break;
+ }
+
+ case (byte)2:
+ {
+ out.print("(compressed; compress response, if any)");
+ break;
+ }
+
+ default:
+ {
+ out.print("(unknown)");
+ break;
+ }
+ }
+
+ int size = stream.readInt();
+ out.print("\nmessage size = " + size);
}
}
diff --git a/javae/src/IceUtil/Arrays.java b/javae/src/IceUtil/Arrays.java
index bb241c83538..10e03f09ea7 100644
--- a/javae/src/IceUtil/Arrays.java
+++ b/javae/src/IceUtil/Arrays.java
@@ -14,331 +14,331 @@ public final class Arrays
public static int
search(Object[] array, Object item)
{
- //
- // TODO: Array is expected to be sorted so this would be better
- // implemented as a binary search.
- //
- for(int i = 0 ; i < array.length ; ++i)
- {
- if(array[i].equals(item))
- {
- return i;
- }
- }
- return -1;
+ //
+ // TODO: Array is expected to be sorted so this would be better
+ // implemented as a binary search.
+ //
+ for(int i = 0 ; i < array.length ; ++i)
+ {
+ if(array[i].equals(item))
+ {
+ return i;
+ }
+ }
+ return -1;
}
public static int
search(java.util.Vector vector, Object item)
{
- for(int i = 0 ; i < vector.size() ; ++i)
- {
- if(vector.elementAt(i).equals(item))
- {
- return i;
- }
- }
- return -1;
+ for(int i = 0 ; i < vector.size() ; ++i)
+ {
+ if(vector.elementAt(i).equals(item))
+ {
+ return i;
+ }
+ }
+ return -1;
}
public static void
sort(java.util.Vector vector)
{
- //
- // Bubble sort. This is only used to sequences of endpoints, which for embedded applications will be quite
- // short.
- //
- for(int i = 0; i < vector.size() ; ++i)
- {
- for(int j = 0; j < vector.size() -1 ; ++j)
- {
- if(((IceUtil.Comparable)vector.elementAt(j)).compareTo(vector.elementAt(j + 1)) > 0)
- {
- java.lang.Object t = vector.elementAt(j + 1);
- vector.setElementAt(vector.elementAt(j), j + 1);
- vector.setElementAt(t, j);
- }
- }
- }
+ //
+ // Bubble sort. This is only used to sequences of endpoints, which for embedded applications will be quite
+ // short.
+ //
+ for(int i = 0; i < vector.size() ; ++i)
+ {
+ for(int j = 0; j < vector.size() -1 ; ++j)
+ {
+ if(((IceUtil.Comparable)vector.elementAt(j)).compareTo(vector.elementAt(j + 1)) > 0)
+ {
+ java.lang.Object t = vector.elementAt(j + 1);
+ vector.setElementAt(vector.elementAt(j), j + 1);
+ vector.setElementAt(t, j);
+ }
+ }
+ }
}
public static boolean
equals(boolean[] a1, boolean[] a2)
{
- //
- // If they are both null then they are equal.
- //
- if(a1 == null && a2 == null)
- {
- return true;
- }
-
- //
- // If one of them is null but the other is not, then they are not equal. This validity of this 'if'
- // statement is order dependent on the previous 'if' statement.
- //
- if(a1 == null || a2 == null)
- {
- return false;
- }
-
- if(a1.length != a2.length)
- {
- return false;
- }
-
- for(int i = 0; i < a1.length; ++i)
- {
- if(a1[i] != a2[i])
- {
- return false;
- }
- }
- return true;
+ //
+ // If they are both null then they are equal.
+ //
+ if(a1 == null && a2 == null)
+ {
+ return true;
+ }
+
+ //
+ // If one of them is null but the other is not, then they are not equal. This validity of this 'if'
+ // statement is order dependent on the previous 'if' statement.
+ //
+ if(a1 == null || a2 == null)
+ {
+ return false;
+ }
+
+ if(a1.length != a2.length)
+ {
+ return false;
+ }
+
+ for(int i = 0; i < a1.length; ++i)
+ {
+ if(a1[i] != a2[i])
+ {
+ return false;
+ }
+ }
+ return true;
}
public static boolean
equals(byte[] a1, byte[] a2)
{
- //
- // If they are both null then they are equal.
- //
- if(a1 == null && a2 == null)
- {
- return true;
- }
-
- //
- // If one of them is null but the other is not, then they are not equal. This validity of this 'if'
- // statement is order dependent on the previous 'if' statement.
- //
- if(a1 == null || a2 == null)
- {
- return false;
- }
-
- if(a1.length != a2.length)
- {
- return false;
- }
-
- for(int i = 0; i < a1.length; ++i)
- {
- if(a1[i] != a2[i])
- {
- return false;
- }
- }
- return true;
+ //
+ // If they are both null then they are equal.
+ //
+ if(a1 == null && a2 == null)
+ {
+ return true;
+ }
+
+ //
+ // If one of them is null but the other is not, then they are not equal. This validity of this 'if'
+ // statement is order dependent on the previous 'if' statement.
+ //
+ if(a1 == null || a2 == null)
+ {
+ return false;
+ }
+
+ if(a1.length != a2.length)
+ {
+ return false;
+ }
+
+ for(int i = 0; i < a1.length; ++i)
+ {
+ if(a1[i] != a2[i])
+ {
+ return false;
+ }
+ }
+ return true;
}
public static boolean
equals(short[] a1, short[] a2)
{
- //
- // If they are both null then they are equal.
- //
- if(a1 == null && a2 == null)
- {
- return true;
- }
-
- //
- // If one of them is null but the other is not, then they are not equal. This validity of this 'if'
- // statement is order dependent on the previous 'if' statement.
- //
- if(a1 == null || a2 == null)
- {
- return false;
- }
-
- if(a1.length != a2.length)
- {
- return false;
- }
-
- for(int i = 0; i < a1.length; ++i)
- {
- if(a1[i] != a2[i])
- {
- return false;
- }
- }
- return true;
+ //
+ // If they are both null then they are equal.
+ //
+ if(a1 == null && a2 == null)
+ {
+ return true;
+ }
+
+ //
+ // If one of them is null but the other is not, then they are not equal. This validity of this 'if'
+ // statement is order dependent on the previous 'if' statement.
+ //
+ if(a1 == null || a2 == null)
+ {
+ return false;
+ }
+
+ if(a1.length != a2.length)
+ {
+ return false;
+ }
+
+ for(int i = 0; i < a1.length; ++i)
+ {
+ if(a1[i] != a2[i])
+ {
+ return false;
+ }
+ }
+ return true;
}
public static boolean
equals(int[] a1, int[] a2)
{
- //
- // If they are both null then they are equal.
- //
- if(a1 == null && a2 == null)
- {
- return true;
- }
-
- //
- // If one of them is null but the other is not, then they are not equal. This validity of this 'if'
- // statement is order dependent on the previous 'if' statement.
- //
- if(a1 == null || a2 == null)
- {
- return false;
- }
-
- if(a1.length != a2.length)
- {
- return false;
- }
-
- for(int i = 0; i < a1.length; ++i)
- {
- if(a1[i] != a2[i])
- {
- return false;
- }
- }
- return true;
+ //
+ // If they are both null then they are equal.
+ //
+ if(a1 == null && a2 == null)
+ {
+ return true;
+ }
+
+ //
+ // If one of them is null but the other is not, then they are not equal. This validity of this 'if'
+ // statement is order dependent on the previous 'if' statement.
+ //
+ if(a1 == null || a2 == null)
+ {
+ return false;
+ }
+
+ if(a1.length != a2.length)
+ {
+ return false;
+ }
+
+ for(int i = 0; i < a1.length; ++i)
+ {
+ if(a1[i] != a2[i])
+ {
+ return false;
+ }
+ }
+ return true;
}
public static boolean
equals(long[] a1, long[] a2)
{
- //
- // If they are both null then they are equal.
- //
- if(a1 == null && a2 == null)
- {
- return true;
- }
-
- //
- // If one of them is null but the other is not, then they are not equal. This validity of this 'if'
- // statement is order dependent on the previous 'if' statement.
- //
- if(a1 == null || a2 == null)
- {
- return false;
- }
-
- if(a1.length != a2.length)
- {
- return false;
- }
-
- for(int i = 0; i < a1.length; ++i)
- {
- if(a1[i] != a2[i])
- {
- return false;
- }
- }
- return true;
+ //
+ // If they are both null then they are equal.
+ //
+ if(a1 == null && a2 == null)
+ {
+ return true;
+ }
+
+ //
+ // If one of them is null but the other is not, then they are not equal. This validity of this 'if'
+ // statement is order dependent on the previous 'if' statement.
+ //
+ if(a1 == null || a2 == null)
+ {
+ return false;
+ }
+
+ if(a1.length != a2.length)
+ {
+ return false;
+ }
+
+ for(int i = 0; i < a1.length; ++i)
+ {
+ if(a1[i] != a2[i])
+ {
+ return false;
+ }
+ }
+ return true;
}
public static boolean
equals(float[] a1, float[] a2)
{
- //
- // If they are both null then they are equal.
- //
- if(a1 == null && a2 == null)
- {
- return true;
- }
-
- //
- // If one of them is null but the other is not, then they are not equal. This validity of this 'if'
- // statement is order dependent on the previous 'if' statement.
- //
- if(a1 == null || a2 == null)
- {
- return false;
- }
-
- if(a1.length != a2.length)
- {
- return false;
- }
-
- for(int i = 0; i < a1.length; ++i)
- {
- if(a1[i] != a2[i])
- {
- return false;
- }
- }
- return true;
+ //
+ // If they are both null then they are equal.
+ //
+ if(a1 == null && a2 == null)
+ {
+ return true;
+ }
+
+ //
+ // If one of them is null but the other is not, then they are not equal. This validity of this 'if'
+ // statement is order dependent on the previous 'if' statement.
+ //
+ if(a1 == null || a2 == null)
+ {
+ return false;
+ }
+
+ if(a1.length != a2.length)
+ {
+ return false;
+ }
+
+ for(int i = 0; i < a1.length; ++i)
+ {
+ if(a1[i] != a2[i])
+ {
+ return false;
+ }
+ }
+ return true;
}
public static boolean
equals(double[] a1, double[] a2)
{
- //
- // If they are both null then they are equal.
- //
- if(a1 == null && a2 == null)
- {
- return true;
- }
-
- //
- // If one of them is null but the other is not, then they are not equal. This validity of this 'if'
- // statement is order dependent on the previous 'if' statement.
- //
- if(a1 == null || a2 == null)
- {
- return false;
- }
-
- if(a1.length != a2.length)
- {
- return false;
- }
-
- for(int i = 0; i < a1.length; ++i)
- {
- if(a1[i] != a2[i])
- {
- return false;
- }
- }
- return true;
+ //
+ // If they are both null then they are equal.
+ //
+ if(a1 == null && a2 == null)
+ {
+ return true;
+ }
+
+ //
+ // If one of them is null but the other is not, then they are not equal. This validity of this 'if'
+ // statement is order dependent on the previous 'if' statement.
+ //
+ if(a1 == null || a2 == null)
+ {
+ return false;
+ }
+
+ if(a1.length != a2.length)
+ {
+ return false;
+ }
+
+ for(int i = 0; i < a1.length; ++i)
+ {
+ if(a1[i] != a2[i])
+ {
+ return false;
+ }
+ }
+ return true;
}
public static boolean
equals(java.lang.Object[] a1, java.lang.Object[] a2)
{
- //
- // If they are both null then they are equal.
- //
- if(a1 == null && a2 == null)
- {
- return true;
- }
-
- //
- // If one of them is null but the other is not, then they are not equal. This validity of this 'if'
- // statement is order dependent on the previous 'if' statement.
- //
- if(a1 == null || a2 == null)
- {
- return false;
- }
-
- if(a1.length != a2.length)
- {
- return false;
- }
-
- for(int i = 0; i < a1.length; ++i)
- {
- if(!a1[i].equals(a2[i]))
- {
- return false;
- }
- }
- return true;
+ //
+ // If they are both null then they are equal.
+ //
+ if(a1 == null && a2 == null)
+ {
+ return true;
+ }
+
+ //
+ // If one of them is null but the other is not, then they are not equal. This validity of this 'if'
+ // statement is order dependent on the previous 'if' statement.
+ //
+ if(a1 == null || a2 == null)
+ {
+ return false;
+ }
+
+ if(a1.length != a2.length)
+ {
+ return false;
+ }
+
+ for(int i = 0; i < a1.length; ++i)
+ {
+ if(!a1[i].equals(a2[i]))
+ {
+ return false;
+ }
+ }
+ return true;
}
}
diff --git a/javae/src/IceUtil/AssertionError.java b/javae/src/IceUtil/AssertionError.java
index 74e72745bd6..05968e0fab1 100644
--- a/javae/src/IceUtil/AssertionError.java
+++ b/javae/src/IceUtil/AssertionError.java
@@ -19,6 +19,6 @@ public class AssertionError extends Error
public
AssertionError(String message)
{
- super(message);
+ super(message);
}
}
diff --git a/javae/src/IceUtil/CloneException.java b/javae/src/IceUtil/CloneException.java
index f9cf9969ff4..75bb6dbae26 100644
--- a/javae/src/IceUtil/CloneException.java
+++ b/javae/src/IceUtil/CloneException.java
@@ -13,11 +13,11 @@ public class CloneException extends java.lang.Exception
{
public CloneException()
{
- super();
+ super();
}
public CloneException(String s)
{
- super(s);
+ super(s);
}
};
diff --git a/javae/src/IceUtil/Debug.java b/javae/src/IceUtil/Debug.java
index 7d099bf1d3e..dc5db8af439 100644
--- a/javae/src/IceUtil/Debug.java
+++ b/javae/src/IceUtil/Debug.java
@@ -29,10 +29,10 @@ public final class Debug
public static void
Assert(boolean b)
{
- if(!b)
- {
- throw new AssertionError();
- }
+ if(!b)
+ {
+ throw new AssertionError();
+ }
}
//
@@ -42,14 +42,14 @@ public final class Debug
public static void
FinalizerAssert(boolean b)
{
- if(!b)
- {
- //
- // Create a Throwable to obtain the stack trace.
- //
- Throwable t = new Throwable();
- System.err.println("Assertion failure:");
- t.printStackTrace();
- }
+ if(!b)
+ {
+ //
+ // Create a Throwable to obtain the stack trace.
+ //
+ Throwable t = new Throwable();
+ System.err.println("Assertion failure:");
+ t.printStackTrace();
+ }
}
}
diff --git a/javae/src/IceUtil/Hashtable.java b/javae/src/IceUtil/Hashtable.java
index 05521315731..5042667f687 100644
--- a/javae/src/IceUtil/Hashtable.java
+++ b/javae/src/IceUtil/Hashtable.java
@@ -14,28 +14,28 @@ public final class Hashtable
static public boolean
equals(java.util.Hashtable h1, java.util.Hashtable h2)
{
- if(h1.size() != h2.size())
- {
- return false;
- }
+ if(h1.size() != h2.size())
+ {
+ return false;
+ }
- java.util.Enumeration e1 = h1.keys();
- boolean mismatch = false;
- while(e1.hasMoreElements() && !mismatch)
- {
- java.lang.Object k = e1.nextElement();
- java.lang.Object v1 = h1.get(k);
- java.lang.Object v2 = h2.get(k);
- if(v1 == v2)
- {
- continue;
- }
- else if(v1 != null && v1.equals(v2))
- {
- continue;
- }
- mismatch = true;
- }
- return !mismatch;
+ java.util.Enumeration e1 = h1.keys();
+ boolean mismatch = false;
+ while(e1.hasMoreElements() && !mismatch)
+ {
+ java.lang.Object k = e1.nextElement();
+ java.lang.Object v1 = h1.get(k);
+ java.lang.Object v2 = h2.get(k);
+ if(v1 == v2)
+ {
+ continue;
+ }
+ else if(v1 != null && v1.equals(v2))
+ {
+ continue;
+ }
+ mismatch = true;
+ }
+ return !mismatch;
}
}
diff --git a/javae/src/IceUtil/StringUtil.java b/javae/src/IceUtil/StringUtil.java
index f095cc70a2f..01e2fb98708 100644
--- a/javae/src/IceUtil/StringUtil.java
+++ b/javae/src/IceUtil/StringUtil.java
@@ -86,76 +86,76 @@ public final class StringUtil
{
switch(b)
{
- case (byte)'\\':
- {
- sb.append("\\\\");
- break;
- }
- case (byte)'\'':
- {
- sb.append("\\'");
- break;
- }
- case (byte)'"':
- {
- sb.append("\\\"");
- break;
- }
- case (byte)'\b':
- {
- sb.append("\\b");
- break;
- }
- case (byte)'\f':
- {
- sb.append("\\f");
- break;
- }
- case (byte)'\n':
- {
- sb.append("\\n");
- break;
- }
- case (byte)'\r':
- {
- sb.append("\\r");
- break;
- }
- case (byte)'\t':
- {
- sb.append("\\t");
- break;
- }
- default:
- {
- if(!(b >= 32 && b <= 126))
- {
- sb.append('\\');
- String octal = Integer.toOctalString(b < 0 ? b + 256 : b);
- //
- // Add leading zeroes so that we avoid problems during
- // decoding. For example, consider the encoded string
- // \0013 (i.e., a character with value 1 followed by
- // the character '3'). If the leading zeroes were omitted,
- // the result would be incorrectly interpreted by the
- // decoder as a single character with value 11.
- //
- for(int j = octal.length(); j < 3; j++)
- {
- sb.append('0');
- }
- sb.append(octal);
- }
- else if(special != null && special.indexOf((char)b) != -1)
- {
- sb.append('\\');
- sb.append((char)b);
- }
- else
- {
- sb.append((char)b);
- }
- }
+ case (byte)'\\':
+ {
+ sb.append("\\\\");
+ break;
+ }
+ case (byte)'\'':
+ {
+ sb.append("\\'");
+ break;
+ }
+ case (byte)'"':
+ {
+ sb.append("\\\"");
+ break;
+ }
+ case (byte)'\b':
+ {
+ sb.append("\\b");
+ break;
+ }
+ case (byte)'\f':
+ {
+ sb.append("\\f");
+ break;
+ }
+ case (byte)'\n':
+ {
+ sb.append("\\n");
+ break;
+ }
+ case (byte)'\r':
+ {
+ sb.append("\\r");
+ break;
+ }
+ case (byte)'\t':
+ {
+ sb.append("\\t");
+ break;
+ }
+ default:
+ {
+ if(!(b >= 32 && b <= 126))
+ {
+ sb.append('\\');
+ String octal = Integer.toOctalString(b < 0 ? b + 256 : b);
+ //
+ // Add leading zeroes so that we avoid problems during
+ // decoding. For example, consider the encoded string
+ // \0013 (i.e., a character with value 1 followed by
+ // the character '3'). If the leading zeroes were omitted,
+ // the result would be incorrectly interpreted by the
+ // decoder as a single character with value 11.
+ //
+ for(int j = octal.length(); j < 3; j++)
+ {
+ sb.append('0');
+ }
+ sb.append(octal);
+ }
+ else if(special != null && special.indexOf((char)b) != -1)
+ {
+ sb.append('\\');
+ sb.append((char)b);
+ }
+ else
+ {
+ sb.append((char)b);
+ }
+ }
}
}
@@ -167,46 +167,46 @@ public final class StringUtil
public static String
escapeString(String s, String special)
{
- if(special != null)
- {
- for(int i = 0; i < special.length(); ++i)
- {
- if(special.charAt(i) < 32 || special.charAt(i) > 126)
- {
- throw new IllegalArgumentException("special characters must be in ASCII range 32-126");
- }
- }
- }
+ if(special != null)
+ {
+ for(int i = 0; i < special.length(); ++i)
+ {
+ if(special.charAt(i) < 32 || special.charAt(i) > 126)
+ {
+ throw new IllegalArgumentException("special characters must be in ASCII range 32-126");
+ }
+ }
+ }
- byte[] bytes = null;
+ byte[] bytes = null;
- //
- // Normally a simple call to the getBytes() specifying the UTF8
- // encoding is all that is needed here. It appears that the Nokia
- // emulators and possibly some of the Nokia phones don't accept
- // encoding arguments to string operations. This allows us to
- // get a create a byte representation of a UTF encoded string in
- // a roundabout way.
- //
- try
- {
- java.io.ByteArrayOutputStream bs = new java.io.ByteArrayOutputStream();
- java.io.DataOutputStream os = new java.io.DataOutputStream(bs);
- os.writeUTF(s);
- bytes = bs.toByteArray();
- }
- catch(java.io.IOException ex)
- {
- Debug.Assert(false);
- return null; // This should never happen
- }
+ //
+ // Normally a simple call to the getBytes() specifying the UTF8
+ // encoding is all that is needed here. It appears that the Nokia
+ // emulators and possibly some of the Nokia phones don't accept
+ // encoding arguments to string operations. This allows us to
+ // get a create a byte representation of a UTF encoded string in
+ // a roundabout way.
+ //
+ try
+ {
+ java.io.ByteArrayOutputStream bs = new java.io.ByteArrayOutputStream();
+ java.io.DataOutputStream os = new java.io.DataOutputStream(bs);
+ os.writeUTF(s);
+ bytes = bs.toByteArray();
+ }
+ catch(java.io.IOException ex)
+ {
+ Debug.Assert(false);
+ return null; // This should never happen
+ }
StringBuffer result = new StringBuffer(bytes.length);
- //
- // The characters in the byte array created by the
- // DataOutput.writeUTF() call start on the third byte.
- //
+ //
+ // The characters in the byte array created by the
+ // DataOutput.writeUTF() call start on the third byte.
+ //
for(int i = 2; i < bytes.length; i++)
{
encodeChar(bytes[i], result, special);
@@ -217,11 +217,11 @@ public final class StringUtil
private static char
checkChar(char c)
{
- if(!(c >= 32 && c <= 126))
- {
- throw new IllegalArgumentException("illegal input character");
- }
- return c;
+ if(!(c >= 32 && c <= 126))
+ {
+ throw new IllegalArgumentException("illegal input character");
+ }
+ return c;
}
//
@@ -231,97 +231,97 @@ public final class StringUtil
//
private static char decodeChar(String s, int start, int end, Ice.IntHolder nextStart)
{
- Debug.Assert(start >= 0);
- Debug.Assert(start < end);
- Debug.Assert(end <= s.length());
+ Debug.Assert(start >= 0);
+ Debug.Assert(start < end);
+ Debug.Assert(end <= s.length());
- char c;
+ char c;
- if(s.charAt(start) != '\\')
- {
- c = checkChar(s.charAt(start++));
- }
- else
- {
- if(start + 1 == end)
- {
- throw new IllegalArgumentException("trailing backslash in argument");
- }
- switch(s.charAt(++start))
- {
- case '\\':
- case '\'':
- case '"':
- {
- c = s.charAt(start++);
- break;
- }
- case 'b':
- {
- ++start;
- c = '\b';
- break;
- }
- case 'f':
- {
- ++start;
- c = '\f';
- break;
- }
- case 'n':
- {
- ++start;
- c = '\n';
- break;
- }
- case 'r':
- {
- ++start;
- c = '\r';
- break;
- }
- case 't':
- {
- ++start;
- c = '\t';
- break;
- }
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- {
- int oct = 0;
- for(int j = 0; j < 3 && start < end; ++j)
- {
- int charVal = s.charAt(start++) - '0';
- if(charVal < 0 || charVal > 7)
- {
- --start;
- break;
- }
- oct = oct * 8 + charVal;
- }
- if(oct > 255)
- {
- throw new IllegalArgumentException("octal value out of range");
- }
- c = (char)oct;
- break;
- }
- default:
- {
- c = checkChar(s.charAt(start++));
- break;
- }
- }
- }
- nextStart.value = start;
- return c;
+ if(s.charAt(start) != '\\')
+ {
+ c = checkChar(s.charAt(start++));
+ }
+ else
+ {
+ if(start + 1 == end)
+ {
+ throw new IllegalArgumentException("trailing backslash in argument");
+ }
+ switch(s.charAt(++start))
+ {
+ case '\\':
+ case '\'':
+ case '"':
+ {
+ c = s.charAt(start++);
+ break;
+ }
+ case 'b':
+ {
+ ++start;
+ c = '\b';
+ break;
+ }
+ case 'f':
+ {
+ ++start;
+ c = '\f';
+ break;
+ }
+ case 'n':
+ {
+ ++start;
+ c = '\n';
+ break;
+ }
+ case 'r':
+ {
+ ++start;
+ c = '\r';
+ break;
+ }
+ case 't':
+ {
+ ++start;
+ c = '\t';
+ break;
+ }
+ case '0':
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ {
+ int oct = 0;
+ for(int j = 0; j < 3 && start < end; ++j)
+ {
+ int charVal = s.charAt(start++) - '0';
+ if(charVal < 0 || charVal > 7)
+ {
+ --start;
+ break;
+ }
+ oct = oct * 8 + charVal;
+ }
+ if(oct > 255)
+ {
+ throw new IllegalArgumentException("octal value out of range");
+ }
+ c = (char)oct;
+ break;
+ }
+ default:
+ {
+ c = checkChar(s.charAt(start++));
+ break;
+ }
+ }
+ }
+ nextStart.value = start;
+ return c;
}
//
@@ -331,12 +331,12 @@ public final class StringUtil
private static void
decodeString(String s, int start, int end, StringBuffer sb)
{
- Ice.IntHolder nextStart = new Ice.IntHolder();
+ Ice.IntHolder nextStart = new Ice.IntHolder();
while(start < end)
- {
- sb.append(decodeChar(s, start, end, nextStart));
- start = nextStart.value;
- }
+ {
+ sb.append(decodeChar(s, start, end, nextStart));
+ start = nextStart.value;
+ }
}
//
@@ -346,50 +346,50 @@ public final class StringUtil
unescapeString(String s, int start, int end, Ice.StringHolder result)
{
if(start < 0)
- {
- throw new IllegalArgumentException("start offset must be >= 0");
- }
- if(end > s.length())
- {
- throw new IllegalArgumentException("end offset must <= s.length()");
- }
- if(start > end)
- {
- throw new IllegalArgumentException("start offset must <= end offset");
- }
+ {
+ throw new IllegalArgumentException("start offset must be >= 0");
+ }
+ if(end > s.length())
+ {
+ throw new IllegalArgumentException("end offset must <= s.length()");
+ }
+ if(start > end)
+ {
+ throw new IllegalArgumentException("start offset must <= end offset");
+ }
- try
- {
- StringBuffer sb = new StringBuffer();
- decodeString(s, start, end, sb);
- String decodedString = sb.toString();
+ try
+ {
+ StringBuffer sb = new StringBuffer();
+ decodeString(s, start, end, sb);
+ String decodedString = sb.toString();
- byte[] arr = new byte[decodedString.length() + 2];
- for(int i = 2; i < arr.length; ++i)
- {
- arr[i] = (byte)decodedString.charAt(i-2);
- }
+ byte[] arr = new byte[decodedString.length() + 2];
+ for(int i = 2; i < arr.length; ++i)
+ {
+ arr[i] = (byte)decodedString.charAt(i-2);
+ }
- //
- // Normally a simple call to the String constructor with the
- // byte array and the UTF8 encoding is all that is needed
- // here. It appears that the Nokia emulators and possibly
- // some of the Nokia phones don't accept encoding arguments
- // to string operations. This allows us to get a UTF encoded
- // string from our byte array in a somewhat roundabout way.
- //
- short i = new Integer(decodedString.length()).shortValue();
- arr[0] = (byte)(i & 0xff00);
- arr[1] = (byte)(i & 0x00ff);
- java.io.ByteArrayInputStream bs = new java.io.ByteArrayInputStream(arr);
- java.io.DataInputStream is = new java.io.DataInputStream(bs);
- result.value = is.readUTF();
- return true;
- }
- catch(java.lang.Exception ex)
- {
- return false;
- }
+ //
+ // Normally a simple call to the String constructor with the
+ // byte array and the UTF8 encoding is all that is needed
+ // here. It appears that the Nokia emulators and possibly
+ // some of the Nokia phones don't accept encoding arguments
+ // to string operations. This allows us to get a UTF encoded
+ // string from our byte array in a somewhat roundabout way.
+ //
+ short i = new Integer(decodedString.length()).shortValue();
+ arr[0] = (byte)(i & 0xff00);
+ arr[1] = (byte)(i & 0x00ff);
+ java.io.ByteArrayInputStream bs = new java.io.ByteArrayInputStream(arr);
+ java.io.DataInputStream is = new java.io.DataInputStream(bs);
+ result.value = is.readUTF();
+ return true;
+ }
+ catch(java.lang.Exception ex)
+ {
+ return false;
+ }
}
public static int
@@ -429,27 +429,27 @@ public final class StringUtil
public static String[]
split(String s, String delim)
{
- java.util.Vector arr = new java.util.Vector();
- int beg = findFirstNotOf(s, delim);
- int end = s.length();
- while(beg != -1 && (end = findFirstOf(s, delim, beg)) != -1)
- {
- arr.addElement(s.substring(beg, end));
- beg = findFirstNotOf(s, delim, end);
- }
- if(beg != -1)
- {
- if(end == -1)
- {
- arr.addElement(s.substring(beg));
- }
- else
- {
- arr.addElement(s.substring(beg, end));
- }
- }
- String[] result = new String[arr.size()];
- arr.copyInto(result);
- return result;
+ java.util.Vector arr = new java.util.Vector();
+ int beg = findFirstNotOf(s, delim);
+ int end = s.length();
+ while(beg != -1 && (end = findFirstOf(s, delim, beg)) != -1)
+ {
+ arr.addElement(s.substring(beg, end));
+ beg = findFirstNotOf(s, delim, end);
+ }
+ if(beg != -1)
+ {
+ if(end == -1)
+ {
+ arr.addElement(s.substring(beg));
+ }
+ else
+ {
+ arr.addElement(s.substring(beg, end));
+ }
+ }
+ String[] result = new String[arr.size()];
+ arr.copyInto(result);
+ return result;
}
}
diff --git a/javae/src/IceUtil/UUID.java b/javae/src/IceUtil/UUID.java
index 44f9fc07eb7..a0e70bdb086 100644
--- a/javae/src/IceUtil/UUID.java
+++ b/javae/src/IceUtil/UUID.java
@@ -13,11 +13,11 @@ final public class UUID
{
static class RandomByte extends java.util.Random
{
- public byte
- nextByte()
- {
- return (byte)next(8);
- }
+ public byte
+ nextByte()
+ {
+ return (byte)next(8);
+ }
}
private final static char[] hex = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'};
@@ -25,59 +25,59 @@ final public class UUID
static String
byteToHexString(byte b)
{
- char[] hexDigits = new char[2];
- hexDigits[0] = hex[(b & 0xF0) >> 4];
- hexDigits[1] = hex[(b & 0x0F)];
- return new String(hexDigits);
+ char[] hexDigits = new char[2];
+ hexDigits[0] = hex[(b & 0xF0) >> 4];
+ hexDigits[1] = hex[(b & 0x0F)];
+ return new String(hexDigits);
}
static public String
create()
{
- byte[] data = new byte[16];
-
- for(int i = 0; i < data.length; ++i)
- {
- data[i] = _rand.nextByte();
- }
- data[6] &= 0x0F;
- data[6] |= (4 << 4);
- data[8] &= 0x3F;
- data[8] |= 0x80;
-
- int index = 0;
- StringBuffer strRep = new StringBuffer(16 * 2 + 4);
- while(index < 4)
- {
- strRep.append(byteToHexString(data[index]));
- ++index;
- }
- strRep.append('-');
- while(index < 6)
- {
- strRep.append(byteToHexString(data[index]));
- ++index;
- }
- strRep.append('-');
- while(index < 8)
- {
- strRep.append(byteToHexString(data[index]));
- ++index;
- }
- strRep.append('-');
- while(index < 10)
- {
- strRep.append(byteToHexString(data[index]));
- ++index;
- }
- strRep.append('-');
- while(index < 16)
- {
- strRep.append(byteToHexString(data[index]));
- ++index;
- }
-
- return strRep.toString();
+ byte[] data = new byte[16];
+
+ for(int i = 0; i < data.length; ++i)
+ {
+ data[i] = _rand.nextByte();
+ }
+ data[6] &= 0x0F;
+ data[6] |= (4 << 4);
+ data[8] &= 0x3F;
+ data[8] |= 0x80;
+
+ int index = 0;
+ StringBuffer strRep = new StringBuffer(16 * 2 + 4);
+ while(index < 4)
+ {
+ strRep.append(byteToHexString(data[index]));
+ ++index;
+ }
+ strRep.append('-');
+ while(index < 6)
+ {
+ strRep.append(byteToHexString(data[index]));
+ ++index;
+ }
+ strRep.append('-');
+ while(index < 8)
+ {
+ strRep.append(byteToHexString(data[index]));
+ ++index;
+ }
+ strRep.append('-');
+ while(index < 10)
+ {
+ strRep.append(byteToHexString(data[index]));
+ ++index;
+ }
+ strRep.append('-');
+ while(index < 16)
+ {
+ strRep.append(byteToHexString(data[index]));
+ ++index;
+ }
+
+ return strRep.toString();
}
private static final RandomByte _rand = new RandomByte();
diff --git a/javae/test/IceE/adapterDeactivation/AllTests.java b/javae/test/IceE/adapterDeactivation/AllTests.java
index ec806826dbb..d4c2b8b089e 100644
--- a/javae/test/IceE/adapterDeactivation/AllTests.java
+++ b/javae/test/IceE/adapterDeactivation/AllTests.java
@@ -26,7 +26,7 @@ public class AllTests
out.print("testing stringToProxy... ");
out.flush();
String ref = communicator.getProperties().getPropertyWithDefault("Test.Proxy",
- "test:default -p 12010 -t 10000");
+ "test:default -p 12010 -t 10000");
Ice.ObjectPrx base = communicator.stringToProxy(ref);
test(base != null);
out.println("ok");
diff --git a/javae/test/IceE/adapterDeactivation/Client.java b/javae/test/IceE/adapterDeactivation/Client.java
index 92cf98de943..7c1e323ddfe 100644
--- a/javae/test/IceE/adapterDeactivation/Client.java
+++ b/javae/test/IceE/adapterDeactivation/Client.java
@@ -46,7 +46,7 @@ public class Client
}
}
- System.gc();
+ System.gc();
System.exit(status);
}
}
diff --git a/javae/test/IceE/adapterDeactivation/Collocated.java b/javae/test/IceE/adapterDeactivation/Collocated.java
index 5e3e27fa265..78e0a45407b 100644
--- a/javae/test/IceE/adapterDeactivation/Collocated.java
+++ b/javae/test/IceE/adapterDeactivation/Collocated.java
@@ -12,13 +12,13 @@ public class Collocated
public static int
run(String[] args, Ice.Communicator communicator, Ice.InitializationData data, java.io.PrintStream out)
{
- communicator.getProperties().setProperty("Test.Proxy", "test:default -p 12010 -t 10000");
- communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010 -t 10000");
+ communicator.getProperties().setProperty("Test.Proxy", "test:default -p 12010 -t 10000");
+ communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010 -t 10000");
Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
- Ice.Object object = new TestI();
- adapter.add(object, communicator.stringToIdentity("test"));
- adapter.activate();
+ Ice.Object object = new TestI();
+ adapter.add(object, communicator.stringToIdentity("test"));
+ adapter.activate();
AllTests.allTests(communicator, out);
diff --git a/javae/test/IceE/adapterDeactivation/Server.java b/javae/test/IceE/adapterDeactivation/Server.java
index 68fa53829b0..2d3c6016cea 100644
--- a/javae/test/IceE/adapterDeactivation/Server.java
+++ b/javae/test/IceE/adapterDeactivation/Server.java
@@ -12,19 +12,19 @@ public class Server
public static int
run(String[] args, Ice.Communicator communicator, Ice.InitializationData data, java.io.PrintStream out)
{
- //
- // When running as a MIDlet the properties for the server may be
- // overridden by configuration. If it isn't then we assume
- // defaults.
- //
- if(communicator.getProperties().getProperty("TestAdapter.Endpoints").length() == 0)
- {
- communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010 -t 10000");
- }
+ //
+ // When running as a MIDlet the properties for the server may be
+ // overridden by configuration. If it isn't then we assume
+ // defaults.
+ //
+ if(communicator.getProperties().getProperty("TestAdapter.Endpoints").length() == 0)
+ {
+ communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010 -t 10000");
+ }
Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
- Ice.Object object = new TestI();
- adapter.add(object, communicator.stringToIdentity("test"));
+ Ice.Object object = new TestI();
+ adapter.add(object, communicator.stringToIdentity("test"));
adapter.activate();
adapter.waitForDeactivate();
return 0;
@@ -60,7 +60,7 @@ public class Server
}
}
- System.gc();
+ System.gc();
System.exit(status);
}
}
diff --git a/javae/test/IceE/common/ClientBase.java b/javae/test/IceE/common/ClientBase.java
index 39b95f64364..33c014df9a5 100644
--- a/javae/test/IceE/common/ClientBase.java
+++ b/javae/test/IceE/common/ClientBase.java
@@ -45,21 +45,21 @@ abstract public class ClientBase
public void
runTest(Ice.Communicator communicator, java.io.PrintStream ps)
{
- try
- {
- if(communicator != null)
- {
+ try
+ {
+ if(communicator != null)
+ {
Ice.InitializationData data = new Ice.InitializationData();
data.properties = _properties;
- Client.run(new String[0], communicator, data, ps);
- }
+ Client.run(new String[0], communicator, data, ps);
+ }
ps.println("Done!");
- }
- catch(Exception ex)
- {
- ps.println(ex.toString());
- ex.printStackTrace();
- }
+ }
+ catch(Exception ex)
+ {
+ ps.println(ex.toString());
+ ex.printStackTrace();
+ }
}
protected TextField _addr;
diff --git a/javae/test/IceE/common/CollocatedBase.java b/javae/test/IceE/common/CollocatedBase.java
index d3c3a5ec4e5..e64ad3e0f7d 100644
--- a/javae/test/IceE/common/CollocatedBase.java
+++ b/javae/test/IceE/common/CollocatedBase.java
@@ -33,19 +33,19 @@ abstract public class CollocatedBase extends TestApplication
public void
runTest(Ice.Communicator communicator, java.io.PrintStream ps)
{
- try
- {
- if(communicator != null)
- {
- Collocated.run(new String[0], communicator, null, ps);
- }
+ try
+ {
+ if(communicator != null)
+ {
+ Collocated.run(new String[0], communicator, null, ps);
+ }
ps.println("Done");
- }
- catch(Exception ex)
- {
- ps.println(ex.toString());
- ex.printStackTrace();
- }
+ }
+ catch(Exception ex)
+ {
+ ps.println(ex.toString());
+ ex.printStackTrace();
+ }
}
StringItem _host;
diff --git a/javae/test/IceE/common/ServerBase.java b/javae/test/IceE/common/ServerBase.java
index bff40ac84e6..b18dd91095d 100644
--- a/javae/test/IceE/common/ServerBase.java
+++ b/javae/test/IceE/common/ServerBase.java
@@ -44,21 +44,21 @@ abstract public class ServerBase extends TestApplication
public void
runTest(Ice.Communicator communicator, java.io.PrintStream ps)
{
- try
- {
- if(communicator != null)
- {
+ try
+ {
+ if(communicator != null)
+ {
Ice.InitializationData data = new Ice.InitializationData();
data.properties = _properties;
- Server.run(new String[0], communicator, data, ps);
- }
+ Server.run(new String[0], communicator, data, ps);
+ }
ps.println("Done");
- }
- catch(Exception ex)
- {
- ps.println(ex.toString());
- ex.printStackTrace();
- }
+ }
+ catch(Exception ex)
+ {
+ ps.println(ex.toString());
+ ex.printStackTrace();
+ }
}
protected StringItem _host;
diff --git a/javae/test/IceE/common/StreamListAdapter.java b/javae/test/IceE/common/StreamListAdapter.java
index ee35eef09e9..abeea44cab3 100644
--- a/javae/test/IceE/common/StreamListAdapter.java
+++ b/javae/test/IceE/common/StreamListAdapter.java
@@ -18,84 +18,84 @@ public class StreamListAdapter extends java.io.OutputStream
public
StreamListAdapter(javax.microedition.lcdui.List listui)
{
- _list = listui;
+ _list = listui;
}
public void
close()
{
- synchronized(this)
- {
- _closed = true;
- }
+ synchronized(this)
+ {
+ _closed = true;
+ }
}
public void
flush()
- throws java.io.IOException
+ throws java.io.IOException
{
- synchronized(this)
- {
- if(_closed)
- {
- throw new java.io.IOException("Stream closed.");
- }
-
- if(_currentLine.length() != 0)
- {
- writeCurrentLine();
- _replaceLine = true;
- }
- }
+ synchronized(this)
+ {
+ if(_closed)
+ {
+ throw new java.io.IOException("Stream closed.");
+ }
+
+ if(_currentLine.length() != 0)
+ {
+ writeCurrentLine();
+ _replaceLine = true;
+ }
+ }
}
public void
write(int b)
- throws java.io.IOException
+ throws java.io.IOException
{
- synchronized(this)
- {
- if(_closed)
- {
- throw new java.io.IOException("Stream closed.");
- }
-
- //
- // If there is no associated list element then don't do anything.
- //
- if(_list == null)
- {
- return;
- }
-
- if((char)b != '\n')
- {
- _currentLine.append((char)b);
- }
- else
- {
- writeCurrentLine();
- _currentLine.setLength(0);
- if(_list.size() > MAX_SCROLLBACK_LINES)
- {
- _list.delete(0);
- }
- _replaceLine = false;
- }
- }
+ synchronized(this)
+ {
+ if(_closed)
+ {
+ throw new java.io.IOException("Stream closed.");
+ }
+
+ //
+ // If there is no associated list element then don't do anything.
+ //
+ if(_list == null)
+ {
+ return;
+ }
+
+ if((char)b != '\n')
+ {
+ _currentLine.append((char)b);
+ }
+ else
+ {
+ writeCurrentLine();
+ _currentLine.setLength(0);
+ if(_list.size() > MAX_SCROLLBACK_LINES)
+ {
+ _list.delete(0);
+ }
+ _replaceLine = false;
+ }
+ }
}
private void
writeCurrentLine()
{
- if(_replaceLine)
- {
- _list.set(_list.size() -1, _currentLine.toString(), null);
- }
- else
- {
- _list.append(_currentLine.toString(), null);
- }
+ if(_replaceLine)
+ {
+ _list.set(_list.size() -1, _currentLine.toString(), null);
+ }
+ else
+ {
+ _list.append(_currentLine.toString(), null);
+ }
}
private boolean _closed = false;
diff --git a/javae/test/IceE/common/TestApplication.java b/javae/test/IceE/common/TestApplication.java
index 78f8c81e36b..1dfadeb41ee 100644
--- a/javae/test/IceE/common/TestApplication.java
+++ b/javae/test/IceE/common/TestApplication.java
@@ -16,16 +16,16 @@ abstract public class TestApplication
protected String
getHost()
{
- try
- {
- _hostnameConnection =
- (javax.microedition.io.ServerSocketConnection)javax.microedition.io.Connector.open("socket://");
- return _hostnameConnection.getLocalAddress();
- }
- catch(Exception ex)
- {
+ try
+ {
+ _hostnameConnection =
+ (javax.microedition.io.ServerSocketConnection)javax.microedition.io.Connector.open("socket://");
+ return _hostnameConnection.getLocalAddress();
+ }
+ catch(Exception ex)
+ {
return null;
- }
+ }
}
class SetupThread implements Runnable
@@ -58,9 +58,9 @@ abstract public class TestApplication
protected void
startApp()
- throws javax.microedition.midlet.MIDletStateChangeException
+ throws javax.microedition.midlet.MIDletStateChangeException
{
- try
+ try
{
//
// Read properties from embedded config file.
@@ -85,24 +85,24 @@ abstract public class TestApplication
Thread t = new Thread(new SetupThread(this));
t.start();
}
- catch(Exception ex)
- {
- javax.microedition.lcdui.Alert a =
- new javax.microedition.lcdui.Alert("startApp alert", ex.getMessage(),
- null, javax.microedition.lcdui.AlertType.ERROR);
- a.setTimeout(javax.microedition.lcdui.Alert.FOREVER);
- javax.microedition.lcdui.Display.getDisplay(this).setCurrent(a);
- throw new javax.microedition.midlet.MIDletStateChangeException(ex.getMessage());
- }
+ catch(Exception ex)
+ {
+ javax.microedition.lcdui.Alert a =
+ new javax.microedition.lcdui.Alert("startApp alert", ex.getMessage(),
+ null, javax.microedition.lcdui.AlertType.ERROR);
+ a.setTimeout(javax.microedition.lcdui.Alert.FOREVER);
+ javax.microedition.lcdui.Display.getDisplay(this).setCurrent(a);
+ throw new javax.microedition.midlet.MIDletStateChangeException(ex.getMessage());
+ }
}
protected void
pauseApp()
{
- //
- // The test wrapper will not pause properly because it does not have direct access to the wrapped test
- // driver's communicators.
- //
+ //
+ // The test wrapper will not pause properly because it does not have direct access to the wrapped test
+ // driver's communicators.
+ //
}
protected void
diff --git a/javae/test/IceE/exceptions/AllTests.java b/javae/test/IceE/exceptions/AllTests.java
index 6a3cd75d7fb..4ee3be19840 100644
--- a/javae/test/IceE/exceptions/AllTests.java
+++ b/javae/test/IceE/exceptions/AllTests.java
@@ -22,109 +22,109 @@ public class AllTests
private static class Callback
{
- Callback()
- {
- _called = false;
- }
-
- public synchronized boolean
- check()
- {
- while(!_called)
- {
- try
- {
- wait(5000);
- }
- catch(InterruptedException ex)
- {
- continue;
- }
-
- if(!_called)
- {
- return false; // Must be timeout.
- }
- }
-
- _called = false;
- return true;
- }
-
- public synchronized void
- called()
- {
- IceUtil.Debug.Assert(!_called);
- _called = true;
- notify();
- }
-
- private boolean _called;
+ Callback()
+ {
+ _called = false;
+ }
+
+ public synchronized boolean
+ check()
+ {
+ while(!_called)
+ {
+ try
+ {
+ wait(5000);
+ }
+ catch(InterruptedException ex)
+ {
+ continue;
+ }
+
+ if(!_called)
+ {
+ return false; // Must be timeout.
+ }
+ }
+
+ _called = false;
+ return true;
+ }
+
+ public synchronized void
+ called()
+ {
+ IceUtil.Debug.Assert(!_called);
+ _called = true;
+ notify();
+ }
+
+ private boolean _called;
}
public static ThrowerPrx
allTests(Ice.Communicator communicator, java.io.PrintStream out)
{
- {
- out.print("testing object adapter registration exceptions... ");
- Ice.ObjectAdapter first = communicator.createObjectAdapter("TestAdapter0");
- try
- {
- Ice.ObjectAdapter second = communicator.createObjectAdapter("TestAdapter0");
- test(false);
- }
- catch(Ice.AlreadyRegisteredException ex)
- {
- // Expected
- }
-
- communicator.getProperties().setProperty("TestAdapter0.Endpoints", "");
- try
- {
- Ice.ObjectAdapter second =
- communicator.createObjectAdapterWithEndpoints("TestAdapter0", "ssl -h foo -p 12011 -t 10000");
- test(false);
- }
- catch(Ice.AlreadyRegisteredException ex)
- {
- // Expected
- }
- test(communicator.getProperties().getProperty("TestAdapter0.Endpoints").equals(""));
- first.deactivate();
- out.println("ok");
- }
-
- {
- out.print("testing servant registration exceptions... ");
- Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter1");
- Ice.Object obj = new EmptyI();
- adapter.add(obj, communicator.stringToIdentity("x"));
- try
+ {
+ out.print("testing object adapter registration exceptions... ");
+ Ice.ObjectAdapter first = communicator.createObjectAdapter("TestAdapter0");
+ try
+ {
+ Ice.ObjectAdapter second = communicator.createObjectAdapter("TestAdapter0");
+ test(false);
+ }
+ catch(Ice.AlreadyRegisteredException ex)
+ {
+ // Expected
+ }
+
+ communicator.getProperties().setProperty("TestAdapter0.Endpoints", "");
+ try
+ {
+ Ice.ObjectAdapter second =
+ communicator.createObjectAdapterWithEndpoints("TestAdapter0", "ssl -h foo -p 12011 -t 10000");
+ test(false);
+ }
+ catch(Ice.AlreadyRegisteredException ex)
+ {
+ // Expected
+ }
+ test(communicator.getProperties().getProperty("TestAdapter0.Endpoints").equals(""));
+ first.deactivate();
+ out.println("ok");
+ }
+
+ {
+ out.print("testing servant registration exceptions... ");
+ Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter1");
+ Ice.Object obj = new EmptyI();
+ adapter.add(obj, communicator.stringToIdentity("x"));
+ try
+ {
+ adapter.add(obj, communicator.stringToIdentity("x"));
+ test(false);
+ }
+ catch(Ice.AlreadyRegisteredException ex)
{
- adapter.add(obj, communicator.stringToIdentity("x"));
- test(false);
- }
- catch(Ice.AlreadyRegisteredException ex)
- {
- }
-
- adapter.remove(communicator.stringToIdentity("x"));
- try
+ }
+
+ adapter.remove(communicator.stringToIdentity("x"));
+ try
+ {
+ adapter.remove(communicator.stringToIdentity("x"));
+ test(false);
+ }
+ catch(Ice.NotRegisteredException ex)
{
- adapter.remove(communicator.stringToIdentity("x"));
- test(false);
- }
- catch(Ice.NotRegisteredException ex)
- {
- }
- adapter.deactivate();
- out.println("ok");
- }
+ }
+ adapter.deactivate();
+ out.println("ok");
+ }
out.print("testing stringToProxy... ");
out.flush();
String ref = communicator.getProperties().getPropertyWithDefault("Test.Proxy",
- "thrower:default -p 12010 -t 10000");
+ "thrower:default -p 12010 -t 10000");
Ice.ObjectPrx base = communicator.stringToProxy(ref);
test(base != null);
out.println("ok");
@@ -148,7 +148,7 @@ public class AllTests
{
test(ex.aMem == 1);
}
- catch(Exception ex)
+ catch(Throwable ex)
{
test(false);
}
@@ -162,7 +162,7 @@ public class AllTests
{
test(ex.aMem == 1);
}
- catch(Exception ex)
+ catch(Throwable ex)
{
test(false);
}
@@ -176,7 +176,7 @@ public class AllTests
{
test(ex.dMem == -1);
}
- catch(Exception ex)
+ catch(Throwable ex)
{
test(false);
}
@@ -191,7 +191,7 @@ public class AllTests
test(ex.aMem == 1);
test(ex.bMem == 2);
}
- catch(Exception ex)
+ catch(Throwable ex)
{
test(false);
}
@@ -207,7 +207,7 @@ public class AllTests
test(ex.bMem == 2);
test(ex.cMem == 3);
}
- catch(Exception ex)
+ catch(Throwable ex)
{
test(false);
}
@@ -226,7 +226,7 @@ public class AllTests
{
test(ex.aMem == 1);
}
- catch(Exception ex)
+ catch(Throwable ex)
{
test(false);
}
@@ -241,15 +241,15 @@ public class AllTests
test(ex.aMem == 1);
test(ex.bMem == 2);
}
- catch(Exception ex)
+ catch(Throwable ex)
{
test(false);
}
out.println("ok");
- out.print("catching derived types... ");
- out.flush();
+ out.print("catching derived types... ");
+ out.flush();
try
{
@@ -261,7 +261,7 @@ public class AllTests
test(ex.aMem == 1);
test(ex.bMem == 2);
}
- catch(Exception ex)
+ catch(Throwable ex)
{
test(false);
}
@@ -277,7 +277,7 @@ public class AllTests
test(ex.bMem == 2);
test(ex.cMem == 3);
}
- catch(Exception ex)
+ catch(Throwable ex)
{
test(false);
}
@@ -293,121 +293,121 @@ public class AllTests
test(ex.bMem == 2);
test(ex.cMem == 3);
}
- catch(Exception ex)
+ catch(Throwable ex)
{
test(false);
}
out.println("ok");
- if(thrower.supportsUndeclaredExceptions())
- {
- out.print("catching unknown user exception... ");
- out.flush();
-
- try
- {
- thrower.throwUndeclaredA(1);
- test(false);
- }
- catch(Ice.UnknownUserException ex)
- {
- }
- catch(Exception ex)
- {
- test(false);
- }
-
- try
- {
- thrower.throwUndeclaredB(1, 2);
- test(false);
- }
- catch(Ice.UnknownUserException ex)
- {
- }
- catch(Exception ex)
- {
- test(false);
- }
-
- try
- {
- thrower.throwUndeclaredC(1, 2, 3);
- test(false);
- }
- catch(Ice.UnknownUserException ex)
- {
- }
- catch(Exception ex)
- {
- test(false);
- }
-
- out.println("ok");
- }
-
- if(thrower.supportsAssertException())
- {
- out.print("testing assert in the server... ");
- out.flush();
-
- try
- {
- thrower.throwAssertException();
- test(false);
- }
- catch(Ice.ConnectionLostException ex)
- {
- }
- catch(Exception ex)
- {
- test(false);
- }
-
- out.println("ok");
- }
-
- out.print("catching object not exist exception... ");
- out.flush();
-
- {
- Ice.Identity id = communicator.stringToIdentity("does not exist");
- try
- {
- ThrowerPrx thrower2 = ThrowerPrxHelper.uncheckedCast(thrower.ice_identity(id));
- thrower2.ice_ping();
- test(false);
- }
- catch(Ice.ObjectNotExistException ex)
- {
- test(ex.id.equals(id));
- }
- catch(Exception ex)
- {
- test(false);
- }
- }
+ if(thrower.supportsUndeclaredExceptions())
+ {
+ out.print("catching unknown user exception... ");
+ out.flush();
+
+ try
+ {
+ thrower.throwUndeclaredA(1);
+ test(false);
+ }
+ catch(Ice.UnknownUserException ex)
+ {
+ }
+ catch(Throwable ex)
+ {
+ test(false);
+ }
+
+ try
+ {
+ thrower.throwUndeclaredB(1, 2);
+ test(false);
+ }
+ catch(Ice.UnknownUserException ex)
+ {
+ }
+ catch(Throwable ex)
+ {
+ test(false);
+ }
+
+ try
+ {
+ thrower.throwUndeclaredC(1, 2, 3);
+ test(false);
+ }
+ catch(Ice.UnknownUserException ex)
+ {
+ }
+ catch(Throwable ex)
+ {
+ test(false);
+ }
+
+ out.println("ok");
+ }
+
+ if(thrower.supportsAssertException())
+ {
+ out.print("testing assert in the server... ");
+ out.flush();
+
+ try
+ {
+ thrower.throwAssertException();
+ test(false);
+ }
+ catch(Ice.ConnectionLostException ex)
+ {
+ }
+ catch(Throwable ex)
+ {
+ test(false);
+ }
+
+ out.println("ok");
+ }
+
+ out.print("catching object not exist exception... ");
+ out.flush();
+
+ {
+ Ice.Identity id = communicator.stringToIdentity("does not exist");
+ try
+ {
+ ThrowerPrx thrower2 = ThrowerPrxHelper.uncheckedCast(thrower.ice_identity(id));
+ thrower2.ice_ping();
+ test(false);
+ }
+ catch(Ice.ObjectNotExistException ex)
+ {
+ test(ex.id.equals(id));
+ }
+ catch(Throwable ex)
+ {
+ test(false);
+ }
+ }
out.println("ok");
out.print("catching facet not exist exception... ");
out.flush();
- try
- {
- ThrowerPrx thrower2 = ThrowerPrxHelper.uncheckedCast(thrower, "no such facet");
- try
- {
- thrower2.ice_ping();
- test(false);
- }
- catch(Ice.FacetNotExistException ex)
- {
- test(ex.facet.equals("no such facet"));
- }
- }
- catch(Exception ex)
+ try
+ {
+ ThrowerPrx thrower2 = ThrowerPrxHelper.uncheckedCast(thrower, "no such facet");
+ try
+ {
+ thrower2.ice_ping();
+ test(false);
+ }
+ catch(Ice.FacetNotExistException ex)
+ {
+ test(ex.facet.equals("no such facet"));
+ }
+ }
+ catch(Throwable ex)
{
test(false);
}
@@ -419,15 +419,15 @@ public class AllTests
try
{
- WrongOperationPrx thrower2 = WrongOperationPrxHelper.uncheckedCast(thrower);
- thrower2.noSuchOperation();
- test(false);
+ WrongOperationPrx thrower2 = WrongOperationPrxHelper.uncheckedCast(thrower);
+ thrower2.noSuchOperation();
+ test(false);
}
catch(Ice.OperationNotExistException ex)
{
- test(ex.operation.equals("noSuchOperation"));
+ test(ex.operation.equals("noSuchOperation"));
}
- catch(Exception ex)
+ catch(Throwable ex)
{
test(false);
}
@@ -444,8 +444,8 @@ public class AllTests
}
catch(Ice.UnknownLocalException ex)
{
- }
- catch(Exception ex)
+ }
+ catch(Throwable ex)
{
test(false);
}
diff --git a/javae/test/IceE/exceptions/Client.java b/javae/test/IceE/exceptions/Client.java
index 428e403f938..c533353b488 100644
--- a/javae/test/IceE/exceptions/Client.java
+++ b/javae/test/IceE/exceptions/Client.java
@@ -49,7 +49,7 @@ public class Client
}
}
- System.gc();
+ System.gc();
System.exit(status);
}
}
diff --git a/javae/test/IceE/exceptions/Collocated.java b/javae/test/IceE/exceptions/Collocated.java
index 70dc6623e5f..623f398b156 100644
--- a/javae/test/IceE/exceptions/Collocated.java
+++ b/javae/test/IceE/exceptions/Collocated.java
@@ -12,12 +12,12 @@ public class Collocated
public static int
run(String[] args, Ice.Communicator communicator, Ice.InitializationData data, java.io.PrintStream out)
{
- communicator.getProperties().setProperty("Test.Proxy", "thrower:default -p 12010 -t 10000");
+ communicator.getProperties().setProperty("Test.Proxy", "thrower:default -p 12010 -t 10000");
communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010 -t 10000");
Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
Ice.Object object = new ThrowerI(adapter);
adapter.add(object, communicator.stringToIdentity("thrower"));
- adapter.activate();
+ adapter.activate();
AllTests.allTests(communicator, out);
@@ -32,12 +32,12 @@ public class Collocated
try
{
- //
- // For this test, we need a dummy logger, otherwise the
- // assertion test will print an error message.
- //
- Ice.InitializationData initData = new Ice.InitializationData();
- initData.logger = new DummyLogger();
+ //
+ // For this test, we need a dummy logger, otherwise the
+ // assertion test will print an error message.
+ //
+ Ice.InitializationData initData = new Ice.InitializationData();
+ initData.logger = new DummyLogger();
communicator = Ice.Util.initialize(args, initData);
status = run(args, communicator, initData, System.out);
}
diff --git a/javae/test/IceE/exceptions/DummyLogger.java b/javae/test/IceE/exceptions/DummyLogger.java
index 30e72453393..c4401d8ee44 100644
--- a/javae/test/IceE/exceptions/DummyLogger.java
+++ b/javae/test/IceE/exceptions/DummyLogger.java
@@ -32,6 +32,6 @@ public final class DummyLogger implements Ice.Logger
public java.lang.Object
ice_clone()
{
- return new DummyLogger();
+ return new DummyLogger();
}
}
diff --git a/javae/test/IceE/exceptions/Server.java b/javae/test/IceE/exceptions/Server.java
index 4515b56aeca..2ce656f76d1 100644
--- a/javae/test/IceE/exceptions/Server.java
+++ b/javae/test/IceE/exceptions/Server.java
@@ -12,15 +12,15 @@ public class Server
public static int
run(String[] args, Ice.Communicator communicator, Ice.InitializationData data, java.io.PrintStream out)
{
- //
- // When running as a MIDlet the properties for the server may be
- // overridden by configuration. If it isn't then we assume
- // defaults.
- //
- if(communicator.getProperties().getProperty("TestAdapter.Endpoints").length() == 0)
- {
- communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010 -t 10000");
- }
+ //
+ // When running as a MIDlet the properties for the server may be
+ // overridden by configuration. If it isn't then we assume
+ // defaults.
+ //
+ if(communicator.getProperties().getProperty("TestAdapter.Endpoints").length() == 0)
+ {
+ communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010 -t 10000");
+ }
Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
Ice.Object object = new ThrowerI(adapter);
@@ -38,12 +38,12 @@ public class Server
try
{
- //
- // For this test, we need a dummy logger, otherwise the
- // assertion test will print an error message.
- //
- Ice.InitializationData initData = new Ice.InitializationData();
- initData.logger = new DummyLogger();
+ //
+ // For this test, we need a dummy logger, otherwise the
+ // assertion test will print an error message.
+ //
+ Ice.InitializationData initData = new Ice.InitializationData();
+ initData.logger = new DummyLogger();
communicator = Ice.Util.initialize(args, initData);
status = run(args, communicator, initData, System.out);
}
@@ -66,7 +66,7 @@ public class Server
}
}
- System.gc();
+ System.gc();
System.exit(status);
}
}
diff --git a/javae/test/IceE/facets/AllTests.java b/javae/test/IceE/facets/AllTests.java
index 83e671ba9f6..456a6e59fac 100644
--- a/javae/test/IceE/facets/AllTests.java
+++ b/javae/test/IceE/facets/AllTests.java
@@ -24,55 +24,55 @@ public class AllTests
allTests(Ice.Communicator communicator, java.io.PrintStream out)
{
out.print("testing facet registration exceptions... ");
- Ice.ObjectAdapter adapter = communicator.createObjectAdapter("FacetExceptionTestAdapter");
- Ice.Object obj = new EmptyI();
+ Ice.ObjectAdapter adapter = communicator.createObjectAdapter("FacetExceptionTestAdapter");
+ Ice.Object obj = new EmptyI();
adapter.add(obj, communicator.stringToIdentity("d"));
- adapter.addFacet(obj, communicator.stringToIdentity("d"), "facetABCD");
- try
- {
+ adapter.addFacet(obj, communicator.stringToIdentity("d"), "facetABCD");
+ try
+ {
adapter.addFacet(obj, communicator.stringToIdentity("d"), "facetABCD");
- test(false);
- }
- catch(Ice.AlreadyRegisteredException ex)
- {
- }
- adapter.removeFacet(communicator.stringToIdentity("d"), "facetABCD");
- try
- {
+ test(false);
+ }
+ catch(Ice.AlreadyRegisteredException ex)
+ {
+ }
+ adapter.removeFacet(communicator.stringToIdentity("d"), "facetABCD");
+ try
+ {
adapter.removeFacet(communicator.stringToIdentity("d"), "facetABCD");
- test(false);
- }
- catch(Ice.NotRegisteredException ex)
- {
- }
+ test(false);
+ }
+ catch(Ice.NotRegisteredException ex)
+ {
+ }
out.println("ok");
out.print("testing removeAllFacets... ");
- Ice.Object obj1 = new EmptyI();
- Ice.Object obj2 = new EmptyI();
- adapter.addFacet(obj1, communicator.stringToIdentity("id1"), "f1");
- adapter.addFacet(obj2, communicator.stringToIdentity("id1"), "f2");
- Ice.Object obj3 = new EmptyI();
- adapter.addFacet(obj1, communicator.stringToIdentity("id2"), "f1");
- adapter.addFacet(obj2, communicator.stringToIdentity("id2"), "f2");
- adapter.addFacet(obj3, communicator.stringToIdentity("id2"), "");
- java.util.Hashtable fm = adapter.removeAllFacets(communicator.stringToIdentity("id1"));
- test(fm.size() == 2);
- test(fm.get("f1") == obj1);
- test(fm.get("f2") == obj2);
- try
- {
+ Ice.Object obj1 = new EmptyI();
+ Ice.Object obj2 = new EmptyI();
+ adapter.addFacet(obj1, communicator.stringToIdentity("id1"), "f1");
+ adapter.addFacet(obj2, communicator.stringToIdentity("id1"), "f2");
+ Ice.Object obj3 = new EmptyI();
+ adapter.addFacet(obj1, communicator.stringToIdentity("id2"), "f1");
+ adapter.addFacet(obj2, communicator.stringToIdentity("id2"), "f2");
+ adapter.addFacet(obj3, communicator.stringToIdentity("id2"), "");
+ java.util.Hashtable fm = adapter.removeAllFacets(communicator.stringToIdentity("id1"));
+ test(fm.size() == 2);
+ test(fm.get("f1") == obj1);
+ test(fm.get("f2") == obj2);
+ try
+ {
adapter.removeAllFacets(communicator.stringToIdentity("id1"));
- test(false);
- }
- catch(Ice.NotRegisteredException ex)
- {
- }
- fm = adapter.removeAllFacets(communicator.stringToIdentity("id2"));
- test(fm.size() == 3);
- test(fm.get("f1") == obj1);
- test(fm.get("f2") == obj2);
- test(fm.get("") == obj3);
+ test(false);
+ }
+ catch(Ice.NotRegisteredException ex)
+ {
+ }
+ fm = adapter.removeAllFacets(communicator.stringToIdentity("id2"));
+ test(fm.size() == 3);
+ test(fm.get("f1") == obj1);
+ test(fm.get("f2") == obj2);
+ test(fm.get("") == obj3);
out.println("ok");
adapter.deactivate();
diff --git a/javae/test/IceE/facets/Client.java b/javae/test/IceE/facets/Client.java
index a43402c37da..3b1fee12740 100644
--- a/javae/test/IceE/facets/Client.java
+++ b/javae/test/IceE/facets/Client.java
@@ -49,7 +49,7 @@ public class Client
}
}
- System.gc();
+ System.gc();
System.exit(status);
}
}
diff --git a/javae/test/IceE/facets/Collocated.java b/javae/test/IceE/facets/Collocated.java
index c06ff1f0035..c002ca00032 100644
--- a/javae/test/IceE/facets/Collocated.java
+++ b/javae/test/IceE/facets/Collocated.java
@@ -12,17 +12,17 @@ public class Collocated
public static int
run(String[] args, Ice.Communicator communicator, Ice.InitializationData data, java.io.PrintStream out)
{
- communicator.getProperties().setProperty("Test.Proxy", "d:default -p 12010 -t 10000");
+ communicator.getProperties().setProperty("Test.Proxy", "d:default -p 12010 -t 10000");
communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010 -t 10000");
Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
Ice.Object d = new DI();
adapter.add(d, communicator.stringToIdentity("d"));
adapter.addFacet(d, communicator.stringToIdentity("d"), "facetABCD");
- Ice.Object f = new FI();
+ Ice.Object f = new FI();
adapter.addFacet(f, communicator.stringToIdentity("d"), "facetEF");
- Ice.Object h = new HI(communicator);
+ Ice.Object h = new HI(communicator);
adapter.addFacet(h, communicator.stringToIdentity("d"), "facetGH");
- adapter.activate();
+ adapter.activate();
AllTests.allTests(communicator, out);
diff --git a/javae/test/IceE/facets/Server.java b/javae/test/IceE/facets/Server.java
index 30407027584..40d14ac4838 100644
--- a/javae/test/IceE/facets/Server.java
+++ b/javae/test/IceE/facets/Server.java
@@ -12,23 +12,23 @@ public class Server
public static int
run(String[] args, Ice.Communicator communicator, Ice.InitializationData data, java.io.PrintStream out)
{
- //
- // When running as a MIDlet the properties for the server may be
- // overridden by configuration. If it isn't then we assume
- // defaults.
- //
- if(communicator.getProperties().getProperty("TestAdapter.Endpoints").length() == 0)
- {
- communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010 -t 10000");
- }
+ //
+ // When running as a MIDlet the properties for the server may be
+ // overridden by configuration. If it isn't then we assume
+ // defaults.
+ //
+ if(communicator.getProperties().getProperty("TestAdapter.Endpoints").length() == 0)
+ {
+ communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010 -t 10000");
+ }
Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
Ice.Object d = new DI();
adapter.add(d, communicator.stringToIdentity("d"));
adapter.addFacet(d, communicator.stringToIdentity("d"), "facetABCD");
- Ice.Object f = new FI();
+ Ice.Object f = new FI();
adapter.addFacet(f, communicator.stringToIdentity("d"), "facetEF");
- Ice.Object h = new HI(communicator);
+ Ice.Object h = new HI(communicator);
adapter.addFacet(h, communicator.stringToIdentity("d"), "facetGH");
adapter.activate();
@@ -67,7 +67,7 @@ public class Server
}
}
- System.gc();
+ System.gc();
System.exit(status);
}
}
diff --git a/javae/test/IceE/faultTolerance/AllTests.java b/javae/test/IceE/faultTolerance/AllTests.java
index 61f0ec7e7bf..234f9f1f8e0 100644
--- a/javae/test/IceE/faultTolerance/AllTests.java
+++ b/javae/test/IceE/faultTolerance/AllTests.java
@@ -22,44 +22,44 @@ public class AllTests
private static class Callback
{
- Callback()
- {
- _called = false;
- }
+ Callback()
+ {
+ _called = false;
+ }
- public synchronized boolean
- check()
- {
- while(!_called)
- {
- try
- {
- wait(30000);
- }
- catch(InterruptedException ex)
- {
- continue;
- }
+ public synchronized boolean
+ check()
+ {
+ while(!_called)
+ {
+ try
+ {
+ wait(30000);
+ }
+ catch(InterruptedException ex)
+ {
+ continue;
+ }
- if(!_called)
- {
- return false; // Must be timeout.
- }
- }
-
- _called = false;
- return true;
- }
-
- public synchronized void
- called()
- {
- IceUtil.Debug.Assert(!_called);
- _called = true;
- notify();
- }
+ if(!_called)
+ {
+ return false; // Must be timeout.
+ }
+ }
+
+ _called = false;
+ return true;
+ }
+
+ public synchronized void
+ called()
+ {
+ IceUtil.Debug.Assert(!_called);
+ _called = true;
+ notify();
+ }
- private boolean _called;
+ private boolean _called;
}
public static void
@@ -68,11 +68,11 @@ public class AllTests
out.print("testing stringToProxy... ");
out.flush();
String ref = "test";
- String host = communicator.getProperties().getProperty("Test.Host");
- if(host.length() > 0)
- {
- host = " -h " + host;
- }
+ String host = communicator.getProperties().getProperty("Test.Host");
+ if(host.length() > 0)
+ {
+ host = " -h " + host;
+ }
for(int i = 0; i < ports.length; i++)
{
ref += ":default -t 60000 -p " + ports[i] + host;
@@ -91,68 +91,68 @@ public class AllTests
int oldPid = 0;
for(int i = 1, j = 0; i <= ports.length; ++i, ++j)
{
- if(j > 3)
- {
- j = 0;
- }
+ if(j > 3)
+ {
+ j = 0;
+ }
- out.print("testing server #" + i + "... ");
- out.flush();
- int pid = obj.pid();
- test(pid != oldPid);
- out.println("ok");
- oldPid = pid;
+ out.print("testing server #" + i + "... ");
+ out.flush();
+ int pid = obj.pid();
+ test(pid != oldPid);
+ out.println("ok");
+ oldPid = pid;
if(j == 0)
{
- out.print("shutting down server #" + i + "... ");
- out.flush();
- obj.shutdown();
- out.println("ok");
+ out.print("shutting down server #" + i + "... ");
+ out.flush();
+ obj.shutdown();
+ out.println("ok");
}
else if(j == 1 || i + 1 > ports.length)
{
- out.print("aborting server #" + i + "... ");
- out.flush();
- try
- {
- obj.abort();
- test(false);
- }
- catch(Ice.ConnectionLostException ex)
- {
- out.println("ok");
- }
- catch(Ice.ConnectFailedException exc)
- {
- out.println("ok");
- }
- catch(Ice.SocketException ex)
- {
- out.println("ok");
- }
+ out.print("aborting server #" + i + "... ");
+ out.flush();
+ try
+ {
+ obj.abort();
+ test(false);
+ }
+ catch(Ice.ConnectionLostException ex)
+ {
+ out.println("ok");
+ }
+ catch(Ice.ConnectFailedException exc)
+ {
+ out.println("ok");
+ }
+ catch(Ice.SocketException ex)
+ {
+ out.println("ok");
+ }
}
else if(j == 2 || j == 3)
{
- out.print("aborting server #" + i + " and #" + (i + 1) + " with idempotent call... ");
- out.flush();
- try
- {
- obj.idempotentAbort();
- test(false);
- }
- catch(Ice.ConnectionLostException ex)
- {
- out.println("ok");
- }
- catch(Ice.ConnectFailedException exc)
- {
- out.println("ok");
- }
- catch(Ice.SocketException ex)
- {
- out.println("ok");
- }
+ out.print("aborting server #" + i + " and #" + (i + 1) + " with idempotent call... ");
+ out.flush();
+ try
+ {
+ obj.idempotentAbort();
+ test(false);
+ }
+ catch(Ice.ConnectionLostException ex)
+ {
+ out.println("ok");
+ }
+ catch(Ice.ConnectFailedException exc)
+ {
+ out.println("ok");
+ }
+ catch(Ice.SocketException ex)
+ {
+ out.println("ok");
+ }
++i;
}
diff --git a/javae/test/IceE/faultTolerance/Client.java b/javae/test/IceE/faultTolerance/Client.java
index 13a34837a6f..db9a4b5fa8b 100644
--- a/javae/test/IceE/faultTolerance/Client.java
+++ b/javae/test/IceE/faultTolerance/Client.java
@@ -48,31 +48,31 @@ public class Client
if(ports.isEmpty())
{
- //
- // MIDlets won't have command line options, but they can
- // configure a port range by specificying a start port and a
- // number of ports to configure.
- //
- String startPort = communicator.getProperties().getProperty("Test.FirstPort");
- String nPorts = communicator.getProperties().getProperty("Test.ServerCount");
+ //
+ // MIDlets won't have command line options, but they can
+ // configure a port range by specificying a start port and a
+ // number of ports to configure.
+ //
+ String startPort = communicator.getProperties().getProperty("Test.FirstPort");
+ String nPorts = communicator.getProperties().getProperty("Test.ServerCount");
- int firstPort = 0;
- int n = 0;
- try
- {
- firstPort = Integer.parseInt(startPort);
- n = Integer.parseInt(nPorts);
- }
+ int firstPort = 0;
+ int n = 0;
+ try
+ {
+ firstPort = Integer.parseInt(startPort);
+ n = Integer.parseInt(nPorts);
+ }
catch(NumberFormatException ex)
{
ex.printStackTrace();
return 1;
}
- for(int i = 0; i < n; ++i)
- {
- ports.addElement(new Integer(firstPort++));
- }
+ for(int i = 0; i < n; ++i)
+ {
+ ports.addElement(new Integer(firstPort++));
+ }
}
if(ports.isEmpty())
@@ -80,7 +80,7 @@ public class Client
out.println("Client: no ports specified");
usage(out);
return 1;
- }
+ }
int[] arr = new int[ports.size()];
for(int i = 0; i < arr.length; i++)
@@ -88,15 +88,15 @@ public class Client
arr[i] = ((Integer)ports.elementAt(i)).intValue();
}
- try
- {
- AllTests.allTests(communicator, arr, out);
- }
- catch(Ice.LocalException ex)
- {
- ex.printStackTrace();
- AllTests.test(false);
- }
+ try
+ {
+ AllTests.allTests(communicator, arr, out);
+ }
+ catch(Ice.LocalException ex)
+ {
+ ex.printStackTrace();
+ AllTests.test(false);
+ }
return 0;
}
@@ -109,14 +109,14 @@ public class Client
try
{
- Ice.StringSeqHolder argsH = new Ice.StringSeqHolder(args);
- Ice.InitializationData initData = new Ice.InitializationData();
- initData.properties = Ice.Util.createProperties(argsH);
-
- //
- // This test aborts servers, so we don't want warnings.
- //
- initData.properties.setProperty("Ice.Warn.Connections", "0");
+ Ice.StringSeqHolder argsH = new Ice.StringSeqHolder(args);
+ Ice.InitializationData initData = new Ice.InitializationData();
+ initData.properties = Ice.Util.createProperties(argsH);
+
+ //
+ // This test aborts servers, so we don't want warnings.
+ //
+ initData.properties.setProperty("Ice.Warn.Connections", "0");
communicator = Ice.Util.initialize(argsH, initData);
status = run(argsH.value, communicator, initData, System.out);
@@ -140,7 +140,7 @@ public class Client
}
}
- System.gc();
+ System.gc();
System.exit(status);
}
}
diff --git a/javae/test/IceE/faultTolerance/Server.java b/javae/test/IceE/faultTolerance/Server.java
index a0b678547f3..4c406966c59 100644
--- a/javae/test/IceE/faultTolerance/Server.java
+++ b/javae/test/IceE/faultTolerance/Server.java
@@ -71,15 +71,15 @@ public class Server
try
{
- //
- // In this test, we need a longer server idle time,
- // otherwise our test servers may time out before they are
- // used in the test.
- //
- Ice.StringSeqHolder argsH = new Ice.StringSeqHolder(args);
- Ice.InitializationData initData = new Ice.InitializationData();
- initData.properties = Ice.Util.createProperties(argsH);
- initData.properties.setProperty("Ice.ServerIdleTime", "120"); // Two minutes.
+ //
+ // In this test, we need a longer server idle time,
+ // otherwise our test servers may time out before they are
+ // used in the test.
+ //
+ Ice.StringSeqHolder argsH = new Ice.StringSeqHolder(args);
+ Ice.InitializationData initData = new Ice.InitializationData();
+ initData.properties = Ice.Util.createProperties(argsH);
+ initData.properties.setProperty("Ice.ServerIdleTime", "120"); // Two minutes.
communicator = Ice.Util.initialize(argsH, initData);
status = run(argsH.value, communicator);
@@ -103,7 +103,7 @@ public class Server
}
}
- System.gc();
+ System.gc();
System.exit(status);
}
}
diff --git a/javae/test/IceE/faultTolerance/TestI.java b/javae/test/IceE/faultTolerance/TestI.java
index ca0fb0fc387..36d78b7d991 100644
--- a/javae/test/IceE/faultTolerance/TestI.java
+++ b/javae/test/IceE/faultTolerance/TestI.java
@@ -15,7 +15,7 @@ public final class TestI extends _TestIntfDisp
TestI(Ice.ObjectAdapter adapter, int port)
{
_adapter = adapter;
- _pseudoPid = port; // We use the port number instead of the process ID in Java.
+ _pseudoPid = port; // We use the port number instead of the process ID in Java.
}
public void
@@ -27,13 +27,13 @@ public final class TestI extends _TestIntfDisp
public void
abort(Ice.Current current)
{
- System.exit(1);
+ System.exit(1);
}
public void
idempotentAbort(Ice.Current current)
{
- System.exit(1);
+ System.exit(1);
}
public int
diff --git a/javae/test/IceE/inheritance/AllTests.java b/javae/test/IceE/inheritance/AllTests.java
index 94c05011b27..bf742cf24d0 100644
--- a/javae/test/IceE/inheritance/AllTests.java
+++ b/javae/test/IceE/inheritance/AllTests.java
@@ -24,7 +24,7 @@ public class AllTests
out.print("testing stringToProxy... ");
out.flush();
String ref = communicator.getProperties().getPropertyWithDefault("Test.Proxy",
- "initial:default -p 12010 -t 10000");
+ "initial:default -p 12010 -t 10000");
Ice.ObjectPrx base = communicator.stringToProxy(ref);
test(base != null);
out.println("ok");
diff --git a/javae/test/IceE/inheritance/Client.java b/javae/test/IceE/inheritance/Client.java
index 37676a37821..30944eb9882 100644
--- a/javae/test/IceE/inheritance/Client.java
+++ b/javae/test/IceE/inheritance/Client.java
@@ -49,7 +49,7 @@ public class Client
}
}
- System.gc();
+ System.gc();
System.exit(status);
}
}
diff --git a/javae/test/IceE/inheritance/Collocated.java b/javae/test/IceE/inheritance/Collocated.java
index f69cfadb63e..ac3fea8df27 100644
--- a/javae/test/IceE/inheritance/Collocated.java
+++ b/javae/test/IceE/inheritance/Collocated.java
@@ -12,12 +12,12 @@ public class Collocated
public static int
run(String[] args, Ice.Communicator communicator, Ice.InitializationData data, java.io.PrintStream out)
{
- communicator.getProperties().setProperty("Test.Proxy", "initial:default -p 12010 -t 10000");
+ communicator.getProperties().setProperty("Test.Proxy", "initial:default -p 12010 -t 10000");
communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010 -t 10000");
Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
Ice.Object object = new InitialI(adapter);
adapter.add(object, communicator.stringToIdentity("initial"));
- adapter.activate();
+ adapter.activate();
AllTests.allTests(communicator, out);
diff --git a/javae/test/IceE/inheritance/Server.java b/javae/test/IceE/inheritance/Server.java
index 0f37db1f49d..f764e2e7be8 100644
--- a/javae/test/IceE/inheritance/Server.java
+++ b/javae/test/IceE/inheritance/Server.java
@@ -12,15 +12,15 @@ public class Server
public static int
run(String[] args, Ice.Communicator communicator, Ice.InitializationData data, java.io.PrintStream out)
{
- //
- // When running as a MIDlet the properties for the server may be
- // overridden by configuration. If it isn't then we assume
- // defaults.
- //
- if(communicator.getProperties().getProperty("TestAdapter.Endpoints").length() == 0)
- {
- communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010 -t 10000");
- }
+ //
+ // When running as a MIDlet the properties for the server may be
+ // overridden by configuration. If it isn't then we assume
+ // defaults.
+ //
+ if(communicator.getProperties().getProperty("TestAdapter.Endpoints").length() == 0)
+ {
+ communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010 -t 10000");
+ }
Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
Ice.Object object = new InitialI(adapter);
@@ -60,7 +60,7 @@ public class Server
}
}
- System.gc();
+ System.gc();
System.exit(status);
}
}
diff --git a/javae/test/IceE/location/AllTests.java b/javae/test/IceE/location/AllTests.java
index 13012e91d6b..6c3c41415ca 100644
--- a/javae/test/IceE/location/AllTests.java
+++ b/javae/test/IceE/location/AllTests.java
@@ -23,261 +23,261 @@ public class AllTests
public static void
allTests(Ice.Communicator communicator, java.io.PrintStream out)
{
- String serverManagerRef = communicator.getProperties().getPropertyWithDefault("Test.ServerManager",
- "ServerManager :default -t 10000 -p 12010");
- ServerManagerPrx manager = ServerManagerPrxHelper.checkedCast(communicator.stringToProxy(serverManagerRef));
- test(manager != null);
- Ice.LocatorPrx locator = Ice.LocatorPrxHelper.uncheckedCast(communicator.getDefaultLocator());
- test(locator != null);
+ String serverManagerRef = communicator.getProperties().getPropertyWithDefault("Test.ServerManager",
+ "ServerManager :default -t 10000 -p 12010");
+ ServerManagerPrx manager = ServerManagerPrxHelper.checkedCast(communicator.stringToProxy(serverManagerRef));
+ test(manager != null);
+ Ice.LocatorPrx locator = Ice.LocatorPrxHelper.uncheckedCast(communicator.getDefaultLocator());
+ test(locator != null);
- out.print("testing stringToProxy... ");
+ out.print("testing stringToProxy... ");
out.flush();
- Ice.ObjectPrx base = communicator.stringToProxy("test @ TestAdapter");
- Ice.ObjectPrx base2 = communicator.stringToProxy("test @ TestAdapter");
- Ice.ObjectPrx base3 = communicator.stringToProxy("test");
- Ice.ObjectPrx base4 = communicator.stringToProxy("ServerManager");
- Ice.ObjectPrx base5 = communicator.stringToProxy("test2");
- Ice.ObjectPrx base6 = communicator.stringToProxy("test @ ReplicatedAdapter");
- out.println("ok");
+ Ice.ObjectPrx base = communicator.stringToProxy("test @ TestAdapter");
+ Ice.ObjectPrx base2 = communicator.stringToProxy("test @ TestAdapter");
+ Ice.ObjectPrx base3 = communicator.stringToProxy("test");
+ Ice.ObjectPrx base4 = communicator.stringToProxy("ServerManager");
+ Ice.ObjectPrx base5 = communicator.stringToProxy("test2");
+ Ice.ObjectPrx base6 = communicator.stringToProxy("test @ ReplicatedAdapter");
+ out.println("ok");
- System.out.print("testing ice_locator and ice_getLocator... ");
- test(Ice.Util.proxyIdentityCompare(base.ice_getLocator(), communicator.getDefaultLocator()) == 0);
- Ice.LocatorPrx anotherLocator =
- Ice.LocatorPrxHelper.uncheckedCast(communicator.stringToProxy("anotherLocator"));
- base = base.ice_locator(anotherLocator);
- test(Ice.Util.proxyIdentityCompare(base.ice_getLocator(), anotherLocator) == 0);
- communicator.setDefaultLocator(null);
- base = communicator.stringToProxy("test @ TestAdapter");
- test(base.ice_getLocator() == null);
- base = base.ice_locator(anotherLocator);
- test(Ice.Util.proxyIdentityCompare(base.ice_getLocator(), anotherLocator) == 0);
- communicator.setDefaultLocator(locator);
- base = communicator.stringToProxy("test @ TestAdapter");
- test(Ice.Util.proxyIdentityCompare(base.ice_getLocator(), communicator.getDefaultLocator()) == 0);
-
- //
- // We also test ice_router/ice_getRouter (perhaps we should add a
- // test/Ice/router test?)
- //
- test(base.ice_getRouter() == null);
- Ice.RouterPrx anotherRouter = Ice.RouterPrxHelper.uncheckedCast(communicator.stringToProxy("anotherRouter"));
- base = base.ice_router(anotherRouter);
- test(Ice.Util.proxyIdentityCompare(base.ice_getRouter(), anotherRouter) == 0);
- Ice.RouterPrx router = Ice.RouterPrxHelper.uncheckedCast(communicator.stringToProxy("dummyrouter"));
- communicator.setDefaultRouter(router);
- base = communicator.stringToProxy("test @ TestAdapter");
- test(Ice.Util.proxyIdentityCompare(base.ice_getRouter(), communicator.getDefaultRouter()) == 0);
- communicator.setDefaultRouter(null);
- base = communicator.stringToProxy("test @ TestAdapter");
- test(base.ice_getRouter() == null);
- System.out.println("ok");
+ System.out.print("testing ice_locator and ice_getLocator... ");
+ test(Ice.Util.proxyIdentityCompare(base.ice_getLocator(), communicator.getDefaultLocator()) == 0);
+ Ice.LocatorPrx anotherLocator =
+ Ice.LocatorPrxHelper.uncheckedCast(communicator.stringToProxy("anotherLocator"));
+ base = base.ice_locator(anotherLocator);
+ test(Ice.Util.proxyIdentityCompare(base.ice_getLocator(), anotherLocator) == 0);
+ communicator.setDefaultLocator(null);
+ base = communicator.stringToProxy("test @ TestAdapter");
+ test(base.ice_getLocator() == null);
+ base = base.ice_locator(anotherLocator);
+ test(Ice.Util.proxyIdentityCompare(base.ice_getLocator(), anotherLocator) == 0);
+ communicator.setDefaultLocator(locator);
+ base = communicator.stringToProxy("test @ TestAdapter");
+ test(Ice.Util.proxyIdentityCompare(base.ice_getLocator(), communicator.getDefaultLocator()) == 0);
+
+ //
+ // We also test ice_router/ice_getRouter (perhaps we should add a
+ // test/Ice/router test?)
+ //
+ test(base.ice_getRouter() == null);
+ Ice.RouterPrx anotherRouter = Ice.RouterPrxHelper.uncheckedCast(communicator.stringToProxy("anotherRouter"));
+ base = base.ice_router(anotherRouter);
+ test(Ice.Util.proxyIdentityCompare(base.ice_getRouter(), anotherRouter) == 0);
+ Ice.RouterPrx router = Ice.RouterPrxHelper.uncheckedCast(communicator.stringToProxy("dummyrouter"));
+ communicator.setDefaultRouter(router);
+ base = communicator.stringToProxy("test @ TestAdapter");
+ test(Ice.Util.proxyIdentityCompare(base.ice_getRouter(), communicator.getDefaultRouter()) == 0);
+ communicator.setDefaultRouter(null);
+ base = communicator.stringToProxy("test @ TestAdapter");
+ test(base.ice_getRouter() == null);
+ System.out.println("ok");
- //
- // Start a server, get the port of the adapter it's listening on,
- // and add it to the configuration so that the client can locate
- // the TestAdapter adapter.
- //
- out.print("starting server... ");
+ //
+ // Start a server, get the port of the adapter it's listening on,
+ // and add it to the configuration so that the client can locate
+ // the TestAdapter adapter.
+ //
+ out.print("starting server... ");
out.flush();
- manager.startServer();
- out.println("ok");
+ manager.startServer();
+ out.println("ok");
- out.print("testing checked cast... ");
+ out.print("testing checked cast... ");
out.flush();
- TestIntfPrx obj = TestIntfPrxHelper.checkedCast(base);
- test(obj != null);
- TestIntfPrx obj2 = TestIntfPrxHelper.checkedCast(base2);
- test(obj2 != null);
- TestIntfPrx obj3 = TestIntfPrxHelper.checkedCast(base3);
- test(obj3 != null);
- ServerManagerPrx obj4 = ServerManagerPrxHelper.checkedCast(base4);
- test(obj4 != null);
- TestIntfPrx obj5 = TestIntfPrxHelper.checkedCast(base5);
- test(obj5 != null);
- TestIntfPrx obj6 = TestIntfPrxHelper.checkedCast(base6);
- test(obj6 != null);
- out.println("ok");
+ TestIntfPrx obj = TestIntfPrxHelper.checkedCast(base);
+ test(obj != null);
+ TestIntfPrx obj2 = TestIntfPrxHelper.checkedCast(base2);
+ test(obj2 != null);
+ TestIntfPrx obj3 = TestIntfPrxHelper.checkedCast(base3);
+ test(obj3 != null);
+ ServerManagerPrx obj4 = ServerManagerPrxHelper.checkedCast(base4);
+ test(obj4 != null);
+ TestIntfPrx obj5 = TestIntfPrxHelper.checkedCast(base5);
+ test(obj5 != null);
+ TestIntfPrx obj6 = TestIntfPrxHelper.checkedCast(base6);
+ test(obj6 != null);
+ out.println("ok");
- out.print("testing id@AdapterId indirect proxy... ");
+ out.print("testing id@AdapterId indirect proxy... ");
out.flush();
- obj.shutdown();
- manager.startServer();
- try
- {
- obj2.ice_ping();
- }
- catch(Ice.LocalException ex)
- {
- test(false);
- }
- out.println("ok");
+ obj.shutdown();
+ manager.startServer();
+ try
+ {
+ obj2.ice_ping();
+ }
+ catch(Ice.LocalException ex)
+ {
+ test(false);
+ }
+ out.println("ok");
- out.print("testing id@ReplicaGroupId indirect proxy... ");
+ out.print("testing id@ReplicaGroupId indirect proxy... ");
out.flush();
- obj.shutdown();
- manager.startServer();
- try
- {
- obj6.ice_ping();
- }
- catch(Ice.LocalException ex)
- {
- test(false);
- }
- out.println("ok");
+ obj.shutdown();
+ manager.startServer();
+ try
+ {
+ obj6.ice_ping();
+ }
+ catch(Ice.LocalException ex)
+ {
+ test(false);
+ }
+ out.println("ok");
- out.print("testing identity indirect proxy... ");
+ out.print("testing identity indirect proxy... ");
out.flush();
- obj.shutdown();
- manager.startServer();
- try
- {
- obj3 = TestIntfPrxHelper.checkedCast(base3);
- obj3.ice_ping();
- }
- catch(Ice.LocalException ex)
- {
- test(false);
- }
- try
- {
- obj2 = TestIntfPrxHelper.checkedCast(base2);
- obj2.ice_ping();
- }
- catch(Ice.LocalException ex)
- {
- test(false);
- }
- obj.shutdown();
- manager.startServer();
- try
- {
- obj2 = TestIntfPrxHelper.checkedCast(base2);
- obj2.ice_ping();
- }
- catch(Ice.LocalException ex)
- {
- test(false);
- }
- try
- {
- obj3 = TestIntfPrxHelper.checkedCast(base3);
- obj3.ice_ping();
- }
- catch(Ice.LocalException ex)
- {
- test(false);
- }
- obj.shutdown();
- manager.startServer();
- try
- {
- obj2 = TestIntfPrxHelper.checkedCast(base2);
- obj2.ice_ping();
- }
- catch(Ice.LocalException ex)
- {
- test(false);
- }
- obj.shutdown();
- manager.startServer();
- try
- {
- obj3 = TestIntfPrxHelper.checkedCast(base2);
- obj3.ice_ping();
- }
- catch(Ice.LocalException ex)
- {
- test(false);
- }
- obj.shutdown();
- manager.startServer();
- try
- {
- obj5 = TestIntfPrxHelper.checkedCast(base5);
- obj5.ice_ping();
- }
- catch(Ice.LocalException ex)
- {
- test(false);
- }
+ obj.shutdown();
+ manager.startServer();
+ try
+ {
+ obj3 = TestIntfPrxHelper.checkedCast(base3);
+ obj3.ice_ping();
+ }
+ catch(Ice.LocalException ex)
+ {
+ test(false);
+ }
+ try
+ {
+ obj2 = TestIntfPrxHelper.checkedCast(base2);
+ obj2.ice_ping();
+ }
+ catch(Ice.LocalException ex)
+ {
+ test(false);
+ }
+ obj.shutdown();
+ manager.startServer();
+ try
+ {
+ obj2 = TestIntfPrxHelper.checkedCast(base2);
+ obj2.ice_ping();
+ }
+ catch(Ice.LocalException ex)
+ {
+ test(false);
+ }
+ try
+ {
+ obj3 = TestIntfPrxHelper.checkedCast(base3);
+ obj3.ice_ping();
+ }
+ catch(Ice.LocalException ex)
+ {
+ test(false);
+ }
+ obj.shutdown();
+ manager.startServer();
+ try
+ {
+ obj2 = TestIntfPrxHelper.checkedCast(base2);
+ obj2.ice_ping();
+ }
+ catch(Ice.LocalException ex)
+ {
+ test(false);
+ }
+ obj.shutdown();
+ manager.startServer();
+ try
+ {
+ obj3 = TestIntfPrxHelper.checkedCast(base2);
+ obj3.ice_ping();
+ }
+ catch(Ice.LocalException ex)
+ {
+ test(false);
+ }
+ obj.shutdown();
+ manager.startServer();
+ try
+ {
+ obj5 = TestIntfPrxHelper.checkedCast(base5);
+ obj5.ice_ping();
+ }
+ catch(Ice.LocalException ex)
+ {
+ test(false);
+ }
- out.println("ok");
+ out.println("ok");
- out.print("testing reference with unknown identity... ");
- out.flush();
- try
- {
- base = communicator.stringToProxy("unknown/unknown");
- base.ice_ping();
- test(false);
- }
- catch(Ice.NotRegisteredException ex)
- {
- test(ex.kindOfObject.equals("object"));
- test(ex.id.equals("unknown/unknown"));
- }
- out.println("ok");
+ out.print("testing reference with unknown identity... ");
+ out.flush();
+ try
+ {
+ base = communicator.stringToProxy("unknown/unknown");
+ base.ice_ping();
+ test(false);
+ }
+ catch(Ice.NotRegisteredException ex)
+ {
+ test(ex.kindOfObject.equals("object"));
+ test(ex.id.equals("unknown/unknown"));
+ }
+ out.println("ok");
- out.print("testing reference with unknown adapter... ");
- out.flush();
- try
- {
- base = communicator.stringToProxy("test @ TestAdapterUnknown");
- base.ice_ping();
- test(false);
- }
- catch(Ice.NotRegisteredException ex)
- {
- test(ex.kindOfObject.equals("object adapter"));
- test(ex.id.equals("TestAdapterUnknown"));
- }
- out.println("ok");
+ out.print("testing reference with unknown adapter... ");
+ out.flush();
+ try
+ {
+ base = communicator.stringToProxy("test @ TestAdapterUnknown");
+ base.ice_ping();
+ test(false);
+ }
+ catch(Ice.NotRegisteredException ex)
+ {
+ test(ex.kindOfObject.equals("object adapter"));
+ test(ex.id.equals("TestAdapterUnknown"));
+ }
+ out.println("ok");
- out.print("testing object reference from server... ");
+ out.print("testing object reference from server... ");
out.flush();
- HelloPrx hello = obj.getHello();
- hello.sayHello();
- test(communicator.proxyToString(hello).indexOf("TestAdapter") != -1);
- hello = obj.getReplicatedHello();
- hello.sayHello();
- test(communicator.proxyToString(hello).indexOf("ReplicatedAdapter") != -1);
- out.println("ok");
+ HelloPrx hello = obj.getHello();
+ hello.sayHello();
+ test(communicator.proxyToString(hello).indexOf("TestAdapter") != -1);
+ hello = obj.getReplicatedHello();
+ hello.sayHello();
+ test(communicator.proxyToString(hello).indexOf("ReplicatedAdapter") != -1);
+ out.println("ok");
- out.print("testing object reference from server after shutdown... ");
+ out.print("testing object reference from server after shutdown... ");
out.flush();
- obj.shutdown();
- manager.startServer();
- hello.sayHello();
- out.println("ok");
+ obj.shutdown();
+ manager.startServer();
+ hello.sayHello();
+ out.println("ok");
- out.print("testing object migration...");
- out.flush();
- hello = HelloPrxHelper.checkedCast(communicator.stringToProxy("hello"));
- obj.migrateHello();
- hello.sayHello();
- obj.migrateHello();
- hello.sayHello();
- obj.migrateHello();
- hello.sayHello();
- out.println("ok");
+ out.print("testing object migration...");
+ out.flush();
+ hello = HelloPrxHelper.checkedCast(communicator.stringToProxy("hello"));
+ obj.migrateHello();
+ hello.sayHello();
+ obj.migrateHello();
+ hello.sayHello();
+ obj.migrateHello();
+ hello.sayHello();
+ out.println("ok");
- out.print("testing whether server is gone... ");
+ out.print("testing whether server is gone... ");
out.flush();
- obj.shutdown();
- try
- {
- obj2.ice_ping();
- test(false);
- }
+ obj.shutdown();
+ try
+ {
+ obj2.ice_ping();
+ test(false);
+ }
catch(Ice.LocalException ex)
{
out.println("ok");
}
- out.print("shutdown server manager... ");
+ out.print("shutdown server manager... ");
out.flush();
- manager.shutdown();
- out.println("ok");
+ manager.shutdown();
+ out.println("ok");
}
}
diff --git a/javae/test/IceE/location/Client.java b/javae/test/IceE/location/Client.java
index 899b2f31c53..6adb2a7d3af 100644
--- a/javae/test/IceE/location/Client.java
+++ b/javae/test/IceE/location/Client.java
@@ -12,7 +12,7 @@ public class Client
public static int
run(String[] args, Ice.Communicator communicator, Ice.InitializationData data, java.io.PrintStream out)
{
- AllTests.allTests(communicator, out);
+ AllTests.allTests(communicator, out);
return 0;
}
@@ -24,16 +24,16 @@ public class Client
try
{
- Ice.StringSeqHolder argsH = new Ice.StringSeqHolder(args);
- Ice.InitializationData initData = new Ice.InitializationData();
+ Ice.StringSeqHolder argsH = new Ice.StringSeqHolder(args);
+ Ice.InitializationData initData = new Ice.InitializationData();
initData.properties = Ice.Util.createProperties(argsH);
- initData.properties.setProperty("Ice.Default.Locator", "locator:default -p 12010");
+ initData.properties.setProperty("Ice.Default.Locator", "locator:default -p 12010");
- if(initData.properties.getPropertyAsInt("Ice.Blocking") > 0)
- {
- initData.properties.setProperty("Ice.RetryIntervals", "0 0");
- initData.properties.setProperty("Ice.Warn.Connections", "0");
- }
+ if(initData.properties.getPropertyAsInt("Ice.Blocking") > 0)
+ {
+ initData.properties.setProperty("Ice.RetryIntervals", "0 0");
+ initData.properties.setProperty("Ice.Warn.Connections", "0");
+ }
communicator = Ice.Util.initialize(argsH, initData);
status = run(argsH.value, communicator, initData, System.out);
@@ -57,7 +57,7 @@ public class Client
}
}
- System.gc();
+ System.gc();
System.exit(status);
}
}
diff --git a/javae/test/IceE/location/Server.java b/javae/test/IceE/location/Server.java
index 34da70c220d..94cd08bd85e 100644
--- a/javae/test/IceE/location/Server.java
+++ b/javae/test/IceE/location/Server.java
@@ -12,43 +12,43 @@ public class Server
public static int
run(String[] args, Ice.Communicator communicator, Ice.InitializationData initData, java.io.PrintStream out)
{
- //
- // When running as a MIDlet the properties for the server may be
- // overridden by configuration. If it isn't then we assume
- // defaults.
- //
- if(communicator.getProperties().getProperty("ServerManagerAdapter.Endpoints").length() == 0)
- {
- communicator.getProperties().setProperty("ServerManagerAdapter.Endpoints", "default -p 12010 -t 30000");
- }
+ //
+ // When running as a MIDlet the properties for the server may be
+ // overridden by configuration. If it isn't then we assume
+ // defaults.
+ //
+ if(communicator.getProperties().getProperty("ServerManagerAdapter.Endpoints").length() == 0)
+ {
+ communicator.getProperties().setProperty("ServerManagerAdapter.Endpoints", "default -p 12010 -t 30000");
+ }
- //
- // Register the server manager. The server manager creates a new
- // 'server' (a server isn't a different process, it's just a new
- // communicator and object adapter).
- //
- Ice.ObjectAdapter adapter = communicator.createObjectAdapter("ServerManagerAdapter");
+ //
+ // Register the server manager. The server manager creates a new
+ // 'server' (a server isn't a different process, it's just a new
+ // communicator and object adapter).
+ //
+ 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
- // 'servers' created with the server manager interface.
- //
- ServerLocatorRegistry registry = new ServerLocatorRegistry();
- registry.addObject(adapter.createProxy(communicator.stringToIdentity("ServerManager")));
- Ice.Object object = new ServerManagerI(adapter, registry, initData);
- adapter.add(object, communicator.stringToIdentity("ServerManager"));
+ //
+ // We also register a sample server locator which implements the
+ // locator interface, this locator is used by the clients and the
+ // 'servers' created with the server manager interface.
+ //
+ ServerLocatorRegistry registry = new ServerLocatorRegistry();
+ registry.addObject(adapter.createProxy(communicator.stringToIdentity("ServerManager")));
+ Ice.Object object = new ServerManagerI(adapter, registry, initData);
+ adapter.add(object, 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;
+ 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
@@ -59,20 +59,20 @@ public class Server
try
{
- Ice.StringSeqHolder argsH = new Ice.StringSeqHolder(args);
- Ice.InitializationData initData = new Ice.InitializationData();
- initData.properties = Ice.Util.createProperties(argsH);
+ Ice.StringSeqHolder argsH = new Ice.StringSeqHolder(args);
+ Ice.InitializationData initData = new Ice.InitializationData();
+ initData.properties = Ice.Util.createProperties(argsH);
- //
+ //
// For blocking client test, set timeout so CloseConnection send will
// return quickly. Otherwise server will hang since client is not
// listening for these messages.
//
- if(initData.properties.getPropertyAsInt("Ice.Blocking") > 0)
+ if(initData.properties.getPropertyAsInt("Ice.Blocking") > 0)
{
initData.properties.setProperty("Ice.Override.Timeout", "100");
- initData.properties.setProperty("Ice.Warn.Connections", "0");
- }
+ initData.properties.setProperty("Ice.Warn.Connections", "0");
+ }
communicator = Ice.Util.initialize(argsH, initData);
status = run(argsH.value, communicator, initData, System.out);
@@ -96,7 +96,7 @@ public class Server
}
}
- System.gc();
+ System.gc();
System.exit(status);
}
}
diff --git a/javae/test/IceE/location/ServerLocator.java b/javae/test/IceE/location/ServerLocator.java
index eac0d156876..064e8e15194 100644
--- a/javae/test/IceE/location/ServerLocator.java
+++ b/javae/test/IceE/location/ServerLocator.java
@@ -12,28 +12,28 @@ public class ServerLocator extends Ice._LocatorDisp
public
ServerLocator(ServerLocatorRegistry registry, Ice.LocatorRegistryPrx registryPrx)
{
- _registry = registry;
- _registryPrx = registryPrx;
+ _registry = registry;
+ _registryPrx = registryPrx;
}
public Ice.ObjectPrx
findAdapterById(String adapter, Ice.Current current)
- throws Ice.AdapterNotFoundException
+ throws Ice.AdapterNotFoundException
{
- return _registry.getAdapter(adapter);
+ return _registry.getAdapter(adapter);
}
public Ice.ObjectPrx
findObjectById(Ice.Identity id, Ice.Current current)
- throws Ice.ObjectNotFoundException
+ throws Ice.ObjectNotFoundException
{
- return _registry.getObject(id);
+ return _registry.getObject(id);
}
public Ice.LocatorRegistryPrx
getRegistry(Ice.Current current)
{
- return _registryPrx;
+ return _registryPrx;
}
private ServerLocatorRegistry _registry;
diff --git a/javae/test/IceE/location/ServerLocatorRegistry.java b/javae/test/IceE/location/ServerLocatorRegistry.java
index 8e52db116db..67497c4cd1f 100644
--- a/javae/test/IceE/location/ServerLocatorRegistry.java
+++ b/javae/test/IceE/location/ServerLocatorRegistry.java
@@ -39,32 +39,32 @@ public class ServerLocatorRegistry extends Ice._LocatorRegistryDisp
public Ice.ObjectPrx
getAdapter(String adapter)
- throws Ice.AdapterNotFoundException
+ throws Ice.AdapterNotFoundException
{
- Ice.ObjectPrx obj = (Ice.ObjectPrx)_adapters.get(adapter);
- if(obj == null)
- {
- throw new Ice.AdapterNotFoundException();
- }
- return obj;
+ Ice.ObjectPrx obj = (Ice.ObjectPrx)_adapters.get(adapter);
+ if(obj == null)
+ {
+ throw new Ice.AdapterNotFoundException();
+ }
+ return obj;
}
public Ice.ObjectPrx
getObject(Ice.Identity id)
- throws Ice.ObjectNotFoundException
+ throws Ice.ObjectNotFoundException
{
- Ice.ObjectPrx obj = (Ice.ObjectPrx)_objects.get(id);
- if(obj == null)
- {
- throw new Ice.ObjectNotFoundException();
- }
- return obj;
+ Ice.ObjectPrx obj = (Ice.ObjectPrx)_objects.get(id);
+ if(obj == null)
+ {
+ throw new Ice.ObjectNotFoundException();
+ }
+ return obj;
}
public void
addObject(Ice.ObjectPrx object)
{
- _objects.put(object.ice_getIdentity(), object);
+ _objects.put(object.ice_getIdentity(), object);
}
private java.util.Hashtable _adapters = new java.util.Hashtable();
diff --git a/javae/test/IceE/location/ServerManagerI.java b/javae/test/IceE/location/ServerManagerI.java
index 954541fc09e..fb4e64d3c0f 100644
--- a/javae/test/IceE/location/ServerManagerI.java
+++ b/javae/test/IceE/location/ServerManagerI.java
@@ -12,67 +12,67 @@ import Test.*;
public class ServerManagerI extends _ServerManagerDisp
{
ServerManagerI(Ice.ObjectAdapter adapter, ServerLocatorRegistry registry,
- Ice.InitializationData initData)
+ Ice.InitializationData initData)
{
- _adapter = adapter;
- _registry = registry;
- _communicators = new java.util.Vector();
- _initData = initData;
-
- _initData.properties.setProperty("TestAdapter2.Endpoints", "default");
- _initData.properties.setProperty("TestAdapter2.AdapterId", "TestAdapter2");
- _initData.properties.setProperty("TestAdapter.Endpoints", "default");
- _initData.properties.setProperty("TestAdapter.AdapterId", "TestAdapter");
- _initData.properties.setProperty("TestAdapter.ReplicaGroupId", "ReplicatedAdapter");
+ _adapter = adapter;
+ _registry = registry;
+ _communicators = new java.util.Vector();
+ _initData = initData;
+
+ _initData.properties.setProperty("TestAdapter2.Endpoints", "default");
+ _initData.properties.setProperty("TestAdapter2.AdapterId", "TestAdapter2");
+ _initData.properties.setProperty("TestAdapter.Endpoints", "default");
+ _initData.properties.setProperty("TestAdapter.AdapterId", "TestAdapter");
+ _initData.properties.setProperty("TestAdapter.ReplicaGroupId", "ReplicatedAdapter");
}
public void
startServer(Ice.Current current)
{
java.util.Enumeration e = _communicators.elements();
- while(e.hasMoreElements())
- {
- Ice.Communicator c = (Ice.Communicator)e.nextElement();
- c.waitForShutdown();
- c.destroy();
- }
- _communicators.removeAllElements();
+ while(e.hasMoreElements())
+ {
+ Ice.Communicator c = (Ice.Communicator)e.nextElement();
+ c.waitForShutdown();
+ c.destroy();
+ }
+ _communicators.removeAllElements();
- //
- // Simulate a server: create a new communicator and object
- // adapter. The object adapter is started on a system allocated
- // port. The configuration used here contains the Ice.Locator
- // configuration variable. The new object adapter will register
- // its endpoints with the locator and create references
- // containing the adapter id instead of the endpoints.
- //
- Ice.Communicator serverCommunicator = Ice.Util.initialize(_initData);
- _communicators.addElement(serverCommunicator);
+ //
+ // Simulate a server: create a new communicator and object
+ // adapter. The object adapter is started on a system allocated
+ // port. The configuration used here contains the Ice.Locator
+ // configuration variable. The new object adapter will register
+ // its endpoints with the locator and create references
+ // containing the adapter id instead of the endpoints.
+ //
+ Ice.Communicator serverCommunicator = Ice.Util.initialize(_initData);
+ _communicators.addElement(serverCommunicator);
- Ice.ObjectAdapter adapter = serverCommunicator.createObjectAdapter("TestAdapter");
- Ice.ObjectAdapter adapter2 = serverCommunicator.createObjectAdapter("TestAdapter2");
+ Ice.ObjectAdapter adapter = serverCommunicator.createObjectAdapter("TestAdapter");
+ Ice.ObjectAdapter adapter2 = serverCommunicator.createObjectAdapter("TestAdapter2");
- Ice.ObjectPrx locator = serverCommunicator.stringToProxy("locator:default -p 12010 -t 30000");
- adapter.setLocator(Ice.LocatorPrxHelper.uncheckedCast(locator));
- adapter2.setLocator(Ice.LocatorPrxHelper.uncheckedCast(locator));
+ Ice.ObjectPrx locator = serverCommunicator.stringToProxy("locator:default -p 12010 -t 30000");
+ adapter.setLocator(Ice.LocatorPrxHelper.uncheckedCast(locator));
+ adapter2.setLocator(Ice.LocatorPrxHelper.uncheckedCast(locator));
- Ice.Object object = new TestI(adapter, adapter2, _registry);
- _registry.addObject(adapter.add(object, serverCommunicator.stringToIdentity("test")));
- _registry.addObject(adapter.add(object, serverCommunicator.stringToIdentity("test2")));
+ Ice.Object object = new TestI(adapter, adapter2, _registry);
+ _registry.addObject(adapter.add(object, serverCommunicator.stringToIdentity("test")));
+ _registry.addObject(adapter.add(object, serverCommunicator.stringToIdentity("test2")));
- adapter.activate();
- adapter2.activate();
+ adapter.activate();
+ adapter2.activate();
}
public void
shutdown(Ice.Current current)
{
java.util.Enumeration e = _communicators.elements();
- while(e.hasMoreElements())
- {
- ((Ice.Communicator)e.nextElement()).destroy();
- }
- _adapter.getCommunicator().shutdown();
+ while(e.hasMoreElements())
+ {
+ ((Ice.Communicator)e.nextElement()).destroy();
+ }
+ _adapter.getCommunicator().shutdown();
}
private Ice.ObjectAdapter _adapter;
diff --git a/javae/test/IceE/location/TestI.java b/javae/test/IceE/location/TestI.java
index 1b8bee600c5..9a445fa485a 100644
--- a/javae/test/IceE/location/TestI.java
+++ b/javae/test/IceE/location/TestI.java
@@ -13,43 +13,43 @@ public class TestI extends _TestIntfDisp
{
TestI(Ice.ObjectAdapter adapter1, Ice.ObjectAdapter adapter2, ServerLocatorRegistry registry)
{
- _adapter1 = adapter1;
- _adapter2 = adapter2;
- _registry = registry;
+ _adapter1 = adapter1;
+ _adapter2 = adapter2;
+ _registry = registry;
- _registry.addObject(_adapter1.add(new HelloI(), _adapter1.getCommunicator().stringToIdentity("hello")));
+ _registry.addObject(_adapter1.add(new HelloI(), _adapter1.getCommunicator().stringToIdentity("hello")));
}
public void
shutdown(Ice.Current current)
{
- _adapter1.getCommunicator().shutdown();
+ _adapter1.getCommunicator().shutdown();
}
public HelloPrx
getHello(Ice.Current current)
{
- return HelloPrxHelper.uncheckedCast(_adapter1.createIndirectProxy(_adapter1.getCommunicator().stringToIdentity("hello")));
+ return HelloPrxHelper.uncheckedCast(_adapter1.createIndirectProxy(_adapter1.getCommunicator().stringToIdentity("hello")));
}
public HelloPrx
getReplicatedHello(Ice.Current current)
{
- return HelloPrxHelper.uncheckedCast(_adapter1.createProxy(_adapter1.getCommunicator().stringToIdentity("hello")));
+ return HelloPrxHelper.uncheckedCast(_adapter1.createProxy(_adapter1.getCommunicator().stringToIdentity("hello")));
}
public void
migrateHello(Ice.Current current)
{
- final Ice.Identity id = _adapter1.getCommunicator().stringToIdentity("hello");
- try
- {
- _registry.addObject(_adapter2.add(_adapter1.remove(id), id));
- }
- catch(Ice.NotRegisteredException ex)
- {
- _registry.addObject(_adapter1.add(_adapter2.remove(id), id));
- }
+ final Ice.Identity id = _adapter1.getCommunicator().stringToIdentity("hello");
+ try
+ {
+ _registry.addObject(_adapter2.add(_adapter1.remove(id), id));
+ }
+ catch(Ice.NotRegisteredException ex)
+ {
+ _registry.addObject(_adapter1.add(_adapter2.remove(id), id));
+ }
}
private ServerLocatorRegistry _registry;
diff --git a/javae/test/IceE/operations/AllTests.java b/javae/test/IceE/operations/AllTests.java
index 2e31c16bcf8..5050f1b9811 100644
--- a/javae/test/IceE/operations/AllTests.java
+++ b/javae/test/IceE/operations/AllTests.java
@@ -23,23 +23,23 @@ public class AllTests
{
out.flush();
String ref = communicator.getProperties().getPropertyWithDefault("Test.Proxy",
- "test:default -p 12010 -t 10000");
+ "test:default -p 12010 -t 10000");
Ice.ObjectPrx base = communicator.stringToProxy(ref);
Test.MyClassPrx cl = Test.MyClassPrxHelper.checkedCast(base);
Test.MyDerivedClassPrx derived = Test.MyDerivedClassPrxHelper.checkedCast(cl);
- out.print("testing timeout... ");
- out.flush();
- try
- {
- Test.MyClassPrx clTimeout = Test.MyClassPrxHelper.uncheckedCast(cl.ice_timeout(500));
- clTimeout.opSleep(1000);
- test(false);
- }
- catch(Ice.TimeoutException ex)
- {
- }
- out.println("ok");
+ out.print("testing timeout... ");
+ out.flush();
+ try
+ {
+ Test.MyClassPrx clTimeout = Test.MyClassPrxHelper.uncheckedCast(cl.ice_timeout(500));
+ clTimeout.opSleep(1000);
+ test(false);
+ }
+ catch(Ice.TimeoutException ex)
+ {
+ }
+ out.println("ok");
out.print("testing twoway operations... ");
out.flush();
@@ -47,11 +47,11 @@ public class AllTests
Twoways.twoways(communicator, initData, derived);
derived.opDerived();
out.println("ok");
- out.print("testing batch oneway operations... ");
- out.flush();
- BatchOneways.batchOneways(cl);
- BatchOneways.batchOneways(derived);
- out.println("ok");
+ out.print("testing batch oneway operations... ");
+ out.flush();
+ BatchOneways.batchOneways(cl);
+ BatchOneways.batchOneways(derived);
+ out.println("ok");
return cl;
}
diff --git a/javae/test/IceE/operations/BatchOneways.java b/javae/test/IceE/operations/BatchOneways.java
index 71f86a40d89..2fc025ca8e9 100644
--- a/javae/test/IceE/operations/BatchOneways.java
+++ b/javae/test/IceE/operations/BatchOneways.java
@@ -21,55 +21,53 @@ class BatchOneways
static void
batchOneways(Test.MyClassPrx p)
{
- final byte[] bs1 = new byte[10 * 1024];
- final byte[] bs2 = new byte[99 * 1024];
- final byte[] bs3 = new byte[100 * 1024];
+ final byte[] bs1 = new byte[10 * 1024];
+ final byte[] bs2 = new byte[99 * 1024];
+ final byte[] bs3 = new byte[100 * 1024];
- try
+ try
{
p.opByteSOneway(bs1);
- test(true);
+ test(true);
+ }
+ catch(Ice.MemoryLimitException ex)
+ {
+ test(false);
}
- catch(Ice.MemoryLimitException ex)
- {
- test(false);
- }
- try
+ try
{
p.opByteSOneway(bs2);
- test(true);
+ test(true);
+ }
+ catch(Ice.MemoryLimitException ex)
+ {
+ test(false);
}
- catch(Ice.MemoryLimitException ex)
- {
- test(false);
- }
- try
+ try
{
p.opByteSOneway(bs3);
- test(false);
+ test(false);
+ }
+ catch(Ice.MemoryLimitException ex)
+ {
}
- catch(Ice.MemoryLimitException ex)
- {
- test(true);
- }
- Test.MyClassPrx batch = Test.MyClassPrxHelper.uncheckedCast(p.ice_batchOneway());
+ Test.MyClassPrx batch = Test.MyClassPrxHelper.uncheckedCast(p.ice_batchOneway());
- for(int i = 0 ; i < 30 ; ++i)
- {
- try
- {
- batch.opByteSOneway(bs1);
- test(true);
- }
- catch(Ice.MemoryLimitException ex)
- {
- test(false);
- }
- }
+ for(int i = 0 ; i < 30 ; ++i)
+ {
+ try
+ {
+ batch.opByteSOneway(bs1);
+ }
+ catch(Ice.MemoryLimitException ex)
+ {
+ test(false);
+ }
+ }
- batch.ice_getConnection().flushBatchRequests();
+ batch.ice_getConnection().flushBatchRequests();
}
}
diff --git a/javae/test/IceE/operations/Client.java b/javae/test/IceE/operations/Client.java
index fe4c136d51c..02d330f3538 100644
--- a/javae/test/IceE/operations/Client.java
+++ b/javae/test/IceE/operations/Client.java
@@ -38,24 +38,19 @@ public class Client
try
{
- Ice.StringSeqHolder argsH = new Ice.StringSeqHolder(args);
- Ice.InitializationData initData = new Ice.InitializationData();
- initData.properties = Ice.Util.createProperties(argsH);
+ Ice.StringSeqHolder argsH = new Ice.StringSeqHolder(args);
+ Ice.InitializationData initData = new Ice.InitializationData();
+ initData.properties = Ice.Util.createProperties(argsH);
- //
- // We must set MessageSizeMax to an explicit value,
- // because we run tests to check whether
- // Ice.MemoryLimitException is raised as expected.
- //
- initData.properties.setProperty("Ice.MessageSizeMax", "100");
-
- //
- // We don't want connection warnings because of the timeout test.
- //
- initData.properties.setProperty("Ice.Warn.Connections", "0");
+ //
+ // We must set MessageSizeMax to an explicit value,
+ // because we run tests to check whether
+ // Ice.MemoryLimitException is raised as expected.
+ //
+ initData.properties.setProperty("Ice.MessageSizeMax", "100");
communicator = Ice.Util.initialize(argsH, initData);
-
+
status = run(argsH.value, communicator, initData, System.out);
}
catch(Exception ex)
@@ -77,7 +72,7 @@ public class Client
}
}
- System.gc();
+ System.gc();
System.exit(status);
}
}
diff --git a/javae/test/IceE/operations/Collocated.java b/javae/test/IceE/operations/Collocated.java
index 4f3f304e042..97cc43fc7da 100644
--- a/javae/test/IceE/operations/Collocated.java
+++ b/javae/test/IceE/operations/Collocated.java
@@ -12,10 +12,10 @@ public class Collocated
{
public static int
run(String[] args, Ice.Communicator communicator,
- Ice.InitializationData initData, java.io.PrintStream out)
+ Ice.InitializationData initData, java.io.PrintStream out)
{
- communicator.getProperties().setProperty("Test.Proxy", "test:default -p 12010 -t 10000");
- communicator.getProperties().setProperty("Test.ProxyWithContext", "context:default -p 12010 -t 10000");
+ communicator.getProperties().setProperty("Test.Proxy", "test:default -p 12010 -t 10000");
+ communicator.getProperties().setProperty("Test.ProxyWithContext", "context:default -p 12010 -t 10000");
communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010 -t 10000");
Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
adapter.add(new MyDerivedClassI(), communicator.stringToIdentity("test"));
@@ -36,7 +36,7 @@ public class Collocated
{
Ice.StringSeqHolder argsH = new Ice.StringSeqHolder(args);
Ice.InitializationData initData = new Ice.InitializationData();
- initData.properties = Ice.Util.createProperties(argsH);
+ initData.properties = Ice.Util.createProperties(argsH);
//
// We must set MessageSizeMax to an explicit values,
diff --git a/javae/test/IceE/operations/MyDerivedClassI.java b/javae/test/IceE/operations/MyDerivedClassI.java
index 4ed5d0fbe0b..f16d1641eeb 100644
--- a/javae/test/IceE/operations/MyDerivedClassI.java
+++ b/javae/test/IceE/operations/MyDerivedClassI.java
@@ -37,23 +37,23 @@ public final class MyDerivedClassI extends Test.MyDerivedClass
public void
opSleep(int duration, Ice.Current current)
{
- while(true)
- {
- try
- {
- Thread.currentThread().sleep(duration);
- break;
- }
- catch(java.lang.InterruptedException ex)
- {
- }
- }
+ while(true)
+ {
+ try
+ {
+ Thread.currentThread().sleep(duration);
+ break;
+ }
+ catch(java.lang.InterruptedException ex)
+ {
+ }
+ }
}
public boolean
opBool(boolean p1, boolean p2,
- Ice.BooleanHolder p3,
- Ice.Current current)
+ Ice.BooleanHolder p3,
+ Ice.Current current)
{
p3.value = p1;
return p2;
@@ -61,7 +61,7 @@ public final class MyDerivedClassI extends Test.MyDerivedClass
public boolean[]
opBoolS(boolean[] p1, boolean[] p2,
- Test.BoolSHolder p3,
+ Test.BoolSHolder p3,
Ice.Current current)
{
p3.value = new boolean[p1.length + p2.length];
@@ -78,7 +78,7 @@ public final class MyDerivedClassI extends Test.MyDerivedClass
public boolean[][]
opBoolSS(boolean[][] p1, boolean[][] p2,
- Test.BoolSSHolder p3,
+ Test.BoolSSHolder p3,
Ice.Current current)
{
p3.value = new boolean[p1.length + p2.length][];
@@ -95,8 +95,8 @@ public final class MyDerivedClassI extends Test.MyDerivedClass
public byte
opByte(byte p1, byte p2,
- Ice.ByteHolder p3,
- Ice.Current current)
+ Ice.ByteHolder p3,
+ Ice.Current current)
{
p3.value = (byte)(p1 ^ p2);
return p1;
@@ -105,30 +105,30 @@ public final class MyDerivedClassI extends Test.MyDerivedClass
protected void
copyHashtable(java.util.Hashtable from, java.util.Hashtable to)
{
- java.util.Enumeration e = from.keys();
- while(e.hasMoreElements())
- {
- java.lang.Object key = e.nextElement();
- to.put(key, from.get(key));
- }
+ java.util.Enumeration e = from.keys();
+ while(e.hasMoreElements())
+ {
+ java.lang.Object key = e.nextElement();
+ to.put(key, from.get(key));
+ }
}
public java.util.Hashtable
opByteBoolD(java.util.Hashtable p1, java.util.Hashtable p2,
- Test.ByteBoolDHolder p3,
+ Test.ByteBoolDHolder p3,
Ice.Current current)
{
p3.value = p1;
java.util.Hashtable r = new java.util.Hashtable();
- copyHashtable(p1, r);
- copyHashtable(p2, r);
+ copyHashtable(p1, r);
+ copyHashtable(p2, r);
return r;
}
public byte[]
opByteS(byte[] p1, byte[] p2,
- Test.ByteSHolder p3,
- Ice.Current current)
+ Test.ByteSHolder p3,
+ Ice.Current current)
{
p3.value = new byte[p1.length];
for(int i = 0; i < p1.length; i++)
@@ -144,7 +144,7 @@ public final class MyDerivedClassI extends Test.MyDerivedClass
public byte[][]
opByteSS(byte[][] p1, byte[][] p2,
- Test.ByteSSHolder p3,
+ Test.ByteSSHolder p3,
Ice.Current current)
{
p3.value = new byte[p1.length][];
@@ -161,8 +161,8 @@ public final class MyDerivedClassI extends Test.MyDerivedClass
public double
opFloatDouble(float p1, double p2,
- Ice.FloatHolder p3, Ice.DoubleHolder p4,
- Ice.Current current)
+ Ice.FloatHolder p3, Ice.DoubleHolder p4,
+ Ice.Current current)
{
p3.value = p1;
p4.value = p2;
@@ -171,8 +171,8 @@ public final class MyDerivedClassI extends Test.MyDerivedClass
public double[]
opFloatDoubleS(float[] p1, double[] p2,
- Test.FloatSHolder p3, Test.DoubleSHolder p4,
- Ice.Current current)
+ Test.FloatSHolder p3, Test.DoubleSHolder p4,
+ Ice.Current current)
{
p3.value = p1;
p4.value = new double[p2.length];
@@ -191,8 +191,8 @@ public final class MyDerivedClassI extends Test.MyDerivedClass
public double[][]
opFloatDoubleSS(float[][] p1, double[][] p2,
- Test.FloatSSHolder p3, Test.DoubleSSHolder p4,
- Ice.Current current)
+ Test.FloatSSHolder p3, Test.DoubleSSHolder p4,
+ Ice.Current current)
{
p3.value = p1;
p4.value = new double[p2.length][];
@@ -208,31 +208,31 @@ public final class MyDerivedClassI extends Test.MyDerivedClass
public java.util.Hashtable
opLongFloatD(java.util.Hashtable p1, java.util.Hashtable p2,
- Test.LongFloatDHolder p3,
+ Test.LongFloatDHolder p3,
Ice.Current current)
{
p3.value = p1;
java.util.Hashtable r = new java.util.Hashtable();
- copyHashtable(p1, r);
- copyHashtable(p2, r);
+ copyHashtable(p1, r);
+ copyHashtable(p2, r);
return r;
}
public Test.MyClassPrx
opMyClass(Test.MyClassPrx p1,
- Test.MyClassPrxHolder p2, Test.MyClassPrxHolder p3,
- Ice.Current current)
+ Test.MyClassPrxHolder p2, Test.MyClassPrxHolder p3,
+ Ice.Current current)
{
p2.value = p1;
p3.value = Test.MyClassPrxHelper.uncheckedCast(
- current.adapter.createProxy(current.adapter.getCommunicator().stringToIdentity("noSuchIdentity")));
+ current.adapter.createProxy(current.adapter.getCommunicator().stringToIdentity("noSuchIdentity")));
return Test.MyClassPrxHelper.uncheckedCast(current.adapter.createProxy(current.id));
}
public Test.MyEnum
opMyEnum(Test.MyEnum p1,
- Test.MyEnumHolder p2,
- Ice.Current current)
+ Test.MyEnumHolder p2,
+ Ice.Current current)
{
p2.value = p1;
return Test.MyEnum.enum3;
@@ -240,20 +240,20 @@ public final class MyDerivedClassI extends Test.MyDerivedClass
public java.util.Hashtable
opShortIntD(java.util.Hashtable p1, java.util.Hashtable p2,
- Test.ShortIntDHolder p3,
+ Test.ShortIntDHolder p3,
Ice.Current current)
{
p3.value = p1;
java.util.Hashtable r = new java.util.Hashtable();
- copyHashtable(p1, r);
- copyHashtable(p2, r);
+ copyHashtable(p1, r);
+ copyHashtable(p2, r);
return r;
}
public long
opShortIntLong(short p1, int p2, long p3,
- Ice.ShortHolder p4, Ice.IntHolder p5, Ice.LongHolder p6,
- Ice.Current current)
+ Ice.ShortHolder p4, Ice.IntHolder p5, Ice.LongHolder p6,
+ Ice.Current current)
{
p4.value = p1;
p5.value = p2;
@@ -263,7 +263,7 @@ public final class MyDerivedClassI extends Test.MyDerivedClass
public long[]
opShortIntLongS(short[] p1, int[] p2, long[] p3,
- Test.ShortSHolder p4, Test.IntSHolder p5, Test.LongSHolder p6,
+ Test.ShortSHolder p4, Test.IntSHolder p5, Test.LongSHolder p6,
Ice.Current current)
{
p4.value = p1;
@@ -281,7 +281,7 @@ public final class MyDerivedClassI extends Test.MyDerivedClass
public long[][]
opShortIntLongSS(short[][] p1, int[][] p2, long[][] p3,
Test.ShortSSHolder p4, Test.IntSSHolder p5, Test.LongSSHolder p6,
- Ice.Current current)
+ Ice.Current current)
{
p4.value = p1;
p5.value = new int[p2.length][];
@@ -297,8 +297,8 @@ public final class MyDerivedClassI extends Test.MyDerivedClass
public String
opString(String p1, String p2,
- Ice.StringHolder p3,
- Ice.Current current)
+ Ice.StringHolder p3,
+ Ice.Current current)
{
p3.value = p2 + " " + p1;
return p1 + " " + p2;
@@ -307,23 +307,23 @@ public final class MyDerivedClassI extends Test.MyDerivedClass
public java.util.Hashtable
opStringMyEnumD(java.util.Hashtable p1, java.util.Hashtable p2,
Test.StringMyEnumDHolder p3,
- Ice.Current current)
+ Ice.Current current)
{
p3.value = p1;
java.util.Hashtable r = new java.util.Hashtable();
- copyHashtable(p1, r);
- copyHashtable(p2, r);
+ copyHashtable(p1, r);
+ copyHashtable(p2, r);
return r;
}
public int[]
opIntS(int[] s, Ice.Current current)
{
- int[] r = new int[s.length];
- for(int i = 0; i < r.length; ++i)
- {
- r[i] = -s[i];
- }
+ int[] r = new int[s.length];
+ for(int i = 0; i < r.length; ++i)
+ {
+ r[i] = -s[i];
+ }
return r;
}
@@ -335,23 +335,23 @@ public final class MyDerivedClassI extends Test.MyDerivedClass
public java.util.Hashtable
opContext(Ice.Current current)
{
- return current.ctx;
+ return current.ctx;
}
public void
opDoubleMarshaling(double p1, double[] p2, Ice.Current current)
{
- double d = 1278312346.0 / 13.0;
- test(p1 == d);
- for(int i = 0; i < p2.length; ++i)
- {
- test(p2[i] == d);
- }
+ double d = 1278312346.0 / 13.0;
+ test(p1 == d);
+ for(int i = 0; i < p2.length; ++i)
+ {
+ test(p2[i] == d);
+ }
}
public String[]
opStringS(String[] p1, String[] p2,
- Test.StringSHolder p3,
+ Test.StringSHolder p3,
Ice.Current current)
{
p3.value = new String[p1.length + p2.length];
@@ -368,7 +368,7 @@ public final class MyDerivedClassI extends Test.MyDerivedClass
public String[][]
opStringSS(String[][] p1, String[][] p2,
- Test.StringSSHolder p3,
+ Test.StringSSHolder p3,
Ice.Current current)
{
p3.value = new String[p1.length + p2.length][];
@@ -385,7 +385,7 @@ public final class MyDerivedClassI extends Test.MyDerivedClass
public String[][][]
opStringSSS(String[][][] p1, String[][][] p2,
- Test.StringSSSHolder p3,
+ Test.StringSSSHolder p3,
Ice.Current current)
{
p3.value = new String[p1.length + p2.length][][];
@@ -403,18 +403,18 @@ public final class MyDerivedClassI extends Test.MyDerivedClass
public java.util.Hashtable
opStringStringD(java.util.Hashtable p1, java.util.Hashtable p2,
Test.StringStringDHolder p3,
- Ice.Current current)
+ Ice.Current current)
{
p3.value = p1;
java.util.Hashtable r = new java.util.Hashtable();
- copyHashtable(p1, r);
- copyHashtable(p2, r);
+ copyHashtable(p1, r);
+ copyHashtable(p2, r);
return r;
}
public Test.Structure
opStruct(Test.Structure p1, Test.Structure p2,
- Test.StructureHolder p3,
+ Test.StructureHolder p3,
Ice.Current current)
{
p3.value = p1;
diff --git a/javae/test/IceE/operations/Server.java b/javae/test/IceE/operations/Server.java
index 0a35c50ef32..e27d3dd47ac 100644
--- a/javae/test/IceE/operations/Server.java
+++ b/javae/test/IceE/operations/Server.java
@@ -12,15 +12,15 @@ public class Server
public static int
run(String[] args, Ice.Communicator communicator, Ice.InitializationData data, java.io.PrintStream out)
{
- //
- // When running as a MIDlet the properties for the server may be
- // overridden by configuration. If it isn't then we assume
- // defaults.
- //
- if(communicator.getProperties().getProperty("TestAdapter.Endpoints").length() == 0)
- {
- communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010");
- }
+ //
+ // When running as a MIDlet the properties for the server may be
+ // overridden by configuration. If it isn't then we assume
+ // defaults.
+ //
+ if(communicator.getProperties().getProperty("TestAdapter.Endpoints").length() == 0)
+ {
+ communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010");
+ }
Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
adapter.add(new MyDerivedClassI(), communicator.stringToIdentity("test"));
@@ -60,7 +60,7 @@ public class Server
}
}
- System.gc();
+ System.gc();
System.exit(status);
}
}
diff --git a/javae/test/IceE/operations/Test.ice b/javae/test/IceE/operations/Test.ice
index a31d034db5c..4b97c45331d 100644
--- a/javae/test/IceE/operations/Test.ice
+++ b/javae/test/IceE/operations/Test.ice
@@ -73,75 +73,75 @@ class MyClass
void opSleep(int duration);
byte opByte(byte p1, byte p2,
- out byte p3);
+ out byte p3);
bool opBool(bool p1, bool p2,
- out bool p3);
+ out bool p3);
long opShortIntLong(short p1, int p2, long p3,
- out short p4, out int p5, out long p6);
+ out short p4, out int p5, out long p6);
double opFloatDouble(float p1, double p2,
- out float p3, out double p4);
+ out float p3, out double p4);
string opString(string p1, string p2,
- out string p3);
+ out string p3);
MyEnum opMyEnum(MyEnum p1, out MyEnum p2);
MyClass* opMyClass(MyClass* p1, out MyClass* p2, out MyClass* p3);
Structure opStruct(Structure p1, Structure p2,
- out Structure p3);
+ out Structure p3);
ByteS opByteS(ByteS p1, ByteS p2,
- out ByteS p3);
+ out ByteS p3);
BoolS opBoolS(BoolS p1, BoolS p2,
- out BoolS p3);
+ out BoolS p3);
LongS opShortIntLongS(Test::ShortS p1, IntS p2, LongS p3,
- out ::Test::ShortS p4, out IntS p5, out LongS p6);
+ out ::Test::ShortS p4, out IntS p5, out LongS p6);
DoubleS opFloatDoubleS(FloatS p1, DoubleS p2,
- out FloatS p3, out DoubleS p4);
+ out FloatS p3, out DoubleS p4);
StringS opStringS(StringS p1, StringS p2,
- out StringS p3);
+ out StringS p3);
ByteSS opByteSS(ByteSS p1, ByteSS p2,
- out ByteSS p3);
+ out ByteSS p3);
BoolSS opBoolSS(BoolSS p1, BoolSS p2,
- out BoolSS p3);
+ out BoolSS p3);
LongSS opShortIntLongSS(ShortSS p1, IntSS p2, LongSS p3,
- out ShortSS p4, out IntSS p5, out LongSS p6);
+ out ShortSS p4, out IntSS p5, out LongSS p6);
DoubleSS opFloatDoubleSS(FloatSS p1, DoubleSS p2,
- out FloatSS p3, out DoubleSS p4);
+ out FloatSS p3, out DoubleSS p4);
StringSS opStringSS(StringSS p1, StringSS p2,
- out StringSS p3);
+ out StringSS p3);
StringSSS opStringSSS(StringSSS p1, StringSSS p2,
- out StringSSS p3);
+ out StringSSS p3);
ByteBoolD opByteBoolD(ByteBoolD p1, ByteBoolD p2,
- out ByteBoolD p3);
+ out ByteBoolD p3);
ShortIntD opShortIntD(ShortIntD p1, ShortIntD p2,
- out ShortIntD p3);
+ out ShortIntD p3);
LongFloatD opLongFloatD(LongFloatD p1, LongFloatD p2,
- out LongFloatD p3);
+ out LongFloatD p3);
StringStringD opStringStringD(StringStringD p1, StringStringD p2,
- out StringStringD p3);
+ out StringStringD p3);
StringMyEnumD opStringMyEnumD(StringMyEnumD p1, StringMyEnumD p2,
- out StringMyEnumD p3);
+ out StringMyEnumD p3);
IntS opIntS(IntS s);
diff --git a/javae/test/IceE/operations/Twoways.java b/javae/test/IceE/operations/Twoways.java
index c30b2e35731..5dbd79c7c21 100644
--- a/javae/test/IceE/operations/Twoways.java
+++ b/javae/test/IceE/operations/Twoways.java
@@ -402,80 +402,80 @@ class Twoways
test(rso[2].length == 0);
}
- {
- final String[][][] sssi1 =
- {
- {
- {
- "abc", "de"
- },
- {
- "xyz"
- }
- },
- {
- {
- "hello"
- }
- }
- };
-
- final String[][][] sssi2 =
- {
- {
- {
- "", ""
- },
- {
- "abcd"
- }
- },
- {
- {
- ""
- }
- },
- {
- }
- };
-
- Test.StringSSSHolder ssso = new Test.StringSSSHolder();
- String rsso[][][];
-
- rsso = p.opStringSSS(sssi1, sssi2, ssso);
- test(ssso.value.length == 5);
- test(ssso.value[0].length == 2);
- test(ssso.value[0][0].length == 2);
- test(ssso.value[0][1].length == 1);
- test(ssso.value[1].length == 1);
- test(ssso.value[1][0].length == 1);
- test(ssso.value[2].length == 2);
- test(ssso.value[2][0].length == 2);
- test(ssso.value[2][1].length == 1);
- test(ssso.value[3].length == 1);
- test(ssso.value[3][0].length == 1);
- test(ssso.value[4].length == 0);
- test(ssso.value[0][0][0].equals("abc"));
- test(ssso.value[0][0][1].equals("de"));
- test(ssso.value[0][1][0].equals("xyz"));
- test(ssso.value[1][0][0].equals("hello"));
- test(ssso.value[2][0][0].equals(""));
- test(ssso.value[2][0][1].equals(""));
- test(ssso.value[2][1][0].equals("abcd"));
- test(ssso.value[3][0][0].equals(""));
-
- test(rsso.length == 3);
- test(rsso[0].length == 0);
- test(rsso[1].length == 1);
- test(rsso[1][0].length == 1);
- test(rsso[2].length == 2);
- test(rsso[2][0].length == 2);
- test(rsso[2][1].length == 1);
- test(rsso[1][0][0].equals(""));
- test(rsso[2][0][0].equals(""));
- test(rsso[2][0][1].equals(""));
- test(rsso[2][1][0].equals("abcd"));
- }
+ {
+ final String[][][] sssi1 =
+ {
+ {
+ {
+ "abc", "de"
+ },
+ {
+ "xyz"
+ }
+ },
+ {
+ {
+ "hello"
+ }
+ }
+ };
+
+ final String[][][] sssi2 =
+ {
+ {
+ {
+ "", ""
+ },
+ {
+ "abcd"
+ }
+ },
+ {
+ {
+ ""
+ }
+ },
+ {
+ }
+ };
+
+ Test.StringSSSHolder ssso = new Test.StringSSSHolder();
+ String rsso[][][];
+
+ rsso = p.opStringSSS(sssi1, sssi2, ssso);
+ test(ssso.value.length == 5);
+ test(ssso.value[0].length == 2);
+ test(ssso.value[0][0].length == 2);
+ test(ssso.value[0][1].length == 1);
+ test(ssso.value[1].length == 1);
+ test(ssso.value[1][0].length == 1);
+ test(ssso.value[2].length == 2);
+ test(ssso.value[2][0].length == 2);
+ test(ssso.value[2][1].length == 1);
+ test(ssso.value[3].length == 1);
+ test(ssso.value[3][0].length == 1);
+ test(ssso.value[4].length == 0);
+ test(ssso.value[0][0][0].equals("abc"));
+ test(ssso.value[0][0][1].equals("de"));
+ test(ssso.value[0][1][0].equals("xyz"));
+ test(ssso.value[1][0][0].equals("hello"));
+ test(ssso.value[2][0][0].equals(""));
+ test(ssso.value[2][0][1].equals(""));
+ test(ssso.value[2][1][0].equals("abcd"));
+ test(ssso.value[3][0][0].equals(""));
+
+ test(rsso.length == 3);
+ test(rsso[0].length == 0);
+ test(rsso[1].length == 1);
+ test(rsso[1][0].length == 1);
+ test(rsso[2].length == 2);
+ test(rsso[2][0].length == 2);
+ test(rsso[2][1].length == 1);
+ test(rsso[1][0][0].equals(""));
+ test(rsso[2][0][0].equals(""));
+ test(rsso[2][0][1].equals(""));
+ test(rsso[2][1][0].equals("abcd"));
+ }
{
java.util.Hashtable di1 = new java.util.Hashtable();
@@ -578,73 +578,73 @@ class Twoways
}
{
- int[] lengths = { 0, 1, 2, 126, 127, 128, 129, 253, 254, 255, 256, 257, 1000 };
-
- for(int l = 0; l < lengths.length; ++l)
- {
- int[] s = new int[lengths[l]];
- for(int i = 0; i < lengths[l]; ++i)
- {
- s[i] = i;
- }
- int[] r = p.opIntS(s);
- test(r.length == lengths[l]);
- for(int j = 0; j < r.length; ++j)
- {
- test(r[j] == -j);
- }
- }
+ int[] lengths = { 0, 1, 2, 126, 127, 128, 129, 253, 254, 255, 256, 257, 1000 };
+
+ for(int l = 0; l < lengths.length; ++l)
+ {
+ int[] s = new int[lengths[l]];
+ for(int i = 0; i < lengths[l]; ++i)
+ {
+ s[i] = i;
+ }
+ int[] r = p.opIntS(s);
+ test(r.length == lengths[l]);
+ for(int j = 0; j < r.length; ++j)
+ {
+ test(r[j] == -j);
+ }
+ }
}
- {
- java.util.Hashtable ctx = new java.util.Hashtable();
- ctx.put("one", "ONE");
- ctx.put("two", "TWO");
- ctx.put("three", "THREE");
- {
- test(p.ice_getContext().isEmpty());
- java.util.Hashtable r = p.opContext();
- test(!IceUtil.Hashtable.equals(r, ctx));
- }
- {
- java.util.Hashtable r = p.opContext(ctx);
- test(p.ice_getContext().isEmpty());
- test(IceUtil.Hashtable.equals(r, ctx));
- }
- {
- Test.MyClassPrx p2 = Test.MyClassPrxHelper.checkedCast(p.ice_context(ctx));
- test(IceUtil.Hashtable.equals(p2.ice_getContext(), ctx));
- java.util.Hashtable r = p2.opContext();
- test(IceUtil.Hashtable.equals(r, ctx));
- r = p2.opContext(ctx);
- test(IceUtil.Hashtable.equals(r, ctx));
- }
- {
- //
- // Test proxy contexts
- String ref = communicator.getProperties().getPropertyWithDefault("Test.Proxy",
- "test:default -p 12010 -t 10000");
- Test.MyClassPrx c = Test.MyClassPrxHelper.checkedCast(communicator.stringToProxy(ref));
-
- java.util.Hashtable dflt = new java.util.Hashtable();
- dflt.put("a", "b");
- Test.MyClassPrx c2 = Test.MyClassPrxHelper.uncheckedCast(c.ice_context(dflt));
- test(c2.opContext().get("a").equals("b"));
-
- dflt.clear();
- Test.MyClassPrx c3 = Test.MyClassPrxHelper.uncheckedCast(c2.ice_context(dflt));
- test(c3.opContext().get("a") == null);
- }
- }
-
- {
- double d = 1278312346.0 / 13.0;
- double[] ds = new double[5];
- for(int i = 0; i < 5; i++)
- {
- ds[i] = d;
- }
- p.opDoubleMarshaling(d, ds);
- }
+ {
+ java.util.Hashtable ctx = new java.util.Hashtable();
+ ctx.put("one", "ONE");
+ ctx.put("two", "TWO");
+ ctx.put("three", "THREE");
+ {
+ test(p.ice_getContext().isEmpty());
+ java.util.Hashtable r = p.opContext();
+ test(!IceUtil.Hashtable.equals(r, ctx));
+ }
+ {
+ java.util.Hashtable r = p.opContext(ctx);
+ test(p.ice_getContext().isEmpty());
+ test(IceUtil.Hashtable.equals(r, ctx));
+ }
+ {
+ Test.MyClassPrx p2 = Test.MyClassPrxHelper.checkedCast(p.ice_context(ctx));
+ test(IceUtil.Hashtable.equals(p2.ice_getContext(), ctx));
+ java.util.Hashtable r = p2.opContext();
+ test(IceUtil.Hashtable.equals(r, ctx));
+ r = p2.opContext(ctx);
+ test(IceUtil.Hashtable.equals(r, ctx));
+ }
+ {
+ //
+ // Test proxy contexts
+ String ref = communicator.getProperties().getPropertyWithDefault("Test.Proxy",
+ "test:default -p 12010 -t 10000");
+ Test.MyClassPrx c = Test.MyClassPrxHelper.checkedCast(communicator.stringToProxy(ref));
+
+ java.util.Hashtable dflt = new java.util.Hashtable();
+ dflt.put("a", "b");
+ Test.MyClassPrx c2 = Test.MyClassPrxHelper.uncheckedCast(c.ice_context(dflt));
+ test(c2.opContext().get("a").equals("b"));
+
+ dflt.clear();
+ Test.MyClassPrx c3 = Test.MyClassPrxHelper.uncheckedCast(c2.ice_context(dflt));
+ test(c3.opContext().get("a") == null);
+ }
+ }
+
+ {
+ double d = 1278312346.0 / 13.0;
+ double[] ds = new double[5];
+ for(int i = 0; i < 5; i++)
+ {
+ ds[i] = d;
+ }
+ p.opDoubleMarshaling(d, ds);
+ }
}
}
diff --git a/javae/test/IceE/package/AllTests.java b/javae/test/IceE/package/AllTests.java
index df7485d562b..b160008369b 100644
--- a/javae/test/IceE/package/AllTests.java
+++ b/javae/test/IceE/package/AllTests.java
@@ -24,7 +24,7 @@ public class AllTests
out.print("testing stringToProxy... ");
out.flush();
String ref = communicator.getProperties().getPropertyWithDefault("Test.Proxy",
- "initial:default -p 12010 -t 10000");
+ "initial:default -p 12010 -t 10000");
Ice.ObjectPrx base = communicator.stringToProxy(ref);
test(base != null);
out.println("ok");
diff --git a/javae/test/IceE/package/Client.java b/javae/test/IceE/package/Client.java
index f891a7be742..2a27abdec5f 100644
--- a/javae/test/IceE/package/Client.java
+++ b/javae/test/IceE/package/Client.java
@@ -47,7 +47,7 @@ public class Client
}
}
- System.gc();
+ System.gc();
System.exit(status);
}
}
diff --git a/javae/test/IceE/package/Server.java b/javae/test/IceE/package/Server.java
index feeaf8100a2..22d178b2a7a 100644
--- a/javae/test/IceE/package/Server.java
+++ b/javae/test/IceE/package/Server.java
@@ -12,15 +12,15 @@ public class Server
public static int
run(String[] args, Ice.Communicator communicator, Ice.InitializationData data, java.io.PrintStream out)
{
- //
- // When running as a MIDlet the properties for the server may be
- // overridden by configuration. If it isn't then we assume
- // defaults.
- //
- if(communicator.getProperties().getProperty("TestAdapter.Endpoints").length() == 0)
- {
- communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010 -t 10000");
- }
+ //
+ // When running as a MIDlet the properties for the server may be
+ // overridden by configuration. If it isn't then we assume
+ // defaults.
+ //
+ if(communicator.getProperties().getProperty("TestAdapter.Endpoints").length() == 0)
+ {
+ communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010 -t 10000");
+ }
Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
Ice.Object object = new InitialI();
@@ -60,7 +60,7 @@ public class Server
}
}
- System.gc();
+ System.gc();
System.exit(status);
}
}
diff --git a/javae/test/IceE/proxy/AllTests.java b/javae/test/IceE/proxy/AllTests.java
index d606a3cd86c..17f412e58e9 100644
--- a/javae/test/IceE/proxy/AllTests.java
+++ b/javae/test/IceE/proxy/AllTests.java
@@ -24,7 +24,7 @@ public class AllTests
out.print("testing stringToProxy... ");
out.flush();
String ref = communicator.getProperties().getPropertyWithDefault("Test.Proxy",
- "test:default -p 12010 -t 10000");
+ "test:default -p 12010 -t 10000");
Ice.ObjectPrx base = communicator.stringToProxy(ref);
test(base != null);
diff --git a/javae/test/IceE/proxy/Collocated.java b/javae/test/IceE/proxy/Collocated.java
index 21d2cf2837c..39204dae008 100644
--- a/javae/test/IceE/proxy/Collocated.java
+++ b/javae/test/IceE/proxy/Collocated.java
@@ -12,7 +12,7 @@ public class Collocated
public static int
run(String[] args, Ice.Communicator communicator, Ice.InitializationData data, java.io.PrintStream out)
{
- communicator.getProperties().setProperty("Test.Proxy", "test:default -p 12010 -t 10000");
+ communicator.getProperties().setProperty("Test.Proxy", "test:default -p 12010 -t 10000");
communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010 -t 10000");
Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
adapter.add(new MyDerivedClassI(), communicator.stringToIdentity("test"));
diff --git a/javae/test/IceE/proxy/Server.java b/javae/test/IceE/proxy/Server.java
index e4e28cfb476..3f7f2db1faa 100644
--- a/javae/test/IceE/proxy/Server.java
+++ b/javae/test/IceE/proxy/Server.java
@@ -12,15 +12,15 @@ public class Server
public static int
run(String[] args, Ice.Communicator communicator, Ice.InitializationData data, java.io.PrintStream ps)
{
- //
- // When running as a MIDlet the properties for the server may be
- // overridden by configuration. If it isn't then we assume
- // defaults.
- //
- if(communicator.getProperties().getProperty("TestAdapter.Endpoints").length() == 0)
- {
- communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010");
- }
+ //
+ // When running as a MIDlet the properties for the server may be
+ // overridden by configuration. If it isn't then we assume
+ // defaults.
+ //
+ if(communicator.getProperties().getProperty("TestAdapter.Endpoints").length() == 0)
+ {
+ communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010");
+ }
Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
adapter.add(new MyDerivedClassI(), communicator.stringToIdentity("test"));
adapter.activate();
diff --git a/javae/test/IceE/retry/AllTests.java b/javae/test/IceE/retry/AllTests.java
index 2f7ae716a6a..0434790e866 100644
--- a/javae/test/IceE/retry/AllTests.java
+++ b/javae/test/IceE/retry/AllTests.java
@@ -24,10 +24,10 @@ public class AllTests
out.print("testing stringToProxy... ");
out.flush();
String ref = communicator.getProperties().getPropertyWithDefault("Retry.Proxy",
- "retry:default -p 12010 -t 10000");
+ "retry:default -p 12010 -t 10000");
Ice.ObjectPrx base1 = communicator.stringToProxy(ref);
test(base1 != null);
- Ice.ObjectPrx base2 = communicator.stringToProxy(ref);
+ Ice.ObjectPrx base2 = communicator.stringToProxy(ref);
test(base2 != null);
out.println("ok");
@@ -35,33 +35,33 @@ public class AllTests
out.flush();
Test.RetryPrx retry1 = Test.RetryPrxHelper.checkedCast(base1);
test(retry1 != null);
- test(retry1.equals(base1));
+ test(retry1.equals(base1));
Test.RetryPrx retry2 = Test.RetryPrxHelper.checkedCast(base2);
test(retry2 != null);
- test(retry2.equals(base2));
+ test(retry2.equals(base2));
out.println("ok");
- out.print("calling regular operation with first proxy... ");
- out.flush();
- retry1.op(false);
- out.println("ok");
+ out.print("calling regular operation with first proxy... ");
+ out.flush();
+ retry1.op(false);
+ out.println("ok");
- out.print("calling operation to kill connection with second proxy... ");
- out.flush();
- try
- {
- retry2.op(true);
- test(false);
- }
- catch(Ice.ConnectionLostException ex)
- {
- out.println("ok");
- }
+ out.print("calling operation to kill connection with second proxy... ");
+ out.flush();
+ try
+ {
+ retry2.op(true);
+ test(false);
+ }
+ catch(Ice.ConnectionLostException ex)
+ {
+ out.println("ok");
+ }
out.print("calling regular operation with first proxy again... ");
out.flush();
- retry1.op(false);
- out.println("ok");
+ retry1.op(false);
+ out.println("ok");
return retry1;
}
diff --git a/javae/test/IceE/retry/Client.java b/javae/test/IceE/retry/Client.java
index a7a1fd627ee..62d1a2f7afe 100644
--- a/javae/test/IceE/retry/Client.java
+++ b/javae/test/IceE/retry/Client.java
@@ -25,23 +25,23 @@ public class Client
try
{
- Ice.StringSeqHolder argsH = new Ice.StringSeqHolder(args);
- Ice.InitializationData initData = new Ice.InitializationData();
-
- initData.properties = Ice.Util.createProperties(argsH);
+ Ice.StringSeqHolder argsH = new Ice.StringSeqHolder(args);
+ Ice.InitializationData initData = new Ice.InitializationData();
+
+ initData.properties = Ice.Util.createProperties(argsH);
- //
- // For this test, we want to disable retries.
- //
- initData.properties.setProperty("Ice.RetryIntervals", "-1");
+ //
+ // For this test, we want to disable retries.
+ //
+ initData.properties.setProperty("Ice.RetryIntervals", "-1");
- //
- // We don't want connection warnings because of the timeout test.
- //
- initData.properties.setProperty("Ice.Warn.Connections", "0");
+ //
+ // We don't want connection warnings because of the timeout test.
+ //
+ initData.properties.setProperty("Ice.Warn.Connections", "0");
- communicator = Ice.Util.initialize(argsH, initData);
-
+ communicator = Ice.Util.initialize(argsH, initData);
+
status = run(argsH.value, communicator, initData, System.out);
}
catch(Exception ex)
@@ -63,7 +63,7 @@ public class Client
}
}
- System.gc();
+ System.gc();
System.exit(status);
}
}
diff --git a/javae/test/IceE/retry/RetryI.java b/javae/test/IceE/retry/RetryI.java
index d8b5c911a60..c221c441267 100644
--- a/javae/test/IceE/retry/RetryI.java
+++ b/javae/test/IceE/retry/RetryI.java
@@ -20,9 +20,9 @@ public final class RetryI extends _RetryDisp
op(boolean kill, Ice.Current current)
{
if(kill)
- {
- current.con.close(true);
- }
+ {
+ current.con.close(true);
+ }
}
public void
diff --git a/javae/test/IceE/retry/Server.java b/javae/test/IceE/retry/Server.java
index 7d5b5acf2fd..76803454194 100644
--- a/javae/test/IceE/retry/Server.java
+++ b/javae/test/IceE/retry/Server.java
@@ -12,15 +12,15 @@ public class Server
public static int
run(String[] args, Ice.Communicator communicator, Ice.InitializationData data, java.io.PrintStream out)
{
- //
- // When running as a MIDlet the properties for the server may be
- // overridden by configuration. If it isn't then we assume
- // defaults.
- //
- if(communicator.getProperties().getProperty("TestAdapter.Endpoints").length() == 0)
- {
- communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010 -t 10000");
- }
+ //
+ // When running as a MIDlet the properties for the server may be
+ // overridden by configuration. If it isn't then we assume
+ // defaults.
+ //
+ if(communicator.getProperties().getProperty("TestAdapter.Endpoints").length() == 0)
+ {
+ communicator.getProperties().setProperty("TestAdapter.Endpoints", "default -p 12010 -t 10000");
+ }
Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
adapter.add(new RetryI(), communicator.stringToIdentity("retry"));
@@ -60,7 +60,7 @@ public class Server
}
}
- System.gc();
+ System.gc();
System.exit(status);
}
}
diff --git a/javae/test/IceE/slicing/csrc/AllTests.java b/javae/test/IceE/slicing/csrc/AllTests.java
index 230469fd301..765b970b16b 100644
--- a/javae/test/IceE/slicing/csrc/AllTests.java
+++ b/javae/test/IceE/slicing/csrc/AllTests.java
@@ -22,44 +22,44 @@ public class AllTests
private static class Callback
{
- Callback()
- {
- _called = false;
- }
+ Callback()
+ {
+ _called = false;
+ }
- public synchronized boolean
- check()
- {
- while(!_called)
- {
- try
- {
- wait(5000);
- }
- catch(InterruptedException ex)
- {
- continue;
- }
+ public synchronized boolean
+ check()
+ {
+ while(!_called)
+ {
+ try
+ {
+ wait(5000);
+ }
+ catch(InterruptedException ex)
+ {
+ continue;
+ }
- if(!_called)
- {
- return false; // Must be timeout.
- }
- }
+ if(!_called)
+ {
+ return false; // Must be timeout.
+ }
+ }
- _called = false;
- return true;
- }
-
- public synchronized void
- called()
- {
- IceUtil.Debug.Assert(!_called);
- _called = true;
- notify();
- }
+ _called = false;
+ return true;
+ }
+
+ public synchronized void
+ called()
+ {
+ IceUtil.Debug.Assert(!_called);
+ _called = true;
+ notify();
+ }
- private boolean _called;
+ private boolean _called;
}
public static TestIntfPrx
@@ -79,277 +79,277 @@ public class AllTests
test(test.equals(base));
out.println("ok");
- out.print("base... ");
+ out.print("base... ");
out.flush();
- {
- try
- {
- test.baseAsBase();
- test(false);
- }
- catch(Base b)
- {
- test(b.b.equals("Base.b"));
- test(b.ice_name().equals("Test::Base"));
- }
- catch(Exception ex)
- {
- test(false);
- }
- }
- out.println("ok");
+ {
+ try
+ {
+ test.baseAsBase();
+ test(false);
+ }
+ catch(Base b)
+ {
+ test(b.b.equals("Base.b"));
+ test(b.ice_name().equals("Test::Base"));
+ }
+ catch(Exception ex)
+ {
+ test(false);
+ }
+ }
+ out.println("ok");
- out.print("slicing of unknown derived... ");
- out.flush();
- {
- try
- {
- test.unknownDerivedAsBase();
- test(false);
- }
- catch(Base b)
- {
- test(b.b.equals("UnknownDerived.b"));
- test(b.ice_name().equals("Test::Base"));
- }
- catch(Exception ex)
- {
- test(false);
- }
- }
- out.println("ok");
+ out.print("slicing of unknown derived... ");
+ out.flush();
+ {
+ try
+ {
+ test.unknownDerivedAsBase();
+ test(false);
+ }
+ catch(Base b)
+ {
+ test(b.b.equals("UnknownDerived.b"));
+ test(b.ice_name().equals("Test::Base"));
+ }
+ catch(Exception ex)
+ {
+ test(false);
+ }
+ }
+ out.println("ok");
- out.print("non-slicing of known derived as base... ");
- out.flush();
- {
- try
- {
- test.knownDerivedAsBase();
- test(false);
- }
- catch(KnownDerived k)
- {
- test(k.b.equals("KnownDerived.b"));
- test(k.kd.equals("KnownDerived.kd"));
- test(k.ice_name().equals("Test::KnownDerived"));
- }
- catch(Exception ex)
- {
- test(false);
- }
- }
- out.println("ok");
+ out.print("non-slicing of known derived as base... ");
+ out.flush();
+ {
+ try
+ {
+ test.knownDerivedAsBase();
+ test(false);
+ }
+ catch(KnownDerived k)
+ {
+ test(k.b.equals("KnownDerived.b"));
+ test(k.kd.equals("KnownDerived.kd"));
+ test(k.ice_name().equals("Test::KnownDerived"));
+ }
+ catch(Exception ex)
+ {
+ test(false);
+ }
+ }
+ out.println("ok");
- out.print("non-slicing of known derived as derived... ");
- out.flush();
- {
- try
- {
- test.knownDerivedAsKnownDerived();
- test(false);
- }
- catch(KnownDerived k)
- {
- test(k.b.equals("KnownDerived.b"));
- test(k.kd.equals("KnownDerived.kd"));
- test(k.ice_name().equals("Test::KnownDerived"));
- }
- catch(Exception ex)
- {
- test(false);
- }
- }
- out.println("ok");
+ out.print("non-slicing of known derived as derived... ");
+ out.flush();
+ {
+ try
+ {
+ test.knownDerivedAsKnownDerived();
+ test(false);
+ }
+ catch(KnownDerived k)
+ {
+ test(k.b.equals("KnownDerived.b"));
+ test(k.kd.equals("KnownDerived.kd"));
+ test(k.ice_name().equals("Test::KnownDerived"));
+ }
+ catch(Exception ex)
+ {
+ test(false);
+ }
+ }
+ out.println("ok");
- out.print("slicing of unknown intermediate as base... ");
- out.flush();
- {
- try
- {
- test.unknownIntermediateAsBase();
- test(false);
- }
- catch(Base b)
- {
- test(b.b.equals("UnknownIntermediate.b"));
- test(b.ice_name().equals("Test::Base"));
- }
- catch(Exception ex)
- {
- test(false);
- }
- }
- out.println("ok");
+ out.print("slicing of unknown intermediate as base... ");
+ out.flush();
+ {
+ try
+ {
+ test.unknownIntermediateAsBase();
+ test(false);
+ }
+ catch(Base b)
+ {
+ test(b.b.equals("UnknownIntermediate.b"));
+ test(b.ice_name().equals("Test::Base"));
+ }
+ catch(Exception ex)
+ {
+ test(false);
+ }
+ }
+ out.println("ok");
- out.print("slicing of known intermediate as base... ");
- out.flush();
- {
- try
- {
- test.knownIntermediateAsBase();
- test(false);
- }
- catch(KnownIntermediate ki)
- {
- test(ki.b.equals("KnownIntermediate.b"));
- test(ki.ki.equals("KnownIntermediate.ki"));
- test(ki.ice_name().equals("Test::KnownIntermediate"));
- }
- catch(Exception ex)
- {
- test(false);
- }
- }
- out.println("ok");
+ out.print("slicing of known intermediate as base... ");
+ out.flush();
+ {
+ try
+ {
+ test.knownIntermediateAsBase();
+ test(false);
+ }
+ catch(KnownIntermediate ki)
+ {
+ test(ki.b.equals("KnownIntermediate.b"));
+ test(ki.ki.equals("KnownIntermediate.ki"));
+ test(ki.ice_name().equals("Test::KnownIntermediate"));
+ }
+ catch(Exception ex)
+ {
+ test(false);
+ }
+ }
+ out.println("ok");
- out.print("slicing of known most derived as base... ");
- out.flush();
- {
- try
- {
- test.knownMostDerivedAsBase();
- test(false);
- }
- catch(KnownMostDerived kmd)
- {
- test(kmd.b.equals("KnownMostDerived.b"));
- test(kmd.ki.equals("KnownMostDerived.ki"));
- test(kmd.kmd.equals("KnownMostDerived.kmd"));
- test(kmd.ice_name().equals("Test::KnownMostDerived"));
- }
- catch(Exception ex)
- {
- test(false);
- }
- }
- out.println("ok");
+ out.print("slicing of known most derived as base... ");
+ out.flush();
+ {
+ try
+ {
+ test.knownMostDerivedAsBase();
+ test(false);
+ }
+ catch(KnownMostDerived kmd)
+ {
+ test(kmd.b.equals("KnownMostDerived.b"));
+ test(kmd.ki.equals("KnownMostDerived.ki"));
+ test(kmd.kmd.equals("KnownMostDerived.kmd"));
+ test(kmd.ice_name().equals("Test::KnownMostDerived"));
+ }
+ catch(Exception ex)
+ {
+ test(false);
+ }
+ }
+ out.println("ok");
- out.print("non-slicing of known intermediate as intermediate... ");
- out.flush();
- {
- try
- {
- test.knownIntermediateAsKnownIntermediate();
- test(false);
- }
- catch(KnownIntermediate ki)
- {
- test(ki.b.equals("KnownIntermediate.b"));
- test(ki.ki.equals("KnownIntermediate.ki"));
- test(ki.ice_name().equals("Test::KnownIntermediate"));
- }
- catch(Exception ex)
- {
- test(false);
- }
- }
- out.println("ok");
+ out.print("non-slicing of known intermediate as intermediate... ");
+ out.flush();
+ {
+ try
+ {
+ test.knownIntermediateAsKnownIntermediate();
+ test(false);
+ }
+ catch(KnownIntermediate ki)
+ {
+ test(ki.b.equals("KnownIntermediate.b"));
+ test(ki.ki.equals("KnownIntermediate.ki"));
+ test(ki.ice_name().equals("Test::KnownIntermediate"));
+ }
+ catch(Exception ex)
+ {
+ test(false);
+ }
+ }
+ out.println("ok");
- out.print("non-slicing of known most derived as intermediate... ");
- out.flush();
- {
- try
- {
- test.knownMostDerivedAsKnownIntermediate();
- test(false);
- }
- catch(KnownMostDerived kmd)
- {
- test(kmd.b.equals("KnownMostDerived.b"));
- test(kmd.ki.equals("KnownMostDerived.ki"));
- test(kmd.kmd.equals("KnownMostDerived.kmd"));
- test(kmd.ice_name().equals("Test::KnownMostDerived"));
- }
- catch(Exception ex)
- {
- test(false);
- }
- }
- out.println("ok");
+ out.print("non-slicing of known most derived as intermediate... ");
+ out.flush();
+ {
+ try
+ {
+ test.knownMostDerivedAsKnownIntermediate();
+ test(false);
+ }
+ catch(KnownMostDerived kmd)
+ {
+ test(kmd.b.equals("KnownMostDerived.b"));
+ test(kmd.ki.equals("KnownMostDerived.ki"));
+ test(kmd.kmd.equals("KnownMostDerived.kmd"));
+ test(kmd.ice_name().equals("Test::KnownMostDerived"));
+ }
+ catch(Exception ex)
+ {
+ test(false);
+ }
+ }
+ out.println("ok");
- out.print("non-slicing of known most derived as most derived... ");
- out.flush();
- {
- try
- {
- test.knownMostDerivedAsKnownMostDerived();
- test(false);
- }
- catch(KnownMostDerived kmd)
- {
- test(kmd.b.equals("KnownMostDerived.b"));
- test(kmd.ki.equals("KnownMostDerived.ki"));
- test(kmd.kmd.equals("KnownMostDerived.kmd"));
- test(kmd.ice_name().equals("Test::KnownMostDerived"));
- }
- catch(Exception ex)
- {
- test(false);
- }
- }
- out.println("ok");
+ out.print("non-slicing of known most derived as most derived... ");
+ out.flush();
+ {
+ try
+ {
+ test.knownMostDerivedAsKnownMostDerived();
+ test(false);
+ }
+ catch(KnownMostDerived kmd)
+ {
+ test(kmd.b.equals("KnownMostDerived.b"));
+ test(kmd.ki.equals("KnownMostDerived.ki"));
+ test(kmd.kmd.equals("KnownMostDerived.kmd"));
+ test(kmd.ice_name().equals("Test::KnownMostDerived"));
+ }
+ catch(Exception ex)
+ {
+ test(false);
+ }
+ }
+ out.println("ok");
- out.print("slicing of unknown most derived, known intermediate as base... ");
- out.flush();
- {
- try
- {
- test.unknownMostDerived1AsBase();
- test(false);
- }
- catch(KnownIntermediate ki)
- {
- test(ki.b.equals("UnknownMostDerived1.b"));
- test(ki.ki.equals("UnknownMostDerived1.ki"));
- test(ki.ice_name().equals("Test::KnownIntermediate"));
- }
- catch(Exception ex)
- {
- test(false);
- }
- }
- out.println("ok");
+ out.print("slicing of unknown most derived, known intermediate as base... ");
+ out.flush();
+ {
+ try
+ {
+ test.unknownMostDerived1AsBase();
+ test(false);
+ }
+ catch(KnownIntermediate ki)
+ {
+ test(ki.b.equals("UnknownMostDerived1.b"));
+ test(ki.ki.equals("UnknownMostDerived1.ki"));
+ test(ki.ice_name().equals("Test::KnownIntermediate"));
+ }
+ catch(Exception ex)
+ {
+ test(false);
+ }
+ }
+ out.println("ok");
- out.print("slicing of unknown most derived, known intermediate as intermediate... ");
- out.flush();
- {
- try
- {
- test.unknownMostDerived1AsKnownIntermediate();
- test(false);
- }
- catch(KnownIntermediate ki)
- {
- test(ki.b.equals("UnknownMostDerived1.b"));
- test(ki.ki.equals("UnknownMostDerived1.ki"));
- test(ki.ice_name().equals("Test::KnownIntermediate"));
- }
- catch(Exception ex)
- {
- test(false);
- }
- }
- out.println("ok");
+ out.print("slicing of unknown most derived, known intermediate as intermediate... ");
+ out.flush();
+ {
+ try
+ {
+ test.unknownMostDerived1AsKnownIntermediate();
+ test(false);
+ }
+ catch(KnownIntermediate ki)
+ {
+ test(ki.b.equals("UnknownMostDerived1.b"));
+ test(ki.ki.equals("UnknownMostDerived1.ki"));
+ test(ki.ice_name().equals("Test::KnownIntermediate"));
+ }
+ catch(Exception ex)
+ {
+ test(false);
+ }
+ }
+ out.println("ok");
- out.print("slicing of unknown most derived, unknown intermediate thrown as base... ");
- out.flush();
- {
- try
- {
- test.unknownMostDerived2AsBase();
- test(false);
- }
- catch(Base b)
- {
- test(b.b.equals("UnknownMostDerived2.b"));
- test(b.ice_name().equals("Test::Base"));
- }
- catch(Exception ex)
- {
- test(false);
- }
- }
- out.println("ok");
+ out.print("slicing of unknown most derived, unknown intermediate thrown as base... ");
+ out.flush();
+ {
+ try
+ {
+ test.unknownMostDerived2AsBase();
+ test(false);
+ }
+ catch(Base b)
+ {
+ test(b.b.equals("UnknownMostDerived2.b"));
+ test(b.ice_name().equals("Test::Base"));
+ }
+ catch(Exception ex)
+ {
+ test(false);
+ }
+ }
+ out.println("ok");
return test;
}
diff --git a/javae/test/IceE/slicing/csrc/Client.java b/javae/test/IceE/slicing/csrc/Client.java
index 20f49876934..a453272ee5b 100644
--- a/javae/test/IceE/slicing/csrc/Client.java
+++ b/javae/test/IceE/slicing/csrc/Client.java
@@ -49,7 +49,7 @@ public class Client
}
}
- System.gc();
+ System.gc();
System.exit(status);
}
}
diff --git a/javae/test/IceE/slicing/ssrc/Server.java b/javae/test/IceE/slicing/ssrc/Server.java
index 088329ad8da..01599175b9b 100644
--- a/javae/test/IceE/slicing/ssrc/Server.java
+++ b/javae/test/IceE/slicing/ssrc/Server.java
@@ -14,10 +14,10 @@ public class Server
{
Ice.Properties properties = communicator.getProperties();
properties.setProperty("Ice.Warn.Dispatch", "0");
- if(properties.getProperty("TestAdapter.Endpoints").length() == 0)
- {
- properties.setProperty("TestAdapter.Endpoints", "default -p 12010 -t 2000");
- }
+ if(properties.getProperty("TestAdapter.Endpoints").length() == 0)
+ {
+ properties.setProperty("TestAdapter.Endpoints", "default -p 12010 -t 2000");
+ }
Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter");
Ice.Object object = new TestI(adapter);
@@ -57,7 +57,7 @@ public class Server
}
}
- System.gc();
+ System.gc();
System.exit(status);
}
}
diff --git a/javae/test/IceE/slicing/ssrc/TestI.java b/javae/test/IceE/slicing/ssrc/TestI.java
index 5f3b9e812fe..026237e9f4d 100644
--- a/javae/test/IceE/slicing/ssrc/TestI.java
+++ b/javae/test/IceE/slicing/ssrc/TestI.java
@@ -28,134 +28,134 @@ public final class TestI extends _TestIntfDisp
throws Base
{
Base b = new Base();
- b.b = "Base.b";
- throw b;
+ b.b = "Base.b";
+ throw b;
}
public void
unknownDerivedAsBase(Ice.Current current)
throws Base
{
- UnknownDerived d = new UnknownDerived();
- d.b = "UnknownDerived.b";
- d.ud = "UnknownDerived.ud";
- throw d;
+ UnknownDerived d = new UnknownDerived();
+ d.b = "UnknownDerived.b";
+ d.ud = "UnknownDerived.ud";
+ throw d;
}
public void
knownDerivedAsBase(Ice.Current current)
throws Base
{
- KnownDerived d = new KnownDerived();
- d.b = "KnownDerived.b";
- d.kd = "KnownDerived.kd";
- throw d;
+ KnownDerived d = new KnownDerived();
+ d.b = "KnownDerived.b";
+ d.kd = "KnownDerived.kd";
+ throw d;
}
public void
knownDerivedAsKnownDerived(Ice.Current current)
throws KnownDerived
{
- KnownDerived d = new KnownDerived();
- d.b = "KnownDerived.b";
- d.kd = "KnownDerived.kd";
- throw d;
+ KnownDerived d = new KnownDerived();
+ d.b = "KnownDerived.b";
+ d.kd = "KnownDerived.kd";
+ throw d;
}
public void
unknownIntermediateAsBase(Ice.Current current)
throws Base
{
- UnknownIntermediate ui = new UnknownIntermediate();
- ui.b = "UnknownIntermediate.b";
- ui.ui = "UnknownIntermediate.ui";
- throw ui;
+ UnknownIntermediate ui = new UnknownIntermediate();
+ ui.b = "UnknownIntermediate.b";
+ ui.ui = "UnknownIntermediate.ui";
+ throw ui;
}
public void
knownIntermediateAsBase(Ice.Current current)
throws Base
{
- KnownIntermediate ki = new KnownIntermediate();
- ki.b = "KnownIntermediate.b";
- ki.ki = "KnownIntermediate.ki";
- throw ki;
+ KnownIntermediate ki = new KnownIntermediate();
+ ki.b = "KnownIntermediate.b";
+ ki.ki = "KnownIntermediate.ki";
+ throw ki;
}
public void
knownMostDerivedAsBase(Ice.Current current)
throws Base
{
- KnownMostDerived kmd = new KnownMostDerived();
- kmd.b = "KnownMostDerived.b";
- kmd.ki = "KnownMostDerived.ki";
- kmd.kmd = "KnownMostDerived.kmd";
- throw kmd;
+ KnownMostDerived kmd = new KnownMostDerived();
+ kmd.b = "KnownMostDerived.b";
+ kmd.ki = "KnownMostDerived.ki";
+ kmd.kmd = "KnownMostDerived.kmd";
+ throw kmd;
}
public void
knownIntermediateAsKnownIntermediate(Ice.Current current)
throws KnownIntermediate
{
- KnownIntermediate ki = new KnownIntermediate();
- ki.b = "KnownIntermediate.b";
- ki.ki = "KnownIntermediate.ki";
- throw ki;
+ KnownIntermediate ki = new KnownIntermediate();
+ ki.b = "KnownIntermediate.b";
+ ki.ki = "KnownIntermediate.ki";
+ throw ki;
}
public void
knownMostDerivedAsKnownIntermediate(Ice.Current current)
throws KnownIntermediate
{
- KnownMostDerived kmd = new KnownMostDerived();
- kmd.b = "KnownMostDerived.b";
- kmd.ki = "KnownMostDerived.ki";
- kmd.kmd = "KnownMostDerived.kmd";
- throw kmd;
+ KnownMostDerived kmd = new KnownMostDerived();
+ kmd.b = "KnownMostDerived.b";
+ kmd.ki = "KnownMostDerived.ki";
+ kmd.kmd = "KnownMostDerived.kmd";
+ throw kmd;
}
public void
knownMostDerivedAsKnownMostDerived(Ice.Current current)
throws KnownMostDerived
{
- KnownMostDerived kmd = new KnownMostDerived();
- kmd.b = "KnownMostDerived.b";
- kmd.ki = "KnownMostDerived.ki";
- kmd.kmd = "KnownMostDerived.kmd";
- throw kmd;
+ KnownMostDerived kmd = new KnownMostDerived();
+ kmd.b = "KnownMostDerived.b";
+ kmd.ki = "KnownMostDerived.ki";
+ kmd.kmd = "KnownMostDerived.kmd";
+ throw kmd;
}
public void
unknownMostDerived1AsBase(Ice.Current current)
throws Base
{
- UnknownMostDerived1 umd1 = new UnknownMostDerived1();
- umd1.b = "UnknownMostDerived1.b";
- umd1.ki = "UnknownMostDerived1.ki";
- umd1.umd1 = "UnknownMostDerived1.umd1";
- throw umd1;
+ UnknownMostDerived1 umd1 = new UnknownMostDerived1();
+ umd1.b = "UnknownMostDerived1.b";
+ umd1.ki = "UnknownMostDerived1.ki";
+ umd1.umd1 = "UnknownMostDerived1.umd1";
+ throw umd1;
}
public void
unknownMostDerived1AsKnownIntermediate(Ice.Current current)
throws KnownIntermediate
{
- UnknownMostDerived1 umd1 = new UnknownMostDerived1();
- umd1.b = "UnknownMostDerived1.b";
- umd1.ki = "UnknownMostDerived1.ki";
- umd1.umd1 = "UnknownMostDerived1.umd1";
- throw umd1;
+ UnknownMostDerived1 umd1 = new UnknownMostDerived1();
+ umd1.b = "UnknownMostDerived1.b";
+ umd1.ki = "UnknownMostDerived1.ki";
+ umd1.umd1 = "UnknownMostDerived1.umd1";
+ throw umd1;
}
public void
unknownMostDerived2AsBase(Ice.Current current)
throws Base
{
- UnknownMostDerived2 umd2 = new UnknownMostDerived2();
- umd2.b = "UnknownMostDerived2.b";
- umd2.ui = "UnknownMostDerived2.ui";
- umd2.umd2 = "UnknownMostDerived2.umd2";
- throw umd2;
+ UnknownMostDerived2 umd2 = new UnknownMostDerived2();
+ umd2.b = "UnknownMostDerived2.b";
+ umd2.ui = "UnknownMostDerived2.ui";
+ umd2.umd2 = "UnknownMostDerived2.umd2";
+ throw umd2;
}
private Ice.ObjectAdapter _adapter;
}
diff --git a/javae/test/IceE/translator/Metadata.ice b/javae/test/IceE/translator/Metadata.ice
index 5306dc5f887..248f7ee426c 100644
--- a/javae/test/IceE/translator/Metadata.ice
+++ b/javae/test/IceE/translator/Metadata.ice
@@ -16,8 +16,8 @@ module MetadataTest
IntList intListMember;
["java:type:NonexistentList"] IntSeq modifiedIntSeqMember;
- StringDict stringDictMember;
- StringMap stringMapMember;
+ StringDict stringDictMember;
+ StringMap stringMapMember;
IntList opIntList(IntList inArg, out IntList outArg);