From 183c7a004d0a62ddecd9eeb0bc459846d98a7614 Mon Sep 17 00:00:00 2001 From: Benoit Foucher Date: Fri, 23 Nov 2007 11:25:31 +0100 Subject: Refactored IceGrid session servant management --- cpp/src/IceGrid/AllocatableObjectCache.cpp | 64 ++++++++++++++---------------- 1 file changed, 29 insertions(+), 35 deletions(-) (limited to 'cpp/src/IceGrid/AllocatableObjectCache.cpp') diff --git a/cpp/src/IceGrid/AllocatableObjectCache.cpp b/cpp/src/IceGrid/AllocatableObjectCache.cpp index e8308ae4e8e..37db16d0a96 100644 --- a/cpp/src/IceGrid/AllocatableObjectCache.cpp +++ b/cpp/src/IceGrid/AllocatableObjectCache.cpp @@ -295,27 +295,24 @@ AllocatableObjectEntry::allocated(const SessionIPtr& session) << ")"; } - if(session->useFilters()) + Glacier2::IdentitySetPrx identities = session->getGlacier2IdentitySet(); + if(identities) { - Glacier2::SessionControlPrx ctl = session->getSessionControl(); - if(ctl) + try { - try - { - Ice::IdentitySeq seq(1); - seq.push_back(_info.proxy->ice_getIdentity()); - ctl->identities()->add(seq); - } - catch(const Ice::LocalException& ex) + Ice::IdentitySeq seq(1); + seq.push_back(_info.proxy->ice_getIdentity()); + identities->add(seq); + } + catch(const Ice::LocalException& ex) + { + if(traceLevels && traceLevels->object > 0) { - if(traceLevels && traceLevels->object > 0) - { - Ice::Trace out(traceLevels->logger, traceLevels->objectCat); - out << "couldn't add Glacier2 filter for object `" << _info.proxy->ice_toString(); - out << "' allocated by `" << session->getId() << "':\n" << ex; - } - } - } + Ice::Trace out(traceLevels->logger, traceLevels->objectCat); + out << "couldn't add Glacier2 filter for object `" << _info.proxy->ice_toString(); + out << "' allocated by `" << session->getId() << "':\n" << ex; + } + } } } @@ -329,26 +326,23 @@ AllocatableObjectEntry::released(const SessionIPtr& session) TraceLevelsPtr traceLevels = _cache.getTraceLevels(); - if(session->useFilters()) + Glacier2::IdentitySetPrx identities = session->getGlacier2IdentitySet(); + if(identities) { - Glacier2::SessionControlPrx ctl = session->getSessionControl(); - if(ctl) + try { - try - { - Ice::IdentitySeq seq(1); - seq.push_back(_info.proxy->ice_getIdentity()); - ctl->identities()->remove(seq); - } - catch(const Ice::LocalException& ex) + Ice::IdentitySeq seq(1); + seq.push_back(_info.proxy->ice_getIdentity()); + identities->remove(seq); + } + catch(const Ice::LocalException& ex) + { + if(traceLevels && traceLevels->object > 0) { - if(traceLevels && traceLevels->object > 0) - { - Ice::Trace out(traceLevels->logger, traceLevels->objectCat); - out << "couldn't remove Glacier2 filter for object `" << _info.proxy->ice_toString(); - out << "' allocated by `" << session->getId() << "':\n" << ex; - } - } + Ice::Trace out(traceLevels->logger, traceLevels->objectCat); + out << "couldn't remove Glacier2 filter for object `" << _info.proxy->ice_toString(); + out << "' allocated by `" << session->getId() << "':\n" << ex; + } } } -- cgit v1.2.3