summaryrefslogtreecommitdiff
path: root/TAO
diff options
context:
space:
mode:
authorJohnny Willemsen <jwillemsen@remedy.nl>2018-12-04 18:33:44 +0100
committerGitHub <noreply@github.com>2018-12-04 18:33:44 +0100
commitaae3b9ad2545c2941122c58c1be52d7c19496ae3 (patch)
tree16a3a3e685fed4ca9bf9903ad7701a4ec785c419 /TAO
parent8b4ad16cc2691199e860306e8d6e3b405309f2d4 (diff)
parent791a3e0ca8710e22c7aa4e601eaf39c97b23c542 (diff)
downloadATCD-aae3b9ad2545c2941122c58c1be52d7c19496ae3.tar.gz
Merge pull request #767 from jwillemsen/jwi-imrnotifywaiter
Add try/catch around the notify of a single waiter within notify_wait… …ers so that when we get an exception we still inform all other waiters instead of exiting the loop on the first exception
Diffstat (limited to 'TAO')
-rw-r--r--TAO/orbsvcs/ImplRepo_Service/AsyncAccessManager.cpp111
-rw-r--r--TAO/orbsvcs/ImplRepo_Service/AsyncAccessManager.h1
2 files changed, 65 insertions, 47 deletions
diff --git a/TAO/orbsvcs/ImplRepo_Service/AsyncAccessManager.cpp b/TAO/orbsvcs/ImplRepo_Service/AsyncAccessManager.cpp
index 918440ed01f..a8447aa98da 100644
--- a/TAO/orbsvcs/ImplRepo_Service/AsyncAccessManager.cpp
+++ b/TAO/orbsvcs/ImplRepo_Service/AsyncAccessManager.cpp
@@ -247,58 +247,75 @@ AsyncAccessManager::final_state (bool active)
}
void
-AsyncAccessManager::notify_waiters (void)
+AsyncAccessManager::notify_waiter (ImR_ResponseHandler *rh)
{
- for (size_t i = 0; i < this->rh_list_.size(); i++)
+ if (this->status_ == ImplementationRepository::AAM_SERVER_READY)
{
- ImR_ResponseHandler *rh = this->rh_list_[i];
- if (rh != 0)
+ if (this->info_->is_mode (ImplementationRepository::PER_CLIENT))
+ {
+ rh->send_ior (this->partial_ior_.c_str());
+ }
+ else
{
- if (this->status_ == ImplementationRepository::AAM_SERVER_READY)
+ rh->send_ior (this->info_->partial_ior.c_str());
+ }
+ }
+ else
+ {
+ try
+ {
+ switch (this->status_)
{
- if (this->info_->is_mode (ImplementationRepository::PER_CLIENT))
- {
- rh->send_ior (this->partial_ior_.c_str());
- }
- else
- {
- rh->send_ior (this->info_->partial_ior.c_str());
- }
+ case ImplementationRepository::AAM_NO_ACTIVATOR:
+ throw ImplementationRepository::CannotActivate
+ ("No activator registered for server.");
+ case ImplementationRepository::AAM_NOT_MANUAL:
+ throw ImplementationRepository::CannotActivate
+ ("Cannot implicitly activate MANUAL server.");
+ case ImplementationRepository::AAM_NO_COMMANDLINE:
+ throw ImplementationRepository::CannotActivate
+ ("No command line registered for server.");
+ case ImplementationRepository::AAM_RETRIES_EXCEEDED:
+ throw ImplementationRepository::CannotActivate
+ ("Restart attempt count exceeded.");
+ case ImplementationRepository::AAM_ACTIVE_TERMINATE:
+ throw ImplementationRepository::CannotActivate
+ ("Server terminating.");
+ default: {
+ ACE_CString reason = ACE_CString ("AAM_Status is ") +
+ status_name (this->status_);
+ throw ImplementationRepository::CannotActivate (reason.c_str());
}
- else
- {
- try
- {
- switch (this->status_)
- {
- case ImplementationRepository::AAM_NO_ACTIVATOR:
- throw ImplementationRepository::CannotActivate
- ("No activator registered for server.");
- case ImplementationRepository::AAM_NOT_MANUAL:
- throw ImplementationRepository::CannotActivate
- ("Cannot implicitly activate MANUAL server.");
- case ImplementationRepository::AAM_NO_COMMANDLINE:
- throw ImplementationRepository::CannotActivate
- ("No command line registered for server.");
- case ImplementationRepository::AAM_RETRIES_EXCEEDED:
- throw ImplementationRepository::CannotActivate
- ("Restart attempt count exceeded.");
- case ImplementationRepository::AAM_ACTIVE_TERMINATE:
- throw ImplementationRepository::CannotActivate
- ("Server terminating.");
- default: {
- ACE_CString reason = ACE_CString ("AAM_Status is ") +
- status_name (this->status_);
- throw ImplementationRepository::CannotActivate (reason.c_str());
- }
- }
- }
- catch (const CORBA::Exception &ex)
- {
- rh->send_exception (ex._tao_duplicate());
- }
}
- }
+ }
+ catch (const CORBA::Exception &ex)
+ {
+ rh->send_exception (ex._tao_duplicate());
+ }
+ }
+}
+
+void
+AsyncAccessManager::notify_waiters (void)
+{
+ for (size_t i = 0; i < this->rh_list_.size(); i++)
+ {
+ // Sending the IOR through to the response handler could trigger
+ // an exception which we should catch here and log. This way when
+ // we have multiple waiters we do inform them all and not abort
+ // after the first exception
+ try
+ {
+ ImR_ResponseHandler *rh = this->rh_list_[i];
+ if (rh != 0)
+ {
+ this->notify_waiter (rh);
+ }
+ }
+ catch (const CORBA::Exception& ex)
+ {
+ ex._tao_print_exception ("AsyncAccessManager::notify_waiters");
+ }
}
this->rh_list_.clear ();
}
@@ -501,7 +518,7 @@ AsyncAccessManager::notify_child_death (int pid)
this, info_->ping_id (), pid, status_name (status_),
this->info_->pid, this->prev_pid_, this->rh_list_.size() ));
}
- if (this->info_->pid == pid || this->prev_pid_ == pid)
+ if (this->info_->pid == 0 || this->info_->pid == pid || this->prev_pid_ == pid)
{
if (this->status_ == ImplementationRepository::AAM_WAIT_FOR_DEATH &&
this->rh_list_.size() > 0)
diff --git a/TAO/orbsvcs/ImplRepo_Service/AsyncAccessManager.h b/TAO/orbsvcs/ImplRepo_Service/AsyncAccessManager.h
index 1632d41e065..1af3d7aa3b1 100644
--- a/TAO/orbsvcs/ImplRepo_Service/AsyncAccessManager.h
+++ b/TAO/orbsvcs/ImplRepo_Service/AsyncAccessManager.h
@@ -85,6 +85,7 @@ class Locator_Export AsyncAccessManager
private:
void report (const char* operation) const;
void final_state (bool active = true);
+ void notify_waiter (ImR_ResponseHandler *rh);
void notify_waiters (void);
void status (ImplementationRepository::AAM_Status s);
void update_status (ImplementationRepository::AAM_Status s);