TAO::ORB Namespace Reference


Functions

void init_orb_globals (void)
int open_services (ACE_Service_Gestalt *cfg, int &argc, ACE_TCHAR **argv)
int close_services (ACE_Service_Gestalt *pcfg)
void default_svc_conf_entries (char const *rf_args, char const *ssf_args, char const *csf_args)


Function Documentation

int TAO::ORB::close_services ACE_Service_Gestalt pcfg  ) 
 

The complement to open_services(), this will perform appropriate ACE Service Configurator closure operations. It should be called as many times as open_services(), and will only actually close things down on the last call. It is fully thread-safe.

Returns:
0 if successful, -1 with errno set if failure.

Definition at line 422 of file TAO_Internal.cpp.

References ACE_GUARD_RETURN, ACE_Service_Gestalt::close(), ACE_Service_Config::global(), service_open_count, and TAO_SYNCH_RECURSIVE_MUTEX.

Referenced by TAO_ORB_Core::~TAO_ORB_Core().

00423 {
00424   ACE_MT (ACE_GUARD_RETURN (TAO_SYNCH_RECURSIVE_MUTEX,
00425                             guard,
00426                             *ACE_Static_Object_Lock::instance (),
00427                             -1));
00428   service_open_count--;
00429 
00430   if (pcfg == ACE_Service_Config::global())
00431     return 0;
00432   return pcfg->close ();
00433 }

void TAO::ORB::default_svc_conf_entries char const *  rf_args,
char const *  ssf_args,
char const *  csf_args
 

