summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormjb2 <mjb2@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1998-08-19 20:39:17 +0000
committermjb2 <mjb2@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1998-08-19 20:39:17 +0000
commitbb20acf227bf816e6b5f892991de091a56e3cfb3 (patch)
treec45060940fe36440d30b1c11b983cd842962b301
parent73b89296423669abcc585907d51b0143469fa7f6 (diff)
downloadATCD-bb20acf227bf816e6b5f892991de091a56e3cfb3.tar.gz
See Wed Aug 19 15:18:36 1998 Matthew J Braun <mjb2@cec.wustl.edu>
-rw-r--r--TAO/ChangeLog-98c13
-rw-r--r--TAO/orbsvcs/orbsvcs/AV/Endpoint_Strategy.cpp2
-rw-r--r--TAO/orbsvcs/orbsvcs/AV/Endpoint_Strategy.h3
-rw-r--r--TAO/orbsvcs/tests/Property/client.cpp69
-rw-r--r--TAO/orbsvcs/tests/Property/client.h3
-rw-r--r--TAO/performance-tests/Cubit/TAO/MT_Cubit/Task_Client.cpp106
-rw-r--r--TAO/performance-tests/Cubit/TAO/MT_Cubit/Task_Client.h6
-rw-r--r--TAO/performance-tests/Cubit/TAO/MT_Cubit/server.cpp67
-rw-r--r--TAO/performance-tests/Cubit/TAO/MT_Cubit/server.h15
-rw-r--r--TAO/tests/Cubit/TAO/IDL_Cubit/client_i.cpp56
-rw-r--r--TAO/tests/Cubit/TAO/IDL_Cubit/client_i.h5
-rw-r--r--TAO/tests/Cubit/TAO/MT_Cubit/Task_Client.cpp106
-rw-r--r--TAO/tests/Cubit/TAO/MT_Cubit/Task_Client.h6
-rw-r--r--TAO/tests/Cubit/TAO/MT_Cubit/server.cpp67
-rw-r--r--TAO/tests/Cubit/TAO/MT_Cubit/server.h15
15 files changed, 307 insertions, 232 deletions
diff --git a/TAO/ChangeLog-98c b/TAO/ChangeLog-98c
index 64c5514e136..171e5b8295f 100644
--- a/TAO/ChangeLog-98c
+++ b/TAO/ChangeLog-98c
@@ -1,3 +1,16 @@
+Wed Aug 19 15:18:36 1998 Matthew J Braun <mjb2@cec.wustl.edu>
+
+ * orbsvcs/orbsvcs/AV/Endpoint_Strategy.{h,cpp}:
+ Fixed template errors that derailed compilation
+
+ * orbsvcs/tests/Property/client.{h,cpp}:
+ * tests/Cubit/TAO/MT_Cubit/Task_Client.{h,cpp}:
+ * tests/Cubit/TAO/MT_client/server.{h,cpp}
+ * tests/Cubit/TAO/IDL_Cubit/client_i.{h,cpp}
+ Replaced old code with Naming_Utils code. Added a
+ TAO_Naming_Client to the *.h, and used it in the *.cpp to
+ contact the Naming Service for binds and resolves.
+
Wed Aug 19 15:06:59 1998 Carlos O'Ryan <coryan@cs.wustl.edu>
* tao/ORB.h:
diff --git a/TAO/orbsvcs/orbsvcs/AV/Endpoint_Strategy.cpp b/TAO/orbsvcs/orbsvcs/AV/Endpoint_Strategy.cpp
index 6d8bf071cc3..359ebcf2973 100644
--- a/TAO/orbsvcs/orbsvcs/AV/Endpoint_Strategy.cpp
+++ b/TAO/orbsvcs/orbsvcs/AV/Endpoint_Strategy.cpp
@@ -524,7 +524,7 @@ TAO_AV_Endpoint_Reactive_Strategy_B <T_StreamEndpoint, T_VDev, T_MediaCtrl>::act
if (this->make_stream_endpoint (stream_endpoint_b) == -1)
return -1;
- this->orb_manager_->activate (this->stream_endpoint_b_,
+ this->orb_manager_->activate (stream_endpoint_b,
env);
TAO_CHECK_ENV_RETURN (env, -1);
diff --git a/TAO/orbsvcs/orbsvcs/AV/Endpoint_Strategy.h b/TAO/orbsvcs/orbsvcs/AV/Endpoint_Strategy.h
index 1975ae60aaa..890cdd8b164 100644
--- a/TAO/orbsvcs/orbsvcs/AV/Endpoint_Strategy.h
+++ b/TAO/orbsvcs/orbsvcs/AV/Endpoint_Strategy.h
@@ -202,7 +202,8 @@ class TAO_ORBSVCS_Export TAO_AV_Endpoint_Reactive_Strategy_A
// ----------------------------------------------------------------------
template <class T_StreamEndpoint, class T_Vdev , class T_MediaCtrl>
class TAO_ORBSVCS_Export TAO_AV_Endpoint_Reactive_Strategy_B
- : public TAO_AV_Endpoint_Reactive_Strategy
+ : public TAO_AV_Endpoint_Reactive_Strategy <class T_StreamEndpoint,
+ class T_Vdev, class T_MediaCtrl>
// = DESCRIPTION
// Reactive strategy
{
diff --git a/TAO/orbsvcs/tests/Property/client.cpp b/TAO/orbsvcs/tests/Property/client.cpp
index 1efe7b90b1a..f7955f2da52 100644
--- a/TAO/orbsvcs/tests/Property/client.cpp
+++ b/TAO/orbsvcs/tests/Property/client.cpp
@@ -20,7 +20,7 @@
ACE_RCSID(Property, client, "$Id$")
-Client::Client (void)
+ Client::Client (void)
{
}
@@ -42,25 +42,20 @@ Client::init (int argc,
// Open the ORB.
manager_.orb ()->open ();
- // Naming service.
- CORBA::Object_var naming_obj =
- manager_.orb ()->resolve_initial_references ("NameService");
- if (CORBA::is_nil (naming_obj.in ()))
+ // Initialize the naming services
+ if (my_name_client_.init (manager_.orb (), argc, argv) != 0)
ACE_ERROR_RETURN ((LM_ERROR,
- " (%P|%t) Unable to resolve the Name Service.\n"),
+ " (%P|%t) Unable to initialize "
+ "the TAO_Naming_Client. \n"),
-1);
- CosNaming::NamingContext_var naming_context =
- CosNaming::NamingContext::_narrow (naming_obj.in (),
- env);
- TAO_CHECK_ENV_RETURN (env, 1);
// Bind PropertySetDef Object.
CosNaming::Name propsetdef_name (1);
propsetdef_name.length (1);
propsetdef_name [0].id = CORBA::string_dup ("PropertySetDef");
- CORBA::Object_var propsetdef_obj = naming_context->resolve (propsetdef_name,
- env);
+ CORBA::Object_var propsetdef_obj = my_name_client_->resolve (propsetdef_name,
+ env);
TAO_CHECK_ENV_RETURN (env, 1);
ACE_DEBUG ((LM_DEBUG, "Naming resolve done\n"));
@@ -173,8 +168,8 @@ Client::test_define_property (CORBA::Environment &env)
"Main : Char ch = %c\n",
ch));
this->propsetdef_->define_property ("char_property",
- anyval,
- env);
+ anyval,
+ env);
// Check if that is an user exception, if so, print it out.
if ((env.exception () != 0) &&
@@ -194,8 +189,8 @@ Client::test_define_property (CORBA::Environment &env)
"Main : Short s = %d\n",
s));
propsetdef_->define_property ("short_property",
- anyval,
- env);
+ anyval,
+ env);
// Check if that is an user exception, if so, print it out.
if ((env.exception () != 0) &&
@@ -215,8 +210,8 @@ Client::test_define_property (CORBA::Environment &env)
l));
CORBA::Any newany(anyval);
propsetdef_->define_property ("long_property",
- anyval,
- env);
+ anyval,
+ env);
// Check if that is an user exception, if so, print it out.
if ((env.exception () != 0) &&
@@ -235,8 +230,8 @@ Client::test_define_property (CORBA::Environment &env)
"Main : Float f = %f\n",
f));
propsetdef_->define_property ("float_property",
- anyval,
- env);
+ anyval,
+ env);
// Check if that is an user exception, if so, print it out.
if ((env.exception () != 0) &&
@@ -258,8 +253,8 @@ Client::test_define_property (CORBA::Environment &env)
strvar.in (),
newstr));
propsetdef_->define_property ("string_property",
- anyval,
- env);
+ anyval,
+ env);
// Check if that is an user exception, if so, print it out.
if ((env.exception () != 0) &&
@@ -290,9 +285,9 @@ Client::test_get_all_property_names (CORBA::Environment &env)
CosPropertyService::PropertyNames_var names_var;
CosPropertyService::PropertyNamesIterator_var iterator_var;
propsetdef_->get_all_property_names (how_many,
- names_var.out (),
- iterator_var.out (),
- env);
+ names_var.out (),
+ iterator_var.out (),
+ env);
TAO_CHECK_ENV_RETURN (env, -1);
// Print out the names in the names-sequence.
@@ -350,8 +345,8 @@ Client::test_get_properties (CORBA::Environment &env)
// Get the properties.
CORBA::Boolean return_val = propsetdef_->get_properties (names.in (),
- properties.out (),
- env);
+ properties.out (),
+ env);
TAO_CHECK_ENV_RETURN (env, -1);
if (properties.ptr () != 0)
@@ -436,7 +431,7 @@ Client::test_delete_properties (CORBA::Environment &env)
prop_names.length (),
prop_names.maximum ()));
this->propsetdef_->delete_properties (prop_names,
- env);
+ env);
TAO_CHECK_ENV_RETURN (env, 0);
return 0;
@@ -509,9 +504,9 @@ Client::test_get_all_properties (CORBA::Environment &env)
CosPropertyService::Properties_var properties;
CosPropertyService::PropertiesIterator_var iterator;
propsetdef_->get_all_properties (how_many,
- properties.out (),
- iterator.out (),
- env);
+ properties.out (),
+ iterator.out (),
+ env);
TAO_CHECK_ENV_RETURN (env, -1);
// Print out the properties now.
@@ -647,9 +642,9 @@ Client::test_define_property_with_mode (CORBA::Environment &env)
l));
CORBA::Any newany(anyval);
propsetdef_->define_property_with_mode ("long_property",
- anyval,
- CosPropertyService::fixed_normal,
- env);
+ anyval,
+ CosPropertyService::fixed_normal,
+ env);
TAO_CHECK_ENV_RETURN (env, -1);
@@ -662,9 +657,9 @@ Client::test_define_property_with_mode (CORBA::Environment &env)
"Main : Float f = %f\n",
f));
propsetdef_->define_property_with_mode ("float_property",
- anyval,
- CosPropertyService::fixed_readonly,
- env);
+ anyval,
+ CosPropertyService::fixed_readonly,
+ env);
TAO_CHECK_ENV_RETURN (env, -1);
// Prepare a String and "define" that in the PropertySet.
diff --git a/TAO/orbsvcs/tests/Property/client.h b/TAO/orbsvcs/tests/Property/client.h
index fac248d6fd3..f602d5cf7d6 100644
--- a/TAO/orbsvcs/tests/Property/client.h
+++ b/TAO/orbsvcs/tests/Property/client.h
@@ -98,6 +98,9 @@ protected:
TAO_ORB_Manager manager_;
// The ORB manager, handles ORB initialization etc.
+ TAO_Naming_Client my_name_client_;
+ // The Name Client, simplifies NameService interaction
+
CosPropertyService::PropertySetDef_var propsetdef_;
// To test propertySetDef interface.
};
diff --git a/TAO/performance-tests/Cubit/TAO/MT_Cubit/Task_Client.cpp b/TAO/performance-tests/Cubit/TAO/MT_Cubit/Task_Client.cpp
index f45f14b0654..afb6e2776cc 100644
--- a/TAO/performance-tests/Cubit/TAO/MT_Cubit/Task_Client.cpp
+++ b/TAO/performance-tests/Cubit/TAO/MT_Cubit/Task_Client.cpp
@@ -9,30 +9,30 @@
ACE_RCSID(MT_Cubit, Task_Client, "$Id$")
-Task_State::Task_State (int argc, char **argv)
- : key_ ("Cubit"),
- loop_count_ (1000),
- thread_count_ (2),
- datatype_ (CB_OCTET),
- argc_ (argc),
- argv_ (argv),
- thread_per_rate_ (0),
- global_jitter_array_ (0),
- shutdown_ (0),
- oneway_ (0),
- use_name_service_ (1),
- one_to_n_test_ (0),
- context_switch_test_ (0),
- ior_file_ (0),
- granularity_ (1),
- use_utilization_test_ (0),
- high_priority_loop_count_ (0),
- use_multiple_priority_ (0),
- utilization_task_started_ (0),
- run_server_utilization_test_ (0),
- util_time_ (0),
- ready_ (0),
- ready_cnd_ (ready_mtx_)
+ Task_State::Task_State (int argc, char **argv)
+ : key_ ("Cubit"),
+ loop_count_ (1000),
+ thread_count_ (2),
+ datatype_ (CB_OCTET),
+ argc_ (argc),
+ argv_ (argv),
+ thread_per_rate_ (0),
+ global_jitter_array_ (0),
+ shutdown_ (0),
+ oneway_ (0),
+ use_name_service_ (1),
+ one_to_n_test_ (0),
+ context_switch_test_ (0),
+ ior_file_ (0),
+ granularity_ (1),
+ use_utilization_test_ (0),
+ high_priority_loop_count_ (0),
+ use_multiple_priority_ (0),
+ utilization_task_started_ (0),
+ run_server_utilization_test_ (0),
+ util_time_ (0),
+ ready_ (0),
+ ready_cnd_ (ready_mtx_)
{
}
@@ -181,35 +181,35 @@ Task_State::parse_args (int argc,char **argv)
// file.
{
ACE_NEW_RETURN (barrier_,
- ACE_Barrier (thread_count_ + 2),
- -1);
+ ACE_Barrier (thread_count_ + 2),
+ -1);
}
else
{
ACE_NEW_RETURN (barrier_,
- ACE_Barrier (thread_count_ + 1),
- -1);
+ ACE_Barrier (thread_count_ + 1),
+ -1);
}
}
else
{
ACE_NEW_RETURN (barrier_,
- ACE_Barrier (thread_count_),
+ ACE_Barrier (thread_count_),
-1);
}
ACE_NEW_RETURN (semaphore_,
- ACE_Thread_Semaphore (0),
+ ACE_Thread_Semaphore (0),
-1);
ACE_NEW_RETURN (latency_,
- double [thread_count_],
+ double [thread_count_],
-1);
ACE_NEW_RETURN (global_jitter_array_,
- double *[thread_count_],
- -1);
+ double *[thread_count_],
+ -1);
ACE_NEW_RETURN (count_,
- u_int [thread_count_],
- -1);
+ u_int [thread_count_],
+ -1);
return 0;
}
@@ -434,17 +434,13 @@ Client::svc (void)
ACE_DEBUG ((LM_DEBUG,"(%t) ORB_init success\n"));
if (ts_->use_name_service_ != 0)
{
- naming_obj =
- orb->resolve_initial_references ("NameService");
-
- if (CORBA::is_nil (naming_obj.in ()))
- ACE_ERROR ((LM_ERROR,
- " (%P|%t) Unable to resolve the Name Service.\n"));
- else
- this->naming_context_ =
- CosNaming::NamingContext::_narrow (naming_obj.in (), env);
+ // Initialize the naming services
+ if (my_name_client_.init (orb.in (), argc, argv) != 0)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ " (%P|%t) Unable to initialize "
+ "the TAO_Naming_Client. \n"),
+ -1);
}
-
{
// ACE_DEBUG ((LM_DEBUG,"(%t) Not using Naming service\n"));
@@ -510,7 +506,7 @@ Client::svc (void)
TAO_TRY
{
// if the naming service was resolved successsfully ...
- if (!CORBA::is_nil (this->naming_context_.in ()))
+ if (!CORBA::is_nil (this->my_name_client_.get_context ()))
{
ACE_DEBUG ((LM_DEBUG,
" (%t) ----- Using the NameService resolve() method"
@@ -522,7 +518,7 @@ Client::svc (void)
mt_cubit_context_name[0].id = CORBA::string_dup ("MT_Cubit");
objref =
- this->naming_context_->resolve (mt_cubit_context_name,
+ this->my_name_client_->resolve (mt_cubit_context_name,
TAO_TRY_ENV);
TAO_CHECK_ENV;
@@ -853,7 +849,7 @@ Client::run_tests (Cubit_ptr cb,
}
break;
}
- // Cube a long.
+ // Cube a long.
case CB_LONG:
{
@@ -984,7 +980,7 @@ Client::run_tests (Cubit_ptr cb,
# else /* CHORUS */
// Store the time in usecs.
real_time = (delta_t.sec () * ACE_ONE_SECOND_IN_USECS +
- delta_t.usec ()) / ts_->granularity_;
+ delta_t.usec ()) / ts_->granularity_;
# endif /* !CHORUS */
delta = ((40 * fabs (real_time) / 100) + (60 * delta / 100)); // pow(10,6)
latency += real_time * ts_->granularity_;
@@ -1029,15 +1025,15 @@ Client::run_tests (Cubit_ptr cb,
my_jitter_array [i/ts_->granularity_] = real_time * ACE_ONE_SECOND_IN_MSECS;
#endif /* !ACE_LACKS_FLOATING_POINT */
} // END OF IF :
- // if ( (i % ts_->granularity_) == (ts_->granularity_ - 1) &&
- // (ts_->use_utilization_test_ == 0) &&
- // (ts_->run_server_utilization_test_ == 0)
- // )
+ // if ( (i % ts_->granularity_) == (ts_->granularity_ - 1) &&
+ // (ts_->use_utilization_test_ == 0) &&
+ // (ts_->run_server_utilization_test_ == 0)
+ // )
if ( ts_->thread_per_rate_ == 1 && id_ < (ts_->thread_count_ - 1) )
{
if (ts_->semaphore_->tryacquire () != -1)
- break;
+ break;
}
else
// if We are the high priority client.
@@ -1135,7 +1131,7 @@ Client::run_tests (Cubit_ptr cb,
}
#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
- template class ACE_Condition<ACE_SYNCH_MUTEX>;
+template class ACE_Condition<ACE_SYNCH_MUTEX>;
#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)
# pragma instantiate ACE_Condition<ACE_SYNCH_MUTEX>
#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */
diff --git a/TAO/performance-tests/Cubit/TAO/MT_Cubit/Task_Client.h b/TAO/performance-tests/Cubit/TAO/MT_Cubit/Task_Client.h
index 3e47fe7e9a2..fb8a347a8f9 100644
--- a/TAO/performance-tests/Cubit/TAO/MT_Cubit/Task_Client.h
+++ b/TAO/performance-tests/Cubit/TAO/MT_Cubit/Task_Client.h
@@ -27,6 +27,7 @@
#include "ace/High_Res_Timer.h"
#include "orbsvcs/CosNamingC.h"
+#include "orbsvcs/Naming/Naming_Utils.h"
#include "cubitC.h"
#if defined (CHORUS)
@@ -269,11 +270,14 @@ private:
u_int id_;
// unique id of the task
- CosNaming::NamingContext_var naming_context_;
+ // CosNaming::NamingContext_var naming_context_;
// Object reference to the naming service.
CosNaming::NamingContext_var mt_cubit_context_;
// Object reference to the cubit context "MT_Cubit".
+
+ TAO_Naming_Client my_name_client_;
+ // Naming Client intermediary to naming service stuff
};
#endif /* !defined (TASK_CLIENT_H) */
diff --git a/TAO/performance-tests/Cubit/TAO/MT_Cubit/server.cpp b/TAO/performance-tests/Cubit/TAO/MT_Cubit/server.cpp
index 0bd0e673f90..493262e8edf 100644
--- a/TAO/performance-tests/Cubit/TAO/MT_Cubit/server.cpp
+++ b/TAO/performance-tests/Cubit/TAO/MT_Cubit/server.cpp
@@ -235,24 +235,34 @@ Cubit_Task::initialize_orb (void)
if (GLOBALS::instance ()->use_name_service == 0)
return 0;
-
- CORBA::Object_var naming_obj =
- this->orb_->resolve_initial_references ("NameService");
- if (CORBA::is_nil (naming_obj.in ()))
- ACE_ERROR_RETURN ((LM_ERROR,
- " (%P|%t) Unable to resolve the Name Service.\n"),
- -1);
-
- this->naming_context_ =
- CosNaming::NamingContext::_narrow (naming_obj.in (),
+ /*
+ CORBA::Object_var naming_obj =
+ this->orb_->resolve_initial_references ("NameService");
+ if (CORBA::is_nil (naming_obj.in ()))
+ ACE_ERROR_RETURN ((LM_ERROR,
+ " (%P|%t) Unable to resolve the Name Service.\n"),
+ -1);
+
+ this->naming_context_ =
+ CosNaming::NamingContext::_narrow (naming_obj.in (),
TAO_TRY_ENV);
// Check the environment and return 1 if exception occurred or
// nil pointer.
if (TAO_TRY_ENV.exception () != 0 ||
- CORBA::is_nil (this->naming_context_.in ())==CORBA::B_TRUE )
- return -1;
-
+ CORBA::is_nil (this->naming_context_.in ())==CORBA::B_TRUE )
+ return -1;
+ */
+
+ // Initialize the naming services
+ // Init should be able to be passed the command line arguments,
+ // but it isn't possible here, so use dummy values
+ if (my_name_client_.init (orb_, 0, 0) != 0)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ " (%P|%t) Unable to initialize "
+ "the TAO_Naming_Client. \n"),
+ -1);
+
// Register the servant with the Naming Context....
CosNaming::Name cubit_context_name (1);
cubit_context_name.length (1);
@@ -261,7 +271,7 @@ Cubit_Task::initialize_orb (void)
TAO_TRY_ENV.clear ();
CORBA::Object_var objref =
- this->naming_context_->bind_new_context (cubit_context_name,
+ this->my_name_client_->bind_new_context (cubit_context_name,
TAO_TRY_ENV);
if (TAO_TRY_ENV.exception() != 0)
@@ -271,7 +281,7 @@ Cubit_Task::initialize_orb (void)
if (ex != 0)
{
TAO_TRY_ENV.clear ();
- objref = this->naming_context_->resolve (cubit_context_name,
+ objref = this->my_name_client_->resolve (cubit_context_name,
TAO_TRY_ENV);
printf("NamingContext::AlreadyBound\n");
}
@@ -442,16 +452,25 @@ int
Server::start_servants (ACE_Thread_Manager *serv_thr_mgr,
Task_State *ts)
{
+ ACE_NEW_RETURN (low_thread_args,
+ char[arg_len + 1],
+ -1);
- /*DONE*/// @@ Naga, can you please explain why you need to do all of this?
- /*DONE*/// i.e, we need some comments here! In particular, what is args1
- /*DONE*/// being used for and how will we know that ACE_DEFAULT_ARGV_BUFSIZ
- /*DONE*/// is an appropriate size? It seems to me that we should either (1)
- /*DONE*/// add an accessor on ACE_ARGV to determine what this size ought to
- /*DONE*/// be or (2) we should try to use/add a method on ACE_ARGV that
- /*DONE*/// converts the argv back into a char * buffer or something! At any
- /*DONE*/// rate, this code should be cleaned up and abstracted better.
-
+ ACE_OS::strcpy (low_thread_args,
+ arg_buf);
+ char *args1;
+
+ // @@ Naga, can you please explain why you need to do all of this?
+ // i.e, we need some comments here! In particular, what is args1
+ // being used for and how will we know that ACE_DEFAULT_ARGV_BUFSIZ
+ // is an appropriate size? It seems to me that we should either (1)
+ // add an accessor on ACE_ARGV to determine what this size ought to
+ // be or (2) we should try to use/add a method on ACE_ARGV that
+ // converts the argv back into a char * buffer or something! At any
+ // rate, this code should be cleaned up and abstracted better.
+ ACE_NEW_RETURN (args1,
+ char[ACE_DEFAULT_ARGV_BUFSIZ],
+ -1);
int i;
for (i = 0; i < this->argc_ ; i++)
diff --git a/TAO/performance-tests/Cubit/TAO/MT_Cubit/server.h b/TAO/performance-tests/Cubit/TAO/MT_Cubit/server.h
index 64ab439d044..8b0e2704f84 100644
--- a/TAO/performance-tests/Cubit/TAO/MT_Cubit/server.h
+++ b/TAO/performance-tests/Cubit/TAO/MT_Cubit/server.h
@@ -17,8 +17,8 @@
#if defined (TAO_PLATFORM_SVC_CONF_FILE_NOTSUP)
#define TAO_DEFAULT_SERVER_STRATEGY_FACTORY_ARGS { "-ORBconcurrency", "thread-per-connection", \
- "-ORBdemuxstrategy", "dynamic", \
- "-ORBtablesize", "128" }
+ "-ORBdemuxstrategy", "dynamic", \
+ "-ORBtablesize", "128" }
#endif
#include "ace/Get_Opt.h"
@@ -26,6 +26,7 @@
#include "ace/ARGV.h"
#include "ace/Sched_Params.h"
#include "orbsvcs/CosNamingC.h"
+#include "orbsvcs/Naming/Naming_Utils.h"
// TAO includes.
#include "tao/corba.h"
@@ -88,7 +89,7 @@ class Cubit_Task : public ACE_Task<ACE_MT_SYNCH>
{
// = TITLE
// Encapsulates an ORB for the Cubit application.
- public:
+public:
Cubit_Task (const char *args,
const char* orbname,
u_int num_of_objs,
@@ -134,7 +135,7 @@ private:
CORBA::String *servants_iors_;
// ior strings of the servants
- CosNaming::NamingContext_var naming_context_;
+ //CosNaming::NamingContext_var naming_context_;
// Object reference to the naming service
u_int task_id_;
@@ -148,6 +149,10 @@ private:
TAO_ORB_Manager orb_manager_;
// The TAO ORB Manager
+
+ TAO_Naming_Client my_name_client_;
+ // An instance of the name client used for resolving the factory
+ // objects.
};
@@ -158,7 +163,7 @@ public:
int initialize (int argc, char **argv);
int start_servants (ACE_Thread_Manager *serv_thr_mgr,Task_State *ts);
Util_Thread * start_utilization (ACE_Thread_Manager *util_thr_mgr, Task_State *ts);
- private:
+private:
int argc_;
char **argv_;
};
diff --git a/TAO/tests/Cubit/TAO/IDL_Cubit/client_i.cpp b/TAO/tests/Cubit/TAO/IDL_Cubit/client_i.cpp
index 12bcc57f907..92f0a58ed21 100644
--- a/TAO/tests/Cubit/TAO/IDL_Cubit/client_i.cpp
+++ b/TAO/tests/Cubit/TAO/IDL_Cubit/client_i.cpp
@@ -11,7 +11,7 @@ ACE_RCSID(IDL_Cubit, client_i, "$Id$")
#if defined (ACE_ENABLE_TIMEPROBES)
-static const char *Cubit_Client_Timeprobe_Description[] =
+ static const char *Cubit_Client_Timeprobe_Description[] =
{
"Cubit_Client::cube_oneway - start",
"Cubit_Client::cube_oneway - end",
@@ -162,7 +162,7 @@ Cubit_Client::parse_args (void)
"Unable to read ior from %s : %p\n",
get_opts.optarg),
-1);
- break;
+ break;
case 'k': // read the cubit IOR from the command-line.
this->cubit_factory_key_ =
ACE_OS::strdup (get_opts.optarg);
@@ -357,7 +357,7 @@ Cubit_Client::cube_octet (int i)
{
CORBA::Octet arg_octet = this->func (i);
- // Cube an octet.
+ // Cube an octet.
CORBA::Octet ret_octet;
{
ACE_FUNCTION_TIMEPROBE (CUBIT_CLIENT_CUBE_OCTET_START);
@@ -637,11 +637,11 @@ Cubit_Client::print_stats (const char *call_name,
"system_time\t= %0.06f ms\n"
"\t%0.00f calls/second\n",
elapsed_time.real_time < 0.0 ? 0.0
- : elapsed_time.real_time * ACE_ONE_SECOND_IN_MSECS,
+ : elapsed_time.real_time * ACE_ONE_SECOND_IN_MSECS,
elapsed_time.user_time < 0.0 ? 0.0
- : elapsed_time.user_time * ACE_ONE_SECOND_IN_MSECS,
+ : elapsed_time.user_time * ACE_ONE_SECOND_IN_MSECS,
elapsed_time.system_time < 0.0 ? 0.0
- : elapsed_time.system_time * ACE_ONE_SECOND_IN_MSECS,
+ : elapsed_time.system_time * ACE_ONE_SECOND_IN_MSECS,
calls_per_sec < 0.0 ? 0.0 : calls_per_sec));
#endif /* ! ACE_LACKS_FLOATING_POINT */
}
@@ -920,21 +920,31 @@ Cubit_Client::init_naming_service (void)
{
TAO_TRY
{
- // @@ This code should use the new TAO_Naming_Client helper
- // class.
- CORBA::Object_var naming_obj =
+ /*
+ // @@ This code should use the new TAO_Naming_Client helper
+ // class.
+ CORBA::Object_var naming_obj =
this->orb_->resolve_initial_references ("NameService");
-
- if (CORBA::is_nil (naming_obj.in ()))
- ACE_ERROR_RETURN ((LM_ERROR,
- " (%P|%t) Unable to resolve the NameService.\n"),
- -1);
-
- CosNaming::NamingContext_var naming_context =
- CosNaming::NamingContext::_narrow (naming_obj.in (),
- TAO_TRY_ENV);
- TAO_CHECK_ENV;
-
+
+ if (CORBA::is_nil (naming_obj.in ()))
+ ACE_ERROR_RETURN ((LM_ERROR,
+ " (%P|%t) Unable to resolve the NameService.\n"),
+ -1);
+
+ CosNaming::NamingContext_var naming_context =
+ CosNaming::NamingContext::_narrow (naming_obj.in (),
+ TAO_TRY_ENV);
+ TAO_CHECK_ENV;
+
+ */
+
+ // Initialize the naming services
+ if (my_name_client_.init (orb_, argc_, argv_) != 0)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ " (%P|%t) Unable to initialize "
+ "the TAO_Naming_Client. \n"),
+ -1);
+
CosNaming::Name cubit_factory_name (2);
cubit_factory_name.length (2);
cubit_factory_name[0].id =
@@ -942,8 +952,8 @@ Cubit_Client::init_naming_service (void)
cubit_factory_name[1].id =
CORBA::string_dup ("cubit_factory");
CORBA::Object_var factory_obj =
- naming_context->resolve (cubit_factory_name,
- TAO_TRY_ENV);
+ my_name_client_->resolve (cubit_factory_name,
+ TAO_TRY_ENV);
TAO_CHECK_ENV;
this->factory_ =
@@ -955,7 +965,7 @@ Cubit_Client::init_naming_service (void)
ACE_ERROR_RETURN ((LM_ERROR,
" could not resolve cubit factory in Naming service <%s>\n"),
-1);
- }
+ }
TAO_CATCHANY
{
TAO_TRY_ENV.print_exception ("Cubit::init_naming_service");
diff --git a/TAO/tests/Cubit/TAO/IDL_Cubit/client_i.h b/TAO/tests/Cubit/TAO/IDL_Cubit/client_i.h
index cdb47aca91e..6e99675e89b 100644
--- a/TAO/tests/Cubit/TAO/IDL_Cubit/client_i.h
+++ b/TAO/tests/Cubit/TAO/IDL_Cubit/client_i.h
@@ -22,6 +22,7 @@
#include "ace/Profile_Timer.h"
#include "tao/corba.h"
#include "cubitC.h"
+#include "orbsvcs/Naming/Naming_Utils.h"
class Cubit_Client
{
@@ -144,4 +145,8 @@ private:
int only_oneway_;
// Run only the cube_oneway() test.
+
+ TAO_Naming_Client my_name_client_;
+ // An instance of the name client used for resolving the factory
+ // objects.
};
diff --git a/TAO/tests/Cubit/TAO/MT_Cubit/Task_Client.cpp b/TAO/tests/Cubit/TAO/MT_Cubit/Task_Client.cpp
index f45f14b0654..afb6e2776cc 100644
--- a/TAO/tests/Cubit/TAO/MT_Cubit/Task_Client.cpp
+++ b/TAO/tests/Cubit/TAO/MT_Cubit/Task_Client.cpp
@@ -9,30 +9,30 @@
ACE_RCSID(MT_Cubit, Task_Client, "$Id$")
-Task_State::Task_State (int argc, char **argv)
- : key_ ("Cubit"),
- loop_count_ (1000),
- thread_count_ (2),
- datatype_ (CB_OCTET),
- argc_ (argc),
- argv_ (argv),
- thread_per_rate_ (0),
- global_jitter_array_ (0),
- shutdown_ (0),
- oneway_ (0),
- use_name_service_ (1),
- one_to_n_test_ (0),
- context_switch_test_ (0),
- ior_file_ (0),
- granularity_ (1),
- use_utilization_test_ (0),
- high_priority_loop_count_ (0),
- use_multiple_priority_ (0),
- utilization_task_started_ (0),
- run_server_utilization_test_ (0),
- util_time_ (0),
- ready_ (0),
- ready_cnd_ (ready_mtx_)
+ Task_State::Task_State (int argc, char **argv)
+ : key_ ("Cubit"),
+ loop_count_ (1000),
+ thread_count_ (2),
+ datatype_ (CB_OCTET),
+ argc_ (argc),
+ argv_ (argv),
+ thread_per_rate_ (0),
+ global_jitter_array_ (0),
+ shutdown_ (0),
+ oneway_ (0),
+ use_name_service_ (1),
+ one_to_n_test_ (0),
+ context_switch_test_ (0),
+ ior_file_ (0),
+ granularity_ (1),
+ use_utilization_test_ (0),
+ high_priority_loop_count_ (0),
+ use_multiple_priority_ (0),
+ utilization_task_started_ (0),
+ run_server_utilization_test_ (0),
+ util_time_ (0),
+ ready_ (0),
+ ready_cnd_ (ready_mtx_)
{
}
@@ -181,35 +181,35 @@ Task_State::parse_args (int argc,char **argv)
// file.
{
ACE_NEW_RETURN (barrier_,
- ACE_Barrier (thread_count_ + 2),
- -1);
+ ACE_Barrier (thread_count_ + 2),
+ -1);
}
else
{
ACE_NEW_RETURN (barrier_,
- ACE_Barrier (thread_count_ + 1),
- -1);
+ ACE_Barrier (thread_count_ + 1),
+ -1);
}
}
else
{
ACE_NEW_RETURN (barrier_,
- ACE_Barrier (thread_count_),
+ ACE_Barrier (thread_count_),
-1);
}
ACE_NEW_RETURN (semaphore_,
- ACE_Thread_Semaphore (0),
+ ACE_Thread_Semaphore (0),
-1);
ACE_NEW_RETURN (latency_,
- double [thread_count_],
+ double [thread_count_],
-1);
ACE_NEW_RETURN (global_jitter_array_,
- double *[thread_count_],
- -1);
+ double *[thread_count_],
+ -1);
ACE_NEW_RETURN (count_,
- u_int [thread_count_],
- -1);
+ u_int [thread_count_],
+ -1);
return 0;
}
@@ -434,17 +434,13 @@ Client::svc (void)
ACE_DEBUG ((LM_DEBUG,"(%t) ORB_init success\n"));
if (ts_->use_name_service_ != 0)
{
- naming_obj =
- orb->resolve_initial_references ("NameService");
-
- if (CORBA::is_nil (naming_obj.in ()))
- ACE_ERROR ((LM_ERROR,
- " (%P|%t) Unable to resolve the Name Service.\n"));
- else
- this->naming_context_ =
- CosNaming::NamingContext::_narrow (naming_obj.in (), env);
+ // Initialize the naming services
+ if (my_name_client_.init (orb.in (), argc, argv) != 0)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ " (%P|%t) Unable to initialize "
+ "the TAO_Naming_Client. \n"),
+ -1);
}
-
{
// ACE_DEBUG ((LM_DEBUG,"(%t) Not using Naming service\n"));
@@ -510,7 +506,7 @@ Client::svc (void)
TAO_TRY
{
// if the naming service was resolved successsfully ...
- if (!CORBA::is_nil (this->naming_context_.in ()))
+ if (!CORBA::is_nil (this->my_name_client_.get_context ()))
{
ACE_DEBUG ((LM_DEBUG,
" (%t) ----- Using the NameService resolve() method"
@@ -522,7 +518,7 @@ Client::svc (void)
mt_cubit_context_name[0].id = CORBA::string_dup ("MT_Cubit");
objref =
- this->naming_context_->resolve (mt_cubit_context_name,
+ this->my_name_client_->resolve (mt_cubit_context_name,
TAO_TRY_ENV);
TAO_CHECK_ENV;
@@ -853,7 +849,7 @@ Client::run_tests (Cubit_ptr cb,
}
break;
}
- // Cube a long.
+ // Cube a long.
case CB_LONG:
{
@@ -984,7 +980,7 @@ Client::run_tests (Cubit_ptr cb,
# else /* CHORUS */
// Store the time in usecs.
real_time = (delta_t.sec () * ACE_ONE_SECOND_IN_USECS +
- delta_t.usec ()) / ts_->granularity_;
+ delta_t.usec ()) / ts_->granularity_;
# endif /* !CHORUS */
delta = ((40 * fabs (real_time) / 100) + (60 * delta / 100)); // pow(10,6)
latency += real_time * ts_->granularity_;
@@ -1029,15 +1025,15 @@ Client::run_tests (Cubit_ptr cb,
my_jitter_array [i/ts_->granularity_] = real_time * ACE_ONE_SECOND_IN_MSECS;
#endif /* !ACE_LACKS_FLOATING_POINT */
} // END OF IF :
- // if ( (i % ts_->granularity_) == (ts_->granularity_ - 1) &&
- // (ts_->use_utilization_test_ == 0) &&
- // (ts_->run_server_utilization_test_ == 0)
- // )
+ // if ( (i % ts_->granularity_) == (ts_->granularity_ - 1) &&
+ // (ts_->use_utilization_test_ == 0) &&
+ // (ts_->run_server_utilization_test_ == 0)
+ // )
if ( ts_->thread_per_rate_ == 1 && id_ < (ts_->thread_count_ - 1) )
{
if (ts_->semaphore_->tryacquire () != -1)
- break;
+ break;
}
else
// if We are the high priority client.
@@ -1135,7 +1131,7 @@ Client::run_tests (Cubit_ptr cb,
}
#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
- template class ACE_Condition<ACE_SYNCH_MUTEX>;
+template class ACE_Condition<ACE_SYNCH_MUTEX>;
#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)
# pragma instantiate ACE_Condition<ACE_SYNCH_MUTEX>
#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */
diff --git a/TAO/tests/Cubit/TAO/MT_Cubit/Task_Client.h b/TAO/tests/Cubit/TAO/MT_Cubit/Task_Client.h
index 3e47fe7e9a2..fb8a347a8f9 100644
--- a/TAO/tests/Cubit/TAO/MT_Cubit/Task_Client.h
+++ b/TAO/tests/Cubit/TAO/MT_Cubit/Task_Client.h
@@ -27,6 +27,7 @@
#include "ace/High_Res_Timer.h"
#include "orbsvcs/CosNamingC.h"
+#include "orbsvcs/Naming/Naming_Utils.h"
#include "cubitC.h"
#if defined (CHORUS)
@@ -269,11 +270,14 @@ private:
u_int id_;
// unique id of the task
- CosNaming::NamingContext_var naming_context_;
+ // CosNaming::NamingContext_var naming_context_;
// Object reference to the naming service.
CosNaming::NamingContext_var mt_cubit_context_;
// Object reference to the cubit context "MT_Cubit".
+
+ TAO_Naming_Client my_name_client_;
+ // Naming Client intermediary to naming service stuff
};
#endif /* !defined (TASK_CLIENT_H) */
diff --git a/TAO/tests/Cubit/TAO/MT_Cubit/server.cpp b/TAO/tests/Cubit/TAO/MT_Cubit/server.cpp
index 0bd0e673f90..493262e8edf 100644
--- a/TAO/tests/Cubit/TAO/MT_Cubit/server.cpp
+++ b/TAO/tests/Cubit/TAO/MT_Cubit/server.cpp
@@ -235,24 +235,34 @@ Cubit_Task::initialize_orb (void)
if (GLOBALS::instance ()->use_name_service == 0)
return 0;
-
- CORBA::Object_var naming_obj =
- this->orb_->resolve_initial_references ("NameService");
- if (CORBA::is_nil (naming_obj.in ()))
- ACE_ERROR_RETURN ((LM_ERROR,
- " (%P|%t) Unable to resolve the Name Service.\n"),
- -1);
-
- this->naming_context_ =
- CosNaming::NamingContext::_narrow (naming_obj.in (),
+ /*
+ CORBA::Object_var naming_obj =
+ this->orb_->resolve_initial_references ("NameService");
+ if (CORBA::is_nil (naming_obj.in ()))
+ ACE_ERROR_RETURN ((LM_ERROR,
+ " (%P|%t) Unable to resolve the Name Service.\n"),
+ -1);
+
+ this->naming_context_ =
+ CosNaming::NamingContext::_narrow (naming_obj.in (),
TAO_TRY_ENV);
// Check the environment and return 1 if exception occurred or
// nil pointer.
if (TAO_TRY_ENV.exception () != 0 ||
- CORBA::is_nil (this->naming_context_.in ())==CORBA::B_TRUE )
- return -1;
-
+ CORBA::is_nil (this->naming_context_.in ())==CORBA::B_TRUE )
+ return -1;
+ */
+
+ // Initialize the naming services
+ // Init should be able to be passed the command line arguments,
+ // but it isn't possible here, so use dummy values
+ if (my_name_client_.init (orb_, 0, 0) != 0)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ " (%P|%t) Unable to initialize "
+ "the TAO_Naming_Client. \n"),
+ -1);
+
// Register the servant with the Naming Context....
CosNaming::Name cubit_context_name (1);
cubit_context_name.length (1);
@@ -261,7 +271,7 @@ Cubit_Task::initialize_orb (void)
TAO_TRY_ENV.clear ();
CORBA::Object_var objref =
- this->naming_context_->bind_new_context (cubit_context_name,
+ this->my_name_client_->bind_new_context (cubit_context_name,
TAO_TRY_ENV);
if (TAO_TRY_ENV.exception() != 0)
@@ -271,7 +281,7 @@ Cubit_Task::initialize_orb (void)
if (ex != 0)
{
TAO_TRY_ENV.clear ();
- objref = this->naming_context_->resolve (cubit_context_name,
+ objref = this->my_name_client_->resolve (cubit_context_name,
TAO_TRY_ENV);
printf("NamingContext::AlreadyBound\n");
}
@@ -442,16 +452,25 @@ int
Server::start_servants (ACE_Thread_Manager *serv_thr_mgr,
Task_State *ts)
{
+ ACE_NEW_RETURN (low_thread_args,
+ char[arg_len + 1],
+ -1);
- /*DONE*/// @@ Naga, can you please explain why you need to do all of this?
- /*DONE*/// i.e, we need some comments here! In particular, what is args1
- /*DONE*/// being used for and how will we know that ACE_DEFAULT_ARGV_BUFSIZ
- /*DONE*/// is an appropriate size? It seems to me that we should either (1)
- /*DONE*/// add an accessor on ACE_ARGV to determine what this size ought to
- /*DONE*/// be or (2) we should try to use/add a method on ACE_ARGV that
- /*DONE*/// converts the argv back into a char * buffer or something! At any
- /*DONE*/// rate, this code should be cleaned up and abstracted better.
-
+ ACE_OS::strcpy (low_thread_args,
+ arg_buf);
+ char *args1;
+
+ // @@ Naga, can you please explain why you need to do all of this?
+ // i.e, we need some comments here! In particular, what is args1
+ // being used for and how will we know that ACE_DEFAULT_ARGV_BUFSIZ
+ // is an appropriate size? It seems to me that we should either (1)
+ // add an accessor on ACE_ARGV to determine what this size ought to
+ // be or (2) we should try to use/add a method on ACE_ARGV that
+ // converts the argv back into a char * buffer or something! At any
+ // rate, this code should be cleaned up and abstracted better.
+ ACE_NEW_RETURN (args1,
+ char[ACE_DEFAULT_ARGV_BUFSIZ],
+ -1);
int i;
for (i = 0; i < this->argc_ ; i++)
diff --git a/TAO/tests/Cubit/TAO/MT_Cubit/server.h b/TAO/tests/Cubit/TAO/MT_Cubit/server.h
index 64ab439d044..8b0e2704f84 100644
--- a/TAO/tests/Cubit/TAO/MT_Cubit/server.h
+++ b/TAO/tests/Cubit/TAO/MT_Cubit/server.h
@@ -17,8 +17,8 @@
#if defined (TAO_PLATFORM_SVC_CONF_FILE_NOTSUP)
#define TAO_DEFAULT_SERVER_STRATEGY_FACTORY_ARGS { "-ORBconcurrency", "thread-per-connection", \
- "-ORBdemuxstrategy", "dynamic", \
- "-ORBtablesize", "128" }
+ "-ORBdemuxstrategy", "dynamic", \
+ "-ORBtablesize", "128" }
#endif
#include "ace/Get_Opt.h"
@@ -26,6 +26,7 @@
#include "ace/ARGV.h"
#include "ace/Sched_Params.h"
#include "orbsvcs/CosNamingC.h"
+#include "orbsvcs/Naming/Naming_Utils.h"
// TAO includes.
#include "tao/corba.h"
@@ -88,7 +89,7 @@ class Cubit_Task : public ACE_Task<ACE_MT_SYNCH>
{
// = TITLE
// Encapsulates an ORB for the Cubit application.
- public:
+public:
Cubit_Task (const char *args,
const char* orbname,
u_int num_of_objs,
@@ -134,7 +135,7 @@ private:
CORBA::String *servants_iors_;
// ior strings of the servants
- CosNaming::NamingContext_var naming_context_;
+ //CosNaming::NamingContext_var naming_context_;
// Object reference to the naming service
u_int task_id_;
@@ -148,6 +149,10 @@ private:
TAO_ORB_Manager orb_manager_;
// The TAO ORB Manager
+
+ TAO_Naming_Client my_name_client_;
+ // An instance of the name client used for resolving the factory
+ // objects.
};
@@ -158,7 +163,7 @@ public:
int initialize (int argc, char **argv);
int start_servants (ACE_Thread_Manager *serv_thr_mgr,Task_State *ts);
Util_Thread * start_utilization (ACE_Thread_Manager *util_thr_mgr, Task_State *ts);
- private:
+private:
int argc_;
char **argv_;
};