summaryrefslogtreecommitdiff
path: root/cpp/src/Ice/ObjectAdapterFactory.cpp
diff options
context:
space:
mode:
authorBernard Normier <bernard@zeroc.com>2007-02-01 17:09:49 +0000
committerBernard Normier <bernard@zeroc.com>2007-02-01 17:09:49 +0000
commitabada90e3f84dc703b8ddc9efcbed8a946fadead (patch)
tree2c6f9dccd510ea97cb927a7bd635422efaae547a /cpp/src/Ice/ObjectAdapterFactory.cpp
parentremoving trace message (diff)
downloadice-abada90e3f84dc703b8ddc9efcbed8a946fadead.tar.bz2
ice-abada90e3f84dc703b8ddc9efcbed8a946fadead.tar.xz
ice-abada90e3f84dc703b8ddc9efcbed8a946fadead.zip
Expanded tabs into spaces
Diffstat (limited to 'cpp/src/Ice/ObjectAdapterFactory.cpp')
-rw-r--r--cpp/src/Ice/ObjectAdapterFactory.cpp146
1 files changed, 73 insertions, 73 deletions
diff --git a/cpp/src/Ice/ObjectAdapterFactory.cpp b/cpp/src/Ice/ObjectAdapterFactory.cpp
index 8f93caf12a8..334be027f82 100644
--- a/cpp/src/Ice/ObjectAdapterFactory.cpp
+++ b/cpp/src/Ice/ObjectAdapterFactory.cpp
@@ -26,23 +26,23 @@ IceInternal::ObjectAdapterFactory::shutdown()
map<string, ObjectAdapterIPtr> adapters;
{
- IceUtil::Monitor<IceUtil::RecMutex>::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::RecMutex>::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();
}
//
@@ -50,48 +50,48 @@ IceInternal::ObjectAdapterFactory::shutdown()
// deadlocks.
//
for_each(adapters.begin(), adapters.end(),
- IceUtil::secondVoidMemFun<const string, ObjectAdapterI>(&ObjectAdapter::deactivate));
+ IceUtil::secondVoidMemFun<const string, ObjectAdapterI>(&ObjectAdapter::deactivate));
}
void
IceInternal::ObjectAdapterFactory::waitForShutdown()
{
{
- IceUtil::Monitor<IceUtil::RecMutex>::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::RecMutex>::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;
}
//
// Now we wait for deactivation of each object adapter.
//
for_each(_adapters.begin(), _adapters.end(),
- IceUtil::secondVoidMemFun<const string, ObjectAdapterI>(&ObjectAdapter::waitForDeactivate));
+ IceUtil::secondVoidMemFun<const string, ObjectAdapterI>(&ObjectAdapter::waitForDeactivate));
{
- IceUtil::Monitor<IceUtil::RecMutex>::Lock sync(*this);
+ IceUtil::Monitor<IceUtil::RecMutex>::Lock sync(*this);
- //
- // Signal that waiting is complete.
- //
- _waitForShutdown = false;
- notifyAll();
+ //
+ // Signal that waiting is complete.
+ //
+ _waitForShutdown = false;
+ notifyAll();
}
}
@@ -114,41 +114,41 @@ IceInternal::ObjectAdapterFactory::destroy()
map<string, ObjectAdapterIPtr> adapters;
{
- IceUtil::Monitor<IceUtil::RecMutex>::Lock sync(*this);
+ IceUtil::Monitor<IceUtil::RecMutex>::Lock sync(*this);
- adapters = _adapters;
- _adapters.clear();
+ adapters = _adapters;
+ _adapters.clear();
}
//
// Now we destroy each object adapter.
//
for_each(adapters.begin(), adapters.end(),
- IceUtil::secondVoidMemFun<const string, ObjectAdapterI>(&ObjectAdapter::destroy));
+ IceUtil::secondVoidMemFun<const string, ObjectAdapterI>(&ObjectAdapter::destroy));
}
ObjectAdapterPtr
IceInternal::ObjectAdapterFactory::createObjectAdapter(const string& name, const string& endpoints,
- const RouterPrx& router)
+ const RouterPrx& router)
{
IceUtil::Monitor<IceUtil::RecMutex>::Lock sync(*this);
if(!_instance)
{
- throw ObjectAdapterDeactivatedException(__FILE__, __LINE__);
+ throw ObjectAdapterDeactivatedException(__FILE__, __LINE__);
}
map<string, ObjectAdapterIPtr>::iterator p = _adapters.find(name);
if(p != _adapters.end())
{
- throw AlreadyRegisteredException(__FILE__, __LINE__, "object adapter", name);
+ throw AlreadyRegisteredException(__FILE__, __LINE__, "object adapter", name);
}
if(name.empty() && (!endpoints.empty() || router != 0))
{
InitializationException ex(__FILE__, __LINE__);
- ex.reason = "Cannot configure endpoints or router with nameless object adapter";
- throw ex;
+ ex.reason = "Cannot configure endpoints or router with nameless object adapter";
+ throw ex;
}
ObjectAdapterIPtr adapter;
@@ -156,7 +156,7 @@ IceInternal::ObjectAdapterFactory::createObjectAdapter(const string& name, const
{
string uuid = IceUtil::generateUUID();
adapter = new ObjectAdapterI(_instance, _communicator, this, uuid, "", 0, true);
- _adapters.insert(make_pair(uuid, adapter));
+ _adapters.insert(make_pair(uuid, adapter));
}
else
{
@@ -173,22 +173,22 @@ IceInternal::ObjectAdapterFactory::findObjectAdapter(const ObjectPrx& proxy)
if(!_instance)
{
- return 0;
+ return 0;
}
for(map<string, ObjectAdapterIPtr>::iterator p = _adapters.begin(); p != _adapters.end(); ++p)
{
- try
- {
- if(p->second->isLocal(proxy))
- {
- return p->second;
- }
- }
- catch(const ObjectAdapterDeactivatedException&)
- {
- // Ignore.
- }
+ try
+ {
+ if(p->second->isLocal(proxy))
+ {
+ return p->second;
+ }
+ }
+ catch(const ObjectAdapterDeactivatedException&)
+ {
+ // Ignore.
+ }
}
return 0;
@@ -213,7 +213,7 @@ struct FlushAdapter
{
void operator() (ObjectAdapterIPtr p)
{
- p->flushBatchRequests();
+ p->flushBatchRequests();
}
};
@@ -224,18 +224,18 @@ IceInternal::ObjectAdapterFactory::flushBatchRequests() const
{
list<ObjectAdapterIPtr> a;
{
- IceUtil::Monitor<IceUtil::RecMutex>::Lock sync(*this);
+ IceUtil::Monitor<IceUtil::RecMutex>::Lock sync(*this);
- for(map<string, ObjectAdapterIPtr>::const_iterator p = _adapters.begin(); p != _adapters.end(); ++p)
- {
- a.push_back(p->second);
- }
+ for(map<string, ObjectAdapterIPtr>::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)