#include <default_client.h>
Inheritance diagram for TAO_Default_Client_Strategy_Factory:
Public Member Functions | |
TAO_Default_Client_Strategy_Factory (void) | |
Constructor. | |
virtual | ~TAO_Default_Client_Strategy_Factory (void) |
Destructor. | |
virtual int | init (int argc, ACE_TCHAR *argv[]) |
Dynamic linking hook. | |
int | parse_args (int argc, ACE_TCHAR *argv[]) |
Parse svc.conf arguments. | |
virtual ACE_Lock * | create_profile_lock (void) |
virtual TAO_Transport_Mux_Strategy * | create_transport_mux_strategy (TAO_Transport *transport) |
Create the correct client request muxing strategy. | |
virtual ACE_Lock * | create_transport_mux_strategy_lock (void) |
Create the correct lock for request muxing strategy. | |
virtual int | reply_dispatcher_table_size (void) const |
Return the size of the reply dispatcher table. | |
virtual int | allow_callback (void) |
Does the client allow any form of callback? | |
virtual TAO_Wait_Strategy * | create_wait_strategy (TAO_Transport *transport) |
Create the correct client strategy. | |
virtual TAO_Connect_Strategy * | create_connect_strategy (TAO_ORB_Core *) |
Create the correct client strategy. | |
virtual ACE_Lock * | create_ft_service_retention_id_lock (void) |
virtual bool | use_cleanup_options (void) const |
Cleanup options for wait strategy. | |
virtual Connect_Strategy | connect_strategy (void) const |
Return the selected connection strategy option. | |
Protected Member Functions | |
void | report_option_value_error (const ACE_TCHAR *option_name, const ACE_TCHAR *option_value) |
Private Types | |
enum | Lock_Type { TAO_NULL_LOCK, TAO_THREAD_LOCK } |
enum | Transport_Mux_Strategy { TAO_MUXED_TMS, TAO_EXCLUSIVE_TMS } |
enum | Wait_Strategy { TAO_WAIT_ON_LEADER_FOLLOWER, TAO_WAIT_ON_REACTOR, TAO_WAIT_ON_READ, TAO_WAIT_ON_LF_NO_UPCALL } |
Private Attributes | |
Lock_Type | profile_lock_type_ |
the lock type for forwarding IIOP Profile | |
Transport_Mux_Strategy | transport_mux_strategy_ |
The client Request Mux Strategy. | |
Wait_Strategy | wait_strategy_ |
The wait-for-reply strategy. | |
Connect_Strategy | connect_strategy_ |
The connection initiation strategy. | |
int | rd_table_size_ |
Size of the reply dispatcher table. | |
Lock_Type | muxed_strategy_lock_type_ |
Type of lock for the muxed_strategy. | |
bool | use_cleanup_options_ |
Cleanupoptions for RW strategy. |
Definition at line 36 of file default_client.h.
|
Definition at line 72 of file default_client.h.
00073 { 00074 TAO_NULL_LOCK, 00075 TAO_THREAD_LOCK 00076 }; |
|
Definition at line 81 of file default_client.h.
00082 { 00083 TAO_MUXED_TMS, 00084 TAO_EXCLUSIVE_TMS 00085 }; |
|
Definition at line 90 of file default_client.h.
00091 { 00092 TAO_WAIT_ON_LEADER_FOLLOWER, 00093 TAO_WAIT_ON_REACTOR, 00094 TAO_WAIT_ON_READ, 00095 TAO_WAIT_ON_LF_NO_UPCALL 00096 }; |
|
Constructor.
Definition at line 28 of file default_client.cpp. References TAO_EXCLUSIVE_TMS, TAO_MUXED_TMS, TAO_RD_TABLE_SIZE, TAO_WAIT_ON_LEADER_FOLLOWER, TAO_WAIT_ON_REACTOR, transport_mux_strategy_, and wait_strategy_.
00029 : profile_lock_type_ (TAO_THREAD_LOCK) 00030 , transport_mux_strategy_ (TAO_MUXED_TMS) 00031 , wait_strategy_ (TAO_WAIT_ON_LEADER_FOLLOWER) 00032 , connect_strategy_ (TAO_LEADER_FOLLOWER_CONNECT) 00033 , rd_table_size_ (TAO_RD_TABLE_SIZE) 00034 , muxed_strategy_lock_type_ (TAO_THREAD_LOCK) 00035 , use_cleanup_options_ (false) 00036 { 00037 // Use single thread client connection handler 00038 #if defined (TAO_USE_ST_CLIENT_CONNECTION_HANDLER) 00039 this->wait_strategy_ = TAO_WAIT_ON_REACTOR; 00040 #else 00041 this->wait_strategy_ = TAO_WAIT_ON_LEADER_FOLLOWER; 00042 #endif /* TAO_USE_ST_CLIENT_CONNECTION_HANDLER */ 00043 00044 #if TAO_USE_MUXED_TRANSPORT_MUX_STRATEGY == 1 00045 this->transport_mux_strategy_ = TAO_MUXED_TMS; 00046 #else 00047 this->transport_mux_strategy_ = TAO_EXCLUSIVE_TMS; 00048 #endif /* TAO_USE_MUXED_TRANSPORT_MUX_STRATEGY */ 00049 00050 // @@todo: will be changed when other strategies are implemented. 00051 this->connect_strategy_ = TAO_LEADER_FOLLOWER_CONNECT; 00052 } |
|
Destructor.
Definition at line 54 of file default_client.cpp.
00055 { 00056 } |
|
Does the client allow any form of callback?
Reimplemented from TAO_Client_Strategy_Factory. Definition at line 367 of file default_client.cpp. References TAO_WAIT_ON_READ, and wait_strategy_.
00368 { 00369 return (this->wait_strategy_ != TAO_WAIT_ON_READ); 00370 } |
|
Return the selected connection strategy option.
Reimplemented from TAO_Client_Strategy_Factory. Definition at line 335 of file default_client.cpp.
00336 { 00337 return this->connect_strategy_; 00338 } |
|
Create the correct client strategy.
Reimplemented from TAO_Client_Strategy_Factory. Definition at line 341 of file default_client.cpp. References ACE_NEW_RETURN.
00342 { 00343 TAO_Connect_Strategy *cs = 0; 00344 00345 if (this->connect_strategy_ == TAO_BLOCKED_CONNECT) 00346 ACE_NEW_RETURN (cs, 00347 TAO_Blocked_Connect_Strategy (orb_core), 00348 0); 00349 else if (this->connect_strategy_ == TAO_REACTIVE_CONNECT) 00350 ACE_NEW_RETURN (cs, 00351 TAO_Reactive_Connect_Strategy (orb_core), 00352 0); 00353 else 00354 { 00355 // = Leader follower model. 00356 00357 ACE_NEW_RETURN (cs, 00358 TAO_LF_Connect_Strategy (orb_core), 00359 0); 00360 } 00361 00362 return cs; 00363 } |
|
Create a lock to be used by the TAO_Fault_Tolerant_Service class to generate unique retention ids Reimplemented from TAO_Client_Strategy_Factory. Definition at line 373 of file default_client.cpp. References ACE_NEW_RETURN.
00374 { 00375 ACE_Lock *the_lock = 0; 00376 00377 ACE_NEW_RETURN (the_lock, 00378 ACE_Lock_Adapter<TAO_SYNCH_MUTEX>, 00379 0); 00380 00381 return the_lock; 00382 } |
|
Create the lock for the stub and the profile Reimplemented from TAO_Client_Strategy_Factory. Definition at line 248 of file default_client.cpp. References ACE_NEW_RETURN, profile_lock_type_, and TAO_NULL_LOCK.
00249 { 00250 ACE_Lock *the_lock = 0; 00251 00252 if (this->profile_lock_type_ == TAO_NULL_LOCK) 00253 ACE_NEW_RETURN (the_lock, 00254 ACE_Lock_Adapter<ACE_SYNCH_NULL_MUTEX> (), 00255 0); 00256 else 00257 ACE_NEW_RETURN (the_lock, 00258 ACE_Lock_Adapter<TAO_SYNCH_MUTEX> (), 00259 0); 00260 00261 return the_lock; 00262 } |
|
Create the correct client request muxing strategy.
Reimplemented from TAO_Client_Strategy_Factory. Definition at line 266 of file default_client.cpp. References ACE_NEW_RETURN, TAO_MUXED_TMS, and transport_mux_strategy_.
00267 { 00268 TAO_Transport_Mux_Strategy *tms = 0; 00269 00270 if (this->transport_mux_strategy_ == TAO_MUXED_TMS) 00271 ACE_NEW_RETURN (tms, 00272 TAO_Muxed_TMS (transport), 00273 0); 00274 else 00275 ACE_NEW_RETURN (tms, 00276 TAO_Exclusive_TMS (transport), 00277 0); 00278 00279 return tms; 00280 } |
|
Create the correct lock for request muxing strategy.
Reimplemented from TAO_Client_Strategy_Factory. Definition at line 283 of file default_client.cpp. References ACE_NEW_RETURN, muxed_strategy_lock_type_, and TAO_NULL_LOCK.
00284 { 00285 ACE_Lock *the_lock = 0; 00286 00287 if (this->muxed_strategy_lock_type_ == TAO_NULL_LOCK) 00288 ACE_NEW_RETURN (the_lock, 00289 ACE_Lock_Adapter<ACE_SYNCH_NULL_MUTEX> (), 00290 0); 00291 else 00292 ACE_NEW_RETURN (the_lock, 00293 ACE_Lock_Adapter<TAO_SYNCH_RECURSIVE_MUTEX> (), 00294 0); 00295 00296 return the_lock; 00297 } |
|
Create the correct client strategy.
Reimplemented from TAO_Client_Strategy_Factory. Definition at line 306 of file default_client.cpp. References ACE_NEW_RETURN, TAO_WAIT_ON_LF_NO_UPCALL, TAO_WAIT_ON_REACTOR, TAO_WAIT_ON_READ, and wait_strategy_.
00307 { 00308 TAO_Wait_Strategy *ws = 0; 00309 00310 if (this->wait_strategy_ == TAO_WAIT_ON_READ) 00311 ACE_NEW_RETURN (ws, 00312 TAO_Wait_On_Read (transport), 00313 0); 00314 else if (this->wait_strategy_ == TAO_WAIT_ON_REACTOR) 00315 ACE_NEW_RETURN (ws, 00316 TAO_Wait_On_Reactor (transport), 00317 0); 00318 else if (this->wait_strategy_ == TAO_WAIT_ON_LF_NO_UPCALL) 00319 ACE_NEW_RETURN (ws, 00320 TAO::Wait_On_LF_No_Upcall (transport), 00321 0); 00322 else 00323 { 00324 // = Leader follower model. 00325 00326 ACE_NEW_RETURN (ws, 00327 TAO_Wait_On_Leader_Follower (transport), 00328 0); 00329 } 00330 00331 return ws; 00332 } |
|
Dynamic linking hook.
Reimplemented from ACE_Shared_Object. Definition at line 59 of file default_client.cpp. References parse_args().
00060 { 00061 return this->parse_args (argc, argv); 00062 } |
|
Parse svc.conf arguments.
Definition at line 65 of file default_client.cpp. References ACE_DEBUG, ACE_ERROR, ACE_TCHAR, ACE_TEXT, ACE_TRACE, ACE_OS::atoi(), LM_DEBUG, LM_ERROR, muxed_strategy_lock_type_, profile_lock_type_, rd_table_size_, report_option_value_error(), ACE_OS::strcasecmp(), ACE_OS::strcmp(), ACE_OS::strncmp(), TAO_EXCLUSIVE_TMS, TAO_MUXED_TMS, TAO_NULL_LOCK, TAO_THREAD_LOCK, TAO_WAIT_ON_LEADER_FOLLOWER, TAO_WAIT_ON_LF_NO_UPCALL, TAO_WAIT_ON_REACTOR, TAO_WAIT_ON_READ, transport_mux_strategy_, use_cleanup_options_, and wait_strategy_. Referenced by init().
00066 { 00067 ACE_TRACE ("TAO_Default_Client_Strategy_Factory::parse_args"); 00068 00069 int curarg; 00070 00071 for (curarg = 0; curarg < argc && argv[curarg]; ++curarg) 00072 { 00073 if (ACE_OS::strcasecmp (argv[curarg], 00074 ACE_TEXT("-ORBProfileLock")) == 0) 00075 { 00076 curarg++; 00077 if (curarg < argc) 00078 { 00079 ACE_TCHAR* name = argv[curarg]; 00080 00081 if (ACE_OS::strcasecmp (name, 00082 ACE_TEXT("thread")) == 0) 00083 this->profile_lock_type_ = TAO_THREAD_LOCK; 00084 else if (ACE_OS::strcasecmp (name, 00085 ACE_TEXT("null")) == 0) 00086 this->profile_lock_type_ = TAO_NULL_LOCK; 00087 else 00088 this->report_option_value_error (ACE_TEXT("-ORBProfileLock"), name); 00089 } 00090 } 00091 else if (ACE_OS::strcasecmp (argv[curarg], 00092 ACE_TEXT("-ORBIIOPProfileLock")) == 0) 00093 { 00094 ACE_DEBUG ((LM_DEBUG, 00095 ACE_TEXT ("WARNING: The -ORBIIOPProfileLock option") 00096 ACE_TEXT (" is deprecated and will be removed.\n") 00097 ACE_TEXT (" Please use -ORBProfileLock instead\n"))); 00098 curarg++; 00099 if (curarg < argc) 00100 { 00101 ACE_TCHAR* name = argv[curarg]; 00102 00103 if (ACE_OS::strcasecmp (name, 00104 ACE_TEXT("thread")) == 0) 00105 this->profile_lock_type_ = TAO_THREAD_LOCK; 00106 else if (ACE_OS::strcasecmp (name, 00107 ACE_TEXT("null")) == 0) 00108 this->profile_lock_type_ = TAO_NULL_LOCK; 00109 else 00110 this->report_option_value_error (ACE_TEXT("-ORBIIOPProfileLock"), name); 00111 } 00112 } 00113 00114 else if (ACE_OS::strcasecmp (argv[curarg], 00115 ACE_TEXT("-ORBClientConnectionHandler")) == 0 00116 || 00117 ACE_OS::strcasecmp (argv[curarg], 00118 ACE_TEXT("-ORBWaitStrategy")) == 0) 00119 { 00120 curarg++; 00121 if (curarg < argc) 00122 { 00123 ACE_TCHAR* name = argv[curarg]; 00124 00125 if (ACE_OS::strcasecmp (name, 00126 ACE_TEXT("MT")) == 0) 00127 this->wait_strategy_ = TAO_WAIT_ON_LEADER_FOLLOWER; 00128 else if (ACE_OS::strcasecmp (name, 00129 ACE_TEXT("ST")) == 0) 00130 this->wait_strategy_ = TAO_WAIT_ON_REACTOR; 00131 else if (ACE_OS::strcasecmp (name, 00132 ACE_TEXT("RW")) == 0) 00133 this->wait_strategy_ = TAO_WAIT_ON_READ; 00134 else if (ACE_OS::strcasecmp (name, 00135 ACE_TEXT("MT_NOUPCALL")) == 0) 00136 this->wait_strategy_ = TAO_WAIT_ON_LF_NO_UPCALL; 00137 else 00138 this->report_option_value_error (ACE_TEXT("-ORBClientConnectionHandler"), name); 00139 } 00140 } 00141 else if (ACE_OS::strcasecmp (argv[curarg], 00142 ACE_TEXT("-ORBTransportMuxStrategy")) == 0) 00143 { 00144 curarg++; 00145 if (curarg < argc) 00146 { 00147 ACE_TCHAR* name = argv[curarg]; 00148 00149 if (ACE_OS::strcasecmp (name, 00150 ACE_TEXT("MUXED")) == 0) 00151 this->transport_mux_strategy_ = TAO_MUXED_TMS; 00152 else if (ACE_OS::strcasecmp (name, 00153 ACE_TEXT("EXCLUSIVE")) == 0) 00154 this->transport_mux_strategy_ = TAO_EXCLUSIVE_TMS; 00155 else 00156 this->report_option_value_error (ACE_TEXT("-ORBTransportMuxStrategy"), name); 00157 } 00158 } 00159 else if (ACE_OS::strcasecmp (argv[curarg], 00160 ACE_TEXT("-ORBTransportMuxStrategyLock")) == 0) 00161 { 00162 curarg++; 00163 if (curarg < argc) 00164 { 00165 ACE_TCHAR* name = argv[curarg]; 00166 00167 if (ACE_OS::strcasecmp (name, 00168 ACE_TEXT("null")) == 0) 00169 this->muxed_strategy_lock_type_ = TAO_NULL_LOCK; 00170 else if (ACE_OS::strcasecmp (name, 00171 ACE_TEXT("thread")) == 0) 00172 this->muxed_strategy_lock_type_ = TAO_THREAD_LOCK; 00173 else 00174 this->report_option_value_error (ACE_TEXT("-ORBTransportMuxStrategyLock"), name); 00175 } 00176 } 00177 else if (ACE_OS::strcasecmp (argv[curarg], 00178 ACE_TEXT("-ORBConnectStrategy")) == 0) 00179 { 00180 curarg++; 00181 if (curarg < argc) 00182 { 00183 ACE_TCHAR* name = argv[curarg]; 00184 00185 if (ACE_OS::strcasecmp (name, 00186 ACE_TEXT("Blocked")) == 0) 00187 this->connect_strategy_ = TAO_BLOCKED_CONNECT; 00188 else if (ACE_OS::strcasecmp (name, 00189 ACE_TEXT("Reactive")) == 0) 00190 this->connect_strategy_ = TAO_REACTIVE_CONNECT; 00191 else if (ACE_OS::strcasecmp (name, 00192 ACE_TEXT("LF")) == 0) 00193 this->connect_strategy_ = TAO_LEADER_FOLLOWER_CONNECT; 00194 else 00195 this->report_option_value_error (ACE_TEXT("-ORBConnectStrategy"), name); 00196 } 00197 } 00198 else if (ACE_OS::strcasecmp (argv[curarg], 00199 ACE_TEXT("-ORBReplyDispatcherTableSize")) == 0) 00200 { 00201 curarg++; 00202 if (curarg < argc) 00203 { 00204 this->rd_table_size_ = ACE_OS::atoi (argv[curarg]); 00205 } 00206 } 00207 else if (ACE_OS::strcmp (argv[curarg], 00208 ACE_TEXT("-ORBConnectionHandlerCleanup")) == 0) 00209 { 00210 curarg++; 00211 if (curarg < argc) 00212 { 00213 ACE_TCHAR* name = argv[curarg]; 00214 00215 if (ACE_OS::strcmp (name, ACE_TEXT("0")) == 0 || 00216 ACE_OS::strcasecmp (name, ACE_TEXT("false")) == 0) 00217 this->use_cleanup_options_ = false; 00218 else if (ACE_OS::strcmp (name, ACE_TEXT("1")) == 0 || 00219 ACE_OS::strcasecmp (name, ACE_TEXT("true")) == 0) 00220 this->use_cleanup_options_ = true; 00221 else 00222 this->report_option_value_error (ACE_TEXT("-ORBConnectionHandlerCleanup"), name); 00223 } 00224 } 00225 else if (ACE_OS::strncmp (argv[curarg], ACE_TEXT("-ORB"), 4) == 0) 00226 { 00227 // Can we assume there is an argument after the option? 00228 // curarg++; 00229 ACE_ERROR ((LM_ERROR, 00230 "Client_Strategy_Factory - " 00231 "unknown option <%s>\n", 00232 argv[curarg])); 00233 } 00234 else 00235 { 00236 ACE_DEBUG ((LM_DEBUG, 00237 "Client_Strategy_Factory - " 00238 "ignoring option <%s>\n", 00239 argv[curarg])); 00240 } 00241 00242 00243 } 00244 return 0; 00245 } |
|
Return the size of the reply dispatcher table.
Reimplemented from TAO_Client_Strategy_Factory. Definition at line 300 of file default_client.cpp. References rd_table_size_.
00301 { 00302 return this->rd_table_size_; 00303 } |
|
Definition at line 385 of file default_client.cpp. References ACE_DEBUG, ACE_TEXT, and LM_DEBUG. Referenced by parse_args().
00388 { 00389 ACE_DEBUG((LM_DEBUG, 00390 ACE_TEXT ("Client_Strategy_Factory - unknown argument") 00391 ACE_TEXT (" <%s> for <%s>\n"), 00392 option_value, option_name)); 00393 } |
|
Cleanup options for wait strategy. Only applicable to RW wait strategy Reimplemented from TAO_Client_Strategy_Factory. Definition at line 396 of file default_client.cpp. References use_cleanup_options_.
00397 { 00398 return this->use_cleanup_options_; 00399 } |
|
The connection initiation strategy.
Definition at line 102 of file default_client.h. |
|
Type of lock for the muxed_strategy.
Definition at line 108 of file default_client.h. Referenced by create_transport_mux_strategy_lock(), and parse_args(). |
|
the lock type for forwarding IIOP Profile
Definition at line 79 of file default_client.h. Referenced by create_profile_lock(), and parse_args(). |
|
Size of the reply dispatcher table.
Definition at line 105 of file default_client.h. Referenced by parse_args(), and reply_dispatcher_table_size(). |
|
The client Request Mux Strategy.
Definition at line 88 of file default_client.h. Referenced by create_transport_mux_strategy(), parse_args(), and TAO_Default_Client_Strategy_Factory(). |
|
Cleanupoptions for RW strategy.
Definition at line 111 of file default_client.h. Referenced by parse_args(), and use_cleanup_options(). |
|
The wait-for-reply strategy.
Definition at line 99 of file default_client.h. Referenced by allow_callback(), create_wait_strategy(), parse_args(), and TAO_Default_Client_Strategy_Factory(). |