summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--TAO/ChangeLog25
-rw-r--r--TAO/tao/ORB_Core.cpp2
-rw-r--r--TAO/tao/TAO_Internal.cpp290
-rw-r--r--TAO/tests/ORB_Local_Config/Bug_1459/Test.cpp6
-rw-r--r--TAO/tests/ORB_Local_Config/Two_DLL_ORB/client.cpp65
5 files changed, 230 insertions, 158 deletions
diff --git a/TAO/ChangeLog b/TAO/ChangeLog
index 2b031bc87ca..0ccd1c476a1 100644
--- a/TAO/ChangeLog
+++ b/TAO/ChangeLog
@@ -1,3 +1,28 @@
+Tue May 9 16:32:01 UTC 2006 Iliyan Jeliazkov <iliyan@ociweb.com>
+
+ * tao/ORB_Core.cpp:
+
+ Added a clarifying comment.
+
+ * tao/TAO_Internal.cpp:
+
+ Fixing a problem in processing -ORBSvcConf command-line
+ options. Both the process-wide and the ORB-local service
+ gestalts were processing configuration files. This was causing
+ the loading of the default svc.conf file, even when another one
+ had been specified by -ORBSvcConf. The fix is to give the
+ process-wide gestalt a chance to load the svc conf file, if it
+ is being initialized for the first time.
+
+ * tests/ORB_Local_Config/Bug_1459/Test.cpp:
+
+ Minor updates.
+
+ * tests/ORB_Local_Config/Two_DLL_ORB/client.cpp:
+
+ Updated the tests to eliminate some possibilities for TRANSIENT
+ exceptions.
+
Tue May 9 11:37:30 UTC 2006 Johnny Willemsen <jwillemsen@remedy.nl>
* docs/tutorials/Quoter/idl/Quoter_idl.mpc:
diff --git a/TAO/tao/ORB_Core.cpp b/TAO/tao/ORB_Core.cpp
index 1aaee6f79cc..4c48233f310 100644
--- a/TAO/tao/ORB_Core.cpp
+++ b/TAO/tao/ORB_Core.cpp
@@ -263,6 +263,8 @@ TAO_ORB_Core::TAO_ORB_Core (const char *orbid)
TAO_Request_Dispatcher);
// @TODO: Can this be dynamic container instead?
+ // @TODO: In the global case, the ACE_Service_Config::current ()
+ // should probably be used to simplify initialization?
if (ACE_OS::strnlen (this->orbid_, 1) == 0)
{
ACE_NEW_NORETURN (this->config_,
diff --git a/TAO/tao/TAO_Internal.cpp b/TAO/tao/TAO_Internal.cpp
index 753a0697424..6086a9d4675 100644
--- a/TAO/tao/TAO_Internal.cpp
+++ b/TAO/tao/TAO_Internal.cpp
@@ -64,6 +64,21 @@ namespace
CORBA::StringSeq &svc_config_argv);
/**
+ * Parses the supplied command-line arguments to extract any that
+ * specify a Service Configurator file (-ORBSvcConf). This is done
+ * separately, because depending on the context, the configuration
+ * file may apply to the process-wide service repository, or to the
+ * orb-specific (private) one.
+ *
+ * @brief Modifies the argc to reflect any arguments it has
+ * "consumed"
+ */
+ int
+ parse_svcconf_args_i (int &argc,
+ char **argv,
+ CORBA::StringSeq &svc_config_argv);
+
+ /**
* Initialize the ACE Service Configurator with the process-global
* services (available to any ORB).
*
@@ -83,11 +98,6 @@ namespace
void register_global_services_i (ACE_Service_Gestalt * pcfg);
void register_additional_services_i (ACE_Service_Gestalt * pcfg);
- int open_global_services_i (ACE_Service_Gestalt* theone,
- int & argc,
- char ** argv,
- bool skip_service_config_open);
-
/**
* Parses the supplied command-line arguments to extract any
* instance-specific ones.
@@ -111,7 +121,8 @@ namespace
int open_private_services_i (ACE_Service_Gestalt* pcfg,
int & argc,
char ** argv,
- bool skip_service_config_open = false);
+ bool skip_service_config_open = false,
+ bool ignore_default_svc_conf_file = false);
/**
* Number of times open_services() has been called. Incremented by
@@ -149,30 +160,29 @@ TAO::ORB::open_services (ACE_Service_Gestalt* pcfg,
// Be certain to copy the program name so that service configurator
// has something to skip!
ACE_CString argv0 ("");
-
if (argc > 0 && argv != 0)
{
argv0 = ACE_TEXT_ALWAYS_CHAR (argv[0]);
}
-
svc_config_argv.length (1);
svc_config_argv[0] = argv0.c_str ();
// Should we skip the ACE_Service_Config::open() method, e.g., if we
// already being configured by the ACE Service Configurator.
//
- // @@ This is no longer needed since the Service Configurator is
- // now reentrant.
- // -Ossama
+ // @@ This is no longer needed since the Service Configurator is now
+ // reentrant.(-Ossama)
+ // @@ Leaving it in, since the -ORBSkipServiceConfigOpen is still
+ // available. (-Iliyan)
bool skip_service_config_open = false;
// Extract any ORB options from the argument vector.
- if (parse_private_args_i (argc,
- argv,
- svc_config_argv,
- skip_service_config_open) == -1)
+ if (parse_private_args_i (argc,
+ argv,
+ svc_config_argv,
+ skip_service_config_open) == -1)
return -1;
- else
+
{
ACE_MT (ACE_GUARD_RETURN (TAO_SYNCH_RECURSIVE_MUTEX,
guard,
@@ -180,47 +190,88 @@ TAO::ORB::open_services (ACE_Service_Gestalt* pcfg,
-1));
service_open_count++;
+ }
- ACE_Service_Gestalt * theone = ACE_Service_Config::global ();
- if (pcfg != theone)
+ ACE_Service_Gestalt * theone = ACE_Service_Config::global ();
+ if (service_open_count == 1)
{
- ACE_Service_Config_Guard guard (theone);
+ ACE_Service_Config_Guard config_guard (theone);
+
+ if (TAO_debug_level > 2)
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_LIB_TEXT ("TAO (%P|%t) Initializing the ")
+ ACE_LIB_TEXT("process-wide services\n")));
+
+ ACE_MT (ACE_GUARD_RETURN (TAO_SYNCH_RECURSIVE_MUTEX,
+ guard,
+ *ACE_Static_Object_Lock::instance (),
+ -1));
+
+ register_global_services_i (theone);
+
+ // Construct an argument vector specific to the process-wide
+ // (global) Service Configurator instance.
+ CORBA::StringSeq global_svc_config_argv;
+
+ // Be certain to copy the program name so that service configurator
+ // has something to skip!
+ ACE_CString argv0 ("");
+ if (argc > 0 && argv != 0)
+ {
+ argv0 = ACE_TEXT_ALWAYS_CHAR (argv[0]);
+ }
+ global_svc_config_argv.length (1);
+ global_svc_config_argv[0] = argv0.c_str ();
+ if (parse_global_args_i (argc, argv, global_svc_config_argv) == -1)
+ return -1;
+
+ if (parse_svcconf_args_i (argc, argv, global_svc_config_argv) == -1)
+ return -1;
+
+ int global_svc_config_argc = global_svc_config_argv.length ();
int status =
- open_global_services_i (theone,
- argc,
- argv,
- skip_service_config_open);
+ open_private_services_i (theone,
+ global_svc_config_argc,
+ global_svc_config_argv.get_buffer (),
+ skip_service_config_open);
if (status == -1)
- {
- if (TAO_debug_level > 0)
- ACE_ERROR_RETURN ((LM_DEBUG,
- ACE_LIB_TEXT ("TAO (%P|%t) Failed to ")
- ACE_LIB_TEXT("open process-wide service configuration\n")),
- -1);
- return -1;
- }
+ {
+ if (TAO_debug_level > 0)
+ ACE_ERROR_RETURN ((LM_DEBUG,
+ ACE_LIB_TEXT ("TAO (%P|%t) Failed to ")
+ ACE_LIB_TEXT("open process-wide service configuration\n")),
+ -1);
+ return -1;
+ }
+
register_additional_services_i (theone);
}
- int svc_config_argc = svc_config_argv.length ();
- int status =
- open_private_services_i (pcfg,
- svc_config_argc,
- svc_config_argv.get_buffer (),
- skip_service_config_open);
- if (status == -1)
- {
- if (TAO_debug_level > 0)
- ACE_ERROR_RETURN ((LM_DEBUG,
- ACE_LIB_TEXT ("TAO (%P|%t) Failed to ")
- ACE_LIB_TEXT("open orb service configuration\n")),
- -1);
- return -1;
- }
+ if (TAO_debug_level > 2)
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_LIB_TEXT ("TAO (%P|%t) Initializing the ")
+ ACE_LIB_TEXT("orb-specific services\n")));
+
+ if (parse_svcconf_args_i (argc, argv, svc_config_argv) == -1)
+ return -1;
+
+ int svc_config_argc = svc_config_argv.length ();
+ int status =
+ open_private_services_i (pcfg,
+ svc_config_argc,
+ svc_config_argv.get_buffer (),
+ skip_service_config_open);
+ if (status >= 0)
return 0;
- }
+
+ if (TAO_debug_level > 0)
+ ACE_ERROR_RETURN ((LM_DEBUG,
+ ACE_LIB_TEXT ("TAO (%P|%t) Failed to ")
+ ACE_LIB_TEXT("open orb service configuration\n")),
+ -1);
+ return -1;
}
int
@@ -251,68 +302,19 @@ TAO_END_VERSIONED_NAMESPACE_DECL
namespace
{
- /// Open services, belonging to all gestalt instances within the
- /// process
-
- int
- open_global_services_i (ACE_Service_Gestalt * theone,
- int & argc,
- ACE_TCHAR ** argv,
- bool skip_service_config_open)
- {
- // Construct an argument vector specific to the process-wide
- // (global) Service Configurator instance.
- CORBA::StringSeq global_svc_config_argv;
-
- // Be certain to copy the program name so that service configurator
- // has something to skip!
- ACE_CString argv0 ("");
-
- if (argc > 0 && argv != 0)
- {
- argv0 = ACE_TEXT_ALWAYS_CHAR (argv[0]);
- }
-
- global_svc_config_argv.length (1);
- global_svc_config_argv[0] = argv0.c_str ();
-
- if (parse_global_args_i (argc, argv, global_svc_config_argv) == -1)
- return -1;
-
- register_global_services_i (theone);
-
- int global_svc_config_argc = global_svc_config_argv.length ();
- if (!skip_service_config_open)
- {
- bool ignore_default_svc_conf_file = false;
-#if defined (TAO_PLATFORM_SVC_CONF_FILE_NOTSUP)
- ignore_default_svc_conf_file = true;
-#endif /* TAO_PLATFORM_SVC_CONF_FILE_NOTSUP */
-
- return theone->open (global_svc_config_argc,
- global_svc_config_argv.get_buffer (),
- ACE_DEFAULT_LOGGER_KEY,
- 0, // Don't ignore static services.
- ignore_default_svc_conf_file);
- }
- return 0;
- }
-
-
-
/// Open services, belonging to the gestalt instance
int
open_private_services_i (ACE_Service_Gestalt * pcfg,
int & argc,
ACE_TCHAR ** argv,
- bool skip_service_config_open)
+ bool skip_service_config_open,
+ bool ignore_default_svc_conf_file)
{
if (skip_service_config_open)
return 0;
- bool ignore_default_svc_conf_file = false;
#if defined (TAO_PLATFORM_SVC_CONF_FILE_NOTSUP)
ignore_default_svc_conf_file = true;
#endif /* TAO_PLATFORM_SVC_CONF_FILE_NOTSUP */
@@ -324,6 +326,8 @@ namespace
ignore_default_svc_conf_file);
}
+
+
/// @brief registers all process-wide (global) services, available to all ORBs
void
register_global_services_i (ACE_Service_Gestalt * pcfg)
@@ -391,6 +395,8 @@ namespace
} /* register_global_services_i */
+
+
void
register_additional_services_i (ACE_Service_Gestalt * pcfg)
{
@@ -473,11 +479,12 @@ namespace
} /* register_additional_services_i */
+
+
int
- parse_private_args_i (int &argc,
+ parse_svcconf_args_i (int &argc,
char **argv,
- CORBA::StringSeq &svc_config_argv,
- bool & skip_service_config_open)
+ CORBA::StringSeq &svc_config_argv)
{
// Extract the Service Configurator ORB options from the argument
// vector.
@@ -488,30 +495,7 @@ namespace
{
const ACE_TCHAR *current_arg = 0;
- // Start with the parameterless flags.
- if (arg_shifter.cur_arg_strncasecmp
- (ACE_TEXT ("-ORBSkipServiceConfigOpen")) == 0)
- {
- skip_service_config_open = true;
-
- arg_shifter.consume_arg ();
- }
- // Continue with flags that accept parameters.
- else if (0 != (current_arg = arg_shifter.get_the_parameter (ACE_TEXT ("-ORBSvcConfDirective"))))
- {
- len = svc_config_argv.length ();
- svc_config_argv.length (len + 2); // 2 arguments to add
-
- // This is used to pass arguments to the Service
- // Configurator using the "command line" to provide
- // configuration information rather than using a svc.conf
- // file. Pass the "-S" to the service configurator.
- svc_config_argv[len] = CORBA::string_dup ("-S");
- svc_config_argv[len + 1] = CORBA::string_dup (ACE_TEXT_ALWAYS_CHAR(current_arg));
-
- arg_shifter.consume_arg ();
- }
- else if (0 != (current_arg = arg_shifter.get_the_parameter (ACE_TEXT ("-ORBSvcConf"))))
+ if (0 != (current_arg = arg_shifter.get_the_parameter (ACE_TEXT ("-ORBSvcConf"))))
{
// Specify the name of the svc.conf file to be used.
@@ -545,6 +529,60 @@ namespace
arg_shifter.consume_arg();
}
+ // Can't interpret this argument. Move on to the next argument.
+ else
+ {
+ // Any arguments that don't match are ignored so that the
+ // caller can still use them.
+ arg_shifter.ignore_arg ();
+ }
+ }
+
+ return 0;
+
+ } /* parse_svcconf_args_i */
+
+
+
+
+ int
+ parse_private_args_i (int &argc,
+ char **argv,
+ CORBA::StringSeq &svc_config_argv,
+ bool & skip_service_config_open)
+ {
+ // Extract the Service Configurator ORB options from the argument
+ // vector.
+ ACE_Arg_Shifter arg_shifter (argc, argv);
+
+ CORBA::ULong len = 0;
+ while (arg_shifter.is_anything_left ())
+ {
+ const ACE_TCHAR *current_arg = 0;
+
+ // Start with the parameterless flags.
+ if (arg_shifter.cur_arg_strncasecmp
+ (ACE_TEXT ("-ORBSkipServiceConfigOpen")) == 0)
+ {
+ skip_service_config_open = true;
+
+ arg_shifter.consume_arg ();
+ }
+ // Continue with flags that accept parameters.
+ else if (0 != (current_arg = arg_shifter.get_the_parameter (ACE_TEXT ("-ORBSvcConfDirective"))))
+ {
+ len = svc_config_argv.length ();
+ svc_config_argv.length (len + 2); // 2 arguments to add
+
+ // This is used to pass arguments to the Service
+ // Configurator using the "command line" to provide
+ // configuration information rather than using a svc.conf
+ // file. Pass the "-S" to the service configurator.
+ svc_config_argv[len] = CORBA::string_dup ("-S");
+ svc_config_argv[len + 1] = CORBA::string_dup (ACE_TEXT_ALWAYS_CHAR(current_arg));
+
+ arg_shifter.consume_arg ();
+ }
else if (0 != (current_arg = arg_shifter.get_the_parameter (ACE_TEXT ("-ORBServiceConfigLoggerKey"))))
{
len = svc_config_argv.length ();
@@ -568,6 +606,8 @@ namespace
} /* parse_private_args_i */
+
+
int
parse_global_args_i (int &argc,
char **argv,
diff --git a/TAO/tests/ORB_Local_Config/Bug_1459/Test.cpp b/TAO/tests/ORB_Local_Config/Bug_1459/Test.cpp
index f8e728a78fe..2febd65d358 100644
--- a/TAO/tests/ORB_Local_Config/Bug_1459/Test.cpp
+++ b/TAO/tests/ORB_Local_Config/Bug_1459/Test.cpp
@@ -23,17 +23,17 @@ ACE_RCSID (tests, server, "$Id$")
#include "Service_Configuration_Per_ORB.h"
-const char argA[] = "-ORBId ORB-A -ORBSvcConf a.conf";
+const char argA[] = "AAA -ORBId ORB-A -ORBSvcConf a.conf";
// dynamic SSLIOP_Factory Service_Object * TAO_SSLIOP:_make_TAO_SSLIOP_Protocol_Factory() "-SSLAuthenticate SERVER_AND_CLIENT -SSLPrivateKey PEM:server_key.pem -SSLCertificate PEM:server_cert.pem";
// static Resource_Factory "-ORBProtocolFactory SSLIOP_Factory"
-const char argB[] = "-ORBSvcConf b.conf";
+const char argB[] = "BBB -ORBSvcConf b.conf";
// dynamic SSLIOP_Factory Service_Object * TAO_SSLIOP:_make_TAO_SSLIOP_Protocol_Factory() "-SSLAuthenticate SERVER_AND_CLIENT -SSLPrivateKey PEM:client_key.pem -SSLCertificate PEM:client_cert.pem"
// static Resource_Factory "-ORBProtocolFactory SSLIOP_Factory"
-const char argM[] = "-ORBId ORB-M -ORBSvcConf m.conf";
+const char argM[] = "MMM -ORBId ORB-M -ORBSvcConf m.conf";
// dynamic UIPMC_Factory Service_Object * TAO_PortableGroup:_make_TAO_UIPMC_Protocol_Factory() ""
// static Resource_Factory "-ORBProtocolFactory IIOP_Factory -ORBProtocolFactory UIPMC_Factory"
diff --git a/TAO/tests/ORB_Local_Config/Two_DLL_ORB/client.cpp b/TAO/tests/ORB_Local_Config/Two_DLL_ORB/client.cpp
index 5ab676754c5..c5a322b4249 100644
--- a/TAO/tests/ORB_Local_Config/Two_DLL_ORB/client.cpp
+++ b/TAO/tests/ORB_Local_Config/Two_DLL_ORB/client.cpp
@@ -57,53 +57,58 @@ Client_Worker::test_main (int argc, ACE_TCHAR *argv[] ACE_ENV_ARG_DECL)
// Doing this dance to allow the server some time to come up.
CORBA::Object_ptr co = 0;
- for (int attempts_left=5; co == 0 && attempts_left > 0; --attempts_left)
+ for (int attempts_left=5; attempts_left > 0; --attempts_left)
{
- ACE_DEBUG ((LM_DEBUG, "(%P|%t) Delaying the client to give the server a chance to start ...\n"));
- ACE_OS::sleep (7);
ACE_DEBUG ((LM_DEBUG, "(%P|%t) Client is ready to proceed.\n"));
ACE_TRY
{
co = orb->string_to_object(ior_file_.c_str () ACE_ENV_ARG_PARAMETER);
ACE_TRY_CHECK;
+
+ ACE_ASSERT (co != 0);
+ CORBA::Object_var tmp (co);
+
+ Test::Hello_var hello =
+ Test::Hello::_narrow(tmp.in () ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ if (CORBA::is_nil (hello.in ()))
+ {
+ ACE_ERROR_RETURN ((LM_DEBUG,
+ "(%P|%t) Nil Test::Hello reference <%s>\n",
+ ior_file_.c_str ()),
+ 1);
+ }
+
+ ACE_DEBUG ((LM_DEBUG, "(%P|%t) - Successfuly narrowed the Hello interface\n"));
+
+ CORBA::String_var the_string =
+ hello->get_string (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ ACE_DEBUG ((LM_DEBUG, "(%P|%t) - string returned from the server <%s>\n",
+ the_string.in ()));
+
+ hello->shutdown (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ attempts_left = 0; // We're done here
+
}
ACE_CATCH (CORBA::TRANSIENT, ex)
{
if (!attempts_left)
ACE_RE_THROW;
- else
- ACE_DEBUG ((LM_DEBUG, "(%P|%t) Client is retrying.\n"));
+ ACE_DEBUG ((LM_DEBUG,
+ "(%P|%t) Client is too quick - retrying, "
+ "while the server completes writing out its IOR.\n"));
+ ACE_OS::sleep (5);
}
ACE_ENDTRY;
}
- ACE_ASSERT (co != 0);
- CORBA::Object_var tmp (co);
-
- Test::Hello_var hello =
- Test::Hello::_narrow(tmp.in () ACE_ENV_ARG_PARAMETER);
- ACE_TRY_CHECK;
-
- if (CORBA::is_nil (hello.in ()))
- {
- ACE_ERROR_RETURN ((LM_DEBUG,
- "(%P|%t) Nil Test::Hello reference <%s>\n",
- ior_file_.c_str ()),
- 1);
- }
-
- CORBA::String_var the_string =
- hello->get_string (ACE_ENV_SINGLE_ARG_PARAMETER);
- ACE_TRY_CHECK;
-
- ACE_DEBUG ((LM_DEBUG, "(%P|%t) - string returned from the server <%s>\n",
- the_string.in ()));
-
- hello->shutdown (ACE_ENV_SINGLE_ARG_PARAMETER);
- ACE_TRY_CHECK;
-
orb->shutdown (0 ACE_ENV_ARG_PARAMETER);
ACE_CHECK;