diff options
Diffstat (limited to 'TAO/orbsvcs/orbsvcs/CosEvent/CEC_Reactive_SupplierControl.cpp')
-rw-r--r-- | TAO/orbsvcs/orbsvcs/CosEvent/CEC_Reactive_SupplierControl.cpp | 127 |
1 files changed, 53 insertions, 74 deletions
diff --git a/TAO/orbsvcs/orbsvcs/CosEvent/CEC_Reactive_SupplierControl.cpp b/TAO/orbsvcs/orbsvcs/CosEvent/CEC_Reactive_SupplierControl.cpp index 351b24a2fdc..f0745b949e8 100644 --- a/TAO/orbsvcs/orbsvcs/CosEvent/CEC_Reactive_SupplierControl.cpp +++ b/TAO/orbsvcs/orbsvcs/CosEvent/CEC_Reactive_SupplierControl.cpp @@ -13,8 +13,6 @@ #include "CEC_ProxyPullConsumer.h" -#include "orbsvcs/Time_Utilities.h" - #include "tao/Messaging/Messaging.h" #include "tao/ORB_Core.h" @@ -31,12 +29,10 @@ ACE_RCSID (CosEvent, TAO_CEC_Reactive_SupplierControl:: TAO_CEC_Reactive_SupplierControl (const ACE_Time_Value &rate, const ACE_Time_Value &timeout, - unsigned int retries, TAO_CEC_EventChannel *ec, CORBA::ORB_ptr orb) : rate_ (rate), timeout_ (timeout), - retries_ (retries), adapter_ (this), event_channel_ (ec), orb_ (CORBA::ORB::_duplicate (orb)) @@ -55,12 +51,10 @@ TAO_CEC_Reactive_SupplierControl:: TAO_CEC_Reactive_SupplierControl:: TAO_CEC_Reactive_SupplierControl (const ACE_Time_Value &rate, const ACE_Time_Value &timeout, - unsigned int retries, TAO_CEC_TypedEventChannel *ec, CORBA::ORB_ptr orb) : rate_ (rate), timeout_ (timeout), - retries_ (retries), adapter_ (this), typed_event_channel_ (ec), orb_ (CORBA::ORB::_duplicate (orb)) @@ -112,37 +106,6 @@ TAO_CEC_Reactive_SupplierControl::query_suppliers ( #endif /* TAO_HAS_TYPED_EVENT_CHANNEL */ } -bool -TAO_CEC_Reactive_SupplierControl::need_to_disconnect ( - PortableServer::ServantBase* proxy) -{ - bool disconnect = true; - TAO_CEC_EventChannel::ServantRetryMap::ENTRY* entry; - if (this->event_channel_-> - get_servant_retry_map ().find (proxy, entry) == 0) - { - ++entry->int_id_; - if (entry->int_id_ <= this->retries_) - { - disconnect = false; - } - } - - return disconnect; -} - -void -TAO_CEC_Reactive_SupplierControl::successful_transmission ( - PortableServer::ServantBase* proxy) -{ - TAO_CEC_EventChannel::ServantRetryMap::ENTRY* entry; - if (this->event_channel_-> - get_servant_retry_map ().find (proxy, entry) == 0) - { - entry->int_id_ = 0; - } -} - void TAO_CEC_Reactive_SupplierControl::handle_timeout ( const ACE_Time_Value &, @@ -164,17 +127,9 @@ TAO_CEC_Reactive_SupplierControl::handle_timeout ( ACE_ENV_ARG_PARAMETER); ACE_TRY_CHECK; - ACE_TRY_EX (query) - { - // Query the state of the suppliers... - this->query_suppliers (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK_EX (query); - } - ACE_CATCHANY - { - // Ignore all exceptions - } - ACE_ENDTRY; + // Query the state of the suppliers... + this->query_suppliers (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; this->policy_current_->set_policy_overrides (policies.in (), CORBA::SET_OVERRIDE @@ -210,12 +165,8 @@ TAO_CEC_Reactive_SupplierControl::activate (void) ACE_ENV_ARG_PARAMETER); ACE_TRY_CHECK; - // Pre-compute the policy list to the set the right timeout - // value... - // We need to convert the relative timeout into 100's of nano seconds. - TimeBase::TimeT timeout; - ORBSVCS_Time::Time_Value_to_TimeT (timeout, - this->timeout_); + // Timeout for polling state (default = 10 msec) + TimeBase::TimeT timeout = timeout_.usec() * 10; CORBA::Any any; any <<= timeout; @@ -324,11 +275,18 @@ TAO_CEC_Reactive_SupplierControl::system_exception ( { ACE_TRY { - if (this->need_to_disconnect (proxy)) - { - proxy->disconnect_pull_consumer (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - } + // The current implementation is very strict, and kicks out a + // client on the first system exception. We may + // want to be more lenient in the future, for example, + // this is TAO's minor code for a failed connection. + // + // if (CORBA::TRANSIENT::_narrow (&exception) != 0 + // && exception->minor () == 0x54410085) + // return; + + // Anything else is serious, including timeouts... + proxy->disconnect_pull_consumer (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; } ACE_CATCHANY { @@ -380,11 +338,18 @@ TAO_CEC_Ping_Push_Supplier::work (TAO_CEC_ProxyPushConsumer *consumer } ACE_CATCH (CORBA::TRANSIENT, transient) { - if (this->control_->need_to_disconnect (consumer)) - { - this->control_->supplier_not_exist (consumer ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - } + // The current implementation is very strict, and kicks out a + // client on the first system exception. We may + // want to be more lenient in the future, for example, + // this is TAO's minor code for a failed connection. + // + // if (CORBA::TRANSIENT::_narrow (&exception) != 0 + // && exception->minor () == 0x54410085) + // return; + + // Anything else is serious, including timeouts... + this->control_->supplier_not_exist (consumer ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; } ACE_CATCHANY { @@ -420,11 +385,18 @@ TAO_CEC_Ping_Typed_Push_Supplier::work (TAO_CEC_TypedProxyPushConsumer *consumer } ACE_CATCH (CORBA::TRANSIENT, transient) { - if (this->control_->need_to_disconnect (consumer)) - { - this->control_->supplier_not_exist (consumer ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - } + // The current implementation is very strict, and kicks out a + // client on the first system exception. We may + // want to be more lenient in the future, for example, + // this is TAO's minor code for a failed connection. + // + // if (CORBA::TRANSIENT::_narrow (&exception) != 0 + // && exception->minor () == 0x54410085) + // return; + + // Anything else is serious, including timeouts... + this->control_->supplier_not_exist (consumer ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; } ACE_CATCHANY { @@ -460,11 +432,18 @@ TAO_CEC_Ping_Pull_Supplier::work (TAO_CEC_ProxyPullConsumer *consumer } ACE_CATCH (CORBA::TRANSIENT, transient) { - if (this->control_->need_to_disconnect (consumer)) - { - this->control_->supplier_not_exist (consumer ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - } + // The current implementation is very strict, and kicks out a + // client on the first system exception. We may + // want to be more lenient in the future, for example, + // this is TAO's minor code for a failed connection. + // + // if (CORBA::TRANSIENT::_narrow (&exception) != 0 + // && exception->minor () == 0x54410085) + // return; + + // Anything else is serious, including timeouts... + this->control_->supplier_not_exist (consumer ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; } ACE_CATCHANY { |