summaryrefslogtreecommitdiff
path: root/cpp/src
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/src')
-rw-r--r--cpp/src/Ice/ConnectionFactory.cpp13
-rw-r--r--cpp/src/Ice/ConnectionFactory.h1
-rw-r--r--cpp/src/Ice/ObjectAdapterI.cpp47
-rw-r--r--cpp/src/Ice/ObjectAdapterI.h1
4 files changed, 35 insertions, 27 deletions
diff --git a/cpp/src/Ice/ConnectionFactory.cpp b/cpp/src/Ice/ConnectionFactory.cpp
index 27d8bc94c6c..bd28f451dde 100644
--- a/cpp/src/Ice/ConnectionFactory.cpp
+++ b/cpp/src/Ice/ConnectionFactory.cpp
@@ -402,7 +402,13 @@ IceInternal::IncomingConnectionFactory::finished(const ThreadPoolPtr& threadPool
_acceptor->close();
- _finished = true;
+ //
+ // Break cyclic object dependency. This is necessary, because
+ // the object adapter never clears the list of incoming
+ // connections it keeps.
+ //
+ _adapter = 0;
+
notifyAll(); // For waitUntilFinished().
}
}
@@ -432,7 +438,6 @@ IceInternal::IncomingConnectionFactory::IncomingConnectionFactory(const Instance
_endpoint(endpoint),
_adapter(adapter),
_state(StateHolding),
- _finished(false),
_registeredWithPool(false)
{
DefaultsAndOverridesPtr defaultsAndOverrides = _instance->defaultsAndOverrides();
@@ -468,7 +473,7 @@ IceInternal::IncomingConnectionFactory::IncomingConnectionFactory(const Instance
IceInternal::IncomingConnectionFactory::~IncomingConnectionFactory()
{
assert(_state == StateClosed);
- assert(_finished);
+ assert(!_adapter);
}
void
@@ -483,7 +488,7 @@ IceInternal::IncomingConnectionFactory::waitUntilFinished()
{
::IceUtil::Monitor< ::IceUtil::Mutex>::Lock sync(*this);
- while (!_finished)
+ while (_adapter)
{
wait();
}
diff --git a/cpp/src/Ice/ConnectionFactory.h b/cpp/src/Ice/ConnectionFactory.h
index 3bc7ef90860..15fadcf3ca8 100644
--- a/cpp/src/Ice/ConnectionFactory.h
+++ b/cpp/src/Ice/ConnectionFactory.h
@@ -100,7 +100,6 @@ private:
std::list<ConnectionPtr> _connections;
State _state;
bool _warn;
- bool _finished;
bool _registeredWithPool;
};
diff --git a/cpp/src/Ice/ObjectAdapterI.cpp b/cpp/src/Ice/ObjectAdapterI.cpp
index a8b37763a34..638b62b0823 100644
--- a/cpp/src/Ice/ObjectAdapterI.cpp
+++ b/cpp/src/Ice/ObjectAdapterI.cpp
@@ -22,6 +22,7 @@
#include <Ice/LocalException.h>
#include <Ice/Properties.h>
#include <Ice/Functional.h>
+#include <Ice/LoggerUtil.h>
#ifdef _WIN32
# include <sys/timeb.h>
@@ -42,7 +43,14 @@ Ice::ObjectAdapterI::getName()
CommunicatorPtr
Ice::ObjectAdapterI::getCommunicator()
{
- return _instance->communicator(); // _instance is immutable
+ IceUtil::Mutex::Lock sync(*this);
+
+ if (!_instance)
+ {
+ throw ObjectAdapterDeactivatedException(__FILE__, __LINE__);
+ }
+
+ return _instance->communicator();
}
void
@@ -50,7 +58,7 @@ Ice::ObjectAdapterI::activate()
{
IceUtil::Mutex::Lock sync(*this);
- if (_deactivated)
+ if (!_instance)
{
throw ObjectAdapterDeactivatedException(__FILE__, __LINE__);
}
@@ -74,7 +82,7 @@ Ice::ObjectAdapterI::hold()
{
IceUtil::Mutex::Lock sync(*this);
- if (_deactivated)
+ if (!_instance)
{
throw ObjectAdapterDeactivatedException(__FILE__, __LINE__);
}
@@ -88,7 +96,7 @@ Ice::ObjectAdapterI::deactivate()
{
IceUtil::Mutex::Lock sync(*this);
- if (_deactivated)
+ if (!_instance)
{
//
// Ignore deactivation requests if the Object Adapter has
@@ -110,7 +118,7 @@ Ice::ObjectAdapterI::deactivate()
_locatorMap.clear();
_locatorMapHint = _locatorMap.end();
- _deactivated = true;
+ _instance = 0;
}
void
@@ -130,7 +138,7 @@ Ice::ObjectAdapterI::add(const ObjectPtr& object, const Identity& ident)
{
IceUtil::Mutex::Lock sync(*this);
- if (_deactivated)
+ if (!_instance)
{
throw ObjectAdapterDeactivatedException(__FILE__, __LINE__);
}
@@ -145,7 +153,7 @@ Ice::ObjectAdapterI::addWithUUID(const ObjectPtr& object)
{
IceUtil::Mutex::Lock sync(*this);
- if (_deactivated)
+ if (!_instance)
{
throw ObjectAdapterDeactivatedException(__FILE__, __LINE__);
}
@@ -163,7 +171,7 @@ Ice::ObjectAdapterI::remove(const Identity& ident)
{
IceUtil::Mutex::Lock sync(*this);
- if (_deactivated)
+ if (!_instance)
{
throw ObjectAdapterDeactivatedException(__FILE__, __LINE__);
}
@@ -177,7 +185,7 @@ Ice::ObjectAdapterI::addServantLocator(const ServantLocatorPtr& locator, const s
{
IceUtil::Mutex::Lock sync(*this);
- if (_deactivated)
+ if (!_instance)
{
throw ObjectAdapterDeactivatedException(__FILE__, __LINE__);
}
@@ -190,7 +198,7 @@ Ice::ObjectAdapterI::removeServantLocator(const string& prefix)
{
IceUtil::Mutex::Lock sync(*this);
- if (_deactivated)
+ if (!_instance)
{
throw ObjectAdapterDeactivatedException(__FILE__, __LINE__);
}
@@ -231,7 +239,7 @@ Ice::ObjectAdapterI::findServantLocator(const string& prefix)
{
IceUtil::Mutex::Lock sync(*this);
- if (_deactivated)
+ if (!_instance)
{
throw ObjectAdapterDeactivatedException(__FILE__, __LINE__);
}
@@ -299,7 +307,7 @@ Ice::ObjectAdapterI::createProxy(const Identity& ident)
{
IceUtil::Mutex::Lock sync(*this);
- if (_deactivated)
+ if (!_instance)
{
throw ObjectAdapterDeactivatedException(__FILE__, __LINE__);
}
@@ -312,7 +320,7 @@ Ice::ObjectAdapterI::createReverseProxy(const Identity& ident)
{
IceUtil::Mutex::Lock sync(*this);
- if (_deactivated)
+ if (!_instance)
{
throw ObjectAdapterDeactivatedException(__FILE__, __LINE__);
}
@@ -331,7 +339,7 @@ Ice::ObjectAdapterI::addRouter(const RouterPrx& router)
{
IceUtil::Mutex::Lock sync(*this);
- if (_deactivated)
+ if (!_instance)
{
throw ObjectAdapterDeactivatedException(__FILE__, __LINE__);
}
@@ -388,7 +396,6 @@ Ice::ObjectAdapterI::getIncomingConnections() const
Ice::ObjectAdapterI::ObjectAdapterI(const InstancePtr& instance, const string& name, const string& endpts) :
_instance(instance),
- _deactivated(false),
_printAdapterReadyDone(false),
_name(name),
_activeServantMapHint(_activeServantMap.end()),
@@ -439,10 +446,7 @@ Ice::ObjectAdapterI::ObjectAdapterI(const InstancePtr& instance, const string& n
}
catch(...)
{
- if (!_deactivated)
- {
- deactivate();
- }
+ deactivate();
__setNoDelete(false);
throw;
}
@@ -463,9 +467,10 @@ Ice::ObjectAdapterI::ObjectAdapterI(const InstancePtr& instance, const string& n
Ice::ObjectAdapterI::~ObjectAdapterI()
{
- if (!_deactivated)
+ if (_instance)
{
- deactivate();
+ Warning out(_instance->logger());
+ out << "object adapter has not been deactivated";
}
}
diff --git a/cpp/src/Ice/ObjectAdapterI.h b/cpp/src/Ice/ObjectAdapterI.h
index de00f2855d5..e9378be1c67 100644
--- a/cpp/src/Ice/ObjectAdapterI.h
+++ b/cpp/src/Ice/ObjectAdapterI.h
@@ -70,7 +70,6 @@ private:
bool isLocal(const ObjectPrx&) const;
::IceInternal::InstancePtr _instance;
- bool _deactivated;
bool _printAdapterReadyDone;
std::string _name;
ObjectDict _activeServantMap;