summaryrefslogtreecommitdiff
path: root/cpp/test/Ice/background/Configuration.cpp
diff options
context:
space:
mode:
authorBenoit Foucher <benoit@zeroc.com>2007-11-27 11:58:35 +0100
committerBenoit Foucher <benoit@zeroc.com>2007-11-27 11:58:35 +0100
commit47f800495093fd7679a315e2d730fea22f6135b7 (patch)
treea7b8d3488f3841367dd03d10cae293f36fd10481 /cpp/test/Ice/background/Configuration.cpp
parentFixed SystemException to no longer derive from LocalException (diff)
downloadice-47f800495093fd7679a315e2d730fea22f6135b7.tar.bz2
ice-47f800495093fd7679a315e2d730fea22f6135b7.tar.xz
ice-47f800495093fd7679a315e2d730fea22f6135b7.zip
- Added support for non-blocking AMI/batch requests, connection
creation. - Added support for AMI oneway requests. - Changed collocation optimization to not perform any DNS lookups.
Diffstat (limited to 'cpp/test/Ice/background/Configuration.cpp')
-rw-r--r--cpp/test/Ice/background/Configuration.cpp182
1 files changed, 182 insertions, 0 deletions
diff --git a/cpp/test/Ice/background/Configuration.cpp b/cpp/test/Ice/background/Configuration.cpp
new file mode 100644
index 00000000000..d2f7e82a1c1
--- /dev/null
+++ b/cpp/test/Ice/background/Configuration.cpp
@@ -0,0 +1,182 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2007 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#include <Configuration.h>
+
+Configuration* Configuration::_instance = 0;
+
+Configuration::Configuration() :
+ _initializeSocketStatus(IceInternal::Finished),
+ _initializeResetCount(0),
+ _readReadyCount(0),
+ _writeReadyCount(0)
+{
+ assert(!_instance);
+ _instance = this;
+}
+
+Configuration::~Configuration()
+{
+ _instance = 0;
+}
+
+void
+Configuration::connectorsException(Ice::LocalException* ex)
+{
+ Lock sync(*this);
+ _connectorsException.reset(ex);
+}
+
+void
+Configuration::checkConnectorsException()
+{
+ Lock sync(*this);
+ if(_connectorsException.get())
+ {
+ _connectorsException->ice_throw();
+ }
+}
+
+void
+Configuration::connectException(Ice::LocalException* ex)
+{
+ Lock sync(*this);
+ _connectException.reset(ex);
+}
+
+void
+Configuration::checkConnectException()
+{
+ Lock sync(*this);
+ if(_connectException.get())
+ {
+ _connectException->ice_throw();
+ }
+}
+
+void
+Configuration::initializeSocketStatus(IceInternal::SocketStatus status)
+{
+ Lock sync(*this);
+ if(status == IceInternal::Finished)
+ {
+ _initializeResetCount = 0;
+ return;
+ }
+ _initializeResetCount = 10;
+ _initializeSocketStatus = status;
+}
+
+void
+Configuration::initializeException(Ice::LocalException* ex)
+{
+ Lock sync(*this);
+ _initializeException.reset(ex);
+}
+
+IceInternal::SocketStatus
+Configuration::initializeSocketStatus()
+{
+ Lock sync(*this);
+ if(_initializeResetCount == 0)
+ {
+ return IceInternal::Finished;
+ }
+ --_initializeResetCount;
+ return _initializeSocketStatus;
+}
+
+void
+Configuration::checkInitializeException()
+{
+ Lock sync(*this);
+ if(_initializeException.get())
+ {
+ _initializeException->ice_throw();
+ }
+}
+
+void
+Configuration::readReady(bool ready)
+{
+ Lock sync(*this);
+ _readReadyCount = ready ? 0 : 10;
+}
+
+void
+Configuration::readException(Ice::LocalException* ex)
+{
+ Lock sync(*this);
+ _readException.reset(ex);
+}
+
+bool
+Configuration::readReady()
+{
+ Lock sync(*this);
+ if(_readReadyCount == 0)
+ {
+ return true;
+ }
+ --_readReadyCount;
+ return false;
+}
+
+void
+Configuration::checkReadException()
+{
+ Lock sync(*this);
+ if(_readException.get())
+ {
+ _readException->ice_throw();
+ }
+}
+
+void
+Configuration::writeReady(bool ready)
+{
+ Lock sync(*this);
+ _writeReadyCount = ready ? 0 : 10;
+}
+
+void
+Configuration::writeException(Ice::LocalException* ex)
+{
+ Lock sync(*this);
+ _writeException.reset(ex);
+}
+
+bool
+Configuration::writeReady()
+{
+ Lock sync(*this);
+ if(_writeReadyCount == 0)
+ {
+ return true;
+ }
+ --_writeReadyCount;
+ return false;
+}
+
+void
+Configuration::checkWriteException()
+{
+ Lock sync(*this);
+ if(_writeException.get())
+ {
+ _writeException->ice_throw();
+ }
+}
+
+Configuration*
+Configuration::getInstance()
+{
+ return _instance;
+}
+