diff options
Diffstat (limited to 'TAO/tao/ORB_Core.cpp')
-rw-r--r-- | TAO/tao/ORB_Core.cpp | 643 |
1 files changed, 256 insertions, 387 deletions
diff --git a/TAO/tao/ORB_Core.cpp b/TAO/tao/ORB_Core.cpp index eabfb4afdf0..a915b77e1e3 100644 --- a/TAO/tao/ORB_Core.cpp +++ b/TAO/tao/ORB_Core.cpp @@ -1,7 +1,6 @@ // $Id$ #include "tao/ORB_Core.h" -#include "tao/ORB.h" #include "ace/Env_Value_T.h" #include "ace/Arg_Shifter.h" @@ -17,13 +16,6 @@ # include "tao/ORB_Core.i" #endif /* ! __ACE_INLINE__ */ -#include "tao/Connector_Registry.h" -#include "tao/Acceptor_Registry.h" - -#include "ace/Env_Value_T.h" -#include "ace/Dynamic_Service.h" -#include "ace/Arg_Shifter.h" - ACE_RCSID(tao, ORB_Core, "$Id$") typedef ACE_TSS_Singleton<TAO_ORB_Core_TSS_Resources, ACE_SYNCH_MUTEX> @@ -41,44 +33,39 @@ CORBA::default_environment () // **************************************************************** -TAO_ORB_Core::TAO_ORB_Core (const char* orbid) +TAO_ORB_Core::TAO_ORB_Core (void) : thr_mgr_ (0), connector_registry_ (0), - acceptor_registry_ (0), - protocol_factories_ (0), root_poa_ (0), orb_params_ (0), - orbid_ (ACE_OS::strdup (orbid?orbid:"")), + acceptor_ (0), resource_factory_ (0), resource_factory_from_service_config_ (0), - // @@ This is not needed since the default resource factory, fredk - // is staticaly added to the service configurator. client_factory_ (0), client_factory_from_service_config_ (0), - // @@ This is not needed since the default client factory, fredk - // is staticaly added to the service configurator. server_factory_ (0), server_factory_from_service_config_ (0), - // @@ This is not needed since the default server factory, fredk - // is staticaly added to the service configurator. opt_for_collocation_ (1), - use_global_collocation_ (1) +#if defined (TAO_ARL_USES_SAME_CONNECTOR_PORT) + arl_same_port_connect_ (0), +#endif /* TAO_ARL_USES_SAME_CONNECTOR_PORT */ + preconnections_ (0) { - ACE_NEW (this->poa_current_, - TAO_POA_Current); } TAO_ORB_Core::~TAO_ORB_Core (void) { + // This should probably be changed to use the allocator internal to + // here once that chunk is actually implemented. + if (preconnections_) + ACE_OS::free (preconnections_); + // Allocated in init() delete this->orb_params_; - - ACE_OS::free (this->orbid_); } int -TAO_ORB_Core::add_to_ior_table (ACE_CString init_ref, - TAO_IOR_LookupTable &table) +TAO_ORB_Core::add_to_ior_table (ACE_CString init_ref, TAO_IOR_LookupTable &table) { int index = 0; if ((index = init_ref.find ("=")) == ACE_CString::npos) @@ -111,11 +98,9 @@ TAO_ORB_Core::init (int &argc, char *argv[]) // arguments and stash it for use initializing other components such // as the ACE_Service_Config or the RootPOA. // - // Prepare a copy of the argument vector for the service configurator. + // Prepare a copy of the argument vector. char **svc_config_argv; - // @@ depricated - int old_style_endpoint = 0; int svc_config_argc = 0; ACE_NEW_RETURN (svc_config_argv, char *[argc + 1], 0); @@ -128,27 +113,15 @@ TAO_ORB_Core::init (int &argc, char *argv[]) argv0 = argv[0]; svc_config_argv[svc_config_argc++] = CORBA::string_dup (argv0); - // Initialize the container for the ORB parameters. - // orb_params_ must be initialized before the command line parsing loop - // since some of the parsing code expects it to have been already - // initialized. - if (this->orb_params_ == 0) - ACE_NEW_RETURN (this->orb_params_, TAO_ORB_Parameters, 0); - - // @@ This should be an IIOP default, more generally each - // loaded protocol should have it's own default defined by the - // implemention. This is currently defined to be a zero, fredk ACE_Env_Value<int> defport ("TAO_DEFAULT_SERVER_PORT", TAO_DEFAULT_SERVER_PORT); ACE_CString host; CORBA::UShort port = defport; - - // @@ GIOPLite should be an alternative ORB Messaging protocols, fredk - int giop_lite = 0; - CORBA::Boolean use_ior = 1; int cdr_tradeoff = ACE_DEFAULT_CDR_MEMCPY_TRADEOFF; + int giop_lite = 0; + // The following things should be changed to use the ACE_Env_Value<> // template sometime. @@ -170,30 +143,22 @@ TAO_ORB_Core::init (int &argc, char *argv[]) // List of comma separated prefixes from ORBDefaultInitRef. ACE_CString default_init_ref; - // Name Service port use for Multicast + // Name Service port #. u_short ns_port = 0; // Trading Service IOR string. ACE_CString ts_ior; - // Trading Service port used for Multicast + // Trading Service port #. u_short ts_port = 0; // Buffer sizes for kernel socket buffers - // @@ should be a default defined for each protocol implementation? - // since we may have protocols loaded which use shared memory of - // some form, fredk size_t rcv_sock_size = 0; size_t snd_sock_size = 0; - // Should we skip the <ACE_Service_Config::open> method, e.g., if we - // already being configured by the ACE Service Configurator. - int skip_service_config_open = 0; + char *preconnections = 0; // Use dotted decimal addresses - // @@ This option will be treated as a suggestion to each loaded protocol to - // @@ use a character representation for the numeric address, otherwise - // @@ use a logical name. fredk #if defined (TAO_USE_DOTTED_DECIMAL_ADDRESSES) int dotted_decimal_addresses = 1; #else @@ -228,7 +193,6 @@ TAO_ORB_Core::init (int &argc, char *argv[]) else if (ACE_OS::strcmp (current_arg, "-ORBdotteddecimaladdresses") == 0) { // Use dotted decimal addresses - // @@ this should be renamed. See above comment. fredk arg_shifter.consume_arg (); if (arg_shifter.is_parameter_next ()) { @@ -254,68 +218,12 @@ TAO_ORB_Core::init (int &argc, char *argv[]) arg_shifter.consume_arg (); } } - - else if (ACE_OS::strcmp (current_arg, "-ORBendpoint") == 0) - { - // Each "endpoint" is of the form: - // - // protocol://V.v@addr1,addr2,...,addrN - // - // or: - // - // protocol://addr1,addr2,...,addrN - // - // where "V.v" is an optional protocol version for each - // addr. All preconnect or endpoint strings should be of - // the above form(s). - // - // Multiple sets of endpoint may be seperated by a semi-colon `;'. - // For example: - // - // iioploc://space:2001,1.2@odyssey:2010;uiop://foo,bar - // - // All preconnect or endpoint strings should be of the above form(s). - - arg_shifter.consume_arg (); - - if (arg_shifter.is_parameter_next()) - { - ACE_CString endpts (arg_shifter.get_current ()); - - if (this->orb_params ()->endpoints (endpts) != 0) - { - ACE_ERROR_RETURN ((LM_ERROR, - "(%P|%t)\n" - "Invalid endpoint(s) specified:\n%s\n", - endpts.c_str ()), - -1); - } - - arg_shifter.consume_arg (); - } - } - else if (ACE_OS::strcmp (current_arg, "-ORBhost") == 0) { - // @@ Fred&Carlos: This option now has the same effect as specifying - // an extra -ORBendpoint. Ideally, this option - // should be removed so that all INET specific - // stuff can be removed from the ORB core but I - // guess we need to leave it here for backward - // compatibility. C'est la vie. - - old_style_endpoint = 1; // Specify the name of the host (i.e., interface) on which // the server should listen. arg_shifter.consume_arg (); - // Issue a warning since this backward compatibilty support - // may be dropped in future releases. - - ACE_DEBUG ((LM_WARNING, - "(%P|%t) \nWARNING: The `-ORBhost' option is obsolete.\n" - "In the future, use the `-ORBendpoint' option.\n")); - if (arg_shifter.is_parameter_next()) { host = arg_shifter.get_current (); @@ -336,7 +244,6 @@ TAO_ORB_Core::init (int &argc, char *argv[]) else if (ACE_OS::strcmp (current_arg, "-ORBnameserviceport") == 0) { // Specify the port number for the NameService. - // Unrelated to ORB Protocols, this is used for multicast. arg_shifter.consume_arg (); if (arg_shifter.is_parameter_next ()) @@ -369,14 +276,6 @@ TAO_ORB_Core::init (int &argc, char *argv[]) } else if (ACE_OS::strcmp (current_arg, "-ORBport") == 0) { - // Issue a warning since this backward compatibilty support - // may be dropped in future releases. - - old_style_endpoint = 1; - ACE_DEBUG ((LM_WARNING, - "(%P|%t) \nWARNING: The `-ORBport' option is obsolete.\n" - "In the future, use the `-ORBendpoint' option.\n")); - // Specify the port number/name on which we should listen arg_shifter.consume_arg (); if (arg_shifter.is_parameter_next ()) @@ -389,10 +288,6 @@ TAO_ORB_Core::init (int &argc, char *argv[]) } else if (ACE_OS::strcmp (current_arg, "-ORBrcvsock") == 0) { - // @@ All protocol implementation may not use sockets, so - // this can either be a generic I/O Buffer size or - // Buffer info can be a per protocol specification, fredk - arg_shifter.consume_arg (); // Specify the size of the socket's receive buffer @@ -404,10 +299,6 @@ TAO_ORB_Core::init (int &argc, char *argv[]) } else if (ACE_OS::strcmp (current_arg, "-ORBsndsock") == 0) { - // @@ All protocol implementation may not use sockets, so - // this can either be a generic I/O Buffer size or - // Buffer info can be a per protocol specification, fredk - arg_shifter.consume_arg (); // Specify the size of the socket's send buffer if (arg_shifter.is_parameter_next ()) @@ -447,7 +338,6 @@ TAO_ORB_Core::init (int &argc, char *argv[]) arg_shifter.consume_arg (); } } - else if (ACE_OS::strcmp (current_arg, "-ORBcollocation") == 0) // Specify whether we want to optimize against collocation // objects. Valid arguments are: "yes" and "no". Default is @@ -465,82 +355,24 @@ TAO_ORB_Core::init (int &argc, char *argv[]) arg_shifter.consume_arg (); } } - - // @@ Ossama: could you add this option to the Options.html - // file? And could you also remove from the .html file the - // stuff we took out of the default server strategy factory - // and the default resource factory? - else if (ACE_OS::strcmp (current_arg, "-ORBglobalcollocation") == 0) - // Specify whether we want to use collocation across ORBs; - // i.e. all the ORBs in the same address space use collocated - // calls. - { - arg_shifter.consume_arg (); - if (arg_shifter.is_parameter_next ()) - { - char *opt = arg_shifter.get_current (); - if (ACE_OS::strcasecmp (opt, "YES") == 0) - this->use_global_collocation_ = 1; - else if (ACE_OS::strcasecmp (opt, "NO") == 0) - this->use_global_collocation_ = 0; - - arg_shifter.consume_arg (); - } - } - else if (ACE_OS::strcmp (current_arg, "-ORBpreconnect") == 0) { arg_shifter.consume_arg (); - - // Get a string which describes the connections we want to - // cache up-front, thus reducing the latency of the first call. - // - // For example, specify -ORBpreconnect once for each - // protocol: - // - // -ORBpreconnect iiop://tango:10015,watusi:10016 - // -ORBpreconnect busX_iop://board1:0x07450000,board2,0x08450000 + // Get a string which describes the host/port of connections + // we want to cache up-front, thus reducing the latency of + // the first call. It is specified as a comma-separated + // list of host:port specifications, and if multiple + // connections to the same port are desired, they must be + // specified multiple times. For example, the following + // connects to tango:10015 twice, and watusi:10016 once: // - // Or chain all possible endpoint designations together: - // - // -ORBpreconnect iiop://tango:10015,watusi:10016/; - // busX_iop://board1:0x07450000,board2,0x08450000/ - // - // The old style command line only works for IIOP: // -ORBpreconnect tango:10015,tango:10015,watusi:10016 - if (arg_shifter.is_parameter_next ()) { - ACE_CString preconnections (arg_shifter.get_current ()); - - if (this->orb_params ()->preconnects (preconnections) != 0) - { - // Handle old style preconnects for backward compatibility. - // The old style preconnects only work for IIOP! - - // Issue a warning since this backward compatibilty support - // may be dropped in future releases. - - ACE_DEBUG ((LM_WARNING, - "(%P|%t) \nWARNING: The `host:port' pair style " - "for `-ORBpreconnect' is obsolete.\n" - "In the future, use the URL style.\n")); - - preconnections = - ACE_CString ("iiop://") + - ACE_CString (preconnections) + - ACE_CString ("/"); - - ACE_DEBUG ((LM_WARNING, - "(%P|%t) \nWARNING: The following preconnection " - "will be used:\n%s\n", - preconnections.c_str())); - - this->orb_params ()->preconnects (preconnections); - } + preconnections = arg_shifter.get_current (); + arg_shifter.consume_arg (); } } - else if (ACE_OS::strcmp (current_arg, "-ORBcdrtradeoff") == 0) { arg_shifter.consume_arg (); @@ -568,10 +400,20 @@ TAO_ORB_Core::init (int &argc, char *argv[]) arg_shifter.consume_arg (); } } +#if defined (TAO_ARL_USES_SAME_CONNECTOR_PORT) + else if (ACE_OS::strcmp (current_arg, "-ORBarlsameportconnect") == 0) + { + arg_shifter.consume_arg (); + if (arg_shifter.is_parameter_next ()) + { + if (ACE_OS::strcasecmp (arg_shifter.get_current (), "yes") == 0) + this->arl_same_port_connect_ = 1; + arg_shifter.consume_arg (); + } + } +#endif /* TAO_ARL_USES_SAME_CONNECTOR_PORT */ else if (ACE_OS::strcmp (current_arg, "-ORBgioplite") == 0) { - // @@ This will have to change since gioplite will be considered - // as an alternate ORB messaging protocols. arg_shifter.consume_arg (); giop_lite = 1; } @@ -601,11 +443,6 @@ TAO_ORB_Core::init (int &argc, char *argv[]) arg_shifter.consume_arg (); } } - else if (ACE_OS::strcmp (current_arg, "-ORBSkipServiceConfigOpen") == 0) - { - arg_shifter.consume_arg (); - skip_service_config_open = 1; - } else arg_shifter.ignore_arg (); } @@ -628,6 +465,14 @@ TAO_ORB_Core::init (int &argc, char *argv[]) } #endif /* DEBUG */ + // Set the endpoint + ACE_INET_Addr rendezvous; + if (this->set_endpoint (dotted_decimal_addresses, + port, + host, + rendezvous) == -1) + return -1; + #if defined (SIGPIPE) && !defined (ACE_LACKS_UNIX_SIGNALS) // There's really no way to deal with this in a portable manner, so // we just have to suck it up and get preprocessor conditional and @@ -641,14 +486,8 @@ TAO_ORB_Core::init (int &argc, char *argv[]) #endif /* SIGPIPE */ // Initialize the Service Configurator -check for return values. - // Load the resource factory, connector registry, acceptor registry - // and protocols. Will need to call the open () method on - // the registries! int result = TAO_Internal::open_services (svc_config_argc, - svc_config_argv, - 0, - skip_service_config_open); - + svc_config_argv); // Make sure to free up all the dynamically allocated memory. If we // decide we don't need to allocate this stuff dynamically then we // can remove this. @@ -678,6 +517,16 @@ TAO_ORB_Core::init (int &argc, char *argv[]) this->reactor (trf->get_reactor ()); this->thr_mgr (trf->get_thr_mgr ()); + // Init the connector registry ... this initializes the registry + // pointer in the ORB core. The actual registry is either in TSS or global + // memory. + this->connector_registry (trf->get_connector_registry ()); + // @@ Make sure the IIOP_Connector is registered with the connector registry. + this->connector_registry ()->add_connector (trf->get_connector ()); + + // @@ Init acceptor ... This needs altering for Pluggable Protocols! fredk + this->acceptor (trf->get_acceptor ()); + TAO_Server_Strategy_Factory *ssf = this->server_factory (); if (ssf == 0) @@ -694,6 +543,7 @@ TAO_ORB_Core::init (int &argc, char *argv[]) // This should probably move into the ORB Core someday rather then // being done at this level. this->orb_->_use_omg_ior_format (use_ior); + this->orb_->_optimize_collocation_objects (this->opt_for_collocation_); // Set the <shutdown_lock_> for the ORB. this->orb_->shutdown_lock_ = ssf->create_event_loop_lock (); @@ -703,24 +553,16 @@ TAO_ORB_Core::init (int &argc, char *argv[]) //this->leader_follower_lock_ptr_ = this->client_factory () // ->create_leader_follower_lock (); + // Initialize the container for the ORB parameters. + if (this->orb_params_ == 0) + ACE_NEW_RETURN (this->orb_params_, TAO_ORB_Parameters, 0); + // Set all kinds of orb parameters whose setting needed to be // deferred until after the service config entries had been // determined. - // @@ Set the endpoint string to iiop://host:port/ - // Add a string to hold the endpoint desgination for this ORB - // for now it will be IIOP://host:port/ fredk - if (old_style_endpoint) - { - ACE_CString iiop_endpoint; - if (this->set_iiop_endpoint (dotted_decimal_addresses, - port, - host, - iiop_endpoint) == -1) - return -1; - // Add the endpoint - this->orb_params ()->endpoints (iiop_endpoint); - } + this->orb_params ()->addr (rendezvous); + this->orb_params ()->host (host); // Set the init_ref. this->orb_params ()->init_ref (init_ref); @@ -747,119 +589,97 @@ TAO_ORB_Core::init (int &argc, char *argv[]) this->orb_params ()->use_dotted_decimal_addresses (dotted_decimal_addresses); - // ** Set up the pluggable protocol infrastructure. First get a - // pointer to the protocol factories set, then obtain pointers to - // all factories loaded by the service configurator. - // Load all protocol factories! - if (trf->init_protocol_factories () == -1) - return -1; - - // init the ORB core's pointer - this->protocol_factories (trf->get_protocol_factories ()); - - // Now that we have a complete list of available protocols and their - // related factory objects, initial;ize the registries! - - // Init the connector registry ... this initializes the registry - // pointer in the ORB core. The actual registry is either in TSS or global - // memory. - this->connector_registry (trf->get_connector_registry ()); - - // tell the registry to open all registered interfaces - if (this->connector_registry ()->open (this) != 0) + // tell the registry to open all registered interfaces! fredk + if (this->connector_registry ()->open (trf, this->reactor ()) != 0) return -1; - // Init acceptor_registry_ - this->acceptor_registry (trf->get_acceptor_registry ()); - - // if (this->acceptor_registry ()->open (this) == -1) - // return -1; - // Have registry parse the preconnects - if (this->orb_params ()->preconnects ().is_empty () == 0) - this->connector_registry ()->preconnect (this->orb_params ()->preconnects ()); + if (preconnections) + this->connector_registry ()->preconnect (preconnections); return 0; } int -TAO_ORB_Core::set_iiop_endpoint (int dotted_decimal_addresses, - CORBA::UShort port, - ACE_CString &host, - ACE_CString &endpoint) +TAO_ORB_Core::set_endpoint (int dotted_decimal_addresses, + CORBA::UShort port, + ACE_CString &host, + ACE_INET_Addr &rendezvous) { // No host specified; find it if (host.length () == 0) { - ASYS_TCHAR name[MAXHOSTNAMELEN + 1]; - if (ACE_OS::hostname (name, MAXHOSTNAMELEN + 1) == -1) + char buffer[MAXHOSTNAMELEN + 1]; + if (rendezvous.get_host_name (buffer, sizeof (buffer)) != 0) + ACE_ERROR_RETURN ((LM_ERROR, + "(%P|%t) failed to resolve local host %p.\n"), + -1); + else + host = buffer; + } + + // Set the host and port parameters in the address + if (rendezvous.set (port, host.c_str ()) == -1) + ACE_ERROR_RETURN ((LM_ERROR, + "(%P|%t) failed to resolve host %s, %p.\n", + host.c_str (), + "reason"), + -1); + + // Set up the hostname so that we can put it into object later on. + // This extra step is necessary since the user specified hostname + // usually gets expanded to a complete hostname by the conversion. + // Example: tango -> tango.cs.wustl.edu + if (dotted_decimal_addresses) + { + const char *temphost = rendezvous.get_host_addr (); + if (temphost == 0) { ACE_ERROR_RETURN ((LM_ERROR, - "(%P|%t) Failed to look up local host name.\n"), - -1); + "(%P|%t) failed in get_host_addr () %p.\n"), + -1); + } + else + { + host = temphost; } - host.set (name, 1); } - - // @@ For compatibility (ug) with how things were done before, - // get the local host name in the correct format. This will be - // stored away in the ORB! fredk - ACE_INET_Addr rendezvous; - rendezvous.set (port, host.c_str ()); - - char buffer[MAXHOSTNAMELEN + 1]; - - if (rendezvous.addr_to_string (buffer, - MAXHOSTNAMELEN, - dotted_decimal_addresses) == -1) + else { - ACE_ERROR_RETURN ((LM_ERROR, - "(%P|%t) failed in addr_to_string () %p.\n"), - -1); + char buffer[MAXHOSTNAMELEN + 1]; + if (rendezvous.get_host_name (buffer, sizeof (buffer)) != 0) + { + ACE_ERROR_RETURN ((LM_ERROR, + "(%P|%t) failed in get_host_name () %p.\n"), + -1); + } + else + { + host = buffer; + } } - // endpoint == iiop://host:port/ - endpoint.set ("iiop://", 1); - endpoint += buffer; - endpoint += ACE_CString("/"); - return 0; } int TAO_ORB_Core::fini (void) { - // Close connectors before acceptors! - // Ask the registry to close all registered connectors. - this->connector_registry ()->close_all (); - - // Ask the registry to close all registered acceptors. - this->acceptor_registry ()->close_all (); + // Ask the registry to close all registered connectors! + // this->connector_registry ()->close_all (); TAO_Internal::close_services (); - // @@ This is not needed since the default resource factory - // is staticaly added to the service configurator, fredk if (!this->resource_factory_from_service_config_) delete resource_factory_; - // @@ This is not needed since the default client factory - // is staticaly added to the service configurator, fredk if (!this->client_factory_from_service_config_) delete client_factory_; - // @@ This is not needed since the default server factory - // is staticaly added to the service configurator, fredk if (!this->server_factory_from_service_config_) delete server_factory_; - { - ACE_MT (ACE_GUARD_RETURN (ACE_SYNCH_RECURSIVE_MUTEX, guard, - *ACE_Static_Object_Lock::instance (), 0)); - TAO_ORB_Table::instance ()->unbind (this->orbid_); - } - delete this; return 0; @@ -873,12 +693,9 @@ TAO_ORB_Core::resource_factory (void) // Look in the service repository for an instance. this->resource_factory_ = ACE_Dynamic_Service<TAO_Resource_Factory>::instance ("Resource_Factory"); - // @@ Not needed! this->resource_factory_from_service_config_ = 1; } - //@@ None of this stuff is needed since the default resource factory - // is statically adde to the Service Configurator! if (this->resource_factory_ == 0) { // Still don't have one, so let's allocate the default. This @@ -894,7 +711,6 @@ TAO_ORB_Core::resource_factory (void) TAO_Default_Resource_Factory, 0); - // @@ Not needed. this->resource_factory_from_service_config_ = 0; default_factory->resource_source (TAO_Default_Resource_Factory::TAO_GLOBAL); this->resource_factory_ = default_factory; @@ -914,12 +730,10 @@ TAO_ORB_Core::client_factory (void) // Look in the service repository for an instance. this->client_factory_ = ACE_Dynamic_Service<TAO_Client_Strategy_Factory>::instance ("Client_Strategy_Factory"); - // @@ Not needed! - this->client_factory_from_service_config_ = 1; + this->client_factory_from_service_config_ = + 1; } - //@@ None of this stuff is needed since the default client factory - // is statically added to the Service Configurator, fredk if (this->client_factory_ == 0) { // Still don't have one, so let's allocate the default. This @@ -949,13 +763,11 @@ TAO_ORB_Core::server_factory (void) { // Look in the service repository for an instance. this->server_factory_ = - ACE_Dynamic_Service<TAO_Server_Strategy_Factory>::instance ("Server_Strategy_Factory"); - // @@ Not needed! + ACE_Dynamic_Service<TAO_Server_Strategy_Factory>::instance + ("Server_Strategy_Factory"); this->server_factory_from_service_config_ = 1; } - //@@ None of this stuff is needed since the default server factory - // is statically adde to the Service Configurator, fredk // If the <server_factory_> isn't found it's usually because the ORB // hasn't been intialized correctly... if (this->server_factory_ == 0) @@ -971,7 +783,6 @@ TAO_ORB_Core::server_factory (void) TAO_Default_Server_Strategy_Factory, 0); - // @@ Not needed! this->server_factory_from_service_config_ = 0; // At this point we need to register this with the // <Service_Repository> to get it cleaned up properly. But, for @@ -1021,18 +832,52 @@ TAO_ORB_Core::root_poa_reference (CORBA::Environment &TAO_IN_ENV, return PortableServer::POA::_duplicate (this->root_poa_reference_.in ()); } +#if defined (TAO_ARL_USES_SAME_CONNECTOR_PORT) +CORBA::Boolean +TAO_ORB_Core::arl_same_port_connect (void) +{ + return this->arl_same_port_connect_; +} +#endif /* TAO_ARL_USES_SAME_CONNECTOR_PORT */ + int -TAO_ORB_Core::inherit_from_parent_thread (TAO_ORB_Core_TSS_Resources *tss_resources) +TAO_ORB_Core::inherit_from_parent_thread (TAO_ORB_Core *p) { // Inherit properties/objects used in ORB_Core from the // parent thread. Stuff inherited here must already exist // in the "parent" orbcore. - this->reactor (tss_resources->reactor_); + this->reactor (p->reactor ()); // We'll use the spawning thread's reactor. - // this->connection_cache (tss_resources->connection_cache_); - // Inherit connection cache? + this->thr_mgr (p->thr_mgr ()); + // We should use the same thread_manager. + + this->connector_registry (p->connector_registry ()); + // We'll use the spawning thread's connector. + + this->orb (p->orb ()); + // We'll use the spawning thread's ORB. + + this->root_poa (p->root_poa ()); + // And its root_poa. + + this->orb_params_ = p->orb_params (); + // We also need its ORB_Params. + + this->acceptor (p->acceptor ()); + // Also grab the acceptor passively listening for connection + // requests. + + this->using_collocation (p->using_collocation ()); + // Use the same collocation settings + + this->resource_factory_ = p->resource_factory (); + this->client_factory_ = p->client_factory (); + this->server_factory_ = p->server_factory (); + // Inherit the factories. Notice that they will not be destroyed by + // this orb_core because *_factory_from_service_config_'s all + // default to FALSE. return 0; } @@ -1049,7 +894,7 @@ TAO_ORB_Core::create_and_set_root_poa (const char *adapter_name, // Need to do double-checked locking here to cover the case of // multiple threads using a global resource policy. if (poa_manager == 0) - poa_manager = new TAO_POA_Manager (*this->object_adapter ()); + poa_manager = new TAO_POA_Manager (this->object_adapter ()->lock ()); TAO_POA_Policies *root_poa_policies = 0; if (policies == 0) @@ -1081,14 +926,41 @@ TAO_ORB_Core::create_and_set_root_poa (const char *adapter_name, } int -TAO_ORB_Core::is_collocated (const TAO_MProfile& mprofile) +TAO_ORB_Core::add_to_collocation_table (void) { - if (this->acceptor_registry_ == 0) - return 0; + if (this->using_collocation ()) + { + TAO_GLOBAL_Collocation_Table *collocation_table = this->resource_factory ()->get_global_collocation_table (); + if (collocation_table != 0) + return collocation_table->bind (this->orb_params ()->addr (), + this->object_adapter ()); + } + return 0; +} - return this->acceptor_registry_->is_collocated (mprofile); +TAO_Object_Adapter * +TAO_ORB_Core::get_collocated_object_adapter (const ACE_INET_Addr &addr) +{ + if (this->using_collocation ()) + { + TAO_GLOBAL_Collocation_Table *collocation_table = this->resource_factory ()->get_global_collocation_table (); + if (collocation_table != 0) + { + TAO_Object_Adapter *object_adapter; + if (collocation_table->find (addr, + object_adapter) == 0) + return object_adapter; + } + else + { + if (addr == this->orb_params ()->addr ()) + return this->object_adapter (); + } + } + return 0; } + int TAO_ORB_Core::leader_available (void) // returns the value of the flag indicating if a leader @@ -1127,7 +999,8 @@ int TAO_ORB_Core::unset_leader_wake_up_follower (void) // sets the leader_available flag to false and tries to wake up a follower { - ACE_Guard <ACE_SYNCH_MUTEX> g (this->leader_follower_lock ()); + // ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ace_mon, + // this->leader_follower_lock (), -1); this->unset_leader_thread (); @@ -1135,9 +1008,8 @@ TAO_ORB_Core::unset_leader_wake_up_follower (void) // do it only if a follower is available and no leader is available { ACE_SYNCH_CONDITION* condition_ptr = this->get_next_follower (); - if (this->remove_follower (condition_ptr) == -1) + if (condition_ptr == 0 || condition_ptr->signal () == -1) return -1; - condition_ptr->signal (); } return 0; } @@ -1268,10 +1140,21 @@ TAO_ORB_Core::reactor (void) return tss->reactor_; } -TAO_POA_Current & -TAO_ORB_Core::poa_current (void) const +TAO_POA_Current * +TAO_ORB_Core::poa_current (void) { - return *this->poa_current_; + return TAO_ORB_CORE_TSS_RESOURCES::instance ()->poa_current_; +} + +TAO_POA_Current * +TAO_ORB_Core::poa_current (TAO_POA_Current *new_current) +{ + TAO_ORB_Core_TSS_Resources *tss = + TAO_ORB_CORE_TSS_RESOURCES::instance (); + + TAO_POA_Current *old = tss->poa_current_; + tss->poa_current_ = new_current; + return old; } CORBA_Environment* @@ -1288,10 +1171,21 @@ TAO_ORB_Core::default_environment (CORBA_Environment* env) #if defined (TAO_HAS_CORBA_MESSAGING) -TAO_Policy_Current & -TAO_ORB_Core::policy_current (void) +TAO_Policy_Current* +TAO_ORB_Core::policy_current (void) const +{ + return TAO_ORB_CORE_TSS_RESOURCES::instance ()->policy_current_; +} + +TAO_Policy_Current* +TAO_ORB_Core::policy_current (TAO_Policy_Current* current) { - return this->policy_current_; + TAO_ORB_Core_TSS_Resources *tss = + TAO_ORB_CORE_TSS_RESOURCES::instance (); + + TAO_Policy_Current *old = tss->policy_current_; + tss->policy_current_ = current; + return old; } #endif /* TAO_HAS_CORBA_MESSAGING */ @@ -1300,7 +1194,7 @@ TAO_ORB_Core::policy_current (void) TAO_ORB_Core_TSS_Resources::TAO_ORB_Core_TSS_Resources (void) : reactor_ (0), - poa_current_impl_ (0), + poa_current_ (0), default_environment_ (&this->tss_environment_), #if defined (TAO_HAS_CORBA_MESSAGING) policy_current_ (&this->initial_policy_current_), @@ -1327,47 +1221,6 @@ TAO_ORB_Core_TSS_Resources::~TAO_ORB_Core_TSS_Resources (void) // **************************************************************** -TAO_ORB_Table::TAO_ORB_Table (void) -{ -} - -TAO_ORB_Table::~TAO_ORB_Table (void) -{ -} - -TAO_ORB_Table::Iterator -TAO_ORB_Table::begin (void) -{ - return this->table_.begin (); -} - -TAO_ORB_Table::Iterator -TAO_ORB_Table::end (void) -{ - return this->table_.end (); -} - -int -TAO_ORB_Table::bind (const char* orb_id, - TAO_ORB_Core* orb_core) -{ - return this->table_.bind (orb_id, orb_core); -} - -TAO_ORB_Core* -TAO_ORB_Table::find (const char* orb_id) -{ - TAO_ORB_Core* found = 0; - this->table_.find (orb_id, found); - return found; -} - -int -TAO_ORB_Table::unbind (const char* orb_id) -{ - return this->table_.unbind (orb_id); -} - // **************************************************************** // This function exists because of Win32's proclivity for expanding @@ -1387,8 +1240,6 @@ TAO_ORB_Core_instance (void) return CORBA::instance ()->orb_core_; } -// **************************************************************** - #if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) template class ACE_Env_Value<int>; @@ -1397,20 +1248,29 @@ template class ACE_Env_Value<u_int>; template class ACE_TSS_Singleton<TAO_ORB_Core_TSS_Resources, ACE_SYNCH_MUTEX>; template class ACE_TSS<TAO_ORB_Core_TSS_Resources>; +template class ACE_Hash_Map_Manager<ACE_INET_Addr, TAO_Object_Adapter *, TAO_Collocation_Table_Lock>; +template class ACE_Hash_Map_Manager_Ex<ACE_INET_Addr, TAO_Object_Adapter *, ACE_Hash<ACE_INET_Addr>, ACE_Equal_To<ACE_INET_Addr>, TAO_Collocation_Table_Lock>; +template class ACE_Hash_Map_Entry<ACE_INET_Addr, TAO_Object_Adapter *>; +template class ACE_Hash<ACE_INET_Addr>; +template class ACE_Equal_To<ACE_INET_Addr>; +template class ACE_Hash_Map_Iterator_Base_Ex<ACE_INET_Addr, TAO_Object_Adapter *, ACE_Hash<ACE_INET_Addr>, ACE_Equal_To<ACE_INET_Addr>, TAO_Collocation_Table_Lock>; +template class ACE_Hash_Map_Iterator<ACE_INET_Addr, TAO_Object_Adapter *, TAO_Collocation_Table_Lock>; +template class ACE_Hash_Map_Iterator_Ex<ACE_INET_Addr, TAO_Object_Adapter *, ACE_Hash<ACE_INET_Addr>, ACE_Equal_To<ACE_INET_Addr>, TAO_Collocation_Table_Lock>; +template class ACE_Hash_Map_Reverse_Iterator<ACE_INET_Addr, TAO_Object_Adapter *, TAO_Collocation_Table_Lock>; +template class ACE_Hash_Map_Reverse_Iterator_Ex<ACE_INET_Addr, TAO_Object_Adapter *, ACE_Hash<ACE_INET_Addr>, ACE_Equal_To<ACE_INET_Addr>, TAO_Collocation_Table_Lock>; + +template class ACE_Guard<TAO_Collocation_Table_Lock>; +template class ACE_Read_Guard<TAO_Collocation_Table_Lock>; +template class ACE_Write_Guard<TAO_Collocation_Table_Lock>; template class ACE_Read_Guard<ACE_SYNCH_MUTEX>; template class ACE_Write_Guard<ACE_SYNCH_MUTEX>; +template class ACE_Singleton<TAO_GLOBAL_Collocation_Table, ACE_SYNCH_MUTEX>; + template class ACE_Node<ACE_SYNCH_CONDITION*>; template class ACE_Unbounded_Set<ACE_SYNCH_CONDITION*>; template class ACE_Unbounded_Set_Iterator<ACE_SYNCH_CONDITION*>; -template class ACE_Singleton<TAO_ORB_Table,ACE_SYNCH_MUTEX>; -template class ACE_Map_Entry<ACE_CString,TAO_ORB_Core*>; -template class ACE_Map_Manager<ACE_CString,TAO_ORB_Core*,ACE_Null_Mutex>; -template class ACE_Map_Iterator_Base<ACE_CString,TAO_ORB_Core*,ACE_Null_Mutex>; -template class ACE_Map_Iterator<ACE_CString,TAO_ORB_Core*,ACE_Null_Mutex>; -template class ACE_Map_Reverse_Iterator<ACE_CString,TAO_ORB_Core*,ACE_Null_Mutex>; - #elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) #pragma instantiate ACE_Env_Value<int> @@ -1419,18 +1279,27 @@ template class ACE_Map_Reverse_Iterator<ACE_CString,TAO_ORB_Core*,ACE_Null_Mutex #pragma instantiate ACE_TSS_Singleton<TAO_ORB_Core_TSS_Resources, ACE_SYNCH_MUTEX> #pragma instantiate ACE_TSS<TAO_ORB_Core_TSS_Resources> +#pragma instantiate ACE_Hash_Map_Manager<ACE_INET_Addr, TAO_Object_Adapter *, TAO_Collocation_Table_Lock> +#pragma instantiate ACE_Hash_Map_Manager_Ex<ACE_INET_Addr, TAO_Object_Adapter *, ACE_Hash<ACE_INET_Addr>, ACE_Equal_To<ACE_INET_Addr>, TAO_Collocation_Table_Lock> +#pragma instantiate ACE_Hash_Map_Entry<ACE_INET_Addr, TAO_Object_Adapter *> +#pragma instantiate ACE_Hash<ACE_INET_Addr> +#pragma instantiate ACE_Equal_To<ACE_INET_Addr> +#pragma instantiate ACE_Hash_Map_Iterator_Base_Ex<ACE_INET_Addr, TAO_Object_Adapter *, ACE_Hash<ACE_INET_Addr>, ACE_Equal_To<ACE_INET_Addr>, TAO_Collocation_Table_Lock> +#pragma instantiate ACE_Hash_Map_Iterator<ACE_INET_Addr, TAO_Object_Adapter *, TAO_Collocation_Table_Lock> +#pragma instantiate ACE_Hash_Map_Iterator_Ex<ACE_INET_Addr, TAO_Object_Adapter *, ACE_Hash<ACE_INET_Addr>, ACE_Equal_To<ACE_INET_Addr>, TAO_Collocation_Table_Lock> +#pragma instantiate ACE_Hash_Map_Reverse_Iterator<ACE_INET_Addr, TAO_Object_Adapter *, TAO_Collocation_Table_Lock> +#pragma instantiate ACE_Hash_Map_Reverse_Iterator_Ex<ACE_INET_Addr, TAO_Object_Adapter *, ACE_Hash<ACE_INET_Addr>, ACE_Equal_To<ACE_INET_Addr>, TAO_Collocation_Table_Lock> + +#pragma instantiate ACE_Guard<TAO_Collocation_Table_Lock> +#pragma instantiate ACE_Read_Guard<TAO_Collocation_Table_Lock> +#pragma instantiate ACE_Write_Guard<TAO_Collocation_Table_Lock> #pragma instantiate ACE_Read_Guard<ACE_SYNCH_MUTEX> #pragma instantiate ACE_Write_Guard<ACE_SYNCH_MUTEX> +#pragma instantiate ACE_Singleton<TAO_GLOBAL_Collocation_Table, ACE_SYNCH_MUTEX> + #pragma instantiate ACE_Node<ACE_SYNCH_CONDITION*> #pragma instantiate ACE_Unbounded_Set<ACE_SYNCH_CONDITION*> #pragma instantiate ACE_Unbounded_Set_Iterator<ACE_SYNCH_CONDITION*> -#pragma instantiate ACE_Singleton<TAO_ORB_Table,ACE_SYNCH_MUTEX> -#pragma instantiate ACE_Map_Entry<ACE_CString,TAO_ORB_Core*> -#pragma instantiate ACE_Map_Manager<ACE_CString,TAO_ORB_Core*,ACE_Null_Mutex> -#pragma instantiate ACE_Map_Iterator_Base<ACE_CString,TAO_ORB_Core*,ACE_Null_Mutex> -#pragma instantiate ACE_Map_Iterator<ACE_CString,TAO_ORB_Core*,ACE_Null_Mutex> -#pragma instantiate ACE_Map_Reverse_Iterator<ACE_CString,TAO_ORB_Core*,ACE_Null_Mutex> - #endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ |