This is the default strategy factory for CORBA servers. It allows developers to choose strategies via argument flags. This design gives substantial freedom for experimentation. More...
#include <default_server.h>
Public Member Functions | |
TAO_Default_Server_Strategy_Factory (void) | |
virtual | ~TAO_Default_Server_Strategy_Factory (void) |
virtual int | init (int argc, ACE_TCHAR *argv[]) |
virtual int | open (TAO_ORB_Core *) |
virtual int | enable_poa_locking (void) |
Enable POA locking? | |
virtual int | activate_server_connections (void) |
Are server connections active (i.e. run in their own thread). | |
virtual int | thread_per_connection_timeout (ACE_Time_Value &timeout) |
virtual int | server_connection_thread_flags (void) |
The thread activation parameters. | |
virtual int | server_connection_thread_count (void) |
int | parse_args (int argc, ACE_TCHAR *argv[]) |
Protected Types | |
enum | Lock_Type { TAO_NULL_LOCK, TAO_THREAD_LOCK } |
Protected Member Functions | |
void | tokenize (ACE_TCHAR *flag_string) |
void | report_option_value_error (const ACE_TCHAR *option_name, const ACE_TCHAR *option_value) |
Protected Attributes | |
int | activate_server_connections_ |
Should the server connection handlers run in their own thread? | |
int | thread_flags_ |
Default thread flags passed to thr_create(). | |
Lock_Type | poa_lock_type_ |
The type of lock to be returned by <create_poa_lock()>. | |
int | thread_per_connection_use_timeout_ |
The timeout flag and value for the thread-per-connection model. | |
ACE_Time_Value | thread_per_connection_timeout_ |
This is the default strategy factory for CORBA servers. It allows developers to choose strategies via argument flags. This design gives substantial freedom for experimentation.
Definition at line 38 of file default_server.h.
enum TAO_Default_Server_Strategy_Factory::Lock_Type [protected] |
Definition at line 75 of file default_server.h.
{ TAO_NULL_LOCK, TAO_THREAD_LOCK };
TAO_Default_Server_Strategy_Factory::TAO_Default_Server_Strategy_Factory | ( | void | ) |
Definition at line 14 of file default_server.cpp.
: activate_server_connections_ (0), thread_flags_ (THR_BOUND | THR_DETACHED), poa_lock_type_ (TAO_THREAD_LOCK), thread_per_connection_use_timeout_ (-1) { }
TAO_Default_Server_Strategy_Factory::~TAO_Default_Server_Strategy_Factory | ( | void | ) | [virtual] |
Definition at line 22 of file default_server.cpp.
{
// Perform appropriate cleanup.
}
int TAO_Default_Server_Strategy_Factory::activate_server_connections | ( | void | ) | [virtual] |
Are server connections active (i.e. run in their own thread).
Reimplemented from TAO_Server_Strategy_Factory.
Definition at line 41 of file default_server.cpp.
{ return this->activate_server_connections_; }
int TAO_Default_Server_Strategy_Factory::enable_poa_locking | ( | void | ) | [virtual] |
Enable POA locking?
Reimplemented from TAO_Server_Strategy_Factory.
Definition at line 28 of file default_server.cpp.
{ switch (this->poa_lock_type_) { case TAO_NULL_LOCK: return 0; case TAO_THREAD_LOCK: default: return 1; } }
int TAO_Default_Server_Strategy_Factory::init | ( | int | argc, | |
ACE_TCHAR * | argv[] | |||
) | [virtual] |
Reimplemented from ACE_Shared_Object.
Definition at line 98 of file default_server.cpp.
{ return this->parse_args (argc, argv); }
int TAO_Default_Server_Strategy_Factory::open | ( | TAO_ORB_Core * | orb_core | ) | [virtual] |
Call <open> on various strategies. This is not performed in <init> so that the other portions of the ORB have a chance to "settle" in their initialization since the streategies herein might need some of that information.
Reimplemented from TAO_Server_Strategy_Factory.
Definition at line 104 of file default_server.cpp.
{
return 0;
}
int TAO_Default_Server_Strategy_Factory::parse_args | ( | int | argc, | |
ACE_TCHAR * | argv[] | |||
) |
Parse the arguments, check the documentation in $TAO_ROOT/docs/Options.html for details
Definition at line 110 of file default_server.cpp.
{ ACE_TRACE ("TAO_Default_Server_Strategy_Factory::parse_args"); int curarg; for (curarg = 0; curarg < argc && argv[curarg]; ++curarg) if (ACE_OS::strcasecmp (argv[curarg], ACE_TEXT("-ORBConcurrency")) == 0) { ++curarg; if (curarg < argc) { ACE_TCHAR* name = argv[curarg]; if (ACE_OS::strcasecmp (name, ACE_TEXT("reactive")) == 0) this->activate_server_connections_ = 0; else if (ACE_OS::strcasecmp (name, ACE_TEXT("thread-per-connection")) == 0) this->activate_server_connections_ = 1; else this->report_option_value_error (ACE_TEXT("-ORBConcurrency"), name); } } else if (ACE_OS::strcasecmp (argv[curarg], ACE_TEXT("-ORBThreadPerConnectionTimeout")) == 0) { ++curarg; if (curarg < argc) { ACE_TCHAR* name = argv[curarg]; if (ACE_OS::strcasecmp (name, ACE_TEXT("infinite")) == 0) { this->thread_per_connection_use_timeout_ = 0; } else { this->thread_per_connection_use_timeout_ = 1; int milliseconds = ACE_OS::atoi (name); this->thread_per_connection_timeout_.set (0, 1000 * milliseconds); } } } else if (ACE_OS::strcasecmp (argv[curarg], ACE_TEXT("-ORBTableSize")) == 0 || ACE_OS::strcasecmp (argv[curarg], ACE_TEXT("-ORBActiveObjectMapSize")) == 0) { ++curarg; if (curarg < argc) this->active_object_map_creation_parameters_.active_object_map_size_ = ACE_OS::strtoul (argv[curarg], 0, 10); } else if (ACE_OS::strcasecmp (argv[curarg], ACE_TEXT("-ORBPOAMapSize")) == 0) { ++curarg; if (curarg < argc) this->active_object_map_creation_parameters_.poa_map_size_ = ACE_OS::strtoul (argv[curarg], 0, 10); } else if (ACE_OS::strcasecmp (argv[curarg], ACE_TEXT("-ORBActiveHintInIds")) == 0) { ++curarg; if (curarg < argc) { ACE_TCHAR* value = argv[curarg]; this->active_object_map_creation_parameters_.use_active_hint_in_ids_ = ACE_OS::atoi (value); } } else if (ACE_OS::strcasecmp (argv[curarg], ACE_TEXT("-ORBActiveHintInPOANames")) == 0) { ++curarg; if (curarg < argc) { ACE_TCHAR* value = argv[curarg]; this->active_object_map_creation_parameters_.use_active_hint_in_poa_names_ = ACE_OS::atoi (value); } } else if (ACE_OS::strcasecmp (argv[curarg], ACE_TEXT("-ORBAllowReactivationOfSystemids")) == 0) { ++curarg; if (curarg < argc) { ACE_TCHAR* value = argv[curarg]; this->active_object_map_creation_parameters_.allow_reactivation_of_system_ids_ = ACE_OS::atoi (value); } } else if (ACE_OS::strcasecmp (argv[curarg], ACE_TEXT("-ORBUseridPolicyDemuxStrategy")) == 0) { ++curarg; if (curarg < argc) { ACE_TCHAR* name = argv[curarg]; // Active demux not supported with user id policy. if (ACE_OS::strcasecmp (name, ACE_TEXT("dynamic")) == 0) this->active_object_map_creation_parameters_.object_lookup_strategy_for_user_id_policy_ = TAO_DYNAMIC_HASH; else if (ACE_OS::strcasecmp (name, ACE_TEXT("linear")) == 0) this->active_object_map_creation_parameters_.object_lookup_strategy_for_user_id_policy_ = TAO_LINEAR; else this->report_option_value_error (ACE_TEXT("-ORBUseridPolicyDemuxStrategy"), name); } } else if (ACE_OS::strcasecmp (argv[curarg], ACE_TEXT("-ORBSystemidPolicyDemuxStrategy")) == 0) { ++curarg; if (curarg < argc) { ACE_TCHAR* name = argv[curarg]; if (ACE_OS::strcasecmp (name, ACE_TEXT("dynamic")) == 0) this->active_object_map_creation_parameters_.object_lookup_strategy_for_system_id_policy_ = TAO_DYNAMIC_HASH; else if (ACE_OS::strcasecmp (name, ACE_TEXT("linear")) == 0) this->active_object_map_creation_parameters_.object_lookup_strategy_for_system_id_policy_ = TAO_LINEAR; else if (ACE_OS::strcasecmp (name, ACE_TEXT("active")) == 0) this->active_object_map_creation_parameters_.object_lookup_strategy_for_system_id_policy_ = TAO_ACTIVE_DEMUX; else this->report_option_value_error (ACE_TEXT("-ORBSystemidPolicyDemuxStrategy"), name); } } else if (ACE_OS::strcasecmp (argv[curarg], ACE_TEXT("-ORBPersistentidPolicyDemuxStrategy")) == 0) { ++curarg; if (curarg < argc) { ACE_TCHAR* name = argv[curarg]; // Active demux not supported with user id policy. if (ACE_OS::strcasecmp (name, ACE_TEXT("dynamic")) == 0) this->active_object_map_creation_parameters_.poa_lookup_strategy_for_persistent_id_policy_ = TAO_DYNAMIC_HASH; else if (ACE_OS::strcasecmp (name, ACE_TEXT("linear")) == 0) this->active_object_map_creation_parameters_.poa_lookup_strategy_for_persistent_id_policy_ = TAO_LINEAR; else this->report_option_value_error (ACE_TEXT("-ORBPersistentidPolicyDemuxStrategy"), name); } } else if (ACE_OS::strcasecmp (argv[curarg], ACE_TEXT("-ORBTransientidPolicyDemuxStrategy")) == 0) { ++curarg; if (curarg < argc) { ACE_TCHAR* name = argv[curarg]; if (ACE_OS::strcasecmp (name, ACE_TEXT("dynamic")) == 0) this->active_object_map_creation_parameters_.poa_lookup_strategy_for_transient_id_policy_ = TAO_DYNAMIC_HASH; else if (ACE_OS::strcasecmp (name, ACE_TEXT("linear")) == 0) this->active_object_map_creation_parameters_.poa_lookup_strategy_for_transient_id_policy_ = TAO_LINEAR; else if (ACE_OS::strcasecmp (name, ACE_TEXT("active")) == 0) this->active_object_map_creation_parameters_.poa_lookup_strategy_for_transient_id_policy_ = TAO_ACTIVE_DEMUX; else this->report_option_value_error (ACE_TEXT("-ORBTransientidPolicyDemuxStrategy"), name); } } else if (ACE_OS::strcasecmp (argv[curarg], ACE_TEXT("-ORBUniqueidPolicyReverseDemuxStrategy")) == 0) { ++curarg; if (curarg < argc) { ACE_TCHAR* name = argv[curarg]; if (ACE_OS::strcasecmp (name, ACE_TEXT("dynamic")) == 0) this->active_object_map_creation_parameters_.reverse_object_lookup_strategy_for_unique_id_policy_ = TAO_DYNAMIC_HASH; else if (ACE_OS::strcasecmp (name, ACE_TEXT("linear")) == 0) this->active_object_map_creation_parameters_.reverse_object_lookup_strategy_for_unique_id_policy_ = TAO_LINEAR; else this->report_option_value_error (ACE_TEXT("-ORBUniqueidPolicyReverseDemuxStrategy"), name); } } else if (ACE_OS::strcasecmp (argv[curarg], ACE_TEXT("-ORBPOALock")) == 0) { ++curarg; if (curarg < argc) { ACE_TCHAR* name = argv[curarg]; if (ACE_OS::strcasecmp (name, ACE_TEXT("thread")) == 0) this->poa_lock_type_ = TAO_THREAD_LOCK; else if (ACE_OS::strcasecmp (name, ACE_TEXT("null")) == 0) this->poa_lock_type_ = TAO_NULL_LOCK; else this->report_option_value_error (ACE_TEXT("-ORBPOALock"), name); } } else if (ACE_OS::strcasecmp (argv[curarg], ACE_TEXT("-ORBThreadFlags")) == 0) { ++curarg; if (curarg < argc) this->tokenize (argv[curarg]); } 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, ACE_TEXT("Server_Strategy_Factory - ") ACE_TEXT("unknown option <%s>\n"), argv[curarg])); } else { ACE_DEBUG ((LM_DEBUG, ACE_TEXT("Server_Strategy_Factory - ") ACE_TEXT("ignoring option <%s>\n"), argv[curarg])); } return 0; }
void TAO_Default_Server_Strategy_Factory::report_option_value_error | ( | const ACE_TCHAR * | option_name, | |
const ACE_TCHAR * | option_value | |||
) | [protected] |
Definition at line 375 of file default_server.cpp.
int TAO_Default_Server_Strategy_Factory::server_connection_thread_count | ( | void | ) | [virtual] |
Reimplemented from TAO_Server_Strategy_Factory.
Definition at line 60 of file default_server.cpp.
{
return 1;
}
int TAO_Default_Server_Strategy_Factory::server_connection_thread_flags | ( | void | ) | [virtual] |
The thread activation parameters.
Reimplemented from TAO_Server_Strategy_Factory.
Definition at line 54 of file default_server.cpp.
{ return this->thread_flags_; }
int TAO_Default_Server_Strategy_Factory::thread_per_connection_timeout | ( | ACE_Time_Value & | timeout | ) | [virtual] |
Obtain the timeout value used by the thread-per-connection server threads to poll the shutdown flag in the ORB. Return -1 if the ORB should use the compile-time defaults. If the return value is zero then the threads block without timeouts.
Reimplemented from TAO_Server_Strategy_Factory.
Definition at line 47 of file default_server.cpp.
{ timeout = this->thread_per_connection_timeout_; return this->thread_per_connection_use_timeout_; }
void TAO_Default_Server_Strategy_Factory::tokenize | ( | ACE_TCHAR * | flag_string | ) | [protected] |
Definition at line 73 of file default_server.cpp.
{ ACE_TCHAR* lasts = 0; for (ACE_TCHAR* flag = ACE_OS::strtok_r (flag_string, ACE_TEXT("|"), &lasts); flag != 0; flag = ACE_OS::strtok_r (0, ACE_TEXT("|"), &lasts)) { TAO_BEGINCHECK; TAO_CHECKANDSET (THR_DETACHED); TAO_CHECKANDSET (THR_BOUND); TAO_CHECKANDSET (THR_NEW_LWP); TAO_CHECKANDSET (THR_SUSPENDED); #if !defined (ACE_WIN32) TAO_CHECKANDSET (THR_DAEMON); #endif /* ACE_WIN32 */ TAO_ENDCHECK; } }
Should the server connection handlers run in their own thread?
Definition at line 70 of file default_server.h.
The type of lock to be returned by <create_poa_lock()>.
Definition at line 82 of file default_server.h.
int TAO_Default_Server_Strategy_Factory::thread_flags_ [protected] |
Default thread flags passed to thr_create().
Definition at line 73 of file default_server.h.
Definition at line 86 of file default_server.h.
The timeout flag and value for the thread-per-connection model.
Definition at line 85 of file default_server.h.