This is the "default" client strategy factor for TAO. It includes strategies that are configured through command-line options so that everything operates as if there were no dynamically-linkable strategies. More...
#include <default_client.h>


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 transport 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 <wait_for_reply> strategy. | |
| virtual TAO_Connect_Strategy * | create_connect_strategy (TAO_ORB_Core *) |
| Create the correct client <asynch_connect> 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. | |
This is the "default" client strategy factor for TAO. It includes strategies that are configured through command-line options so that everything operates as if there were no dynamically-linkable strategies.
Definition at line 36 of file default_client.h.
enum TAO_Default_Client_Strategy_Factory::Lock_Type [private] |
Definition at line 72 of file default_client.h.
{
TAO_NULL_LOCK,
TAO_THREAD_LOCK
};
enum TAO_Default_Client_Strategy_Factory::Transport_Mux_Strategy [private] |
Definition at line 81 of file default_client.h.
{
TAO_MUXED_TMS,
TAO_EXCLUSIVE_TMS
};
enum TAO_Default_Client_Strategy_Factory::Wait_Strategy [private] |
| TAO_WAIT_ON_LEADER_FOLLOWER | |
| TAO_WAIT_ON_REACTOR | |
| TAO_WAIT_ON_READ | |
| TAO_WAIT_ON_LF_NO_UPCALL |
Definition at line 90 of file default_client.h.
{
TAO_WAIT_ON_LEADER_FOLLOWER,
TAO_WAIT_ON_REACTOR,
TAO_WAIT_ON_READ,
TAO_WAIT_ON_LF_NO_UPCALL
};
| TAO_Default_Client_Strategy_Factory::TAO_Default_Client_Strategy_Factory | ( | void | ) |
Constructor.
Definition at line 28 of file default_client.cpp.
: profile_lock_type_ (TAO_THREAD_LOCK) , transport_mux_strategy_ (TAO_MUXED_TMS) , wait_strategy_ (TAO_WAIT_ON_LEADER_FOLLOWER) , connect_strategy_ (TAO_LEADER_FOLLOWER_CONNECT) , rd_table_size_ (TAO_RD_TABLE_SIZE) , muxed_strategy_lock_type_ (TAO_THREAD_LOCK) , use_cleanup_options_ (false) { // Use single thread client connection handler #if defined (TAO_USE_ST_CLIENT_CONNECTION_HANDLER) this->wait_strategy_ = TAO_WAIT_ON_REACTOR; #elif defined (TAO_USE_WAIT_ON_LF_NO_UPCALL) this->wait_strategy_ = TAO_WAIT_ON_LF_NO_UPCALL; #else this->wait_strategy_ = TAO_WAIT_ON_LEADER_FOLLOWER; #endif /* TAO_USE_ST_CLIENT_CONNECTION_HANDLER */ #if TAO_USE_MUXED_TRANSPORT_MUX_STRATEGY == 1 this->transport_mux_strategy_ = TAO_MUXED_TMS; #else this->transport_mux_strategy_ = TAO_EXCLUSIVE_TMS; #endif /* TAO_USE_MUXED_TRANSPORT_MUX_STRATEGY */ // @todo: will be changed when other strategies are implemented. this->connect_strategy_ = TAO_LEADER_FOLLOWER_CONNECT; }
| TAO_Default_Client_Strategy_Factory::~TAO_Default_Client_Strategy_Factory | ( | void | ) | [virtual] |
| int TAO_Default_Client_Strategy_Factory::allow_callback | ( | void | ) | [virtual] |
Does the client allow any form of callback?
Reimplemented from TAO_Client_Strategy_Factory.
Definition at line 436 of file default_client.cpp.
{
return (this->wait_strategy_ != TAO_WAIT_ON_READ);
}
| TAO_Client_Strategy_Factory::Connect_Strategy TAO_Default_Client_Strategy_Factory::connect_strategy | ( | void | ) | const [virtual] |
Return the selected connection strategy option.
Reimplemented from TAO_Client_Strategy_Factory.
Definition at line 396 of file default_client.cpp.
{
return this->connect_strategy_;
}
| TAO_Connect_Strategy * TAO_Default_Client_Strategy_Factory::create_connect_strategy | ( | TAO_ORB_Core * | ) | [virtual] |
Create the correct client <asynch_connect> strategy.
Reimplemented from TAO_Client_Strategy_Factory.
Definition at line 402 of file default_client.cpp.
{
TAO_Connect_Strategy *cs = 0;
switch (this->connect_strategy_)
{
case TAO_BLOCKED_CONNECT:
{
ACE_NEW_RETURN (cs,
TAO_Blocked_Connect_Strategy (orb_core),
0);
break;
}
case TAO_REACTIVE_CONNECT:
{
ACE_NEW_RETURN (cs,
TAO_Reactive_Connect_Strategy (orb_core),
0);
break;
}
case TAO_LEADER_FOLLOWER_CONNECT :
{
ACE_NEW_RETURN (cs,
TAO_LF_Connect_Strategy (orb_core),
0);
break;
}
}
return cs;
}
| ACE_Lock * TAO_Default_Client_Strategy_Factory::create_profile_lock | ( | void | ) | [virtual] |
Create the lock for the stub and the profile
Reimplemented from TAO_Client_Strategy_Factory.
Definition at line 250 of file default_client.cpp.
{
ACE_Lock *the_lock = 0;
switch (this->profile_lock_type_)
{
case TAO_NULL_LOCK:
{
ACE_NEW_RETURN (the_lock,
ACE_Lock_Adapter<ACE_SYNCH_NULL_MUTEX> (),
0);
break;
}
case TAO_THREAD_LOCK:
{
ACE_NEW_RETURN (the_lock,
ACE_Lock_Adapter<TAO_SYNCH_MUTEX> (),
0);
break;
}
}
return the_lock;
}
| TAO_Configurable_Refcount TAO_Default_Client_Strategy_Factory::create_profile_refcount | ( | void | ) | [virtual] |
Create the refcount for the profile.
Reimplemented from TAO_Client_Strategy_Factory.
Definition at line 276 of file default_client.cpp.
{
switch (this->profile_lock_type_)
{
case TAO_NULL_LOCK:
return TAO_Configurable_Refcount (
TAO_Configurable_Refcount::TAO_NULL_LOCK);
case TAO_THREAD_LOCK:
default:
return TAO_Configurable_Refcount (
TAO_Configurable_Refcount::TAO_THREAD_LOCK);
}
}
| TAO_Transport_Mux_Strategy * TAO_Default_Client_Strategy_Factory::create_transport_mux_strategy | ( | TAO_Transport * | transport | ) | [virtual] |
Create the correct client transport muxing strategy.
Reimplemented from TAO_Client_Strategy_Factory.
Definition at line 292 of file default_client.cpp.
{
TAO_Transport_Mux_Strategy *tms = 0;
switch (this->transport_mux_strategy_)
{
case TAO_MUXED_TMS:
{
ACE_NEW_RETURN (tms,
TAO_Muxed_TMS (transport),
0);
break;
}
case TAO_EXCLUSIVE_TMS:
{
ACE_NEW_RETURN (tms,
TAO_Exclusive_TMS (transport),
0);
break;
}
}
return tms;
}
| ACE_Lock * TAO_Default_Client_Strategy_Factory::create_transport_mux_strategy_lock | ( | void | ) | [virtual] |
Create the correct lock for request muxing strategy.
Reimplemented from TAO_Client_Strategy_Factory.
Definition at line 318 of file default_client.cpp.
{
ACE_Lock *the_lock = 0;
switch (this->muxed_strategy_lock_type_)
{
case TAO_NULL_LOCK:
{
ACE_NEW_RETURN (the_lock,
ACE_Lock_Adapter<ACE_SYNCH_NULL_MUTEX> (),
0);
break;
}
case TAO_THREAD_LOCK:
{
ACE_NEW_RETURN (the_lock,
ACE_Lock_Adapter<TAO_SYNCH_RECURSIVE_MUTEX> (),
0);
break;
}
}
return the_lock;
}
| TAO_Wait_Strategy * TAO_Default_Client_Strategy_Factory::create_wait_strategy | ( | TAO_Transport * | transport | ) | [virtual] |
Create the correct client <wait_for_reply> strategy.
Reimplemented from TAO_Client_Strategy_Factory.
Definition at line 350 of file default_client.cpp.
{
TAO_Wait_Strategy *ws = 0;
/*
* Hook to customize the wait strategy object when the concrete wait strategy
* object is known a priori.
*/
//@@ WAIT_STRATEGY_SPL_COMMENT_HOOK_START
switch (this->wait_strategy_)
{
case TAO_WAIT_ON_LEADER_FOLLOWER :
{
ACE_NEW_RETURN (ws,
TAO_Wait_On_Leader_Follower (transport),
0);
break;
}
case TAO_WAIT_ON_REACTOR:
{
ACE_NEW_RETURN (ws,
TAO_Wait_On_Reactor (transport),
0);
break;
}
case TAO_WAIT_ON_READ:
{
ACE_NEW_RETURN (ws,
TAO_Wait_On_Read (transport),
0);
break;
}
case TAO_WAIT_ON_LF_NO_UPCALL:
{
ACE_NEW_RETURN (ws,
TAO::Wait_On_LF_No_Upcall (transport),
0);
break;
}
}
//@@ WAIT_STRATEGY_SPL_COMMENT_HOOK_END
return ws;
}
| int TAO_Default_Client_Strategy_Factory::init | ( | int | argc, | |
| ACE_TCHAR * | argv[] | |||
| ) | [virtual] |
Dynamic linking hook.
Reimplemented from ACE_Shared_Object.
Definition at line 61 of file default_client.cpp.
{
return this->parse_args (argc, argv);
}
| int TAO_Default_Client_Strategy_Factory::parse_args | ( | int | argc, | |
| ACE_TCHAR * | argv[] | |||
| ) |
Parse svc.conf arguments.
Definition at line 67 of file default_client.cpp.
{
ACE_TRACE ("TAO_Default_Client_Strategy_Factory::parse_args");
int curarg;
for (curarg = 0; curarg < argc && argv[curarg]; ++curarg)
{
if (ACE_OS::strcasecmp (argv[curarg],
ACE_TEXT("-ORBProfileLock")) == 0)
{
curarg++;
if (curarg < argc)
{
ACE_TCHAR* name = argv[curarg];
if (ACE_OS::strcasecmp (name,
ACE_TEXT("thread")) == 0)
this->profile_lock_type_ = TAO_THREAD_LOCK;
else if (ACE_OS::strcasecmp (name,
ACE_TEXT("null")) == 0)
this->profile_lock_type_ = TAO_NULL_LOCK;
else
this->report_option_value_error (ACE_TEXT("-ORBProfileLock"), name);
}
}
else if (ACE_OS::strcasecmp (argv[curarg],
ACE_TEXT("-ORBIIOPProfileLock")) == 0)
{
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("WARNING: The -ORBIIOPProfileLock option")
ACE_TEXT (" is deprecated and will be removed.\n")
ACE_TEXT (" Please use -ORBProfileLock instead\n")));
curarg++;
if (curarg < argc)
{
ACE_TCHAR* name = argv[curarg];
if (ACE_OS::strcasecmp (name,
ACE_TEXT("thread")) == 0)
this->profile_lock_type_ = TAO_THREAD_LOCK;
else if (ACE_OS::strcasecmp (name,
ACE_TEXT("null")) == 0)
this->profile_lock_type_ = TAO_NULL_LOCK;
else
this->report_option_value_error (ACE_TEXT("-ORBIIOPProfileLock"), name);
}
}
else if (ACE_OS::strcasecmp (argv[curarg],
ACE_TEXT("-ORBClientConnectionHandler")) == 0
||
ACE_OS::strcasecmp (argv[curarg],
ACE_TEXT("-ORBWaitStrategy")) == 0)
{
curarg++;
if (curarg < argc)
{
ACE_TCHAR* name = argv[curarg];
if (ACE_OS::strcasecmp (name,
ACE_TEXT("MT")) == 0)
this->wait_strategy_ = TAO_WAIT_ON_LEADER_FOLLOWER;
else if (ACE_OS::strcasecmp (name,
ACE_TEXT("ST")) == 0)
this->wait_strategy_ = TAO_WAIT_ON_REACTOR;
else if (ACE_OS::strcasecmp (name,
ACE_TEXT("RW")) == 0)
this->wait_strategy_ = TAO_WAIT_ON_READ;
else if (ACE_OS::strcasecmp (name,
ACE_TEXT("MT_NOUPCALL")) == 0)
this->wait_strategy_ = TAO_WAIT_ON_LF_NO_UPCALL;
else
this->report_option_value_error (ACE_TEXT("-ORBClientConnectionHandler"), name);
}
}
else if (ACE_OS::strcasecmp (argv[curarg],
ACE_TEXT("-ORBTransportMuxStrategy")) == 0)
{
curarg++;
if (curarg < argc)
{
ACE_TCHAR* name = argv[curarg];
if (ACE_OS::strcasecmp (name,
ACE_TEXT("MUXED")) == 0)
this->transport_mux_strategy_ = TAO_MUXED_TMS;
else if (ACE_OS::strcasecmp (name,
ACE_TEXT("EXCLUSIVE")) == 0)
this->transport_mux_strategy_ = TAO_EXCLUSIVE_TMS;
else
this->report_option_value_error (ACE_TEXT("-ORBTransportMuxStrategy"), name);
}
}
else if (ACE_OS::strcasecmp (argv[curarg],
ACE_TEXT("-ORBTransportMuxStrategyLock")) == 0)
{
curarg++;
if (curarg < argc)
{
ACE_TCHAR* name = argv[curarg];
if (ACE_OS::strcasecmp (name,
ACE_TEXT("null")) == 0)
this->muxed_strategy_lock_type_ = TAO_NULL_LOCK;
else if (ACE_OS::strcasecmp (name,
ACE_TEXT("thread")) == 0)
this->muxed_strategy_lock_type_ = TAO_THREAD_LOCK;
else
this->report_option_value_error (ACE_TEXT("-ORBTransportMuxStrategyLock"), name);
}
}
else if (ACE_OS::strcasecmp (argv[curarg],
ACE_TEXT("-ORBConnectStrategy")) == 0)
{
curarg++;
if (curarg < argc)
{
ACE_TCHAR* name = argv[curarg];
if (ACE_OS::strcasecmp (name,
ACE_TEXT("Blocked")) == 0)
this->connect_strategy_ = TAO_BLOCKED_CONNECT;
else if (ACE_OS::strcasecmp (name,
ACE_TEXT("Reactive")) == 0)
this->connect_strategy_ = TAO_REACTIVE_CONNECT;
else if (ACE_OS::strcasecmp (name,
ACE_TEXT("LF")) == 0)
this->connect_strategy_ = TAO_LEADER_FOLLOWER_CONNECT;
else
this->report_option_value_error (ACE_TEXT("-ORBConnectStrategy"), name);
}
}
else if (ACE_OS::strcasecmp (argv[curarg],
ACE_TEXT("-ORBReplyDispatcherTableSize")) == 0)
{
curarg++;
if (curarg < argc)
{
this->rd_table_size_ = ACE_OS::atoi (argv[curarg]);
}
}
else if (ACE_OS::strcmp (argv[curarg],
ACE_TEXT("-ORBConnectionHandlerCleanup")) == 0)
{
curarg++;
if (curarg < argc)
{
ACE_TCHAR* name = argv[curarg];
if (ACE_OS::strcmp (name, ACE_TEXT("0")) == 0 ||
ACE_OS::strcasecmp (name, ACE_TEXT("false")) == 0)
this->use_cleanup_options_ = false;
else if (ACE_OS::strcmp (name, ACE_TEXT("1")) == 0 ||
ACE_OS::strcasecmp (name, ACE_TEXT("true")) == 0)
this->use_cleanup_options_ = true;
else
this->report_option_value_error (ACE_TEXT("-ORBConnectionHandlerCleanup"), name);
}
}
else if (ACE_OS::strncmp (argv[curarg], ACE_TEXT("-ORB"), 4) == 0)
{
// Can we assume there is an argument after the option?
// curarg++;
ACE_ERROR ((LM_ERROR,
"Client_Strategy_Factory - "
"unknown option <%s>\n",
argv[curarg]));
}
else
{
ACE_DEBUG ((LM_DEBUG,
"Client_Strategy_Factory - "
"ignoring option <%s>\n",
argv[curarg]));
}
}
return 0;
}
| int TAO_Default_Client_Strategy_Factory::reply_dispatcher_table_size | ( | void | ) | const [virtual] |
Return the size of the reply dispatcher table.
Reimplemented from TAO_Client_Strategy_Factory.
Definition at line 344 of file default_client.cpp.
{
return this->rd_table_size_;
}
| void TAO_Default_Client_Strategy_Factory::report_option_value_error | ( | const ACE_TCHAR * | option_name, | |
| const ACE_TCHAR * | option_value | |||
| ) | [protected] |
Definition at line 442 of file default_client.cpp.
| bool TAO_Default_Client_Strategy_Factory::use_cleanup_options | ( | void | ) | const [virtual] |
Cleanup options for wait strategy.
Only applicable to RW wait strategy
Reimplemented from TAO_Client_Strategy_Factory.
Definition at line 453 of file default_client.cpp.
{
return this->use_cleanup_options_;
}
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.
the lock type for forwarding IIOP Profile
Definition at line 79 of file default_client.h.
int TAO_Default_Client_Strategy_Factory::rd_table_size_ [private] |
Size of the reply dispatcher table.
Definition at line 105 of file default_client.h.
The client Request Mux Strategy.
Definition at line 88 of file default_client.h.
bool TAO_Default_Client_Strategy_Factory::use_cleanup_options_ [private] |
Cleanupoptions for RW strategy.
Definition at line 111 of file default_client.h.
The wait-for-reply strategy.
Definition at line 99 of file default_client.h.
1.7.0