diff options
author | Benoit Foucher <benoit@zeroc.com> | 2005-09-06 08:14:14 +0000 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2005-09-06 08:14:14 +0000 |
commit | f5be93b85788a110f1c6c6edf2550bba1a74f585 (patch) | |
tree | 57183bda04d4b974b4ac3e4152a93ae010f45b6f /cpp/src | |
parent | http://bugzilla.zeroc.com/bugzilla/show_bug.cgi?id=448 (diff) | |
download | ice-f5be93b85788a110f1c6c6edf2550bba1a74f585.tar.bz2 ice-f5be93b85788a110f1c6c6edf2550bba1a74f585.tar.xz ice-f5be93b85788a110f1c6c6edf2550bba1a74f585.zip |
startUpdate doesn't throw CacheOutOfDate anymore but instead return the
current serial.
Diffstat (limited to 'cpp/src')
-rw-r--r-- | cpp/src/IceGrid/Database.cpp | 13 | ||||
-rw-r--r-- | cpp/src/IceGrid/Database.h | 2 | ||||
-rw-r--r-- | cpp/src/IceGrid/ObserverSessionI.cpp | 17 | ||||
-rw-r--r-- | cpp/src/IceGrid/ObserverSessionI.h | 2 |
4 files changed, 16 insertions, 18 deletions
diff --git a/cpp/src/IceGrid/Database.cpp b/cpp/src/IceGrid/Database.cpp index 88b6f2fb9ea..9e05c898c84 100644 --- a/cpp/src/IceGrid/Database.cpp +++ b/cpp/src/IceGrid/Database.cpp @@ -209,25 +209,22 @@ Database::checkSessionLock(ObserverSessionI* session) { if(_lock != 0 && session != _lock) { - AccessDenied ex; + AccessDeniedException ex; ex.lockUserId = _lockUserId; throw ex; } } -void -Database::lock(int serial, ObserverSessionI* session, const string& userId) +int +Database::lock(ObserverSessionI* session, const string& userId) { Lock sync(*this); checkSessionLock(session); - if(serial != _serial) - { - throw CacheOutOfDate(); - } - _lock = session; _lockUserId = userId; + + return _serial; } void diff --git a/cpp/src/IceGrid/Database.h b/cpp/src/IceGrid/Database.h index 0ac7bcc6358..588b4cf1e2c 100644 --- a/cpp/src/IceGrid/Database.h +++ b/cpp/src/IceGrid/Database.h @@ -49,7 +49,7 @@ public: void setObservers(const RegistryObserverPrx&, const NodeObserverPrx&); - void lock(int serial, ObserverSessionI*, const std::string&); + int lock(ObserverSessionI*, const std::string&); void unlock(ObserverSessionI*); void addApplicationDescriptor(ObserverSessionI*, const ApplicationDescriptor&); diff --git a/cpp/src/IceGrid/ObserverSessionI.cpp b/cpp/src/IceGrid/ObserverSessionI.cpp index 98b16e032a8..df59d636a8d 100644 --- a/cpp/src/IceGrid/ObserverSessionI.cpp +++ b/cpp/src/IceGrid/ObserverSessionI.cpp @@ -73,8 +73,8 @@ ObserverSessionI::setObserversByIdentity(const Ice::Identity& registryObserver, _nodeObserverTopic.subscribe(_nodeObserver); } -void -ObserverSessionI::startUpdate(int serial, const Ice::Current& current) +int +ObserverSessionI::startUpdate(const Ice::Current& current) { Lock sync(*this); if(_destroyed) @@ -84,8 +84,9 @@ ObserverSessionI::startUpdate(int serial, const Ice::Current& current) throw ex; } - _database->lock(serial, this, _userId); + int serial = _database->lock(this, _userId); _updating = true; + return serial; } void @@ -101,7 +102,7 @@ ObserverSessionI::addApplication(const ApplicationDescriptor& app, const Ice::Cu if(!_updating) { - throw AccessDenied(); + throw AccessDeniedException(); } _database->addApplicationDescriptor(this, app); } @@ -119,7 +120,7 @@ ObserverSessionI::updateApplication(const ApplicationUpdateDescriptor& update, c if(!_updating) { - throw AccessDenied(); + throw AccessDeniedException(); } _database->updateApplicationDescriptor(this, update); } @@ -137,7 +138,7 @@ ObserverSessionI::syncApplication(const ApplicationDescriptor& app, const Ice::C if(!_updating) { - throw AccessDenied(); + throw AccessDeniedException(); } _database->syncApplicationDescriptor(this, app); } @@ -155,7 +156,7 @@ ObserverSessionI::removeApplication(const string& name, const Ice::Current& curr if(!_updating) { - throw AccessDenied(); + throw AccessDeniedException(); } _database->removeApplicationDescriptor(this, name); } @@ -173,7 +174,7 @@ ObserverSessionI::finishUpdate(const Ice::Current& current) if(!_updating) { - throw AccessDenied(); + throw AccessDeniedException(); } _database->unlock(this); _updating = false; diff --git a/cpp/src/IceGrid/ObserverSessionI.h b/cpp/src/IceGrid/ObserverSessionI.h index bb3943a30f9..5509e74f3d1 100644 --- a/cpp/src/IceGrid/ObserverSessionI.h +++ b/cpp/src/IceGrid/ObserverSessionI.h @@ -31,7 +31,7 @@ public: virtual void setObservers(const RegistryObserverPrx&, const NodeObserverPrx&, const Ice::Current&); virtual void setObserversByIdentity(const Ice::Identity&, const Ice::Identity&, const Ice::Current&); - virtual void startUpdate(int, const Ice::Current&); + virtual int startUpdate(const Ice::Current&); virtual void addApplication(const ApplicationDescriptor&, const Ice::Current&); virtual void syncApplication(const ApplicationDescriptor&, const Ice::Current&); virtual void updateApplication(const ApplicationUpdateDescriptor&, const Ice::Current&); |