diff options
author | Benoit Foucher <benoit@zeroc.com> | 2006-05-30 14:40:22 +0000 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2006-05-30 14:40:22 +0000 |
commit | 3bb83324d1004564bcc6e1a56e4bc937f28b6524 (patch) | |
tree | 4c568a7c2076b11c870dbcf261946d71bf3a0e7d /cpp/src/IceGrid/ServerI.cpp | |
parent | Fixed bug 967 (diff) | |
download | ice-3bb83324d1004564bcc6e1a56e4bc937f28b6524.tar.bz2 ice-3bb83324d1004564bcc6e1a56e4bc937f28b6524.tar.xz ice-3bb83324d1004564bcc6e1a56e4bc937f28b6524.zip |
Fixed bug 971 and 983.
Diffstat (limited to 'cpp/src/IceGrid/ServerI.cpp')
-rw-r--r-- | cpp/src/IceGrid/ServerI.cpp | 36 |
1 files changed, 22 insertions, 14 deletions
diff --git a/cpp/src/IceGrid/ServerI.cpp b/cpp/src/IceGrid/ServerI.cpp index e697ba17b74..2544c99dad5 100644 --- a/cpp/src/IceGrid/ServerI.cpp +++ b/cpp/src/IceGrid/ServerI.cpp @@ -329,12 +329,6 @@ public: { } - static bool - isStarted(ServerI::InternalServerState state) - { - return state == ServerI::ActivationTimeout || state == ServerI::Active; - } - virtual bool canExecute(ServerI::InternalServerState state) { @@ -441,6 +435,18 @@ public: } void + failed(const string& reason) + { + stopTimer(); + ServerStopException ex(_server->getId(), reason); + for(vector<AMD_Server_stopPtr>::const_iterator p = _stopCB.begin(); p != _stopCB.end(); ++p) + { + (*p)->ice_exception(ex); + } + _stopCB.clear(); + } + + void finished() { stopTimer(); @@ -607,14 +613,16 @@ ServerI::stop_async(const AMD_Server_stopPtr& amdCB, const Ice::Current&) { Lock sync(*this); checkDestroyed(); + if(StopCommand::isStopped(_state)) { - if(amdCB) - { - amdCB->ice_response(); - } - return; + throw ServerStopException(_id, "The server is already inactive."); + } + else if(_state == Destroying) + { + throw ServerStopException(_id, "The server is being destroyed."); } + if(!_stop) { _stop = new StopCommand(this, _node->getWaitQueue(), _deactivationTimeout); @@ -2044,13 +2052,13 @@ ServerI::setStateNoSync(InternalServerState st, const std::string& reason) _start->failed("The server is being destroyed."); _start = 0; } - break; - case Destroyed: if(_stop) { - _stop->finished(); + _stop->failed("The server is being destroyed."); _stop = 0; } + break; + case Destroyed: if(_destroy) { _destroy->finished(); |