Set default `svc.conf' content. This function must be called before first ORB initialization.

Definition at line 436 of file TAO_Internal.cpp.

References client_strategy_factory_args, resource_factory_args, and server_strategy_factory_args.

00439 {
00440   resource_factory_args        = rf_args;
00441   server_strategy_factory_args = ssf_args;
00442   client_strategy_factory_args = csf_args;
00443 }

void TAO::ORB::init_orb_globals void   ) 
 

Initialize the ORB globals correctly, i.e., only when they haven't been initialized yet.

Definition at line 1059 of file ORB.cpp.

References orb_init_count.

Referenced by CORBA::ORB_init(), and PortableInterceptor::register_orb_initializer().

01060 {
01061   // This method should be invoked atomically.  It is the caller's
01062   // responsibility to ensure that this condition is satisfied.
01063 
01064   // Prevent multiple initializations.
01065   if (orb_init_count != 0)
01066     {
01067       return;
01068     }
01069   else
01070     {
01071       ++orb_init_count;
01072     }
01073 }

int TAO::ORB::open_services ACE_Service_Gestalt cfg,
int &  argc,
ACE_TCHAR **  argv
 

Extract ACE Service Configurator arguments from the given argument vector, and initialize the ACE Service Configurator.

Note:
This method should be called before the ORB Core is initialized, and before any ORBInitializers are invoked.

Definition at line 199 of file TAO_Internal.cpp.

References ACE_CString, ACE_DEBUG, ACE_ERROR, ACE_ERROR_RETURN, ACE_GUARD_RETURN, ACE_TEXT, ACE_TEXT_ALWAYS_CHAR, ACE_Service_Config::global(), is_ubergestalt_ready, LM_DEBUG, open_private_services_i(), parse_global_args_i(), parse_private_args_i(), parse_svcconf_args_i(), register_additional_services_i(), register_global_services_i(), service_open_count, CORBA::StringSeq, TAO_debug_level, and TAO_SYNCH_RECURSIVE_MUTEX.

Referenced by CORBA::ORB_init().

00202 {
00203   {
00204     ACE_MT (ACE_GUARD_RETURN (TAO_SYNCH_RECURSIVE_MUTEX,
00205                               guard,
00206                               TAO_Ubergestalt_Ready_Condition::instance ()->mutex (),
00207                               -1));
00208 
00209     // Wait in line, while the default ORB (which isn't us) completes
00210     // initialization of the globaly required service objects
00211     if (service_open_count == 1)
00212       {
00213         if (TAO_debug_level > 4)
00214           ACE_DEBUG ((LM_DEBUG,
00215                       ACE_TEXT ("TAO (%P|%t) Waiting for the default ")
00216                       ACE_TEXT ("ORB to complete the global ")
00217                       ACE_TEXT ("initialization\n")));
00218 
00219         ACE_MT (while (!is_ubergestalt_ready)
00220                 TAO_Ubergestalt_Ready_Condition::instance ()->wait ());
00221 
00222         if (TAO_debug_level > 4)
00223           ACE_DEBUG ((LM_DEBUG,
00224                       ACE_TEXT ("TAO (%P|%t) The default ")
00225                       ACE_TEXT ("ORB must have completed the global ")
00226                       ACE_TEXT ("initialization...\n")));
00227 
00228       }
00229     else
00230       {
00231         if (TAO_debug_level > 4)
00232           ACE_DEBUG ((LM_DEBUG,
00233                       ACE_TEXT ("TAO (%P|%t) We are %sthe default ")
00234                       ACE_TEXT ("ORB ...\n"),
00235                       (service_open_count == 0) ? "" : "not "));
00236       }
00237 
00238     ++service_open_count;
00239   }
00240 
00241   // Construct an argument vector specific to the Service
00242   // Configurator.
00243   CORBA::StringSeq svc_config_argv;
00244 
00245   // Be certain to copy the program name so that service configurator
00246   // has something to skip!
00247   ACE_CString argv0 ("");
00248 
00249   if (argc > 0 && argv != 0)
00250     {
00251       argv0 = ACE_TEXT_ALWAYS_CHAR (argv[0]);
00252     }
00253 
00254   svc_config_argv.length (1);
00255   svc_config_argv[0] = argv0.c_str ();
00256 
00257   // Should we skip the ACE_Service_Config::open() method, e.g., if we
00258   // already being configured by the ACE Service Configurator.
00259   //
00260   // @@ This is no longer needed since the Service Configurator is now
00261   // reentrant.(-Ossama)
00262   // @@ Leaving it in, since the -ORBSkipServiceConfigOpen is still
00263   // available. (-Iliyan)
00264   bool skip_service_config_open = false;
00265 
00266   // Extract any ORB options from the argument vector.
00267   if (parse_private_args_i (argc,
00268                             argv,
00269                             svc_config_argv,
00270                             skip_service_config_open) == -1)
00271     {
00272       return -1;
00273     }
00274 
00275   // Construct an argument vector specific to the process-wide
00276   // (global) Service Configurator instance.
00277   CORBA::StringSeq global_svc_config_argv;
00278 
00279   ACE_Service_Gestalt * theone = ACE_Service_Config::global ();
00280 
00281   if (service_open_count == 1)
00282     {
00283       ACE_Service_Config_Guard config_guard (theone);
00284 
00285       if (TAO_debug_level > 2)
00286         {
00287           ACE_DEBUG ((LM_DEBUG,
00288                       ACE_TEXT ("TAO (%P|%t) Initializing the ")
00289                       ACE_TEXT ("process-wide services\n")));
00290         }
00291 
00292       register_global_services_i (theone);
00293 
00294       // Be certain to copy the program name so that service configurator
00295       // has something to skip!
00296       ACE_CString gargv0 ("");
00297 
00298       if (argc > 0 && argv != 0)
00299         {
00300           gargv0 = ACE_TEXT_ALWAYS_CHAR (argv[0]);
00301         }
00302 
00303       global_svc_config_argv.length (1);
00304       global_svc_config_argv[0] = gargv0.c_str ();
00305 
00306       if (parse_global_args_i (argc, argv, global_svc_config_argv, true) == -1)
00307         {
00308           return -1;
00309         }
00310 
00311       if (parse_svcconf_args_i (argc, argv, global_svc_config_argv) == -1)
00312         {
00313           return -1;
00314         }
00315 
00316       // If the target configuration happens to be the global context,
00317       // add any 'private' arguments here.
00318       if (pcfg == theone && svc_config_argv.length() > 1)
00319         {
00320           CORBA::ULong glen = global_svc_config_argv.length();
00321           global_svc_config_argv.length(glen + svc_config_argv.length() - 1);
00322           for (CORBA::ULong i = 1; i < svc_config_argv.length(); i++)
00323             global_svc_config_argv[glen++] = svc_config_argv[i];
00324           svc_config_argv.length(1);
00325         }
00326 
00327       int global_svc_config_argc = global_svc_config_argv.length ();
00328       int status =
00329         open_private_services_i (theone,
00330                                  global_svc_config_argc,
00331                                  global_svc_config_argv.get_buffer (),
00332                                  skip_service_config_open);
00333 
00334       if (status == -1)
00335         {
00336           if (TAO_debug_level > 0)
00337             {
00338               ACE_ERROR ((LM_DEBUG,
00339                           ACE_TEXT ("TAO (%P|%t) Failed to open process-")
00340                           ACE_TEXT ("wide service configuration\n")));
00341             }
00342 
00343           return -1;
00344         }
00345 
00346       register_additional_services_i (theone);
00347 
00348       if (TAO_debug_level > 4)
00349         ACE_DEBUG ((LM_DEBUG,
00350                     ACE_TEXT ("TAO (%P|%t) Default ORB - global ")
00351                     ACE_TEXT ("initialization completed.\n")));
00352 
00353       // Notify all other threads that may be waiting, that the global
00354       // gestalt has been initialized.
00355       {
00356         ACE_MT (ACE_GUARD_RETURN (TAO_SYNCH_RECURSIVE_MUTEX,
00357                                   guard,
00358                                   TAO_Ubergestalt_Ready_Condition::instance ()->mutex (),
00359                                   -1));
00360 
00361         is_ubergestalt_ready = true;
00362         ACE_MT (if (TAO_Ubergestalt_Ready_Condition::instance ()->
00363                     broadcast () == -1)
00364                 return -1);
00365       }
00366 
00367     }
00368   else
00369     {
00370       int status =
00371         parse_global_args_i(argc, argv,global_svc_config_argv, false);
00372       if (status == -1 && TAO_debug_level > 0)
00373         ACE_DEBUG ((LM_DEBUG,
00374                     ACE_TEXT ("TAO (%P|%t) Skipping the process-wide ")
00375                     ACE_TEXT ("service configuration, service_open_count ")
00376                     ACE_TEXT ("= %d, status = %d\n"),
00377                     service_open_count,
00378                     status));
00379     }
00380 
00381   if (TAO_debug_level > 2)
00382     {
00383       ACE_DEBUG ((LM_DEBUG,
00384                   ACE_TEXT ("TAO (%P|%t) Initializing the ")
00385                   ACE_TEXT ("orb-specific services\n")));
00386     }
00387 
00388   if (parse_svcconf_args_i (argc, argv, svc_config_argv) == -1)
00389     {
00390       return -1;
00391     }
00392 
00393   int status = 0;
00394   // only open the private context if it is not also the global context
00395   if (pcfg != ACE_Service_Config::global())
00396     {
00397       int svc_config_argc = svc_config_argv.length ();
00398       status =
00399         open_private_services_i (pcfg,
00400                                  svc_config_argc,
00401                                  svc_config_argv.get_buffer (),
00402                                  skip_service_config_open);
00403     }
00404 
00405   if (status >= 0)
00406     {
00407       return 0;
00408     }
00409 
00410   if (TAO_debug_level > 0)
00411     {
00412       ACE_ERROR_RETURN ((LM_DEBUG,
00413                          ACE_TEXT ("TAO (%P|%t) Failed to ")
00414                          ACE_TEXT ("open orb service configuration\n")),
00415                         -1);
00416     }
00417 
00418   return -1;
00419 }


Generated on Sun Jan 27 13:19:13 2008 for TAO by doxygen 1.3.6