summaryrefslogtreecommitdiff
path: root/cpp/src/Ice/CommunicatorI.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/src/Ice/CommunicatorI.cpp')
-rw-r--r--cpp/src/Ice/CommunicatorI.cpp146
1 files changed, 73 insertions, 73 deletions
diff --git a/cpp/src/Ice/CommunicatorI.cpp b/cpp/src/Ice/CommunicatorI.cpp
index ec72da06d01..c7ca49ea899 100644
--- a/cpp/src/Ice/CommunicatorI.cpp
+++ b/cpp/src/Ice/CommunicatorI.cpp
@@ -35,7 +35,7 @@ IceUtil::Handle<IceInternal::GC> theCollector = 0;
struct GarbageCollectorStats
{
GarbageCollectorStats() :
- runs(0), examined(0), collected(0)
+ runs(0), examined(0), collected(0)
{
}
int runs;
@@ -56,15 +56,15 @@ printGCStats(const IceInternal::GCStats& stats)
{
if(gcTraceLevel)
{
- if(gcTraceLevel > 1)
- {
- Trace out(getProcessLogger(), gcTraceCat);
- out << stats.collected << "/" << stats.examined << ", " << stats.time * 1000 << "ms";
- }
- ++gcStats.runs;
- gcStats.examined += stats.examined;
- gcStats.collected += stats.collected;
- gcStats.time += stats.time;
+ if(gcTraceLevel > 1)
+ {
+ Trace out(getProcessLogger(), gcTraceCat);
+ out << stats.collected << "/" << stats.examined << ", " << stats.time * 1000 << "ms";
+ }
+ ++gcStats.runs;
+ gcStats.examined += stats.examined;
+ gcStats.collected += stats.collected;
+ gcStats.time += stats.time;
}
}
@@ -73,37 +73,37 @@ Ice::CommunicatorI::destroy()
{
if(_instance->destroy())
{
- IceUtil::StaticMutex::Lock sync(gcMutex);
-
- //
- // Wait for the collector thread to stop if this is the last communicator
- // to be destroyed.
- //
- bool last = (--communicatorCount == 0);
- if(last && gcInterval > 0 && theCollector)
- {
- theCollector->stop();
- }
-
- if(theCollector)
+ IceUtil::StaticMutex::Lock sync(gcMutex);
+
+ //
+ // Wait for the collector thread to stop if this is the last communicator
+ // to be destroyed.
+ //
+ bool last = (--communicatorCount == 0);
+ if(last && gcInterval > 0 && theCollector)
+ {
+ theCollector->stop();
+ }
+
+ if(theCollector)
{
- theCollector->collectGarbage(); // Collect whenever a communicator is destroyed.
- }
-
- if(last)
- {
- if(gcTraceLevel)
- {
- Trace out(getProcessLogger(), gcTraceCat);
- out << "totals: " << gcStats.collected << "/" << gcStats.examined << ", "
- << gcStats.time * 1000 << "ms" << ", " << gcStats.runs << " run";
- if(gcStats.runs != 1)
- {
- out << "s";
- }
- }
- theCollector = 0; // Force destruction of the collector.
- }
+ theCollector->collectGarbage(); // Collect whenever a communicator is destroyed.
+ }
+
+ if(last)
+ {
+ if(gcTraceLevel)
+ {
+ Trace out(getProcessLogger(), gcTraceCat);
+ out << "totals: " << gcStats.collected << "/" << gcStats.examined << ", "
+ << gcStats.time * 1000 << "ms" << ", " << gcStats.runs << " run";
+ if(gcStats.runs != 1)
+ {
+ out << "s";
+ }
+ }
+ theCollector = 0; // Force destruction of the collector.
+ }
}
}
@@ -263,47 +263,47 @@ Ice::CommunicatorI::CommunicatorI(const InitializationData& initData)
__setNoDelete(true);
try
{
- const_cast<InstancePtr&>(_instance) = new Instance(this, initData);
+ const_cast<InstancePtr&>(_instance) = new Instance(this, initData);
//
// Keep a reference to the dynamic library list to ensure
// the libraries are not unloaded until this Communicator's
// destructor is invoked.
//
- const_cast<DynamicLibraryListPtr&>(_dynamicLibraryList) = _instance->dynamicLibraryList();
+ const_cast<DynamicLibraryListPtr&>(_dynamicLibraryList) = _instance->dynamicLibraryList();
}
catch(...)
{
- __setNoDelete(false);
- throw;
+ __setNoDelete(false);
+ throw;
}
__setNoDelete(false);
{
- //
- // If this is the first communicator that is created, use that communicator's
- // property settings to determine whether to start the garbage collector.
- // We remember that communicator's trace and logger settings so the garbage
- // collector can continue to log messages even if the first communicator that
- // is created isn't the last communicator to be destroyed.
- //
- IceUtil::StaticMutex::Lock sync(gcMutex);
- static bool gcOnce = true;
- if(gcOnce)
- {
- gcTraceLevel = _instance->traceLevels()->gc;
- gcTraceCat = _instance->traceLevels()->gcCat;
- gcInterval = _instance->initializationData().properties->getPropertyAsInt("Ice.GC.Interval");
- gcOnce = false;
- }
- if(++communicatorCount == 1)
- {
- theCollector = new IceInternal::GC(gcInterval, printGCStats);
- if(gcInterval > 0)
- {
- theCollector->start();
- }
- }
+ //
+ // If this is the first communicator that is created, use that communicator's
+ // property settings to determine whether to start the garbage collector.
+ // We remember that communicator's trace and logger settings so the garbage
+ // collector can continue to log messages even if the first communicator that
+ // is created isn't the last communicator to be destroyed.
+ //
+ IceUtil::StaticMutex::Lock sync(gcMutex);
+ static bool gcOnce = true;
+ if(gcOnce)
+ {
+ gcTraceLevel = _instance->traceLevels()->gc;
+ gcTraceCat = _instance->traceLevels()->gcCat;
+ gcInterval = _instance->initializationData().properties->getPropertyAsInt("Ice.GC.Interval");
+ gcOnce = false;
+ }
+ if(++communicatorCount == 1)
+ {
+ theCollector = new IceInternal::GC(gcInterval, printGCStats);
+ if(gcInterval > 0)
+ {
+ theCollector->start();
+ }
+ }
}
}
@@ -311,8 +311,8 @@ Ice::CommunicatorI::~CommunicatorI()
{
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";
}
}
@@ -321,11 +321,11 @@ Ice::CommunicatorI::finishSetup(int& argc, char* argv[])
{
try
{
- _instance->finishSetup(argc, argv);
+ _instance->finishSetup(argc, argv);
}
catch(...)
{
- _instance->destroy();
- throw;
+ _instance->destroy();
+ throw;
}
}