00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef TAO_CEC_REACTIVE_SUPPLIERCONTROL_H
00018 #define TAO_CEC_REACTIVE_SUPPLIERCONTROL_H
00019
00020 #include "ace/pre.h"
00021
00022 #include "orbsvcs/CosEvent/CEC_SupplierControl.h"
00023
00024 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00025 # pragma once
00026 #endif
00027
00028 #include "orbsvcs/ESF/ESF_Worker.h"
00029
00030 #include "tao/ORB.h"
00031
00032 #include "ace/Event_Handler.h"
00033
00034 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00035
00036 class TAO_CEC_EventChannel;
00037 class TAO_CEC_Reactive_SupplierControl;
00038
00039 #if defined (TAO_HAS_TYPED_EVENT_CHANNEL)
00040 class TAO_CEC_TypedEventChannel;
00041 #endif
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052 class TAO_Event_Serv_Export TAO_CEC_SupplierControl_Adapter
00053 : public ACE_Event_Handler
00054 {
00055 public:
00056
00057 TAO_CEC_SupplierControl_Adapter (TAO_CEC_Reactive_SupplierControl *adaptee);
00058
00059
00060 virtual int handle_timeout (const ACE_Time_Value &tv,
00061 const void *arg = 0);
00062
00063 private:
00064
00065 TAO_CEC_Reactive_SupplierControl *adaptee_;
00066 };
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079 class TAO_Event_Serv_Export TAO_CEC_Reactive_SupplierControl
00080 : public TAO_CEC_SupplierControl
00081 {
00082 public:
00083
00084
00085 TAO_CEC_Reactive_SupplierControl (const ACE_Time_Value &rate,
00086 const ACE_Time_Value &timeout,
00087 unsigned int retries,
00088 TAO_CEC_EventChannel *event_channel,
00089 CORBA::ORB_ptr orb);
00090
00091
00092 #if defined (TAO_HAS_TYPED_EVENT_CHANNEL)
00093 TAO_CEC_Reactive_SupplierControl (
00094 const ACE_Time_Value &rate,
00095 const ACE_Time_Value &timeout,
00096 unsigned int retries,
00097 TAO_CEC_TypedEventChannel *typed_event_channel,
00098 CORBA::ORB_ptr orb
00099 );
00100 #endif
00101
00102
00103 virtual ~TAO_CEC_Reactive_SupplierControl (void);
00104
00105
00106 void handle_timeout (const ACE_Time_Value &tv,
00107 const void* arg);
00108
00109
00110 virtual int activate (void);
00111 virtual int shutdown (void);
00112 virtual void supplier_not_exist (TAO_CEC_ProxyPushConsumer *proxy);
00113 #if defined (TAO_HAS_TYPED_EVENT_CHANNEL)
00114 virtual void supplier_not_exist (TAO_CEC_TypedProxyPushConsumer *proxy);
00115 #endif
00116 virtual void supplier_not_exist (TAO_CEC_ProxyPullConsumer *proxy);
00117 virtual void system_exception (TAO_CEC_ProxyPullConsumer *proxy,
00118 CORBA::SystemException &);
00119
00120
00121
00122
00123
00124 virtual bool need_to_disconnect (PortableServer::ServantBase* proxy);
00125
00126
00127 virtual void successful_transmission (PortableServer::ServantBase* proxy);
00128
00129 private:
00130
00131
00132 void query_suppliers (void);
00133
00134 private:
00135
00136 ACE_Time_Value rate_;
00137
00138
00139 ACE_Time_Value timeout_;
00140
00141
00142 unsigned int retries_;
00143
00144
00145 TAO_CEC_SupplierControl_Adapter adapter_;
00146
00147
00148 TAO_CEC_EventChannel *event_channel_;
00149
00150
00151 #if defined (TAO_HAS_TYPED_EVENT_CHANNEL)
00152 TAO_CEC_TypedEventChannel *typed_event_channel_;
00153 #endif
00154
00155
00156 CORBA::ORB_var orb_;
00157
00158
00159 CORBA::PolicyCurrent_var policy_current_;
00160
00161
00162 CORBA::PolicyList policy_list_;
00163
00164
00165 ACE_Reactor *reactor_;
00166
00167 #if defined (TAO_HAS_CORBA_MESSAGING) && TAO_HAS_CORBA_MESSAGING != 0
00168
00169 long timer_id_;
00170 #endif
00171 };
00172
00173
00174
00175 class TAO_CEC_Ping_Push_Supplier : public TAO_ESF_Worker<TAO_CEC_ProxyPushConsumer>
00176 {
00177 public:
00178 TAO_CEC_Ping_Push_Supplier (TAO_CEC_SupplierControl *control);
00179
00180 virtual void work (TAO_CEC_ProxyPushConsumer *consumer);
00181
00182 private:
00183 TAO_CEC_SupplierControl *control_;
00184 };
00185
00186
00187
00188 #if defined (TAO_HAS_TYPED_EVENT_CHANNEL)
00189 class TAO_CEC_Ping_Typed_Push_Supplier : public TAO_ESF_Worker<TAO_CEC_TypedProxyPushConsumer>
00190 {
00191 public:
00192 TAO_CEC_Ping_Typed_Push_Supplier (TAO_CEC_SupplierControl *control);
00193
00194 virtual void work (TAO_CEC_TypedProxyPushConsumer *consumer);
00195
00196 private:
00197 TAO_CEC_SupplierControl *control_;
00198 };
00199 #endif
00200
00201
00202
00203 class TAO_CEC_Ping_Pull_Supplier : public TAO_ESF_Worker<TAO_CEC_ProxyPullConsumer>
00204 {
00205 public:
00206 TAO_CEC_Ping_Pull_Supplier (TAO_CEC_SupplierControl *control);
00207
00208 virtual void work (TAO_CEC_ProxyPullConsumer *consumer);
00209
00210 private:
00211 TAO_CEC_SupplierControl *control_;
00212 };
00213
00214 TAO_END_VERSIONED_NAMESPACE_DECL
00215
00216 #if defined (__ACE_INLINE__)
00217 #include "orbsvcs/CosEvent/CEC_Reactive_SupplierControl.inl"
00218 #endif
00219
00220 #include "ace/post.h"
00221
00222 #endif