diff options
Diffstat (limited to 'cpp/src/IceGrid/Database.cpp')
-rw-r--r-- | cpp/src/IceGrid/Database.cpp | 43 |
1 files changed, 42 insertions, 1 deletions
diff --git a/cpp/src/IceGrid/Database.cpp b/cpp/src/IceGrid/Database.cpp index f0b9dcb3dfe..a81250ce712 100644 --- a/cpp/src/IceGrid/Database.cpp +++ b/cpp/src/IceGrid/Database.cpp @@ -950,12 +950,53 @@ Database::updateObject(const Ice::ObjectPrx& proxy) } } +void +Database::allocateObject(const Ice::Identity& id, const ObjectAllocationRequestPtr& request, bool allocateOnce) +{ + try + { + _objectCache.get(id)->allocate(request, allocateOnce); + return; + } + catch(ObjectNotRegisteredException&) + { + } + + Freeze::ConnectionPtr connection = Freeze::createConnection(_communicator, _envName); + IdentityObjectInfoDict objects(connection, _objectDbName); + IdentityObjectInfoDict::const_iterator p = objects.find(id); + if(p == objects.end()) + { + ObjectNotRegisteredException ex; + ex.id = id; + throw ex; + } + request->response(p->second.proxy); +} + +void +Database::releaseObject(const Ice::Identity& id, const SessionIPtr& session) +{ + try + { + _objectCache.get(id)->release(session); + return; + } + catch(ObjectNotRegisteredException&) + { + } +} + Ice::ObjectPrx Database::getObjectProxy(const Ice::Identity& id) { try { - return _objectCache.get(id)->getProxy(); + // + // Only return proxies for non allocatable objects. + // + ObjectEntryPtr entry = _objectCache.get(id); + return entry->allocatable() ? Ice::ObjectPrx() : entry->getProxy(); } catch(ObjectNotRegisteredException&) { |