summaryrefslogtreecommitdiff
path: root/TAO/tests/RTCORBA/Linear_Priority/client.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'TAO/tests/RTCORBA/Linear_Priority/client.cpp')
-rw-r--r--TAO/tests/RTCORBA/Linear_Priority/client.cpp43
1 files changed, 43 insertions, 0 deletions
diff --git a/TAO/tests/RTCORBA/Linear_Priority/client.cpp b/TAO/tests/RTCORBA/Linear_Priority/client.cpp
index 83ff5df4a3a..4dfb03126a3 100644
--- a/TAO/tests/RTCORBA/Linear_Priority/client.cpp
+++ b/TAO/tests/RTCORBA/Linear_Priority/client.cpp
@@ -71,6 +71,8 @@ public:
int svc (void);
+ void validate_connection (ACE_ENV_SINGLE_ARG_DECL);
+
private:
test_var test_;
RTCORBA::Current_var current_;
@@ -86,6 +88,44 @@ Worker_Thread::Worker_Thread (test_ptr test,
{
}
+void
+Worker_Thread::validate_connection (ACE_ENV_SINGLE_ARG_DECL)
+{
+ // Try to validate the connection several times, ignoring transient
+ // exceptions. If the connection can still not be setup, return
+ // failure.
+ CORBA::PolicyList_var inconsistent_policies;
+ int max_attempts = 10;
+ int current_attempt = 0;
+ for (;;)
+ {
+ ACE_TRY
+ {
+ ++current_attempt;
+ this->test_->_validate_connection (inconsistent_policies.out ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ // If successful, we are done.
+ return;
+ }
+ ACE_CATCH (CORBA::TRANSIENT, exception)
+ {
+ // If we have reach our maximum number of tries, throw exception.
+ if (current_attempt == max_attempts)
+ ACE_RE_THROW;
+ // Otherwise, ignore...
+ }
+ ACE_CATCHANY
+ {
+ // Rethrow any other exceptions.
+ ACE_RE_THROW;
+ }
+ ACE_ENDTRY;
+ ACE_CHECK;
+ }
+}
+
int
Worker_Thread::svc (void)
{
@@ -95,6 +135,9 @@ Worker_Thread::svc (void)
ACE_ENV_ARG_PARAMETER);
ACE_TRY_CHECK;
+ this->validate_connection (ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
for (int i = 0; i < iterations; i++)
{
this->test_->method (ACE_ENV_SINGLE_ARG_PARAMETER);