diff options
Diffstat (limited to 'TAO/orbsvcs/orbsvcs/CosEvent/CEC_Reactive_ConsumerControl.cpp')
-rw-r--r-- | TAO/orbsvcs/orbsvcs/CosEvent/CEC_Reactive_ConsumerControl.cpp | 108 |
1 files changed, 39 insertions, 69 deletions
diff --git a/TAO/orbsvcs/orbsvcs/CosEvent/CEC_Reactive_ConsumerControl.cpp b/TAO/orbsvcs/orbsvcs/CosEvent/CEC_Reactive_ConsumerControl.cpp index 795ba286da9..0fed2f2298e 100644 --- a/TAO/orbsvcs/orbsvcs/CosEvent/CEC_Reactive_ConsumerControl.cpp +++ b/TAO/orbsvcs/orbsvcs/CosEvent/CEC_Reactive_ConsumerControl.cpp @@ -12,8 +12,6 @@ #include "CEC_ProxyPushSupplier.h" #include "CEC_ProxyPullSupplier.h" -#include "orbsvcs/Time_Utilities.h" - #include "tao/Messaging/Messaging.h" #include "tao/ORB_Core.h" @@ -30,12 +28,10 @@ ACE_RCSID (CosEvent, TAO_CEC_Reactive_ConsumerControl:: TAO_CEC_Reactive_ConsumerControl (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)) @@ -54,12 +50,10 @@ TAO_CEC_Reactive_ConsumerControl:: TAO_CEC_Reactive_ConsumerControl:: TAO_CEC_Reactive_ConsumerControl (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)) @@ -110,37 +104,6 @@ TAO_CEC_Reactive_ConsumerControl::query_consumers ( #endif /* TAO_HAS_TYPED_EVENT_CHANNEL */ } -bool -TAO_CEC_Reactive_ConsumerControl::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_ConsumerControl::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_ConsumerControl::handle_timeout ( const ACE_Time_Value &, @@ -162,17 +125,9 @@ TAO_CEC_Reactive_ConsumerControl::handle_timeout ( ACE_ENV_ARG_PARAMETER); ACE_TRY_CHECK; - ACE_TRY_EX (query) - { - // Query the state of the consumers... - this->query_consumers (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK_EX (query); - } - ACE_CATCHANY - { - // Ignore all exceptions - } - ACE_ENDTRY; + // Query the state of the consumers... + this->query_consumers (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; this->policy_current_->set_policy_overrides (policies.in (), CORBA::SET_OVERRIDE @@ -208,12 +163,8 @@ TAO_CEC_Reactive_ConsumerControl::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; @@ -307,11 +258,18 @@ TAO_CEC_Reactive_ConsumerControl::system_exception ( { ACE_TRY { - if (this->need_to_disconnect (proxy)) - { - proxy->disconnect_push_supplier (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_push_supplier (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; } ACE_CATCHANY { @@ -363,11 +321,17 @@ TAO_CEC_Ping_Push_Consumer::work (TAO_CEC_ProxyPushSupplier *supplier } ACE_CATCH (CORBA::TRANSIENT, transient) { - if (this->control_->need_to_disconnect (supplier)) - { - this->control_->consumer_not_exist (supplier 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; + + this->control_->consumer_not_exist (supplier ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; } ACE_CATCHANY { @@ -402,11 +366,17 @@ TAO_CEC_Ping_Pull_Consumer::work (TAO_CEC_ProxyPullSupplier *supplier } ACE_CATCH (CORBA::TRANSIENT, transient) { - if (this->control_->need_to_disconnect (supplier)) - { - this->control_->consumer_not_exist (supplier 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; + + this->control_->consumer_not_exist (supplier ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; } ACE_CATCHANY { |