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