#include <EC_Reactive_SupplierControl.h>
Inheritance diagram for TAO_EC_Reactive_SupplierControl:


Public Member Functions | |
| TAO_EC_Reactive_SupplierControl (const ACE_Time_Value &rate, const ACE_Time_Value &timeout, TAO_EC_Event_Channel_Base *event_channel, CORBA::ORB_ptr orb) | |
| virtual | ~TAO_EC_Reactive_SupplierControl (void) |
| Destructor. | |
| void | handle_timeout (const ACE_Time_Value &tv, const void *arg) |
| Receive the timeout from the adapter. | |
| virtual int | activate (void) |
| virtual int | shutdown (void) |
| virtual void | supplier_not_exist (TAO_EC_ProxyPushConsumer *proxy) |
| virtual void | system_exception (TAO_EC_ProxyPushConsumer *proxy, CORBA::SystemException &) |
Private Member Functions | |
| void | query_suppliers () |
Private Attributes | |
| ACE_Time_Value | rate_ |
| The polling rate. | |
| ACE_Time_Value | timeout_ |
| The polling timeout. | |
| TAO_EC_SupplierControl_Adapter | adapter_ |
| The Adapter for the reactor events. | |
| TAO_EC_Event_Channel_Base * | event_channel_ |
| The event channel. | |
| CORBA::ORB_var | orb_ |
| The ORB. | |
| CORBA::PolicyCurrent_var | policy_current_ |
| To control the timeout policy in the thread. | |
| CORBA::PolicyList | policy_list_ |
| Precomputed policy list to the set timeout. | |
| ACE_Reactor * | reactor_ |
| The ORB reactor. | |
| long | timer_id_ |
| The timer id. | |
Defines the interface for the supplier control strategy. This strategy handles misbehaving or failing suppliers.
Definition at line 82 of file EC_Reactive_SupplierControl.h.
|
||||||||||||||||||||
|
Constructor. It does not assume ownership of the event_channel parameter. Definition at line 23 of file EC_Reactive_SupplierControl.cpp. References TAO_HAS_CORBA_MESSAGING.
00027 : rate_ (rate), 00028 timeout_ (timeout), 00029 adapter_ (this), 00030 event_channel_ (ec), 00031 orb_ (CORBA::ORB::_duplicate (orb)) 00032 #if defined (TAO_HAS_CORBA_MESSAGING) && TAO_HAS_CORBA_MESSAGING != 0 00033 , timer_id_ (-1) 00034 #endif /* TAO_HAS_CORBA_MESSAGING != 0*/ 00035 { 00036 this->reactor_ = 00037 this->orb_->orb_core ()->reactor (); 00038 } |
|
|
Destructor.
Definition at line 40 of file EC_Reactive_SupplierControl.cpp.
00041 {
00042 }
|
|
|
Activate any internal threads or timers used to poll the state of the suppliers Reimplemented from TAO_EC_SupplierControl. Definition at line 97 of file EC_Reactive_SupplierControl.cpp. References CORBA::PolicyCurrent::_narrow(), ACE_CATCHANY, ACE_ENDTRY, ACE_ENV_ARG_PARAMETER, ACE_TRY_CHECK, ACE_TRY_NEW_ENV, TAO::unbounded_object_reference_sequence< Policy, Policy_var >::length(), ACE_Reactor::schedule_timer(), and ACE_Time_Value::usec().
00098 {
00099 #if defined (TAO_HAS_CORBA_MESSAGING) && TAO_HAS_CORBA_MESSAGING != 0
00100 ACE_TRY_NEW_ENV
00101 {
00102 // Get the PolicyCurrent object
00103 CORBA::Object_var tmp =
00104 this->orb_->resolve_initial_references ("PolicyCurrent"
00105 ACE_ENV_ARG_PARAMETER);
00106 ACE_TRY_CHECK;
00107
00108 this->policy_current_ =
00109 CORBA::PolicyCurrent::_narrow (tmp.in ()
00110 ACE_ENV_ARG_PARAMETER);
00111 ACE_TRY_CHECK;
00112
00113 // Timeout for polling state (default = 10 msec)
00114 TimeBase::TimeT timeout = timeout_.usec() * 10;
00115 CORBA::Any any;
00116 any <<= timeout;
00117
00118 this->policy_list_.length (1);
00119 this->policy_list_[0] =
00120 this->orb_->create_policy (
00121 Messaging::RELATIVE_RT_TIMEOUT_POLICY_TYPE,
00122 any
00123 ACE_ENV_ARG_PARAMETER);
00124 ACE_TRY_CHECK;
00125
00126 // Only schedule the timer, when the rate is not zero
00127 if (this->rate_ != ACE_Time_Value::zero)
00128 {
00129 // Schedule the timer after these policies has been set, because the
00130 // handle_timeout uses these policies, if done in front, the channel
00131 // can crash when the timeout expires before initiazation is ready.
00132 timer_id_ = this->reactor_->schedule_timer (&this->adapter_,
00133 0,
00134 this->rate_,
00135 this->rate_);
00136 if (timer_id_ == -1)
00137 return -1;
00138 }
00139 }
00140 ACE_CATCHANY
00141 {
00142 return -1;
00143 }
00144 ACE_ENDTRY;
00145 #endif /* TAO_HAS_CORBA_MESSAGING */
00146
00147 return 0;
00148 }
|
|
||||||||||||
|
Receive the timeout from the adapter.
Definition at line 55 of file EC_Reactive_SupplierControl.cpp. References ACE_CATCHANY, ACE_ENDTRY, ACE_ENV_ARG_PARAMETER, ACE_ENV_SINGLE_ARG_PARAMETER, ACE_TRY_CHECK, ACE_TRY_NEW_ENV, and query_suppliers(). Referenced by TAO_EC_SupplierControl_Adapter::handle_timeout().
00058 {
00059 ACE_TRY_NEW_ENV
00060 {
00061 // Query the state of the Current object *before* we initiate
00062 // the iteration...
00063 CORBA::PolicyTypeSeq types;
00064 CORBA::PolicyList_var policies =
00065 this->policy_current_->get_policy_overrides (types
00066 ACE_ENV_ARG_PARAMETER);
00067 ACE_TRY_CHECK;
00068
00069 // Change the timeout
00070 this->policy_current_->set_policy_overrides (this->policy_list_,
00071 CORBA::ADD_OVERRIDE
00072 ACE_ENV_ARG_PARAMETER);
00073 ACE_TRY_CHECK;
00074
00075 // Query the state of the suppliers...
00076 this->query_suppliers (ACE_ENV_SINGLE_ARG_PARAMETER);
00077 ACE_TRY_CHECK;
00078
00079 this->policy_current_->set_policy_overrides (policies.in (),
00080 CORBA::SET_OVERRIDE
00081 ACE_ENV_ARG_PARAMETER);
00082 ACE_TRY_CHECK;
00083 for (CORBA::ULong i = 0; i != policies->length (); ++i)
00084 {
00085 policies[i]->destroy (ACE_ENV_SINGLE_ARG_PARAMETER);
00086 ACE_TRY_CHECK;
00087 }
00088 }
00089 ACE_CATCHANY
00090 {
00091 // Ignore all exceptions
00092 }
00093 ACE_ENDTRY;
00094 }
|
|
|
Check if the suppliers still exists. It is a helper method for handle_timeout() to isolate the exceptions. Definition at line 45 of file EC_Reactive_SupplierControl.cpp. References ACE_CHECK, ACE_ENV_ARG_PARAMETER, and TAO_EC_Event_Channel_Base::for_each_supplier(). Referenced by handle_timeout().
00047 {
00048 TAO_EC_Ping_Supplier worker (this);
00049 this->event_channel_->for_each_supplier (&worker
00050 ACE_ENV_ARG_PARAMETER);
00051 ACE_CHECK;
00052 }
|
|
|
Reimplemented from TAO_EC_SupplierControl. Definition at line 151 of file EC_Reactive_SupplierControl.cpp. References ACE_Reactor::cancel_timer(), and ACE_Event_Handler::reactor().
00152 {
00153 int r = 0;
00154
00155 #if defined (TAO_HAS_CORBA_MESSAGING) && TAO_HAS_CORBA_MESSAGING != 0
00156 r = this->reactor_->cancel_timer (timer_id_);
00157 #endif /* TAO_HAS_CORBA_MESSAGING */
00158 this->adapter_.reactor (0);
00159 return r;
00160 }
|
|
|
Invoked by helper classes when they detect that a supplier does not exists (i.e. _non_existent() returns true and/or the CORBA::OBJECT_NOT_EXIST exception has been raised). Reimplemented from TAO_EC_SupplierControl. Definition at line 163 of file EC_Reactive_SupplierControl.cpp. References ACE_CATCHANY, ACE_ENDTRY, ACE_ENV_SINGLE_ARG_PARAMETER, ACE_TRY, and ACE_TRY_CHECK.
00166 {
00167 ACE_TRY
00168 {
00169 //ACE_DEBUG ((LM_DEBUG,
00170 // "EC_Reactive_SupplierControl(%P|%t) - "
00171 // "Consumer %x does not exists\n", long(proxy)));
00172 proxy->disconnect_push_consumer (ACE_ENV_SINGLE_ARG_PARAMETER);
00173 ACE_TRY_CHECK;
00174 }
00175 ACE_CATCHANY
00176 {
00177 // Ignore all exceptions..
00178 }
00179 ACE_ENDTRY;
00180 }
|
|
||||||||||||
|
Some system exception was raised while trying to contact the supplier Reimplemented from TAO_EC_SupplierControl. Definition at line 183 of file EC_Reactive_SupplierControl.cpp. References ACE_CATCHANY, ACE_ENDTRY, ACE_ENV_SINGLE_ARG_PARAMETER, ACE_TRY, ACE_TRY_CHECK, and TAO_EC_ProxyPushConsumer::disconnect_push_consumer().
00187 {
00188 ACE_TRY
00189 {
00190 // The current implementation is very strict, and kicks out a
00191 // client on the first system exception. We may
00192 // want to be more lenient in the future, for example,
00193 // this is TAO's minor code for a failed connection.
00194 //
00195 // if (CORBA::TRANSIENT::_narrow (&exception) != 0
00196 // && exception->minor () == 0x54410085)
00197 // return;
00198
00199 // Anything else is serious, including timeouts...
00200 proxy->disconnect_push_consumer (ACE_ENV_SINGLE_ARG_PARAMETER);
00201 ACE_TRY_CHECK;
00202 }
00203 ACE_CATCHANY
00204 {
00205 // Ignore all exceptions..
00206 }
00207 ACE_ENDTRY;
00208 }
|
|
|
The Adapter for the reactor events.
Definition at line 121 of file EC_Reactive_SupplierControl.h. |
|
|
The event channel.
Definition at line 124 of file EC_Reactive_SupplierControl.h. |
|
|
The ORB.
Definition at line 127 of file EC_Reactive_SupplierControl.h. |
|
|
To control the timeout policy in the thread.
Definition at line 130 of file EC_Reactive_SupplierControl.h. |
|
|
Precomputed policy list to the set timeout.
Definition at line 133 of file EC_Reactive_SupplierControl.h. |
|
|
The polling rate.
Definition at line 115 of file EC_Reactive_SupplierControl.h. |
|
|
The ORB reactor.
Definition at line 136 of file EC_Reactive_SupplierControl.h. |
|
|
The polling timeout.
Definition at line 118 of file EC_Reactive_SupplierControl.h. |
|
|
The timer id.
Definition at line 140 of file EC_Reactive_SupplierControl.h. |
1.3.6