diff options
Diffstat (limited to 'cpp')
27 files changed, 409 insertions, 409 deletions
diff --git a/cpp/demo/Freeze/customEvictor/Evictor.cpp b/cpp/demo/Freeze/customEvictor/Evictor.cpp index 7cd656d7ab4..2aeba05e4da 100644 --- a/cpp/demo/Freeze/customEvictor/Evictor.cpp +++ b/cpp/demo/Freeze/customEvictor/Evictor.cpp @@ -200,7 +200,7 @@ Evictor::finished(const Ice::Current& /*current*/, const Ice::ObjectPtr& /*serva } void -Evictor::destroy(const string& /*category*/) +Evictor::deactivate(const string& /*category*/) { Mutex::Lock lock(_mutex); _size = 0; diff --git a/cpp/demo/Freeze/customEvictor/Evictor.h b/cpp/demo/Freeze/customEvictor/Evictor.h index 38f3b026fe2..cea55d0c812 100644 --- a/cpp/demo/Freeze/customEvictor/Evictor.h +++ b/cpp/demo/Freeze/customEvictor/Evictor.h @@ -69,7 +69,7 @@ public: virtual Ice::ObjectPtr locate(const Ice::Current&, Ice::LocalObjectPtr&); virtual void finished(const Ice::Current&, const Ice::ObjectPtr&, const Ice::LocalObjectPtr&); - virtual void destroy(const std::string&); + virtual void deactivate(const std::string&); private: diff --git a/cpp/demo/Freeze/customEvictor/EvictorBase.cpp b/cpp/demo/Freeze/customEvictor/EvictorBase.cpp index a4eece51dc3..8afeb6cecc8 100644 --- a/cpp/demo/Freeze/customEvictor/EvictorBase.cpp +++ b/cpp/demo/Freeze/customEvictor/EvictorBase.cpp @@ -79,7 +79,7 @@ EvictorBase::finished(const Ice::Current&, const Ice::ObjectPtr&, const Ice::Loc } void -EvictorBase::destroy(const std::string& /*category*/) +EvictorBase::deactivate(const std::string& /*category*/) { IceUtil::Mutex::Lock lock(_mutex); diff --git a/cpp/demo/Freeze/customEvictor/EvictorBase.h b/cpp/demo/Freeze/customEvictor/EvictorBase.h index a99be9d55ae..1cddf1ecde5 100644 --- a/cpp/demo/Freeze/customEvictor/EvictorBase.h +++ b/cpp/demo/Freeze/customEvictor/EvictorBase.h @@ -23,7 +23,7 @@ public: virtual Ice::ObjectPtr locate(const Ice::Current&, Ice::LocalObjectPtr&); virtual void finished(const Ice::Current&, const Ice::ObjectPtr&, const Ice::LocalObjectPtr&); - virtual void destroy(const std::string&); + virtual void deactivate(const std::string&); protected: diff --git a/cpp/src/Freeze/BackgroundSaveEvictorI.cpp b/cpp/src/Freeze/BackgroundSaveEvictorI.cpp index e747f371b3a..f37d44bad7e 100644 --- a/cpp/src/Freeze/BackgroundSaveEvictorI.cpp +++ b/cpp/src/Freeze/BackgroundSaveEvictorI.cpp @@ -51,7 +51,7 @@ public: }; Init init; -void +void handleFatalError(const Freeze::BackgroundSaveEvictorPtr& evictor, const Ice::CommunicatorPtr& communicator) { IceUtilInternal::MutexPtrLock<IceUtil::Mutex> lock(fatalErrorCallbackMutex); @@ -73,7 +73,7 @@ handleFatalError(const Freeze::BackgroundSaveEvictorPtr& evictor, const Ice::Com class WatchDogTask : public IceUtil::TimerTask { public: - + WatchDogTask(BackgroundSaveEvictorI& evictor) : _evictor(evictor) { } @@ -85,7 +85,7 @@ public: out.flush(); handleFatalError(&_evictor, _evictor.communicator()); } - + private: BackgroundSaveEvictorI& _evictor; @@ -95,11 +95,11 @@ private: // // createEvictor functions -// +// Freeze::BackgroundSaveEvictorPtr -Freeze::createBackgroundSaveEvictor(const ObjectAdapterPtr& adapter, - const string& envName, +Freeze::createBackgroundSaveEvictor(const ObjectAdapterPtr& adapter, + const string& envName, const string& filename, const ServantInitializerPtr& initializer, const vector<IndexPtr>& indices, @@ -109,9 +109,9 @@ Freeze::createBackgroundSaveEvictor(const ObjectAdapterPtr& adapter, } BackgroundSaveEvictorPtr -Freeze::createBackgroundSaveEvictor(const ObjectAdapterPtr& adapter, - const string& envName, - DbEnv& dbEnv, +Freeze::createBackgroundSaveEvictor(const ObjectAdapterPtr& adapter, + const string& envName, + DbEnv& dbEnv, const string& filename, const ServantInitializerPtr& initializer, const vector<IndexPtr>& indices, @@ -120,7 +120,7 @@ Freeze::createBackgroundSaveEvictor(const ObjectAdapterPtr& adapter, return new BackgroundSaveEvictorI(adapter, envName, &dbEnv, filename, initializer, indices, createDb); } -FatalErrorCallback +FatalErrorCallback Freeze::registerFatalErrorCallback(FatalErrorCallback cb) { IceUtilInternal::MutexPtrLock<IceUtil::Mutex> lock(fatalErrorCallbackMutex); @@ -133,10 +133,10 @@ Freeze::registerFatalErrorCallback(FatalErrorCallback cb) // BackgroundSaveEvictorI // -Freeze::BackgroundSaveEvictorI::BackgroundSaveEvictorI(const ObjectAdapterPtr& adapter, - const string& envName, - DbEnv* dbEnv, - const string& filename, +Freeze::BackgroundSaveEvictorI::BackgroundSaveEvictorI(const ObjectAdapterPtr& adapter, + const string& envName, + DbEnv* dbEnv, + const string& filename, const ServantInitializerPtr& initializer, const vector<IndexPtr>& indices, bool createDb) : @@ -145,8 +145,8 @@ Freeze::BackgroundSaveEvictorI::BackgroundSaveEvictorI(const ObjectAdapterPtr& a _currentEvictorSize(0), _savingThreadDone(false) { - string propertyPrefix = string("Freeze.Evictor.") + envName + '.' + _filename; - + string propertyPrefix = string("Freeze.Evictor.") + envName + '.' + _filename; + // // By default, we save every minute or when the size of the modified queue // reaches 10. @@ -159,24 +159,24 @@ Freeze::BackgroundSaveEvictorI::BackgroundSaveEvictorI(const ObjectAdapterPtr& a getPropertyAsIntWithDefault(propertyPrefix + ".SavePeriod", 60 * 1000); _savePeriod = IceUtil::Time::milliSeconds(savePeriod); - + // // By default, we save at most 10 * SaveSizeTrigger objects per transaction // _maxTxSize = _communicator->getProperties()-> getPropertyAsIntWithDefault(propertyPrefix + ".MaxTxSize", 10 * _saveSizeTrigger); - + if(_maxTxSize <= 0) { _maxTxSize = 100; - } + } // // By default, no stream timeout // _streamTimeout = _communicator->getProperties()-> getPropertyAsIntWithDefault(propertyPrefix+ ".StreamTimeout", 0) * 1000; - + if(_streamTimeout > 0) { _timer = IceInternal::getInstanceTimer(_communicator); @@ -197,9 +197,9 @@ Freeze::BackgroundSaveEvictorI::addFacet(const ObjectPtr& servant, const Identit checkIdentity(ident); checkServant(servant); DeactivateController::Guard deactivateGuard(_deactivateController); - + ObjectStore<BackgroundSaveEvictorElement>* store = findStore(facet, _createDb); - + if(store == 0) { throw NotFoundException(__FILE__, __LINE__, "addFacet: could not open database for facet '" @@ -213,11 +213,11 @@ Freeze::BackgroundSaveEvictorI::addFacet(const ObjectPtr& servant, const Identit // // Create a new entry // - + BackgroundSaveEvictorElementPtr element = new BackgroundSaveEvictorElement(*store); element->status = dead; BackgroundSaveEvictorElementPtr oldElt = store->putIfAbsent(ident, element); - + if(oldElt != 0) { element = oldElt; @@ -230,13 +230,13 @@ Freeze::BackgroundSaveEvictorI::addFacet(const ObjectPtr& servant, const Identit { // // Try again - // + // continue; } fixEvictPosition(element); IceUtil::Mutex::Lock lock(element->mutex); - + switch(element->status) { case clean: @@ -245,12 +245,12 @@ Freeze::BackgroundSaveEvictorI::addFacet(const ObjectPtr& servant, const Identit { alreadyThere = true; break; - } + } case destroyed: { element->status = modified; element->rec.servant = servant; - + // // No need to push it on the modified queue, as a destroyed object // is either already on the queue or about to be saved. When saved, @@ -282,7 +282,7 @@ Freeze::BackgroundSaveEvictorI::addFacet(const ObjectPtr& servant, const Identit } break; // for(;;) } - + if(alreadyThere) { AlreadyRegisteredException ex(__FILE__, __LINE__); @@ -319,7 +319,7 @@ Freeze::BackgroundSaveEvictorI::removeFacet(const Identity& ident, const string& { checkIdentity(ident); DeactivateController::Guard deactivateGuard(_deactivateController); - + ObjectStore<BackgroundSaveEvictorElement>* store = findStore(facet, false); ObjectPtr servant = 0; @@ -330,7 +330,7 @@ Freeze::BackgroundSaveEvictorI::removeFacet(const Identity& ident, const string& // // Retrieve object // - + BackgroundSaveEvictorElementPtr element = store->pin(ident); if(element != 0) { @@ -339,14 +339,14 @@ Freeze::BackgroundSaveEvictorI::removeFacet(const Identity& ident, const string& { // // Try again - // + // continue; } - + fixEvictPosition(element); { IceUtil::Mutex::Lock lock(element->mutex); - + switch(element->status) { case clean: @@ -375,7 +375,7 @@ Freeze::BackgroundSaveEvictorI::removeFacet(const Identity& ident, const string& // (at which point it becomes clean) // break; - } + } case destroyed: case dead: { @@ -403,10 +403,10 @@ Freeze::BackgroundSaveEvictorI::removeFacet(const Identity& ident, const string& element->evictPosition = _evictorList.begin(); } } - break; // for(;;) + break; // for(;;) } } - + if(servant == 0) { NotRegisteredException ex(__FILE__, __LINE__); @@ -461,9 +461,9 @@ Freeze::BackgroundSaveEvictorI::keepFacet(const Identity& ident, const string& f notThere = true; break; } - + Lock sync(*this); - + if(element->stale) { // @@ -471,8 +471,8 @@ Freeze::BackgroundSaveEvictorI::keepFacet(const Identity& ident, const string& f // continue; } - - + + { IceUtil::Mutex::Lock lockElement(element->mutex); if(element->status == destroyed || element->status == dead) @@ -481,7 +481,7 @@ Freeze::BackgroundSaveEvictorI::keepFacet(const Identity& ident, const string& f break; } } - + // // Found! // @@ -540,12 +540,12 @@ Freeze::BackgroundSaveEvictorI::releaseFacet(const Identity& ident, const string if(store != 0) { Lock sync(*this); - + BackgroundSaveEvictorElementPtr element = store->getIfPinned(ident); if(element != 0) { assert(!element->stale); - if(element->keepCount > 0) + if(element->keepCount > 0) { if(--element->keepCount == 0) { @@ -566,7 +566,7 @@ Freeze::BackgroundSaveEvictorI::releaseFacet(const Identity& ident, const string } } } - + NotRegisteredException ex(__FILE__, __LINE__); ex.kindOfObject = "servant"; ex.id = _communicator->identityToString(ident); @@ -591,12 +591,12 @@ Freeze::BackgroundSaveEvictorI::hasFacet(const Identity& ident, const string& fa } { - Lock sync(*this); + Lock sync(*this); BackgroundSaveEvictorElementPtr element = store->getIfPinned(ident); if(element != 0) { - assert(!element->stale); - + assert(!element->stale); + IceUtil::Mutex::Lock lock(element->mutex); return element->status != dead && element->status != destroyed; } @@ -610,34 +610,34 @@ Freeze::BackgroundSaveEvictorI::hasAnotherFacet(const Identity& ident, const str DeactivateController::Guard deactivateGuard(_deactivateController); // - // If the object exists in another store, throw FacetNotExistException + // If the object exists in another store, throw FacetNotExistException // instead of returning 0 (== ObjectNotExistException) - // + // StoreMap storeMapCopy; { Lock sync(*this); storeMapCopy = _storeMap; - } - + } + for(StoreMap::iterator p = storeMapCopy.begin(); p != storeMapCopy.end(); ++p) { // // Do not check again the given facet // if((*p).first != facet) - { + { ObjectStore<BackgroundSaveEvictorElement>* store = (*p).second; - + bool inCache = false; { Lock sync(*this); - + BackgroundSaveEvictorElementPtr element = store->getIfPinned(ident); if(element != 0) { inCache = true; - assert(!element->stale); - + assert(!element->stale); + IceUtil::Mutex::Lock lock(element->mutex); if(element->status != dead && element->status != destroyed) { @@ -675,7 +675,7 @@ Freeze::BackgroundSaveEvictorI::locateImpl(const Current& current, LocalObjectPt } return 0; } - + for(;;) { BackgroundSaveEvictorElementPtr element = store->pin(current.id); @@ -689,7 +689,7 @@ Freeze::BackgroundSaveEvictorI::locateImpl(const Current& current, LocalObjectPt } return 0; } - + Lock sync(*this); if(element->stale) @@ -707,7 +707,7 @@ Freeze::BackgroundSaveEvictorI::locateImpl(const Current& current, LocalObjectPt if(_trace >= 2) { Trace out(_communicator->getLogger(), "Freeze.Evictor"); - out << "locate found \"" << _communicator->identityToString(current.id) + out << "locate found \"" << _communicator->identityToString(current.id) << "\" in the cache for database \"" << current.facet << "\" but it was dead or destroyed"; } return 0; @@ -719,7 +719,7 @@ Freeze::BackgroundSaveEvictorI::locateImpl(const Current& current, LocalObjectPt if(_trace >= 2) { Trace out(_communicator->getLogger(), "Freeze.Evictor"); - out << "locate found \"" << _communicator->identityToString(current.id) << "\" in Db \"" + out << "locate found \"" << _communicator->identityToString(current.id) << "\" in Db \"" << _filename << "\""; } @@ -741,37 +741,37 @@ Freeze::BackgroundSaveEvictorI::finished(const Current& current, const ObjectPtr { BackgroundSaveEvictorElementPtr element = BackgroundSaveEvictorElementPtr::dynamicCast(cookie); assert(element); - + bool enqueue = false; - + if((servant->ice_operationAttributes(current.operation) & 0x1) != 0) { IceUtil::Mutex::Lock lock(element->mutex); - + if(element->status == clean) { // // Assume this operation updated the object - // + // element->status = modified; enqueue = true; } } - + Lock sync(*this); // - // Only elements with a usageCount == 0 can become stale and we own + // Only elements with a usageCount == 0 can become stale and we own // one count! - // + // assert(!element->stale); assert(element->usageCount >= 1); - + // // Decrease the usage count of the evictor queue element. // element->usageCount--; - + if(enqueue) { addToModifiedQueue(element); @@ -787,7 +787,7 @@ Freeze::BackgroundSaveEvictorI::finished(const Current& current, const ObjectPtr } void -Freeze::BackgroundSaveEvictorI::destroy(const string&) +Freeze::BackgroundSaveEvictorI::deactivate(const string&) { if(_deactivateController.deactivate()) { @@ -796,19 +796,19 @@ Freeze::BackgroundSaveEvictorI::destroy(const string&) saveNow(); Lock sync(*this); - + // // Set the evictor size to zero, meaning that we will evict // everything possible. // _evictorSize = 0; evict(); - + _savingThreadDone = true; notifyAll(); sync.release(); getThreadControl().join(); - + closeDbEnv(); } catch(...) @@ -841,7 +841,7 @@ Freeze::BackgroundSaveEvictorI::run() deque<BackgroundSaveEvictorElementPtr> deadObjects; size_t saveNowThreadsSize = 0; - + { Lock sync(*this); @@ -859,18 +859,18 @@ Freeze::BackgroundSaveEvictorI::run() // Timeout, so let's save // break; // while - } + } } - + saveNowThreadsSize = _saveNowThreads.size(); - + if(_savingThreadDone) { assert(_modifiedQueue.size() == 0); assert(saveNowThreadsSize == 0); break; // for(;;) } - + // // Check first if there is something to do! // @@ -883,38 +883,38 @@ Freeze::BackgroundSaveEvictorI::run() } continue; // for(;;) } - + _modifiedQueue.swap(allObjects); } - + const size_t size = allObjects.size(); - + deque<StreamedObject> streamedObjectQueue; - + Long streamStart = IceUtil::Time::now(IceUtil::Time::Monotonic).toMilliSeconds(); - + // // Stream each element // for(size_t i = 0; i < size; i++) { BackgroundSaveEvictorElementPtr& element = allObjects[i]; - + bool tryAgain; do { tryAgain = false; ObjectPtr servant = 0; - + // - // These elements can't be stale as only elements with + // These elements can't be stale as only elements with // usageCount == 0 can become stale, and the modifiedQueue // (us now) owns one count. // IceUtil::Mutex::Lock lockElement(element->mutex); Byte status = element->status; - + switch(status) { case created: @@ -922,7 +922,7 @@ Freeze::BackgroundSaveEvictorI::run() { servant = element->rec.servant; break; - } + } case destroyed: { size_t index = streamedObjectQueue.size(); @@ -934,7 +934,7 @@ Freeze::BackgroundSaveEvictorI::run() deadObjects.push_back(element); break; - } + } case dead: { deadObjects.push_back(element); @@ -961,7 +961,7 @@ Freeze::BackgroundSaveEvictorI::run() // Lock servant and then element so that user can safely lock // servant and call various Evictor operations // - + IceUtil::AbstractMutex::TryLock lockServant(*mutex); if(!lockServant.acquired()) { @@ -983,7 +983,7 @@ Freeze::BackgroundSaveEvictorI::run() lockElement.acquire(); status = element->status; } - + switch(status) { case created: @@ -1007,7 +1007,7 @@ Freeze::BackgroundSaveEvictorI::run() case destroyed: { lockServant.release(); - + size_t index = streamedObjectQueue.size(); streamedObjectQueue.resize(index + 1); StreamedObject& obj = streamedObjectQueue[index]; @@ -1016,7 +1016,7 @@ Freeze::BackgroundSaveEvictorI::run() element->status = dead; deadObjects.push_back(element); break; - } + } case dead: { deadObjects.push_back(element); @@ -1034,26 +1034,26 @@ Freeze::BackgroundSaveEvictorI::run() else { DatabaseException ex(__FILE__, __LINE__); - ex.message = string(typeid(*element->rec.servant).name()) + ex.message = string(typeid(*element->rec.servant).name()) + " does not implement IceUtil::AbstractMutex"; throw ex; } } } while(tryAgain); } - + if(_trace >= 1) { Long now = IceUtil::Time::now(IceUtil::Time::Monotonic).toMilliSeconds(); Trace out(_communicator->getLogger(), "Freeze.Evictor"); - out << "streamed " << streamedObjectQueue.size() << " objects in " + out << "streamed " << streamedObjectQueue.size() << " objects in " << static_cast<Int>(now - streamStart) << " ms"; } - + // // Now let's save all these streamed objects to disk using a transaction // - + // // Each time we get a deadlock, we reduce the number of objects to save // per transaction @@ -1064,20 +1064,20 @@ Freeze::BackgroundSaveEvictorI::run() txSize = static_cast<size_t>(_maxTxSize); } bool tryAgain; - + do { tryAgain = false; - + while(streamedObjectQueue.size() > 0) { if(txSize > streamedObjectQueue.size()) { txSize = streamedObjectQueue.size(); } - + Long saveStart = IceUtil::Time::now(IceUtil::Time::Monotonic).toMilliSeconds(); - + try { DbTxn* tx = 0; @@ -1092,7 +1092,7 @@ Freeze::BackgroundSaveEvictorI::run() } try - { + { for(size_t i = 0; i < txSize; i++) { StreamedObject& obj = streamedObjectQueue[i]; @@ -1118,14 +1118,14 @@ Freeze::BackgroundSaveEvictorI::run() } streamedObjectQueue.erase - (streamedObjectQueue.begin(), + (streamedObjectQueue.begin(), streamedObjectQueue.begin() + txSize); - + if(_trace >= 1) { Long now = IceUtil::Time::now(IceUtil::Time::Monotonic).toMilliSeconds(); Trace out(_communicator->getLogger(), "Freeze.Evictor"); - out << "saved " << txSize << " objects in " + out << "saved " << txSize << " objects in " << static_cast<Int>(now - saveStart) << " ms"; } } @@ -1137,7 +1137,7 @@ Freeze::BackgroundSaveEvictorI::run() out << "Deadlock in Freeze::BackgroundSaveEvictorI::run while writing into Db \"" + _filename + "\"; retrying ..."; } - + tryAgain = true; txSize = (txSize + 1)/2; } @@ -1147,13 +1147,13 @@ Freeze::BackgroundSaveEvictorI::run() ex.message = dx.what(); throw ex; } - } + } } while(tryAgain); - + { Lock sync(*this); - + // // Release usage count // @@ -1191,7 +1191,7 @@ Freeze::BackgroundSaveEvictorI::run() } deadObjects.clear(); evict(); - + if(saveNowThreadsSize > 0) { _saveNowThreads.erase(_saveNowThreads.begin(), _saveNowThreads.begin() + saveNowThreadsSize); @@ -1227,7 +1227,7 @@ void Freeze::BackgroundSaveEvictorI::saveNow() { Lock sync(*this); - + IceUtil::ThreadControl myself; _saveNowThreads.push_back(myself); @@ -1249,7 +1249,7 @@ Freeze::BackgroundSaveEvictorI::evict() assert(_currentEvictorSize == _evictorList.size()); list<BackgroundSaveEvictorElementPtr>::reverse_iterator p = _evictorList.rbegin(); - + while(_currentEvictorSize > _evictorSize) { // @@ -1285,10 +1285,10 @@ Freeze::BackgroundSaveEvictorI::evict() { out << "-f \"" << facet << "\" "; } - out << "from the queue\n" + out << "from the queue\n" << "number of elements in the queue: " << _currentEvictorSize; } - + // // Remove last unused element from the evictor queue. // @@ -1299,11 +1299,11 @@ Freeze::BackgroundSaveEvictorI::evict() } } -void +void Freeze::BackgroundSaveEvictorI::fixEvictPosition(const BackgroundSaveEvictorElementPtr& element) { assert(!element->stale); - + if(element->keepCount == 0) { if(element->usageCount < 0) @@ -1323,7 +1323,7 @@ Freeze::BackgroundSaveEvictorI::fixEvictPosition(const BackgroundSaveEvictorElem } } -void +void Freeze::BackgroundSaveEvictorI::evict(const BackgroundSaveEvictorElementPtr& element) { assert(!element->stale); @@ -1341,7 +1341,7 @@ Freeze::BackgroundSaveEvictorI::addToModifiedQueue(const BackgroundSaveEvictorEl { element->usageCount++; _modifiedQueue.push_back(element); - + if(_saveSizeTrigger >= 0 && static_cast<Int>(_modifiedQueue.size()) >= _saveSizeTrigger) { notifyAll(); @@ -1353,7 +1353,7 @@ void Freeze::BackgroundSaveEvictorI::stream(const BackgroundSaveEvictorElementPtr& element, Long streamStart, StreamedObject& obj) { assert(element->status != dead); - + obj.status = element->status; obj.store = &element->store; @@ -1397,7 +1397,7 @@ Freeze::BackgroundSaveEvictorElement::~BackgroundSaveEvictorElement() { } -void +void Freeze::BackgroundSaveEvictorElement::init(ObjectStore<BackgroundSaveEvictorElement>::Position p) { stale = false; diff --git a/cpp/src/Freeze/BackgroundSaveEvictorI.h b/cpp/src/Freeze/BackgroundSaveEvictorI.h index f9c294e6b05..12037c53275 100644 --- a/cpp/src/Freeze/BackgroundSaveEvictorI.h +++ b/cpp/src/Freeze/BackgroundSaveEvictorI.h @@ -18,16 +18,16 @@ namespace Freeze #if defined(_MSC_VER) && (_MSC_VER <= 1200) || defined(__IBMCPP__) - enum - { + enum + { clean = 0, created = 1, modified = 2, destroyed = 3, dead = 4 }; - -#else + +#else // // Clean object; can become modified or destroyed // @@ -88,24 +88,24 @@ struct BackgroundSaveEvictorElement : public Ice::LocalObject int usageCount; int keepCount; bool stale; - + // // Protected by mutex - // + // IceUtil::Mutex mutex; ObjectRecord rec; Ice::Byte status; }; -class BackgroundSaveEvictorI : public BackgroundSaveEvictor, public EvictorI<BackgroundSaveEvictorElement>, +class BackgroundSaveEvictorI : public BackgroundSaveEvictor, public EvictorI<BackgroundSaveEvictorElement>, public IceUtil::Thread { public: - BackgroundSaveEvictorI(const Ice::ObjectAdapterPtr&, const std::string&, DbEnv*, const std::string&, + BackgroundSaveEvictorI(const Ice::ObjectAdapterPtr&, const std::string&, DbEnv*, const std::string&, const ServantInitializerPtr&, const std::vector<IndexPtr>&, bool); - + virtual Ice::ObjectPrx addFacet(const Ice::ObjectPtr&, const Ice::Identity&, const std::string&); virtual Ice::ObjectPtr removeFacet(const Ice::Identity&, const std::string&); @@ -118,10 +118,10 @@ public: virtual bool hasFacet(const Ice::Identity&, const std::string&); virtual void finished(const Ice::Current&, const Ice::ObjectPtr&, const Ice::LocalObjectPtr&); - virtual void destroy(const std::string&); + virtual void deactivate(const std::string&); virtual ~BackgroundSaveEvictorI(); - + virtual TransactionIPtr beforeQuery(); @@ -139,11 +139,11 @@ public: }; protected: - + virtual bool hasAnotherFacet(const Ice::Identity&, const std::string&); - + virtual Ice::ObjectPtr locateImpl(const Ice::Current&, Ice::LocalObjectPtr&); - + virtual void evict(); private: @@ -155,7 +155,7 @@ private: void fixEvictPosition(const BackgroundSaveEvictorElementPtr&); void stream(const BackgroundSaveEvictorElementPtr&, Ice::Long, StreamedObject&); - + // // The _evictorList contains a list of all objects we keep, // with the most recently used first. @@ -173,7 +173,7 @@ private: bool _savingThreadDone; long _streamTimeout; IceUtil::TimerPtr _timer; - + // // Threads that have requested a "saveNow" and are waiting for // its completion diff --git a/cpp/src/Freeze/TransactionalEvictorI.cpp b/cpp/src/Freeze/TransactionalEvictorI.cpp index 17fdb6703b8..46680e0ee0f 100644 --- a/cpp/src/Freeze/TransactionalEvictorI.cpp +++ b/cpp/src/Freeze/TransactionalEvictorI.cpp @@ -37,11 +37,11 @@ const int never = 3; // // createEvictor functions -// +// Freeze::TransactionalEvictorPtr -Freeze::createTransactionalEvictor(const ObjectAdapterPtr& adapter, - const string& envName, +Freeze::createTransactionalEvictor(const ObjectAdapterPtr& adapter, + const string& envName, const string& filename, const FacetTypeMap& facetTypes, const ServantInitializerPtr& initializer, @@ -52,9 +52,9 @@ Freeze::createTransactionalEvictor(const ObjectAdapterPtr& adapter, } TransactionalEvictorPtr -Freeze::createTransactionalEvictor(const ObjectAdapterPtr& adapter, - const string& envName, - DbEnv& dbEnv, +Freeze::createTransactionalEvictor(const ObjectAdapterPtr& adapter, + const string& envName, + DbEnv& dbEnv, const string& filename, const FacetTypeMap& facetTypes, const ServantInitializerPtr& initializer, @@ -69,9 +69,9 @@ Freeze::createTransactionalEvictor(const ObjectAdapterPtr& adapter, // TransactionalEvictorI // -Freeze::TransactionalEvictorI::TransactionalEvictorI(const ObjectAdapterPtr& adapter, - const string& envName, - DbEnv* dbEnv, +Freeze::TransactionalEvictorI::TransactionalEvictorI(const ObjectAdapterPtr& adapter, + const string& envName, + DbEnv* dbEnv, const string& filename, const FacetTypeMap& facetTypes, const ServantInitializerPtr& initializer, @@ -80,7 +80,7 @@ Freeze::TransactionalEvictorI::TransactionalEvictorI(const ObjectAdapterPtr& ada EvictorI<TransactionalEvictorElement>(adapter, envName, dbEnv, filename, facetTypes, initializer, indices, createDb), _currentEvictorSize(0) { - + class DispatchInterceptorAdapter : public Ice::DispatchInterceptor { public: @@ -96,14 +96,14 @@ Freeze::TransactionalEvictorI::TransactionalEvictorI(const ObjectAdapterPtr& ada } private: - + TransactionalEvictorIPtr _evictor; }; _interceptor = new DispatchInterceptorAdapter(this); - string propertyPrefix = string("Freeze.Evictor.") + envName + '.' + _filename; - + string propertyPrefix = string("Freeze.Evictor.") + envName + '.' + _filename; + _rollbackOnUserException = _communicator->getProperties()-> getPropertyAsIntWithDefault(propertyPrefix + ".RollbackOnUserException", 0) != 0; } @@ -113,7 +113,7 @@ TransactionPtr Freeze::TransactionalEvictorI::getCurrentTransaction() const { DeactivateController::Guard deactivateGuard(_deactivateController); - + TransactionalEvictorContextPtr ctx = _dbEnv->getCurrent(); if(ctx == 0) { @@ -139,14 +139,14 @@ Freeze::TransactionalEvictorI::addFacet(const ObjectPtr& servant, const Identity checkIdentity(ident); checkServant(servant); DeactivateController::Guard deactivateGuard(_deactivateController); - + ObjectStore<TransactionalEvictorElement>* store = findStore(facet, _createDb); if(store == 0) { throw NotFoundException(__FILE__, __LINE__, "addFacet: could not open database for facet '" + facet + "'"); } - + Ice::Long currentTime = 0; if(store->keepStats()) @@ -156,9 +156,9 @@ Freeze::TransactionalEvictorI::addFacet(const ObjectPtr& servant, const Identity Statistics stats = { currentTime }; ObjectRecord rec = { servant, stats }; - + TransactionIPtr tx = beforeQuery(); - + if(store->keepStats()) { updateStats(rec.stats, currentTime); @@ -175,7 +175,7 @@ Freeze::TransactionalEvictorI::addFacet(const ObjectPtr& servant, const Identity } throw ex; } - + ObjectPrx obj = _adapter->createProxy(ident); if(!facet.empty()) { @@ -189,11 +189,11 @@ Freeze::TransactionalEvictorI::removeFacet(const Identity& ident, const string& { checkIdentity(ident); DeactivateController::Guard deactivateGuard(_deactivateController); - + ObjectPtr servant = 0; bool removed = false; ObjectStore<TransactionalEvictorElement>* store = findStore(facet, false); - + if(store != 0) { TransactionalEvictorContextPtr ctx = _dbEnv->getCurrent(); @@ -206,9 +206,9 @@ Freeze::TransactionalEvictorI::removeFacet(const Identity& ident, const string& throw DatabaseException(__FILE__, __LINE__, "inactive transaction"); } } - + removed = store->remove(ident, tx); - + if(removed) { if(ctx != 0) @@ -227,7 +227,7 @@ Freeze::TransactionalEvictorI::removeFacet(const Identity& ident, const string& } } } - + if(!removed) { NotRegisteredException ex(__FILE__, __LINE__); @@ -266,7 +266,7 @@ Freeze::TransactionalEvictorI::hasFacet(const Identity& ident, const string& fac } TransactionIPtr tx = beforeQuery(); - + if(tx == 0) { TransactionalEvictorElementPtr element = store->getIfPinned(ident); @@ -288,38 +288,38 @@ Freeze::TransactionalEvictorI::hasAnotherFacet(const Identity& ident, const stri DeactivateController::Guard deactivateGuard(_deactivateController); // - // If the object exists in another store, throw FacetNotExistException + // If the object exists in another store, throw FacetNotExistException // instead of returning 0 (== ObjectNotExistException) - // + // StoreMap storeMapCopy; { Lock sync(*this); storeMapCopy = _storeMap; - } + } TransactionIPtr tx = beforeQuery(); - + for(StoreMap::iterator p = storeMapCopy.begin(); p != storeMapCopy.end(); ++p) { // // Do not check again the given facet // if((*p).first != facet) - { + { ObjectStore<TransactionalEvictorElement>* store = (*p).second; - + if(tx == 0 && store->getIfPinned(ident) != 0) { return true; } - + if(store->dbHasObject(ident, tx)) { return true; } } } - + return false; } @@ -357,7 +357,7 @@ Freeze::TransactionalEvictorI::dispatch(Request& request) #endif { } - + ~CtxHolder() ICE_NOEXCEPT_FALSE { if(_ownCtx) @@ -382,7 +382,7 @@ Freeze::TransactionalEvictorI::dispatch(Request& request) const SharedDbEnvPtr& _dbEnv; #endif }; - + DeactivateController::Guard deactivateGuard(_deactivateController); @@ -400,15 +400,15 @@ Freeze::TransactionalEvictorI::dispatch(Request& request) ObjectPtr cachedServant = 0; TransactionalEvictorContext::ServantHolder servantHolder; - + if(sample == 0) { if(ctx != 0) - { + { try { servantHolder.init(ctx, current, store); - } + } catch(const DeadlockException& dx) { assert(dx.tx == ctx->transaction()); @@ -422,9 +422,9 @@ Freeze::TransactionalEvictorI::dispatch(Request& request) // // find / load read-only servant // - + cachedServant = loadCachedServant(current.id, store); - + if(cachedServant == 0) { servantNotFound(__FILE__, __LINE__, current); @@ -436,16 +436,16 @@ Freeze::TransactionalEvictorI::dispatch(Request& request) assert(sample != 0); int operationAttributes = sample->ice_operationAttributes(current.operation); - + if(operationAttributes < 0) { throw OperationNotExistException(__FILE__, __LINE__); } - + bool readOnly = (operationAttributes & 0x1) == 0; - + int txMode = (operationAttributes & 0x6) >> 1; - + bool ownCtx = false; // @@ -489,7 +489,7 @@ Freeze::TransactionalEvictorI::dispatch(Request& request) throw OperationNotExistException(__FILE__, __LINE__); } } - + if(ctx == 0 && !ownCtx) { // @@ -499,7 +499,7 @@ Freeze::TransactionalEvictorI::dispatch(Request& request) if(cachedServant == 0) { cachedServant = loadCachedServant(current.id, store); - + if(cachedServant == 0) { servantNotFound(__FILE__, __LINE__, current); @@ -512,9 +512,9 @@ Freeze::TransactionalEvictorI::dispatch(Request& request) // // Create a new transaction; retry on DeadlockException // - + bool tryAgain = false; - + do { TransactionPtr tx; @@ -525,7 +525,7 @@ Freeze::TransactionalEvictorI::dispatch(Request& request) { ctx = _dbEnv->createCurrent(); } - + #ifndef NDEBUG CtxHolder ctxHolder(ownCtx, ctx, _dbEnv); #else @@ -534,7 +534,7 @@ Freeze::TransactionalEvictorI::dispatch(Request& request) tx = ctx->transaction(); try - { + { TransactionalEvictorContext::ServantHolder sh; if(servantHolder.initialized()) { @@ -547,7 +547,7 @@ Freeze::TransactionalEvictorI::dispatch(Request& request) { sh.init(ctx, current, store); } - + if(sh.servant() == 0) { servantNotFound(__FILE__, __LINE__, current); @@ -557,7 +557,7 @@ Freeze::TransactionalEvictorI::dispatch(Request& request) { sh.markReadWrite(); } - + try { DispatchStatus dispatchStatus = sh.servant()->ice_dispatch(request, ctx); @@ -577,7 +577,7 @@ Freeze::TransactionalEvictorI::dispatch(Request& request) ctx->rollback(); } } - + return dispatchStatus; } catch(...) @@ -591,7 +591,7 @@ Freeze::TransactionalEvictorI::dispatch(Request& request) } // // servant holder destructor runs here and may throw (if !rolled back) - // + // } catch(const DeadlockException& dx) { @@ -609,7 +609,7 @@ Freeze::TransactionalEvictorI::dispatch(Request& request) } throw; } - + // // commit occurs here (when ownCtx) // @@ -648,13 +648,13 @@ Freeze::TransactionalEvictorI::dispatch(Request& request) void -Freeze::TransactionalEvictorI::destroy(const string&) +Freeze::TransactionalEvictorI::deactivate(const string&) { if(_deactivateController.deactivate()) { { Lock sync(*this); - + // // Set the evictor size to zero, meaning that we will evict // everything possible. @@ -701,7 +701,7 @@ Freeze::TransactionalEvictorI::beforeQuery() throw DatabaseException(__FILE__, __LINE__,"inactive transaction"); } } - + return tx; } @@ -728,12 +728,12 @@ Freeze::TransactionalEvictorI::loadCachedServant(const Identity& ident, ObjectSt for(;;) { TransactionalEvictorElementPtr element = store->pin(ident); - + if(element == 0) { return 0; } - + Lock sync(*this); if(element->stale()) { @@ -742,9 +742,9 @@ Freeze::TransactionalEvictorI::loadCachedServant(const Identity& ident, ObjectSt // continue; } - + fixEvictPosition(element); - + // // if _evictorSize is 0, I may evict myself ... no big deal // @@ -760,7 +760,7 @@ Freeze::TransactionalEvictorI::evict(const Identity& ident, ObjectStore<Transact // Important: we can't wait for the DB (even indirectly) with 'this' locked // TransactionalEvictorElementPtr element = store->getIfPinned(ident, true); - + if(element != 0) { Lock sync(*this); @@ -773,7 +773,7 @@ Freeze::TransactionalEvictorI::evict(const Identity& ident, ObjectStore<Transact return 0; } -void +void Freeze::TransactionalEvictorI::evict(const TransactionalEvictorElementPtr& element) { // @@ -782,7 +782,7 @@ Freeze::TransactionalEvictorI::evict(const TransactionalEvictorElementPtr& eleme assert(!element->_stale); element->_stale = true; element->_store.unpin(element->_cachePosition); - + if(element->_inEvictor) { element->_inEvictor = false; @@ -791,7 +791,7 @@ Freeze::TransactionalEvictorI::evict(const TransactionalEvictorElementPtr& eleme } } -void +void Freeze::TransactionalEvictorI::fixEvictPosition(const TransactionalEvictorElementPtr& element) { // @@ -799,7 +799,7 @@ Freeze::TransactionalEvictorI::fixEvictPosition(const TransactionalEvictorElemen // assert(!element->_stale); - + if(element->_inEvictor) { _evictorList.erase(element->_evictPosition); @@ -823,10 +823,10 @@ Freeze::TransactionalEvictorI::servantNotFound(const char* file, int line, const if(_trace >= 2) { Trace out(_communicator->getLogger(), "Freeze.Evictor"); - out << "could not find \"" << _communicator->identityToString(current.id) - << "\" with facet \"" << current.facet + "\""; + out << "could not find \"" << _communicator->identityToString(current.id) + << "\" with facet \"" << current.facet + "\""; } - + if(hasAnotherFacet(current.id, current.facet)) { throw FacetNotExistException(file, line, current.id, current.facet, current.operation); @@ -853,7 +853,7 @@ Freeze::TransactionalEvictorElement::~TransactionalEvictorElement() { } -void +void Freeze::TransactionalEvictorElement::init(ObjectStore<TransactionalEvictorElement>::Position p) { _stale = false; diff --git a/cpp/src/Freeze/TransactionalEvictorI.h b/cpp/src/Freeze/TransactionalEvictorI.h index 72f61effb35..18d2972c2d1 100644 --- a/cpp/src/Freeze/TransactionalEvictorI.h +++ b/cpp/src/Freeze/TransactionalEvictorI.h @@ -41,8 +41,8 @@ public: return _stale; } -private: - +private: + friend class TransactionalEvictorI; const Ice::ObjectPtr _servant; @@ -70,9 +70,9 @@ class TransactionalEvictorI : public TransactionalEvictor, public EvictorI<Trans { public: - TransactionalEvictorI(const Ice::ObjectAdapterPtr&, const std::string&, DbEnv*, const std::string&, + TransactionalEvictorI(const Ice::ObjectAdapterPtr&, const std::string&, DbEnv*, const std::string&, const FacetTypeMap&, const ServantInitializerPtr&, const std::vector<IndexPtr>&, bool); - + virtual ~TransactionalEvictorI(); virtual TransactionPtr getCurrentTransaction() const; @@ -84,7 +84,7 @@ public: virtual bool hasFacet(const Ice::Identity&, const std::string&); virtual void finished(const Ice::Current&, const Ice::ObjectPtr&, const Ice::LocalObjectPtr&); - virtual void destroy(const std::string&); + virtual void deactivate(const std::string&); virtual TransactionIPtr beforeQuery(); @@ -93,11 +93,11 @@ public: Ice::ObjectPtr evict(const Ice::Identity&, ObjectStore<TransactionalEvictorElement>*); protected: - + virtual bool hasAnotherFacet(const Ice::Identity&, const std::string&); - + virtual Ice::ObjectPtr locateImpl(const Ice::Current&, Ice::LocalObjectPtr&); - + virtual void evict(); private: diff --git a/cpp/src/Glacier2/SessionRouterI.cpp b/cpp/src/Glacier2/SessionRouterI.cpp index c7aeda9f76f..049fc8db2d4 100644 --- a/cpp/src/Glacier2/SessionRouterI.cpp +++ b/cpp/src/Glacier2/SessionRouterI.cpp @@ -36,7 +36,7 @@ public: void finished(const Ice::AsyncResultPtr& r) - { + { Ice::ObjectPrx o = r->getProxy(); try { @@ -68,7 +68,7 @@ public: void finished(const Ice::AsyncResultPtr& r) - { + { Ice::ObjectPrx o = r->getProxy(); try { @@ -84,7 +84,7 @@ public: _router->destroySession(_connection); } } - + private: const SessionRouterIPtr _router; @@ -99,7 +99,7 @@ class SessionControlI : public SessionControl { public: - SessionControlI(const SessionRouterIPtr& sessionRouter, const ConnectionPtr& connection, + SessionControlI(const SessionRouterIPtr& sessionRouter, const ConnectionPtr& connection, const FilterManagerPtr& filterManager) : _sessionRouter(sessionRouter), _connection(connection), @@ -122,7 +122,7 @@ public: virtual IdentitySetPrx identities(const Current&) { - return _filters->identitiesPrx(); + return _filters->identitiesPrx(); } virtual int @@ -130,7 +130,7 @@ public: { return static_cast<int>(_sessionRouter->getSessionTimeout(current)); } - + virtual void destroy(const Current&) { @@ -153,7 +153,7 @@ public: _sessionRouter(sessionRouter) { } - + virtual ObjectPtr locate(const Current& current, LocalObjectPtr&) { @@ -166,7 +166,7 @@ public: } virtual void - destroy(const std::string&) + deactivate(const std::string&) { } @@ -183,7 +183,7 @@ public: _sessionRouter(sessionRouter) { } - + virtual ObjectPtr locate(const Current& current, LocalObjectPtr&) { @@ -196,7 +196,7 @@ public: } virtual void - destroy(const std::string&) + deactivate(const std::string&) { } @@ -209,14 +209,14 @@ class UserPasswordCreateSession : public CreateSession { public: - UserPasswordCreateSession(const AMD_Router_createSessionPtr& amdCB, const string& user, const string& password, + UserPasswordCreateSession(const AMD_Router_createSessionPtr& amdCB, const string& user, const string& password, const Ice::Current& current, const SessionRouterIPtr& sessionRouter) : CreateSession(sessionRouter, user, current), - _amdCB(amdCB), + _amdCB(amdCB), _password(password) { } - + void checkPermissionsResponse(bool ok, const string& reason) @@ -251,7 +251,7 @@ public: Ice::Context ctx = _current.ctx; ctx.insert(_context.begin(), _context.end()); - + _sessionRouter->_verifier->begin_checkPermissions(_user, _password, ctx, newCallback_PermissionsVerifier_checkPermissions(this, &UserPasswordCreateSession::checkPermissionsResponse, @@ -272,10 +272,10 @@ public: _sessionRouter->_sessionManager->begin_create(_user, _control, ctx, newCallback_SessionManager_create( static_cast<CreateSession*>(this), - &CreateSession::sessionCreated, + &CreateSession::sessionCreated, &CreateSession::createException)); } - + virtual void finished(const SessionPrx& session) { @@ -298,14 +298,14 @@ class SSLCreateSession : public CreateSession { public: - SSLCreateSession(const AMD_Router_createSessionFromSecureConnectionPtr& amdCB, const string& user, + SSLCreateSession(const AMD_Router_createSessionFromSecureConnectionPtr& amdCB, const string& user, const SSLInfo& sslInfo, const Ice::Current& current, const SessionRouterIPtr& sessionRouter) : CreateSession(sessionRouter, user, current), - _amdCB(amdCB), + _amdCB(amdCB), _sslInfo(sslInfo) { } - + void authorizeResponse(bool ok, const string& reason) { @@ -339,9 +339,9 @@ public: Ice::Context ctx = _current.ctx; ctx.insert(_context.begin(), _context.end()); - _sessionRouter->_sslVerifier->begin_authorize(_sslInfo, ctx, + _sessionRouter->_sslVerifier->begin_authorize(_sslInfo, ctx, newCallback_SSLPermissionsVerifier_authorize(this, - &SSLCreateSession::authorizeResponse, + &SSLCreateSession::authorizeResponse, &SSLCreateSession::authorizeException)); } @@ -359,10 +359,10 @@ public: _sessionRouter->_sslSessionManager->begin_create(_sslInfo, _control, ctx, newCallback_SSLSessionManager_create( static_cast<CreateSession*>(this), - &CreateSession::sessionCreated, + &CreateSession::sessionCreated, &CreateSession::createException)); } - + virtual void finished(const SessionPrx& session) { @@ -388,7 +388,7 @@ public: ConnectionCallbackI(const SessionRouterIPtr& sessionRouter) : _sessionRouter(sessionRouter) { } - + virtual void heartbeat(const Ice::ConnectionPtr& connection) { @@ -594,7 +594,7 @@ CreateSession::sessionCreated(const SessionPrx& session) // Notify the router that the creation is finished. // try - { + { _sessionRouter->finishCreateSession(_current.con, router); finished(session); } @@ -624,13 +624,13 @@ void CreateSession::exception(const Ice::Exception& ex) { try - { + { _sessionRouter->finishCreateSession(_current.con, 0); } catch(const Ice::Exception&) { } - + finished(ex); if(_control) @@ -694,7 +694,7 @@ SessionRouterI::SessionRouterI(const InstancePtr& instance, // a router servant based on connection information. // _instance->clientObjectAdapter()->addServantLocator(new ClientLocator(this), ""); - + // // If there is a server object adapter, all calls on this adapter // are dispatched to a router servant based on the category field @@ -732,17 +732,17 @@ SessionRouterI::destroy() Callback_Session_destroyPtr destroyCallback; { IceUtil::Monitor<IceUtil::Mutex>::Lock lock(*this); - + assert(!_destroy); _destroy = true; notify(); - + _routersByConnection.swap(routers); _routersByConnectionHint = _routersByConnection.end(); - + _routersByCategory.clear(); _routersByCategoryHint = _routersByCategory.end(); - + sessionThread = _sessionThread; _sessionThread = 0; @@ -811,7 +811,7 @@ SessionRouterI::getCategoryForClient(const Ice::Current& current) const } void -SessionRouterI::createSession_async(const AMD_Router_createSessionPtr& amdCB, const std::string& userId, +SessionRouterI::createSession_async(const AMD_Router_createSessionPtr& amdCB, const std::string& userId, const std::string& password, const Current& current) { if(!_verifier) @@ -944,14 +944,14 @@ SessionRouterI::destroySession(const ConnectionPtr& connection) { IceUtil::Monitor<IceUtil::Mutex>::Lock lock(*this); - + if(_destroy) { throw ObjectNotExistException(__FILE__, __LINE__); } - - map<ConnectionPtr, RouterIPtr>::iterator p; - + + map<ConnectionPtr, RouterIPtr>::iterator p; + if(_routersByConnectionHint != _routersByConnection.end() && _routersByConnectionHint->first == connection) { p = _routersByConnectionHint; @@ -960,17 +960,17 @@ SessionRouterI::destroySession(const ConnectionPtr& connection) { p = _routersByConnection.find(connection); } - + if(p == _routersByConnection.end()) { throw SessionNotExistException(); } - + router = p->second; _routersByConnection.erase(p++); _routersByConnectionHint = p; - + if(_instance->serverObjectAdapter()) { string category = router->getServerProxy(Current())->ice_getIdentity().category; @@ -1004,7 +1004,7 @@ SessionRouterI::getACMTimeout(const Ice::Current& current) const return current.con->getACM().timeout; } -void +void SessionRouterI::updateSessionObservers() { IceUtil::Monitor<IceUtil::Mutex>::Lock lock(*this); @@ -1015,7 +1015,7 @@ SessionRouterI::updateSessionObservers() for(map<ConnectionPtr, RouterIPtr>::iterator p = _routersByConnection.begin(); p != _routersByConnection.end(); ++p) { p->second->updateObserver(observer); - } + } } RouterIPtr @@ -1048,7 +1048,7 @@ SessionRouterI::getServerBlobject(const string& category) const { return _routersByCategoryHint->second->getServerBlobject(); } - + map<string, RouterIPtr>::iterator p = routers.find(category); if(p != routers.end()) @@ -1066,30 +1066,30 @@ void SessionRouterI::expireSessions() { vector<RouterIPtr> routers; - + { IceUtil::Monitor<IceUtil::Mutex>::Lock lock(*this); - + if(_destroy) { return; } - + assert(_sessionTimeout > IceUtil::Time()); IceUtil::Time minTimestamp = IceUtil::Time::now(IceUtil::Time::Monotonic) - _sessionTimeout; - + map<ConnectionPtr, RouterIPtr>::iterator p = _routersByConnection.begin(); - + while(p != _routersByConnection.end()) { if(p->second->getTimestamp() < minTimestamp) { RouterIPtr router = p->second; routers.push_back(router); - + _routersByConnection.erase(p++); _routersByConnectionHint = p; - + if(_instance->serverObjectAdapter()) { string category = router->getServerProxy(Current())->ice_getIdentity().category; @@ -1104,7 +1104,7 @@ SessionRouterI::expireSessions() } } } - + // // We destroy the expired routers outside the thread // synchronization, to avoid deadlocks. @@ -1135,7 +1135,7 @@ SessionRouterI::getRouterImpl(const ConnectionPtr& connection, const Ice::Identi _routersByConnectionHint->second->updateTimestamp(); return _routersByConnectionHint->second; } - + map<ConnectionPtr, RouterIPtr>::iterator p = routers.find(connection); if(p != routers.end()) @@ -1172,7 +1172,7 @@ bool SessionRouterI::startCreateSession(const CreateSessionPtr& cb, const ConnectionPtr& connection) { IceUtil::Monitor<IceUtil::Mutex>::Lock lock(*this); - + if(_destroy) { CannotCreateSessionException exc; @@ -1184,7 +1184,7 @@ SessionRouterI::startCreateSession(const CreateSessionPtr& cb, const ConnectionP // Check whether a session already exists for the connection. // { - map<ConnectionPtr, RouterIPtr>::iterator p; + map<ConnectionPtr, RouterIPtr>::iterator p; if(_routersByConnectionHint != _routersByConnection.end() && _routersByConnectionHint->first == connection) { @@ -1194,7 +1194,7 @@ SessionRouterI::startCreateSession(const CreateSessionPtr& cb, const ConnectionP { p = _routersByConnection.find(connection); } - + if(p != _routersByConnection.end()) { CannotCreateSessionException exc; @@ -1229,14 +1229,14 @@ void SessionRouterI::finishCreateSession(const ConnectionPtr& connection, const RouterIPtr& router) { IceUtil::Monitor<IceUtil::Mutex>::Lock lock(*this); - + // // Signal other threads that we are done with trying to // establish a session for our connection; // _pending.erase(connection); notify(); - + if(!router) { return; @@ -1250,15 +1250,15 @@ SessionRouterI::finishCreateSession(const ConnectionPtr& connection, const Route exc.reason = "router is shutting down"; throw exc; } - + _routersByConnectionHint = _routersByConnection.insert( _routersByConnectionHint, pair<const ConnectionPtr, RouterIPtr>(connection, router)); - + if(_instance->serverObjectAdapter()) { string category = router->getServerProxy()->ice_getIdentity().category; assert(!category.empty()); - pair<map<string, RouterIPtr>::iterator, bool> rc = + pair<map<string, RouterIPtr>::iterator, bool> rc = _routersByCategory.insert(pair<const string, RouterIPtr>(category, router)); assert(rc.second); _routersByCategoryHint = rc.first; @@ -1308,7 +1308,7 @@ SessionRouterI::SessionThread::run() { return; } - + assert(_sessionTimeout > IceUtil::Time()); timedWait(_sessionTimeout / 4); diff --git a/cpp/src/Ice/ServantManager.cpp b/cpp/src/Ice/ServantManager.cpp index b117757824b..e4e50a7375f 100644 --- a/cpp/src/Ice/ServantManager.cpp +++ b/cpp/src/Ice/ServantManager.cpp @@ -24,7 +24,7 @@ void IceInternal::ServantManager::addServant(const ObjectPtr& object, const Identity& ident, const string& facet) { IceUtil::Mutex::Lock sync(*this); - + assert(_instance); // Must not be called after destruction. ServantMapMap::iterator p = _servantMapMapHint; @@ -89,7 +89,7 @@ IceInternal::ServantManager::removeServant(const Identity& ident, const string& ObjectPtr servant = 0; IceUtil::Mutex::Lock sync(*this); - + assert(_instance); // Must not be called after destruction. ServantMapMap::iterator p = _servantMapMapHint; @@ -99,7 +99,7 @@ IceInternal::ServantManager::removeServant(const Identity& ident, const string& { p = _servantMapMap.find(ident); } - + if(p == _servantMapMap.end() || (q = p->second.find(facet)) == p->second.end()) { NotRegisteredException ex(__FILE__, __LINE__); @@ -164,7 +164,7 @@ FacetMap IceInternal::ServantManager::removeAllFacets(const Identity& ident) { IceUtil::Mutex::Lock sync(*this); - + assert(_instance); // Must not be called after destruction. ServantMapMap::iterator p = _servantMapMapHint; @@ -173,7 +173,7 @@ IceInternal::ServantManager::removeAllFacets(const Identity& ident) { p = _servantMapMap.find(ident); } - + if(p == _servantMapMap.end()) { NotRegisteredException ex(__FILE__, __LINE__); @@ -201,7 +201,7 @@ ObjectPtr IceInternal::ServantManager::findServant(const Identity& ident, const string& facet) const { IceUtil::Mutex::Lock sync(*this); - + // // This assert is not valid if the adapter dispatch incoming // requests from bidir connections. This method might be called if @@ -212,14 +212,14 @@ IceInternal::ServantManager::findServant(const Identity& ident, const string& fa ServantMapMap::iterator p = _servantMapMapHint; FacetMap::iterator q; - + ServantMapMap& servantMapMap = const_cast<ServantMapMap&>(_servantMapMap); if(p == servantMapMap.end() || p->first != ident) { p = servantMapMap.find(ident); } - + if(p == servantMapMap.end() || (q = p->second.find(facet)) == p->second.end()) { DefaultServantMap::const_iterator p = _defaultServantMap.find(ident.category); @@ -267,18 +267,18 @@ FacetMap IceInternal::ServantManager::findAllFacets(const Identity& ident) const { IceUtil::Mutex::Lock sync(*this); - + assert(_instance); // Must not be called after destruction. ServantMapMap::iterator p = _servantMapMapHint; - + ServantMapMap& servantMapMap = const_cast<ServantMapMap&>(_servantMapMap); if(p == servantMapMap.end() || p->first != ident) { p = servantMapMap.find(ident); } - + if(p == servantMapMap.end()) { return FacetMap(); @@ -294,7 +294,7 @@ bool IceInternal::ServantManager::hasServant(const Identity& ident) const { IceUtil::Mutex::Lock sync(*this); - + // // This assert is not valid if the adapter dispatch incoming // requests from bidir connections. This method might be called if @@ -310,7 +310,7 @@ IceInternal::ServantManager::hasServant(const Identity& ident) const { p = servantMapMap.find(ident); } - + if(p == servantMapMap.end()) { return false; @@ -338,7 +338,7 @@ IceInternal::ServantManager::addServantLocator(const ServantLocatorPtr& locator, ex.id = category; throw ex; } - + _locatorMapHint = _locatorMap.insert(_locatorMapHint, pair<const string, ServantLocatorPtr>(category, locator)); } @@ -381,7 +381,7 @@ ServantLocatorPtr IceInternal::ServantManager::findServantLocator(const string& category) const { IceUtil::Mutex::Lock sync(*this); - + // // This assert is not valid if the adapter dispatch incoming // requests from bidir connections. This method might be called if @@ -401,12 +401,12 @@ IceInternal::ServantManager::findServantLocator(const string& category) const p = _locatorMapHint; } } - + if(p == locatorMap.end()) { p = locatorMap.find(category); } - + if(p != locatorMap.end()) { _locatorMapHint = p; @@ -445,13 +445,13 @@ IceInternal::ServantManager::destroy() { IceUtil::Mutex::Lock sync(*this); - + assert(_instance); // Must not be called after destruction. - + logger = _instance->initializationData().logger; servantMapMap.swap(_servantMapMap); _servantMapMapHint = _servantMapMap.end(); - + locatorMap.swap(_locatorMap); _locatorMapHint = _locatorMap.end(); _instance = 0; @@ -461,12 +461,12 @@ IceInternal::ServantManager::destroy() { try { - p->second->destroy(p->first); + p->second->deactivate(p->first); } catch(const Exception& ex) { Error out(logger); - out << "exception during locator destruction:\n" + out << "exception during locator deactivation:\n" << "object adapter: `" << _adapterName << "'\n" << "locator category: `" << p->first << "'\n" << ex; @@ -474,7 +474,7 @@ IceInternal::ServantManager::destroy() catch(...) { Error out(logger); - out << "unknown exception during locator destruction:\n" + out << "unknown exception during locator deactivation:\n" << "object adapter: `" << _adapterName << "'\n" << "locator category: `" << p->first << "'"; } @@ -483,7 +483,7 @@ IceInternal::ServantManager::destroy() // // We clear the maps outside the synchronization as we don't want to // hold any internal Ice mutex while running user code (such as servant - // or servant locator destructors). + // or servant locator destructors). // servantMapMap.clear(); locatorMap.clear(); diff --git a/cpp/src/IceGrid/IceGridNode.cpp b/cpp/src/IceGrid/IceGridNode.cpp index b948faadd9f..089f2d49c26 100644 --- a/cpp/src/IceGrid/IceGridNode.cpp +++ b/cpp/src/IceGrid/IceGridNode.cpp @@ -41,14 +41,14 @@ namespace class ProcessI : public Process { public: - + ProcessI(const ActivatorPtr&, const ProcessPtr&); virtual void shutdown(const Current&); virtual void writeMessage(const std::string&, Int, const Current&); - + private: - + ActivatorPtr _activator; ProcessPtr _origProcess; }; @@ -114,7 +114,7 @@ public: { } - virtual void destroy(const string&) + virtual void deactivate(const string&) { } @@ -145,15 +145,15 @@ setNoIndexingAttribute(const string& pa) } #endif -} +} -CollocatedRegistry::CollocatedRegistry(const CommunicatorPtr& com, - const ActivatorPtr& activator, +CollocatedRegistry::CollocatedRegistry(const CommunicatorPtr& com, + const ActivatorPtr& activator, bool nowarn, bool readonly, const string& initFromReplica) : - RegistryI(com, new TraceLevels(com, "IceGrid.Registry"), nowarn, readonly, initFromReplica), + RegistryI(com, new TraceLevels(com, "IceGrid.Registry"), nowarn, readonly, initFromReplica), _activator(activator) { } @@ -164,7 +164,7 @@ CollocatedRegistry::shutdown() _activator->shutdown(); } -ProcessI::ProcessI(const ActivatorPtr& activator, const ProcessPtr& origProcess) : +ProcessI::ProcessI(const ActivatorPtr& activator, const ProcessPtr& origProcess) : _activator(activator), _origProcess(origProcess) { @@ -264,7 +264,7 @@ NodeService::startImpl(int argc, char* argv[], int& status) } initFromReplica = argv[++i]; - } + } else if(strcmp(argv[i], "--deploy") == 0) { if(i + 1 >= argc) @@ -311,7 +311,7 @@ NodeService::startImpl(int argc, char* argv[], int& status) out << "setting `Ice.ThreadPool.Server.Size' is not useful, "; out << "you should set individual adapter thread pools instead."; } - + setupThreadPool(properties, "IceGrid.Node.ThreadPool", 1, 100); // @@ -332,7 +332,7 @@ NodeService::startImpl(int argc, char* argv[], int& status) } communicator()->setDefaultLocator(_registry->getLocator()); - + // // Set the default locator property to point to the collocated // locator (this property is passed by the activator to each @@ -367,7 +367,7 @@ NodeService::startImpl(int argc, char* argv[], int& status) FileException ex(__FILE__, __LINE__); ex.path = dataPath; ex.error = IceInternal::getSystemErrno(); - + ServiceError err(this); err << "property `IceGrid.Node.Data' is set to an invalid path:\n" << ex; return false; @@ -378,7 +378,7 @@ NodeService::startImpl(int argc, char* argv[], int& status) // if(dataPath[dataPath.length() - 1] != '/') { - dataPath += "/"; + dataPath += "/"; } IcePatch2::createDirectory(dataPath + "servers"); @@ -507,7 +507,7 @@ NodeService::startImpl(int argc, char* argv[], int& status) _node = new NodeI(_adapter, *_sessions, _activator, _timer, traceLevels, nodeProxy, name, mapper, instanceName); _adapter->add(_node, nodeProxy->ice_getIdentity()); - _adapter->addServantLocator(new DefaultServantLocator(new NodeServerAdminRouter(_node)), + _adapter->addServantLocator(new DefaultServantLocator(new NodeServerAdminRouter(_node)), _node->getServerAdminCategory()); // @@ -517,7 +517,7 @@ NodeService::startImpl(int argc, char* argv[], int& status) // // Ensures that the locator is reachable. - // + // if(!nowarn) { try @@ -557,7 +557,7 @@ NodeService::startImpl(int argc, char* argv[], int& status) // // Some plug-in removed the Process facet, so we don't replace it. // (unlikely error though) - // + // } } @@ -602,15 +602,15 @@ NodeService::startImpl(int argc, char* argv[], int& status) Ice::Identity regId; regId.category = instanceName; regId.name = "Registry"; - + RegistryPrx registry = RegistryPrx::checkedCast(communicator()->getDefaultLocator()->findObjectById(regId)); if(!registry) { throw "invalid registry"; } - + registry = registry->ice_preferSecure(true); // Use SSL if available. - + IceGrid::AdminSessionPrx session; if(communicator()->getProperties()->getPropertyAsInt("IceGridAdmin.AuthenticateUsingSSL")) { @@ -626,14 +626,14 @@ NodeService::startImpl(int argc, char* argv[], int& status) getline(cin, id); id = IceUtilInternal::trim(id); } - + if(password.empty()) { cout << "password: " << flush; getline(cin, password); password = IceUtilInternal::trim(password); } - + session = registry->createAdminSession(id, password); } assert(session); @@ -659,7 +659,7 @@ NodeService::startImpl(int argc, char* argv[], int& status) catch(const AccessDeniedException& ex) { ServiceWarning warn(this); - warn << "failed to deploy application `" << desc << "':\n" + warn << "failed to deploy application `" << desc << "':\n" << "registry database is locked by `" << ex.lockUserId << "'"; } catch(const std::exception& ex) @@ -797,7 +797,7 @@ NodeService::stop() } CommunicatorPtr -NodeService::initializeCommunicator(int& argc, char* argv[], +NodeService::initializeCommunicator(int& argc, char* argv[], const InitializationData& initializationData) { InitializationData initData = initializationData; diff --git a/cpp/src/IceGrid/RegistryI.cpp b/cpp/src/IceGrid/RegistryI.cpp index 92bd4dafee8..3db65ada913 100644 --- a/cpp/src/IceGrid/RegistryI.cpp +++ b/cpp/src/IceGrid/RegistryI.cpp @@ -89,7 +89,7 @@ public: { } - virtual void destroy(const string&) + virtual void deactivate(const string&) { } @@ -100,12 +100,12 @@ private: class LookupI : public IceGrid::Lookup { public: - - LookupI(const std::string& instanceName, const WellKnownObjectsManagerPtr& wellKnownObjects) : + + LookupI(const std::string& instanceName, const WellKnownObjectsManagerPtr& wellKnownObjects) : _instanceName(instanceName), _wellKnownObjects(wellKnownObjects) { } - + virtual void findLocator(const string& instanceName, const LookupReplyPrx& reply, const Ice::Current&) { @@ -135,11 +135,11 @@ private: class FinderI : public Ice::LocatorFinder { public: - + FinderI(const WellKnownObjectsManagerPtr& wellKnownObjects) : _wellKnownObjects(wellKnownObjects) { } - + virtual Ice::LocatorPrx getLocator(const Ice::Current&) { @@ -157,7 +157,7 @@ RegistryI::RegistryI(const CommunicatorPtr& communicator, const TraceLevelsPtr& traceLevels, bool nowarn, bool readonly, - const string& initFromReplica) : + const string& initFromReplica) : _communicator(communicator), _traceLevels(traceLevels), _nowarn(nowarn), @@ -268,7 +268,7 @@ RegistryI::startImpl() { Error out(_communicator->getLogger()); out << "invalid --initdb-from-replica option: identical replica"; - return false; + return false; } if(_sessionTimeout > 0 && properties->getProperty("IceGrid.Registry.Client.ACM.Timemout").empty()) @@ -293,7 +293,7 @@ RegistryI::startImpl() } properties->setProperty("Ice.ACM.Server.Close", "3"); // Close on invocation and idle. - + if(!_master && !_communicator->getDefaultLocator()) { Error out(_communicator->getLogger()); @@ -308,7 +308,7 @@ RegistryI::startImpl() // // Get the instance name // - _instanceName = properties->getProperty("IceGrid.InstanceName"); + _instanceName = properties->getProperty("IceGrid.InstanceName"); if(_instanceName.empty()) { _instanceName = properties->getProperty("IceGridDiscovery.InstanceName"); @@ -352,7 +352,7 @@ RegistryI::startImpl() _communicator->getProperties()->setProperty("Freeze.DbEnv.Registry.DbHome", dbPath); const string envName = "Registry"; Freeze::ConnectionPtr connection = Freeze::createConnection(_communicator, envName); - + // // Ensure that nothing is running on this port. This is also // useful to ensure that we don't run twice the same instance of @@ -391,15 +391,15 @@ RegistryI::startImpl() Identity registryTopicManagerId; registryTopicManagerId.category = _instanceName; registryTopicManagerId.name = "RegistryTopicManager"; - _iceStorm = IceStormInternal::Service::create(_communicator, - _registryAdapter, - _registryAdapter, - "IceGrid.Registry", + _iceStorm = IceStormInternal::Service::create(_communicator, + _registryAdapter, + _registryAdapter, + "IceGrid.Registry", registryTopicManagerId, envName); const IceStorm::TopicManagerPrx topicManager = _iceStorm->getTopicManager(); - _database = new Database(_registryAdapter, topicManager, _instanceName, _traceLevels, getInfo(), connection, + _database = new Database(_registryAdapter, topicManager, _instanceName, _traceLevels, getInfo(), connection, "Registry", _readonly); _wellKnownObjects = new WellKnownObjectsManager(_database); @@ -536,19 +536,19 @@ RegistryI::startImpl() // // Create the session servant manager. The session servant manager is responsible - // for managing sessions servants and to ensure that session servants are only + // for managing sessions servants and to ensure that session servants are only // accessed by the connection that created the session. The session servant manager // also takes care of providing the router servant for server admin objects. // ObjectPtr serverAdminRouter = new RegistryServerAdminRouter(_database); AdminCallbackRouterPtr adminCallbackRouter = new AdminCallbackRouter; - _servantManager = new SessionServantManager(_clientAdapter, _instanceName, true, getServerAdminCategory(), + _servantManager = new SessionServantManager(_clientAdapter, _instanceName, true, getServerAdminCategory(), serverAdminRouter, adminCallbackRouter); _clientAdapter->addServantLocator(_servantManager, ""); _serverAdapter->addServantLocator(new DefaultServantLocator(adminCallbackRouter), ""); - + ObjectAdapterPtr sessionAdpt = setupClientSessionFactory(internalLocator); ObjectAdapterPtr admSessionAdpt = setupAdminSessionFactory(serverAdminRouter, internalLocator); @@ -614,7 +614,7 @@ RegistryI::startImpl() } } } - + // // We are ready to go! // @@ -624,7 +624,7 @@ RegistryI::startImpl() { discoveryAdapter->activate(); } - + if(sessionAdpt) { sessionAdpt->activate(); @@ -662,7 +662,7 @@ RegistryI::setupLocator(const Ice::LocatorRegistryPrx& locatorRegistry, locatorId.name = "Locator-" + _replicaName; _clientAdapter->add(locator, locatorId); - + return LocatorPrx::uncheckedCast(_registryAdapter->addWithUUID(locator)); } @@ -838,7 +838,7 @@ RegistryI::setupAdminSessionFactory(const Ice::ObjectPtr& router, const IceGrid: adapter->add(new AdminSessionManagerI(_adminSessionFactory), sessionMgrId); adapter->add(new AdminSSLSessionManagerI(_adminSessionFactory), sslSessionMgrId); - + _wellKnownObjects->add(adapter->createProxy(sessionMgrId), Glacier2::SessionManager::ice_staticId()); _wellKnownObjects->add(adapter->createProxy(sslSessionMgrId), Glacier2::SSLSessionManager::ice_staticId()); } @@ -886,7 +886,7 @@ RegistryI::stop() { Warning out(_communicator->getLogger()); out << "unexpected exception while shutting down registry communicator:\n" << ex; - } + } if(_reaper) { @@ -1029,7 +1029,7 @@ RegistryI::createAdminSession(const string& user, const string& password, const AdminSessionIPtr session = _adminSessionFactory->createSessionServant(user); Ice::ObjectPrx proxy = session->_register(_servantManager, current.con); _reaper->add(new SessionReapable<AdminSessionI>(_traceLevels->logger, session), _sessionTimeout); - return AdminSessionPrx::uncheckedCast(proxy); + return AdminSessionPrx::uncheckedCast(proxy); } SessionPrx @@ -1041,7 +1041,7 @@ RegistryI::createSessionFromSecureConnection(const Current& current) ex.reason = "client session creation is only allowed with the master registry."; throw ex; } - + assert(_reaper && _clientSessionFactory); if(!_sslClientVerifier) @@ -1141,7 +1141,7 @@ RegistryI::createAdminSessionFromSecureConnection(const Current& current) exc.reason = "internal server error"; throw exc; } - + // // We let the connection access the administrative interface. // @@ -1189,13 +1189,13 @@ RegistryI::shutdown() _clientAdapter->deactivate(); } -Ice::ObjectPrx +Ice::ObjectPrx RegistryI::createAdminCallbackProxy(const Identity& id) const { return _serverAdapter->createProxy(id); } -Ice::LocatorPrx +Ice::LocatorPrx RegistryI::getLocator() { return _wellKnownObjects->getLocator(); @@ -1259,7 +1259,7 @@ RegistryI::getPermissionsVerifier(const IceGrid::LocatorPrx& locator, { try { - Glacier2::CryptPermissionsVerifierPluginPtr plugin = + Glacier2::CryptPermissionsVerifierPluginPtr plugin = Glacier2::CryptPermissionsVerifierPluginPtr::dynamicCast( _communicator->getPluginManager()->getPlugin("CryptPermissionsVerifier")); verifier = _registryAdapter->addWithUUID(plugin->create(passwordsProperty)); @@ -1293,7 +1293,7 @@ RegistryI::getPermissionsVerifier(const IceGrid::LocatorPrx& locator, Error out(_communicator->getLogger()); out << "permissions verifier `" + verifierProperty + "' is invalid"; return 0; - } + } } catch(const LocalException& ex) { @@ -1377,14 +1377,14 @@ RegistryI::getSSLPermissionsVerifier(const IceGrid::LocatorPrx& locator, const s Error out(_communicator->getLogger()); out << "ssl permissions verifier `" + verifierProperty + "' is invalid"; return 0; - } + } } catch(const LocalException& ex) { if(!_nowarn) { Warning out(_communicator->getLogger()); - out << "couldn't contact ssl permissions verifier `" + verifierProperty + "':\n" << ex; + out << "couldn't contact ssl permissions verifier `" + verifierProperty + "':\n" << ex; } verifierPrx = Glacier2::SSLPermissionsVerifierPrx::uncheckedCast(verifier->ice_locator(locator)); } @@ -1465,20 +1465,20 @@ RegistryI::registerReplicas(const InternalRegistryPrx& internalRegistry, const N continue; // Ignore the master registry proxy. } id.name = "InternalRegistry-" + id.name.substr(prefix.size()); - + Ice::ObjectPrx prx = (*p)->ice_identity(id)->ice_endpoints(Ice::EndpointSeq()); id.name = "Locator"; prx = prx->ice_locator(Ice::LocatorPrx::uncheckedCast((*p)->ice_identity(id))); for(map<InternalRegistryPrx, RegistryPrx>::iterator q = replicas.begin(); q != replicas.end(); ++q) { - if(q->first->ice_getIdentity() == prx->ice_getIdentity()) + if(q->first->ice_getIdentity() == prx->ice_getIdentity()) { replicas.erase(q); break; } } - replicas.insert(pair<InternalRegistryPrx, RegistryPrx>(InternalRegistryPrx::uncheckedCast(prx), + replicas.insert(pair<InternalRegistryPrx, RegistryPrx>(InternalRegistryPrx::uncheckedCast(prx), RegistryPrx::uncheckedCast(*p))); } @@ -1507,16 +1507,16 @@ RegistryI::registerReplicas(const InternalRegistryPrx& internalRegistry, const N { replicaName = replicaName.substr(prefix.size()); } - + Ice::Trace out(_traceLevels->logger, _traceLevels->replicaCat); out << "creating replica `" << replicaName << "' session"; } - + try { replica->end_registerWithReplica(*p); - + NodePrxSeq nds = replica->getNodes(); nodes.insert(nds.begin(), nds.end()); @@ -1535,7 +1535,7 @@ RegistryI::registerReplicas(const InternalRegistryPrx& internalRegistry, const N RegistryPrx registry; for(map<InternalRegistryPrx, RegistryPrx>::const_iterator q = replicas.begin(); q != replicas.end(); ++q) { - if(q->first->ice_getIdentity() == replica->ice_getIdentity()) + if(q->first->ice_getIdentity() == replica->ice_getIdentity()) { registry = q->second; break; @@ -1568,7 +1568,7 @@ RegistryI::registerReplicas(const InternalRegistryPrx& internalRegistry, const N } } } - + NodePrxSeq result; for(set<NodePrx>::iterator p = nodes.begin(); p != nodes.end(); ++p) { diff --git a/cpp/src/IceGrid/SessionServantManager.cpp b/cpp/src/IceGrid/SessionServantManager.cpp index 9138de674bd..6f85ff9ccff 100644 --- a/cpp/src/IceGrid/SessionServantManager.cpp +++ b/cpp/src/IceGrid/SessionServantManager.cpp @@ -16,12 +16,12 @@ using namespace std; using namespace IceGrid; -SessionServantManager::SessionServantManager(const Ice::ObjectAdapterPtr& adapter, +SessionServantManager::SessionServantManager(const Ice::ObjectAdapterPtr& adapter, const string& instanceName, bool checkConnection, const string& serverAdminCategory, const Ice::ObjectPtr& serverAdminRouter, - const AdminCallbackRouterPtr& adminCallbackRouter) : + const AdminCallbackRouterPtr& adminCallbackRouter) : _adapter(adapter), _instanceName(instanceName), _checkConnection(checkConnection), @@ -63,7 +63,7 @@ SessionServantManager::finished(const Ice::Current&, const Ice::ObjectPtr&, cons } void -SessionServantManager::destroy(const std::string&) +SessionServantManager::deactivate(const std::string&) { Lock sync(*this); assert(_servants.empty()); @@ -95,7 +95,7 @@ SessionServantManager::addSession(const Ice::ObjectPtr& session, const Ice::Conn void SessionServantManager::setSessionControl(const Ice::ObjectPtr& session, - const Glacier2::SessionControlPrx& ctl, + const Glacier2::SessionControlPrx& ctl, const Ice::IdentitySeq& ids) { Lock sync(*this); @@ -116,7 +116,7 @@ SessionServantManager::setSessionControl(const Ice::ObjectPtr& session, // // Allow invocations on server admin objects. // - if(!p->second.category.empty() && _serverAdminRouter) + if(!p->second.category.empty() && _serverAdminRouter) { Ice::StringSeq seq; seq.push_back(_serverAdminCategory); @@ -211,7 +211,7 @@ SessionServantManager::remove(const Ice::Identity& id) assert(p != _servants.end()); // - // Find the session associated to the servant and remove the servant identity from the + // Find the session associated to the servant and remove the servant identity from the // session identities. // map<Ice::ObjectPtr, SessionInfo>::iterator q = _sessions.find(p->second.session); diff --git a/cpp/src/IceGrid/SessionServantManager.h b/cpp/src/IceGrid/SessionServantManager.h index c6dfef8c06e..814371e64a5 100644 --- a/cpp/src/IceGrid/SessionServantManager.h +++ b/cpp/src/IceGrid/SessionServantManager.h @@ -30,7 +30,7 @@ public: Ice::ObjectPtr locate(const Ice::Current&, Ice::LocalObjectPtr&); void finished(const Ice::Current&, const Ice::ObjectPtr&, const Ice::LocalObjectPtr&); - void destroy(const std::string&); + void deactivate(const std::string&); Ice::ObjectPrx addSession(const Ice::ObjectPtr&, const Ice::ConnectionPtr&, const std::string&); void setSessionControl(const Ice::ObjectPtr&, const Glacier2::SessionControlPrx&, const Ice::IdentitySeq&); @@ -79,7 +79,7 @@ private: std::map<Ice::Identity, ServantInfo> _servants; std::map<Ice::ObjectPtr, SessionInfo> _sessions; std::multiset<Ice::ConnectionPtr> _adminConnections; - + }; typedef IceUtil::Handle<SessionServantManager> SessionServantManagerPtr; diff --git a/cpp/test/FreezeScript/evictor/makedb.cpp b/cpp/test/FreezeScript/evictor/makedb.cpp index 3454dce9d38..1672ab92376 100644 --- a/cpp/test/FreezeScript/evictor/makedb.cpp +++ b/cpp/test/FreezeScript/evictor/makedb.cpp @@ -123,7 +123,7 @@ run(const Ice::CommunicatorPtr& communicator, const string& envName, const strin } } - evictor->destroy(""); + evictor->deactivate(""); return EXIT_SUCCESS; } diff --git a/cpp/test/Glacier2/attack/Server.cpp b/cpp/test/Glacier2/attack/Server.cpp index b790f0d8342..1a2a808cfdd 100644 --- a/cpp/test/Glacier2/attack/Server.cpp +++ b/cpp/test/Glacier2/attack/Server.cpp @@ -32,7 +32,7 @@ public: { } - virtual void destroy(const string&) + virtual void deactivate(const string&) { } diff --git a/cpp/test/Glacier2/dynamicFiltering/Server.cpp b/cpp/test/Glacier2/dynamicFiltering/Server.cpp index ab7bc99e29a..15305e63c4d 100644 --- a/cpp/test/Glacier2/dynamicFiltering/Server.cpp +++ b/cpp/test/Glacier2/dynamicFiltering/Server.cpp @@ -102,7 +102,7 @@ public: { } - virtual void destroy(const string&) + virtual void deactivate(const string&) { } diff --git a/cpp/test/Glacier2/staticFiltering/Server.cpp b/cpp/test/Glacier2/staticFiltering/Server.cpp index 2fb936163e3..eac8a97de56 100644 --- a/cpp/test/Glacier2/staticFiltering/Server.cpp +++ b/cpp/test/Glacier2/staticFiltering/Server.cpp @@ -100,7 +100,7 @@ public: { } - virtual void destroy(const string&) + virtual void deactivate(const string&) { } diff --git a/cpp/test/Ice/adapterDeactivation/ServantLocatorI.cpp b/cpp/test/Ice/adapterDeactivation/ServantLocatorI.cpp index e91078ed97b..b19b0fb5407 100644 --- a/cpp/test/Ice/adapterDeactivation/ServantLocatorI.cpp +++ b/cpp/test/Ice/adapterDeactivation/ServantLocatorI.cpp @@ -16,19 +16,19 @@ using namespace Ice; using namespace Test; ServantLocatorI::ServantLocatorI() : - _destroyed(false) + _deactivated(false) { } ServantLocatorI::~ServantLocatorI() { - test(_destroyed); + test(_deactivated); } Ice::ObjectPtr ServantLocatorI::locate(const Ice::Current& current, Ice::LocalObjectPtr& cookie) { - test(!_destroyed); + test(!_deactivated); test(current.id.category == ""); test(current.id.name == "test"); @@ -42,7 +42,7 @@ void ServantLocatorI::finished(const Ice::Current&, const Ice::ObjectPtr&, const Ice::LocalObjectPtr& cookie) { - test(!_destroyed); + test(!_deactivated); CookiePtr co = CookiePtr::dynamicCast(cookie); test(co); @@ -50,9 +50,9 @@ ServantLocatorI::finished(const Ice::Current&, const Ice::ObjectPtr&, } void -ServantLocatorI::destroy(const string&) +ServantLocatorI::deactivate(const string&) { - test(!_destroyed); + test(!_deactivated); - _destroyed = true; + _deactivated = true; } diff --git a/cpp/test/Ice/adapterDeactivation/ServantLocatorI.h b/cpp/test/Ice/adapterDeactivation/ServantLocatorI.h index 03c5c75e504..d30a8258f44 100644 --- a/cpp/test/Ice/adapterDeactivation/ServantLocatorI.h +++ b/cpp/test/Ice/adapterDeactivation/ServantLocatorI.h @@ -21,11 +21,11 @@ public: virtual Ice::ObjectPtr locate(const Ice::Current&, Ice::LocalObjectPtr&); virtual void finished(const Ice::Current&, const Ice::ObjectPtr&, const Ice::LocalObjectPtr&); - virtual void destroy(const std::string&); + virtual void deactivate(const std::string&); public: - bool _destroyed; + bool _deactivated; }; #endif diff --git a/cpp/test/Ice/exceptions/AllTests.cpp b/cpp/test/Ice/exceptions/AllTests.cpp index 6bca0e00a76..81a093f5c2c 100644 --- a/cpp/test/Ice/exceptions/AllTests.cpp +++ b/cpp/test/Ice/exceptions/AllTests.cpp @@ -24,7 +24,7 @@ public: virtual Ice::ObjectPtr locate(const Ice::Current&, Ice::LocalObjectPtr&) { return 0; } virtual void finished(const Ice::Current&, const Ice::ObjectPtr&, const Ice::LocalObjectPtr&) {} - virtual void destroy(const string&) {} + virtual void deactivate(const string&) {} }; class ObjectFactoryI : virtual public Ice::ObjectFactory diff --git a/cpp/test/Ice/invoke/Server.cpp b/cpp/test/Ice/invoke/Server.cpp index 26101751a08..2b0253b887b 100644 --- a/cpp/test/Ice/invoke/Server.cpp +++ b/cpp/test/Ice/invoke/Server.cpp @@ -58,7 +58,7 @@ public: } virtual void - destroy(const string&) + deactivate(const string&) { } diff --git a/cpp/test/Ice/servantLocator/Collocated.cpp b/cpp/test/Ice/servantLocator/Collocated.cpp index 1801cbd6b6e..338bdd76aaa 100644 --- a/cpp/test/Ice/servantLocator/Collocated.cpp +++ b/cpp/test/Ice/servantLocator/Collocated.cpp @@ -64,9 +64,9 @@ public: else { ServantLocatorPtr locator = current.adapter->removeServantLocator(""); - locator->destroy(""); + locator->deactivate(""); locator = current.adapter->removeServantLocator("category"); - locator->destroy("category"); + locator->deactivate("category"); } } }; diff --git a/cpp/test/Ice/servantLocator/ServantLocatorI.cpp b/cpp/test/Ice/servantLocator/ServantLocatorI.cpp index a53a3e67ba8..d550e004d04 100644 --- a/cpp/test/Ice/servantLocator/ServantLocatorI.cpp +++ b/cpp/test/Ice/servantLocator/ServantLocatorI.cpp @@ -19,20 +19,20 @@ using namespace Test; ServantLocatorI::ServantLocatorI(const string& category) : _category(category), - _destroyed(false), + _deactivated(false), _requestId(-1) { } ServantLocatorI::~ServantLocatorI() { - test(_destroyed); + test(_deactivated); } Ice::ObjectPtr ServantLocatorI::locate(const Ice::Current& current, Ice::LocalObjectPtr& cookie) { - test(!_destroyed); + test(!_deactivated); test(current.id.category == _category || _category.empty()); if(current.id.name == "unknown") @@ -59,7 +59,7 @@ void ServantLocatorI::finished(const Ice::Current& current, const Ice::ObjectPtr&, const Ice::LocalObjectPtr& cookie) { - test(!_destroyed); + test(!_deactivated); // // Ensure finished() is only called once per request. @@ -79,11 +79,11 @@ ServantLocatorI::finished(const Ice::Current& current, const Ice::ObjectPtr&, } void -ServantLocatorI::destroy(const string&) +ServantLocatorI::deactivate(const string&) { - test(!_destroyed); + test(!_deactivated); - _destroyed = true; + _deactivated = true; } void diff --git a/cpp/test/Ice/servantLocator/ServantLocatorI.h b/cpp/test/Ice/servantLocator/ServantLocatorI.h index fc22de0f93b..44a65ec39f2 100644 --- a/cpp/test/Ice/servantLocator/ServantLocatorI.h +++ b/cpp/test/Ice/servantLocator/ServantLocatorI.h @@ -24,7 +24,7 @@ public: virtual Ice::ObjectPtr locate(const Ice::Current&, Ice::LocalObjectPtr&); virtual void finished(const Ice::Current&, const Ice::ObjectPtr&, const Ice::LocalObjectPtr&); - virtual void destroy(const std::string&); + virtual void deactivate(const std::string&); protected: @@ -37,7 +37,7 @@ private: void exception(const Ice::Current&); const std::string _category; - bool _destroyed; + bool _deactivated; Ice::Int _requestId; }; diff --git a/cpp/test/Ice/servantLocator/Server.cpp b/cpp/test/Ice/servantLocator/Server.cpp index 648f10e1eef..7ee82c4d8e5 100644 --- a/cpp/test/Ice/servantLocator/Server.cpp +++ b/cpp/test/Ice/servantLocator/Server.cpp @@ -63,9 +63,9 @@ public: else { ServantLocatorPtr locator = current.adapter->removeServantLocator(""); - locator->destroy(""); + locator->deactivate(""); locator = current.adapter->removeServantLocator("category"); - locator->destroy("category"); + locator->deactivate("category"); } } }; diff --git a/cpp/test/Ice/servantLocator/ServerAMD.cpp b/cpp/test/Ice/servantLocator/ServerAMD.cpp index 0860dcaa8b6..a7d3a3984df 100644 --- a/cpp/test/Ice/servantLocator/ServerAMD.cpp +++ b/cpp/test/Ice/servantLocator/ServerAMD.cpp @@ -63,9 +63,9 @@ public: else { ServantLocatorPtr locator = current.adapter->removeServantLocator(""); - locator->destroy(""); + locator->deactivate(""); locator = current.adapter->removeServantLocator("category"); - locator->destroy("category"); + locator->deactivate("category"); } } }; |