#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_Configurable_Refcount | create_profile_refcount (void) |
| Create the refcount for the profile. | |
| 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 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 388 of file default_client.cpp. References TAO_WAIT_ON_READ, and wait_strategy_.
00389 {
00390 return (this->wait_strategy_ != TAO_WAIT_ON_READ);
00391 }
|
|
|
Return the selected connection strategy option.
Reimplemented from TAO_Client_Strategy_Factory. Definition at line 356 of file default_client.cpp.
00357 {
00358 return this->connect_strategy_;
00359 }
|
|
|
Create the correct client strategy.
Reimplemented from TAO_Client_Strategy_Factory. Definition at line 362 of file default_client.cpp. References ACE_NEW_RETURN.
00363 {
00364 TAO_Connect_Strategy *cs = 0;
00365
00366 if (this->connect_strategy_ == TAO_BLOCKED_CONNECT)
00367 ACE_NEW_RETURN (cs,
00368 TAO_Blocked_Connect_Strategy (orb_core),
00369 0);
00370 else if (this->connect_strategy_ == TAO_REACTIVE_CONNECT)
00371 ACE_NEW_RETURN (cs,
00372 TAO_Reactive_Connect_Strategy (orb_core),
00373 0);
00374 else
00375 {
00376 // = Leader follower model.
00377
00378 ACE_NEW_RETURN (cs,
00379 TAO_LF_Connect_Strategy (orb_core),
00380 0);
00381 }
00382
00383 return cs;
00384 }
|
|
|
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, and profile_lock_type_.
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 refcount for the profile.
Reimplemented from TAO_Client_Strategy_Factory. Definition at line 265 of file default_client.cpp. References profile_lock_type_.
00266 {
00267 switch (this->profile_lock_type_)
00268 {
00269 case TAO_NULL_LOCK:
00270 return TAO_Configurable_Refcount (
00271 TAO_Configurable_Refcount::TAO_NULL_LOCK);
00272 case TAO_THREAD_LOCK:
00273 default:
00274 return TAO_Configurable_Refcount (
00275 TAO_Configurable_Refcount::TAO_THREAD_LOCK);
00276 }
00277 }
|
|
|
Create the correct client request muxing strategy.
Reimplemented from TAO_Client_Strategy_Factory. Definition at line 281 of file default_client.cpp. References ACE_NEW_RETURN, TAO_MUXED_TMS, and transport_mux_strategy_.
00282 {
00283 TAO_Transport_Mux_Strategy *tms = 0;
00284
00285 if (this->transport_mux_strategy_ == TAO_MUXED_TMS)
00286 ACE_NEW_RETURN (tms,
00287 TAO_Muxed_TMS (transport),
00288 0);
00289 else
00290 ACE_NEW_RETURN (tms,
00291 TAO_Exclusive_TMS (transport),
00292 0);
00293
00294 return tms;
00295 }
|
|
|
Create the correct lock for request muxing strategy.
Reimplemented from TAO_Client_Strategy_Factory. Definition at line 298 of file default_client.cpp. References ACE_NEW_RETURN, and muxed_strategy_lock_type_.
00299 {
00300 ACE_Lock *the_lock = 0;
00301
00302 if (this->muxed_strategy_lock_type_ == TAO_NULL_LOCK)
00303 ACE_NEW_RETURN (the_lock,
00304 ACE_Lock_Adapter<ACE_SYNCH_NULL_MUTEX> (),
00305 0);
00306 else
00307 ACE_NEW_RETURN (the_lock,
00308 ACE_Lock_Adapter<TAO_SYNCH_RECURSIVE_MUTEX> (),
00309 0);
00310
00311 return the_lock;
00312 }
|
|
|
Create the correct client strategy.
Reimplemented from TAO_Client_Strategy_Factory. Definition at line 321 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_.
00322 {
00323 TAO_Wait_Strategy *ws = 0;
00324
00325 /*
00326 * Hook to customize the wait strategy object when the concrete wait strategy
00327 * object is known a priori.
00328 */
00329 //@@ WAIT_STRATEGY_SPL_COMMENT_HOOK_START
00330 if (this->wait_strategy_ == TAO_WAIT_ON_READ)
00331 ACE_NEW_RETURN (ws,
00332 TAO_Wait_On_Read (transport),
00333 0);
00334 else if (this->wait_strategy_ == TAO_WAIT_ON_REACTOR)
00335 ACE_NEW_RETURN (ws,
00336 TAO_Wait_On_Reactor (transport),
00337 0);
00338 else if (this->wait_strategy_ == TAO_WAIT_ON_LF_NO_UPCALL)
00339 ACE_NEW_RETURN (ws,
00340 TAO::Wait_On_LF_No_Upcall (transport),
00341 0);
00342 else
00343 {
00344 // = Leader follower model.
00345
00346 ACE_NEW_RETURN (ws,
00347 TAO_Wait_On_Leader_Follower (transport),
00348 0);
00349 }
00350 //@@ WAIT_STRATEGY_SPL_COMMENT_HOOK_END
00351
00352 return ws;
00353 }
|
|
||||||||||||
|
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_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 315 of file default_client.cpp. References rd_table_size_.
00316 {
00317 return this->rd_table_size_;
00318 }
|
|
||||||||||||
|
Definition at line 394 of file default_client.cpp. References ACE_DEBUG, ACE_TEXT, and LM_DEBUG. Referenced by parse_args().
00397 {
00398 ACE_DEBUG((LM_DEBUG,
00399 ACE_TEXT ("Client_Strategy_Factory - unknown argument")
00400 ACE_TEXT (" <%s> for <%s>\n"),
00401 option_value, option_name));
00402 }
|
|
|
Cleanup options for wait strategy. Only applicable to RW wait strategy Reimplemented from TAO_Client_Strategy_Factory. Definition at line 405 of file default_client.cpp. References use_cleanup_options_.
00406 {
00407 return this->use_cleanup_options_;
00408 }
|
|
|
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(), create_profile_refcount(), 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(). |
1.3.6