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 ACE_ENV_ARG_DECL_NOT_USED);
00116 virtual void consumer_not_exist (TAO_CEC_ProxyPullSupplier *proxy
00117 ACE_ENV_ARG_DECL_NOT_USED);
00118 virtual void system_exception (TAO_CEC_ProxyPushSupplier *proxy,
00119 CORBA::SystemException &
00120 ACE_ENV_ARG_DECL_NOT_USED);
00121
00122
00123
00124
00125
00126 virtual bool need_to_disconnect (PortableServer::ServantBase* proxy);
00127
00128
00129 virtual void successful_transmission (PortableServer::ServantBase* proxy);
00130
00131 private:
00132
00133
00134 void query_consumers (ACE_ENV_SINGLE_ARG_DECL);
00135
00136 private:
00137
00138 ACE_Time_Value rate_;
00139
00140
00141 ACE_Time_Value timeout_;
00142
00143
00144 unsigned int retries_;
00145
00146
00147 TAO_CEC_ConsumerControl_Adapter adapter_;
00148
00149
00150 TAO_CEC_EventChannel *event_channel_;
00151
00152
00153 #if defined (TAO_HAS_TYPED_EVENT_CHANNEL)
00154 TAO_CEC_TypedEventChannel *typed_event_channel_;
00155 #endif
00156
00157
00158 CORBA::ORB_var orb_;
00159
00160
00161 CORBA::PolicyCurrent_var policy_current_;
00162
00163
00164 CORBA::PolicyList policy_list_;
00165
00166
00167 ACE_Reactor *reactor_;
00168
00169 #if defined (TAO_HAS_CORBA_MESSAGING) && TAO_HAS_CORBA_MESSAGING != 0
00170
00171 long timer_id_;
00172 #endif
00173 };
00174
00175
00176
00177 class TAO_CEC_Ping_Push_Consumer
00178 : public TAO_ESF_Worker<TAO_CEC_ProxyPushSupplier>
00179 {
00180 public:
00181 TAO_CEC_Ping_Push_Consumer (TAO_CEC_ConsumerControl *control);
00182
00183 virtual void work (TAO_CEC_ProxyPushSupplier *supplier
00184 ACE_ENV_ARG_DECL);
00185
00186 private:
00187 TAO_CEC_ConsumerControl *control_;
00188 };
00189
00190
00191
00192 class TAO_CEC_Ping_Pull_Consumer
00193 : public TAO_ESF_Worker<TAO_CEC_ProxyPullSupplier>
00194 {
00195 public:
00196 TAO_CEC_Ping_Pull_Consumer (TAO_CEC_ConsumerControl *control);
00197
00198 virtual void work (TAO_CEC_ProxyPullSupplier *supplier
00199 ACE_ENV_ARG_DECL);
00200
00201 private:
00202 TAO_CEC_ConsumerControl *control_;
00203 };
00204
00205 TAO_END_VERSIONED_NAMESPACE_DECL
00206
00207 #if defined (__ACE_INLINE__)
00208 #include "orbsvcs/CosEvent/CEC_Reactive_ConsumerControl.i"
00209 #endif
00210
00211 #include "ace/post.h"
00212
00213 #endif