diff options
author | coryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1999-05-28 23:41:53 +0000 |
---|---|---|
committer | coryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1999-05-28 23:41:53 +0000 |
commit | 7f00f5d1108d6bd1bc88b57aa4f0b6fd40c22505 (patch) | |
tree | 4da7f076fdf4432d7c780b79926aca41766524a7 | |
parent | c142882be155ea940e3dc9b18c532d2f59d6a6df (diff) | |
download | ATCD-7f00f5d1108d6bd1bc88b57aa4f0b6fd40c22505.tar.gz |
ChangeLogTag:Fri May 28 18:39:35 1999 Carlos O'Ryan <coryan@cs.wustl.edu>
-rw-r--r-- | TAO/ChangeLog-99c | 15 | ||||
-rw-r--r-- | TAO/tests/NestedUpcall/Reactor/Makefile | 74 | ||||
-rw-r--r-- | TAO/tests/NestedUpcall/Reactor/client.cpp | 233 | ||||
-rw-r--r-- | TAO/tests/NestedUpcall/Reactor/client.h | 15 | ||||
-rwxr-xr-x | TAO/tests/NestedUpcall/Reactor/run_test.pl | 8 | ||||
-rw-r--r-- | TAO/tests/NestedUpcall/Reactor/server.cpp | 105 | ||||
-rw-r--r-- | TAO/tests/NestedUpcall/Reactor/server.h | 29 | ||||
-rw-r--r-- | TAO/tests/NestedUpcall/Reactor/svc.conf | 6 |
8 files changed, 154 insertions, 331 deletions
diff --git a/TAO/ChangeLog-99c b/TAO/ChangeLog-99c index ee9b08667e6..c9e7d410d1f 100644 --- a/TAO/ChangeLog-99c +++ b/TAO/ChangeLog-99c @@ -1,3 +1,18 @@ +Fri May 28 18:39:35 1999 Carlos O'Ryan <coryan@cs.wustl.edu> + + * tests/NestedUpcall/Reactor/Makefile: + * tests/NestedUpcall/Reactor/svc.conf: + * tests/NestedUpcall/Reactor/run_test.pl: + * tests/NestedUpcall/Reactor/client.h: + * tests/NestedUpcall/Reactor/client.cpp: + * tests/NestedUpcall/Reactor/server.h: + * tests/NestedUpcall/Reactor/server.cpp: + The test doesn't require the naming service anymore. I also + added a svc.conf file because this is a good test for the ST + clientconnectionstrategy (vs. the default value). + Added options to control the number of iterations and made the + option to shutdown the server functional. + Fri May 28 16:50:46 1999 Carlos O'Ryan <coryan@cs.wustl.edu> * tao/Invocation.h: diff --git a/TAO/tests/NestedUpcall/Reactor/Makefile b/TAO/tests/NestedUpcall/Reactor/Makefile index bc405fa85f5..85fec0266ec 100644 --- a/TAO/tests/NestedUpcall/Reactor/Makefile +++ b/TAO/tests/NestedUpcall/Reactor/Makefile @@ -12,7 +12,7 @@ ifndef TAO_ROOT TAO_ROOT = $(ACE_ROOT)/TAO endif # ! TAO_ROOT -LDLIBS = -lorbsvcs -lTAO +LDLIBS = -lTAO IDL_SRC = ReactorC.cpp ReactorS.cpp PROG_SRCS = $(IDL_SRC) server.cpp client.cpp #tmplinst.cpp @@ -25,14 +25,7 @@ SRC = $(sort $(NESTEDUPCALLS_SVR_OBJS:.o=.cpp) \ VLDLIBS = $(LDLIBS:%=%$(VAR)) -BIN2 = server client - -#### If the TAO orbsvcs library wasn't built with sufficient components, -#### don't try to build here. -TAO_ORBSVCS := $(shell $(ACE_ROOT)/bin/ace_components --orbsvcs) -ifeq (Naming,$(findstring Naming,$(TAO_ORBSVCS))) - BIN = $(BIN2) -endif # Naming +BIN = server client #---------------------------------------------------------------------------- # Include macros and targets @@ -50,8 +43,8 @@ include $(TAO_ROOT)/taoconfig.mk # Local targets #---------------------------------------------------------------------------- -LDFLAGS += -L$(TAO_ROOT)/orbsvcs/orbsvcs -L$(TAO_ROOT)/tao -L$(TAO_ROOT)/orbsvcs/Naming_Service -CPPFLAGS += -I$(TAO_ROOT)/orbsvcs +LDFLAGS += -L$(TAO_ROOT)/tao +CPPFLAGS += .PRECIOUS: ReactorC.h ReactorC.i ReactorC.cpp .PRECIOUS: ReactorS.h ReactorS.i ReactorS.cpp @@ -332,6 +325,7 @@ realclean: clean $(TAO_ROOT)/tao/Operation_Table.h \ $(TAO_ROOT)/tao/Client_Strategy_Factory.h \ $(TAO_ROOT)/tao/Invocation.h \ + $(TAO_ROOT)/tao/Reply_Dispatcher.h \ $(TAO_ROOT)/tao/Invocation.i \ $(TAO_ROOT)/tao/InconsistentTypeCodeC.h \ $(TAO_ROOT)/tao/DynAny_i.h \ @@ -602,6 +596,7 @@ realclean: clean $(TAO_ROOT)/tao/Operation_Table.h \ $(TAO_ROOT)/tao/Client_Strategy_Factory.h \ $(TAO_ROOT)/tao/Invocation.h \ + $(TAO_ROOT)/tao/Reply_Dispatcher.h \ $(TAO_ROOT)/tao/Invocation.i \ $(TAO_ROOT)/tao/InconsistentTypeCodeC.h \ $(TAO_ROOT)/tao/DynAny_i.h \ @@ -611,8 +606,8 @@ realclean: clean $(TAO_ROOT)/tao/ValueFactory.h \ $(TAO_ROOT)/tao/ValueFactory.i \ ReactorC.i ReactorS_T.h ReactorS_T.i ReactorS_T.cpp ReactorS.i -.obj/client.o .obj/client.so .shobj/client.o .shobj/client.so: client.cpp \ - $(ACE_ROOT)/ace/Profile_Timer.h \ +.obj/client.o .obj/client.so .shobj/client.o .shobj/client.so: client.cpp client.h \ + $(ACE_ROOT)/ace/Get_Opt.h \ $(ACE_ROOT)/ace/ACE.h \ $(ACE_ROOT)/ace/OS.h \ $(ACE_ROOT)/ace/inc_user_config.h \ @@ -629,14 +624,11 @@ realclean: clean $(ACE_ROOT)/ace/SString.i \ $(ACE_ROOT)/ace/Malloc_Base.h \ $(ACE_ROOT)/ace/Log_Record.i \ - $(ACE_ROOT)/ace/Time_Value.h \ - $(ACE_ROOT)/ace/High_Res_Timer.h \ - $(ACE_ROOT)/ace/High_Res_Timer.i \ - $(ACE_ROOT)/ace/Profile_Timer.i \ - $(ACE_ROOT)/ace/Env_Value_T.h \ - $(ACE_ROOT)/ace/Env_Value_T.i \ - $(ACE_ROOT)/ace/Env_Value_T.cpp \ - $(ACE_ROOT)/ace/Read_Buffer.h \ + $(ACE_ROOT)/ace/Get_Opt.i \ + $(TAO_ROOT)/tao/corba.h \ + $(TAO_ROOT)/tao/corbafwd.h \ + $(ACE_ROOT)/ace/CDR_Stream.h \ + $(ACE_ROOT)/ace/Message_Block.h \ $(ACE_ROOT)/ace/Malloc.h \ $(ACE_ROOT)/ace/Malloc.i \ $(ACE_ROOT)/ace/Malloc_T.h \ @@ -675,14 +667,6 @@ realclean: clean $(ACE_ROOT)/ace/Mem_Map.h \ $(ACE_ROOT)/ace/Mem_Map.i \ $(ACE_ROOT)/ace/Memory_Pool.i \ - $(ACE_ROOT)/ace/Read_Buffer.i \ - client.h \ - $(ACE_ROOT)/ace/Get_Opt.h \ - $(ACE_ROOT)/ace/Get_Opt.i \ - $(TAO_ROOT)/tao/corba.h \ - $(TAO_ROOT)/tao/corbafwd.h \ - $(ACE_ROOT)/ace/CDR_Stream.h \ - $(ACE_ROOT)/ace/Message_Block.h \ $(ACE_ROOT)/ace/Message_Block.i \ $(ACE_ROOT)/ace/Message_Block_T.h \ $(ACE_ROOT)/ace/Message_Block_T.i \ @@ -852,6 +836,7 @@ realclean: clean $(ACE_ROOT)/ace/INET_Addr.h \ $(ACE_ROOT)/ace/INET_Addr.i \ $(ACE_ROOT)/ace/SOCK_Stream.i \ + $(ACE_ROOT)/ace/Time_Value.h \ $(ACE_ROOT)/ace/SOCK_Acceptor.i \ $(TAO_ROOT)/tao/Connect.i \ $(TAO_ROOT)/tao/params.h \ @@ -883,6 +868,7 @@ realclean: clean $(TAO_ROOT)/tao/Operation_Table.h \ $(TAO_ROOT)/tao/Client_Strategy_Factory.h \ $(TAO_ROOT)/tao/Invocation.h \ + $(TAO_ROOT)/tao/Reply_Dispatcher.h \ $(TAO_ROOT)/tao/Invocation.i \ $(TAO_ROOT)/tao/InconsistentTypeCodeC.h \ $(TAO_ROOT)/tao/DynAny_i.h \ @@ -895,11 +881,7 @@ realclean: clean ReactorS_T.i ReactorS_T.cpp ReactorS.i \ $(ACE_ROOT)/ace/Auto_Ptr.h \ $(ACE_ROOT)/ace/Auto_Ptr.i \ - $(ACE_ROOT)/ace/Auto_Ptr.cpp \ - eh_i.h \ - $(TAO_ROOT)/orbsvcs/orbsvcs/CosNamingC.h \ - $(TAO_ROOT)/orbsvcs/orbsvcs/orbsvcs_export.h \ - $(TAO_ROOT)/orbsvcs/orbsvcs/CosNamingC.i + $(ACE_ROOT)/ace/Auto_Ptr.cpp eh_i.h .obj/eh_i.o .obj/eh_i.so .shobj/eh_i.o .shobj/eh_i.so: eh_i.cpp \ $(TAO_ROOT)/tao/corba.h \ $(ACE_ROOT)/ace/OS.h \ @@ -1160,6 +1142,7 @@ realclean: clean $(TAO_ROOT)/tao/Operation_Table.h \ $(TAO_ROOT)/tao/Client_Strategy_Factory.h \ $(TAO_ROOT)/tao/Invocation.h \ + $(TAO_ROOT)/tao/Reply_Dispatcher.h \ $(TAO_ROOT)/tao/Invocation.i \ $(TAO_ROOT)/tao/InconsistentTypeCodeC.h \ $(TAO_ROOT)/tao/DynAny_i.h \ @@ -1430,6 +1413,7 @@ realclean: clean $(TAO_ROOT)/tao/Operation_Table.h \ $(TAO_ROOT)/tao/Client_Strategy_Factory.h \ $(TAO_ROOT)/tao/Invocation.h \ + $(TAO_ROOT)/tao/Reply_Dispatcher.h \ $(TAO_ROOT)/tao/Invocation.i \ $(TAO_ROOT)/tao/InconsistentTypeCodeC.h \ $(TAO_ROOT)/tao/DynAny_i.h \ @@ -1560,8 +1544,8 @@ realclean: clean $(TAO_ROOT)/tao/PolicyC.i \ $(TAO_ROOT)/tao/Environment.h \ $(TAO_ROOT)/tao/Environment.i \ - $(TAO_ROOT)/tao/POAC.i \ - $(TAO_ROOT)/orbsvcs/orbsvcs/CosNamingC.h \ + $(TAO_ROOT)/tao/POAC.i reactor_i.h \ + ReactorS.h ReactorC.h \ $(TAO_ROOT)/tao/corba.h \ $(TAO_ROOT)/tao/Any.h \ $(TAO_ROOT)/tao/Any.i \ @@ -1704,6 +1688,7 @@ realclean: clean $(TAO_ROOT)/tao/Operation_Table.h \ $(TAO_ROOT)/tao/Client_Strategy_Factory.h \ $(TAO_ROOT)/tao/Invocation.h \ + $(TAO_ROOT)/tao/Reply_Dispatcher.h \ $(TAO_ROOT)/tao/Invocation.i \ $(TAO_ROOT)/tao/InconsistentTypeCodeC.h \ $(TAO_ROOT)/tao/DynAny_i.h \ @@ -1712,21 +1697,6 @@ realclean: clean $(TAO_ROOT)/tao/ValueBase.i \ $(TAO_ROOT)/tao/ValueFactory.h \ $(TAO_ROOT)/tao/ValueFactory.i \ - $(TAO_ROOT)/orbsvcs/orbsvcs/orbsvcs_export.h \ - $(TAO_ROOT)/orbsvcs/orbsvcs/CosNamingC.i \ - reactor_i.h ReactorS.h ReactorC.h ReactorC.i ReactorS_T.h \ - ReactorS_T.i ReactorS_T.cpp ReactorS.i \ - $(TAO_ROOT)/orbsvcs/orbsvcs/Naming/Naming_Utils.h \ - $(TAO_ROOT)/orbsvcs/orbsvcs/IOR_Multicast.h \ - $(ACE_ROOT)/ace/SOCK_Dgram_Mcast.h \ - $(ACE_ROOT)/ace/SOCK_Dgram.h \ - $(ACE_ROOT)/ace/SOCK_Dgram.i \ - $(ACE_ROOT)/ace/SOCK_Dgram_Mcast.i \ - $(TAO_ROOT)/orbsvcs/orbsvcs/Naming/Naming_Context.h \ - $(TAO_ROOT)/orbsvcs/orbsvcs/CosNamingS.h \ - $(TAO_ROOT)/orbsvcs/orbsvcs/CosNamingS_T.h \ - $(TAO_ROOT)/orbsvcs/orbsvcs/CosNamingS_T.i \ - $(TAO_ROOT)/orbsvcs/orbsvcs/CosNamingS_T.cpp \ - $(TAO_ROOT)/orbsvcs/orbsvcs/CosNamingS.i + ReactorC.i ReactorS_T.h ReactorS_T.i ReactorS_T.cpp ReactorS.i # IF YOU PUT ANYTHING HERE IT WILL GO AWAY diff --git a/TAO/tests/NestedUpcall/Reactor/client.cpp b/TAO/tests/NestedUpcall/Reactor/client.cpp index 94e2eda9a9a..5f7a6a9abca 100644 --- a/TAO/tests/NestedUpcall/Reactor/client.cpp +++ b/TAO/tests/NestedUpcall/Reactor/client.cpp @@ -1,67 +1,23 @@ // $Id$ -#include "ace/Profile_Timer.h" -#include "ace/Env_Value_T.h" -#include "ace/Read_Buffer.h" #include "client.h" #include "eh_i.h" -#include "orbsvcs/CosNamingC.h" ACE_RCSID(Reactor, client, "$Id$") -#define quote(x) #x - // Constructor. NestedUpCalls_Client::NestedUpCalls_Client (void) - : nested_up_calls_reactor_key_ (0), + : nested_up_calls_reactor_key_ ("file://test.ior"), shutdown_ (0), - call_count_ (0), - nested_up_calls_reactor_ior_file_ (0), - f_handle_ (ACE_INVALID_HANDLE), - use_naming_service_ (1) -{ -} - -// Simple function that returns the substraction of 117 from the -// parameter. - -int -NestedUpCalls_Client::func (u_int i) + call_count_ (5) { - return i - 117; } -// Reads the NestedUpCalls reactor ior from a file - -int -NestedUpCalls_Client::read_ior (char *filename) -{ - // Open the file for reading. - this->f_handle_ = ACE_OS::open (filename,0); - - if (this->f_handle_ == ACE_INVALID_HANDLE) - ACE_ERROR_RETURN ((LM_ERROR, - "Unable to open %s for writing: %p\n", - filename), - -1); - ACE_Read_Buffer ior_buffer (this->f_handle_); - this->nested_up_calls_reactor_key_ = ior_buffer.read (); - - if (this->nested_up_calls_reactor_key_ == 0) - ACE_ERROR_RETURN ((LM_ERROR, - "Unable to allocate memory to read ior: %p\n"), - -1); - return 0; -} - -// Parses the command line arguments and returns an error status. - int NestedUpCalls_Client::parse_args (void) { - ACE_Get_Opt get_opts (argc_, argv_, "dn:f:k:xs"); + ACE_Get_Opt get_opts (argc_, argv_, "dxn:k:"); int c; - int result; while ((c = get_opts ()) != -1) switch (c) @@ -69,33 +25,26 @@ NestedUpCalls_Client::parse_args (void) case 'd': // debug flag TAO_debug_level++; break; - case 'f': // read the IOR from the file. - result = this->read_ior (get_opts.optarg); - if (result < 0) - ACE_ERROR_RETURN ((LM_ERROR, - "Unable to read ior from %s : %p\n", - get_opts.optarg), - -1); - break; - case 'k': // read the nestedupcalls IOR from the command-line. - this->nested_up_calls_reactor_key_ = - ACE_OS::strdup (get_opts.optarg); - break; + case 'x': this->shutdown_ = 1; break; - case 's': // Don't use the TAO Naming Service. - this->use_naming_service_ = 0; + + case 'n': + this->call_count_ = ACE_OS::atoi (get_opts.optarg); + break; + + case 'k': // read the nestedupcalls IOR from the command-line. + this->nested_up_calls_reactor_key_ = get_opts.optarg; break; + case '?': default: ACE_ERROR_RETURN ((LM_ERROR, "usage: %s" " [-d]" - " [-f nested_up_calls_reactor-obj-ref-key-file]" " [-k nestedupcalls-obj-ref-key]" " [-x]" - " [-s]" "\n", this->argv_ [0]), -1); @@ -109,160 +58,102 @@ NestedUpCalls_Client::parse_args (void) int NestedUpCalls_Client::run (void) { - - TAO_TRY + ACE_TRY_NEW_ENV { // Create an EventHandler servant to hand to the other side... auto_ptr<EventHandler_i> eh_impl (new EventHandler_i); - EventHandler_var eh = eh_impl->_this (TAO_TRY_ENV); + EventHandler_var eh = eh_impl->_this (ACE_TRY_ENV); + ACE_TRY_CHECK; // Now, we can invoke an operation on the remote side. - CORBA::Long r = this->reactor_->register_handler (eh.in (), TAO_TRY_ENV); - TAO_CHECK_ENV; + CORBA::Long r = + this->reactor_->register_handler (eh.in (), ACE_TRY_ENV); + ACE_TRY_CHECK; // We ought to have a result! ACE_DEBUG ((LM_DEBUG, "%s: received %d as return from register_handler ()\n", argv_[0], r)); - this->reactor_->set_value (TAO_TRY_ENV); - TAO_CHECK_ENV; - - this->reactor_->decrement (eh.in (), 5, TAO_TRY_ENV); - TAO_CHECK_ENV; + this->reactor_->set_value (ACE_TRY_ENV); + ACE_TRY_CHECK; - this->reactor_->stop (TAO_TRY_ENV); - TAO_CHECK_ENV; + this->reactor_->decrement (eh.in (), + this->call_count_, + ACE_TRY_ENV); + ACE_TRY_CHECK; if (this->shutdown_) { - this->env_.print_exception ("server, please ACE_OS::exit"); + this->reactor_->stop (ACE_TRY_ENV); + ACE_TRY_CHECK; } } - TAO_CATCHANY + ACE_CATCHANY { - TAO_TRY_ENV.print_exception ("Nestedupcalls::run ()"); + ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, + "Nestedupcalls::run ()"); return -1; } - TAO_ENDTRY; + ACE_ENDTRY; return 0; } NestedUpCalls_Client::~NestedUpCalls_Client (void) { - // Free resources - // Close the ior files - if (this->nested_up_calls_reactor_ior_file_) - ACE_OS::fclose (this->nested_up_calls_reactor_ior_file_); - if (this->f_handle_ != ACE_INVALID_HANDLE) - ACE_OS::close (this->f_handle_); - - if (this->nested_up_calls_reactor_key_ != 0) - ACE_OS::free (this->nested_up_calls_reactor_key_); -} - -int -NestedUpCalls_Client::init_naming_service (void) -{ - TAO_TRY - { - 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); - CosNaming::NamingContext_var naming_context = - CosNaming::NamingContext::_narrow (naming_obj.in (), - TAO_TRY_ENV); - TAO_CHECK_ENV; - - CosNaming::Name nested_up_calls_reactor_name (2); - nested_up_calls_reactor_name.length (2); - nested_up_calls_reactor_name[0].id = CORBA::string_dup ("NestedUpCalls"); - nested_up_calls_reactor_name[1].id = CORBA::string_dup ("nested_up_calls_reactor"); - CORBA::Object_var reactor_obj = - naming_context->resolve (nested_up_calls_reactor_name,TAO_TRY_ENV); - TAO_CHECK_ENV; - - this->reactor_ = - Reactor::_narrow (reactor_obj.in (),TAO_TRY_ENV); - TAO_CHECK_ENV; - - if (CORBA::is_nil (this->reactor_.in ())) - ACE_ERROR_RETURN ((LM_ERROR, - " could not resolve nested up calls reactor in Naming service <%s>\n"), - -1); - } - TAO_CATCHANY - { - TAO_TRY_ENV.print_exception ("NestedUpCalls::init_naming_service"); - return -1; - } - TAO_ENDTRY; - - return 0; } int NestedUpCalls_Client::init (int argc, char **argv) { - int naming_result; this->argc_ = argc; this->argv_ = argv; - TAO_TRY + ACE_TRY_NEW_ENV { // Retrieve the ORB. this->orb_ = CORBA::ORB_init (this->argc_, this->argv_, "internet", - TAO_TRY_ENV); - TAO_CHECK_ENV; + ACE_TRY_ENV); + ACE_TRY_CHECK; // Parse command line and verify parameters. if (this->parse_args () == -1) return -1; - if (this->use_naming_service_) - { - naming_result = this->init_naming_service (); - if (naming_result < 0) - return naming_result; - } - else - { - if (this->nested_up_calls_reactor_key_ == 0) - ACE_ERROR_RETURN ((LM_ERROR, - "%s: no nested up calls reactor key specified\n", - this->argv_[0]), - -1); - - - CORBA::Object_var reactor_object = - this->orb_->string_to_object (this->nested_up_calls_reactor_key_, - TAO_TRY_ENV); - TAO_CHECK_ENV; - - this->reactor_ = - Reactor::_narrow (reactor_object.in(), TAO_TRY_ENV); - TAO_CHECK_ENV; - - if (CORBA::is_nil (this->reactor_.in ())) - ACE_ERROR_RETURN ((LM_ERROR, - "invalid reactor key <%s>\n", - this->nested_up_calls_reactor_key_), - -1); - } + if (this->nested_up_calls_reactor_key_ == 0) + ACE_ERROR_RETURN ((LM_ERROR, + "%s: no nested up calls reactor key specified\n", + this->argv_[0]), + -1); + + + CORBA::Object_var reactor_object = + this->orb_->string_to_object (this->nested_up_calls_reactor_key_, + ACE_TRY_ENV); + ACE_TRY_CHECK; + + this->reactor_ = + Reactor::_narrow (reactor_object.in(), ACE_TRY_ENV); + ACE_TRY_CHECK; + + if (CORBA::is_nil (this->reactor_.in ())) + ACE_ERROR_RETURN ((LM_ERROR, + "invalid reactor key <%s>\n", + this->nested_up_calls_reactor_key_), + -1); + ACE_DEBUG ((LM_DEBUG, "Reactor received OK\n")); - } - TAO_CATCHANY + } + ACE_CATCHANY { - TAO_TRY_ENV.print_exception ("NestedUpCalls::init"); + ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, + "NestedUpCalls::init"); return -1; } - TAO_ENDTRY; + ACE_ENDTRY; return 0; } @@ -278,8 +169,8 @@ main (int argc, char **argv) if (nestedupcalls_client.init (argc, argv) == -1) return 1; - else - return nestedupcalls_client.run (); + + return nestedupcalls_client.run (); } #if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) diff --git a/TAO/tests/NestedUpcall/Reactor/client.h b/TAO/tests/NestedUpcall/Reactor/client.h index 5e2f2fbc187..bc4123e44ac 100644 --- a/TAO/tests/NestedUpcall/Reactor/client.h +++ b/TAO/tests/NestedUpcall/Reactor/client.h @@ -17,6 +17,9 @@ // // ============================================================================ +#ifndef TAO_NUC_CLIENT_H +#define TAO_NUC_CLIENT_H + #include "ace/Get_Opt.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) @@ -50,16 +53,6 @@ public: // Initialize the client communication endpoint with server. private: - int init_naming_service (void); - // Function to initialize the naming service. - - int func (u_int i); - // Simple function that returns the substraction of 117 from the - // parameter. - - int read_ior (char *filename); - // Function to read the NestedUpCalls reactor ior from a file. - int parse_args (void); // Parses the arguments passed on the command line. @@ -97,3 +90,5 @@ private: // Flag to tell client not to use Namingservice to find the NestedUpCalls // reactor. }; + +#endif /* TAO_NUC_CLIENT_H */ diff --git a/TAO/tests/NestedUpcall/Reactor/run_test.pl b/TAO/tests/NestedUpcall/Reactor/run_test.pl index 4dda2cc2e11..05f15378052 100755 --- a/TAO/tests/NestedUpcall/Reactor/run_test.pl +++ b/TAO/tests/NestedUpcall/Reactor/run_test.pl @@ -8,13 +8,15 @@ unshift @INC, '../../../../bin'; require Process; require ACEutils; +$file="test.ior"; + $SV = Process::Create ($EXEPREFIX."server".$Process::EXE_EXT, - " -ORBobjrefstyle url"); + "-o $file"); -sleep ($ACE::sleeptime); +ACE::waitforfile ($file); $status = system ($EXEPREFIX."client".$Process::EXE_EXT. - " -x "); + "-x -k file://$file"); $SV->Wait (); diff --git a/TAO/tests/NestedUpcall/Reactor/server.cpp b/TAO/tests/NestedUpcall/Reactor/server.cpp index 4b7d4e9a761..c3afbeea4fb 100644 --- a/TAO/tests/NestedUpcall/Reactor/server.cpp +++ b/TAO/tests/NestedUpcall/Reactor/server.cpp @@ -5,15 +5,14 @@ ACE_RCSID(Reactor, server, "$Id$") NestedUpCalls_Server::NestedUpCalls_Server (void) - : use_naming_service_ (1), - ior_output_file_ (0) + : ior_output_file_ (0) { } int NestedUpCalls_Server::parse_args (void) { - ACE_Get_Opt get_opts (argc_, argv_, "dn:o:s"); + ACE_Get_Opt get_opts (argc_, argv_, "dn:o:"); int c; while ((c = get_opts ()) != -1) @@ -22,16 +21,15 @@ NestedUpCalls_Server::parse_args (void) case 'd': // debug flag. TAO_debug_level++; break; - case 'o': // output the IOR to a file. + + case 'o': // output the IOR to a file. this->ior_output_file_ = ACE_OS::fopen (get_opts.optarg, "w"); if (this->ior_output_file_ == 0) ACE_ERROR_RETURN ((LM_ERROR, "Unable to open %s for writing: %p\n", get_opts.optarg), -1); break; - case 's': // Don't use the TAO Naming Service. - this->use_naming_service_=0; - break; + case '?': default: ACE_ERROR_RETURN ((LM_ERROR, @@ -50,17 +48,18 @@ NestedUpCalls_Server::parse_args (void) int NestedUpCalls_Server::init (int argc, - char** argv, - CORBA::Environment& env) + char* argv[], + CORBA::Environment& ACE_TRY_ENV) { // Call the init of TAO_ORB_Manager to create a child POA // under the root POA. this->orb_manager_.init_child_poa (argc, argv, "child_poa", - env); + ACE_TRY_ENV); + + ACE_CHECK_RETURN (-1); - TAO_CHECK_ENV_RETURN (env,-1); this->argc_ = argc; this->argv_ = argv; @@ -70,7 +69,9 @@ NestedUpCalls_Server::init (int argc, CORBA::String_var str = this->orb_manager_.activate_under_child_poa ("reactor", &this->reactor_impl_, - env); + ACE_TRY_ENV); + ACE_CHECK_RETURN (-1); + ACE_DEBUG ((LM_DEBUG, "The IOR is: <%s>\n", str.in ())); @@ -83,56 +84,13 @@ NestedUpCalls_Server::init (int argc, ACE_OS::fclose (this->ior_output_file_); } - if (this->use_naming_service_) - return this->init_naming_service (env); - - return 0; -} - -// Initialisation of Naming Service and register IDL_Cubit Context and -// cubit_factory object. - -int -NestedUpCalls_Server::init_naming_service (CORBA::Environment& env) -{ - int result; - CORBA::ORB_var orb; - PortableServer::POA_var child_poa; - - orb = this->orb_manager_.orb (); - child_poa = this->orb_manager_.child_poa (); - - result = this->my_name_server_.init (orb.in (), - child_poa.in ()); - if (result < 0) - return result; - reactor_ = this->reactor_impl_._this (env); - TAO_CHECK_ENV_RETURN (env,-1); - - //Register the nested_up_calls_reactor name with the NestedUpCalls Naming - //Context... - CosNaming::Name nested_up_calls_context_name (1); - nested_up_calls_context_name.length (1); - nested_up_calls_context_name[0].id = CORBA::string_dup ("NestedUpCalls"); - this->naming_context_ = - this->my_name_server_->bind_new_context (nested_up_calls_context_name, - env); - TAO_CHECK_ENV_RETURN (env,-1); - - CosNaming::Name reactor_name (1); - reactor_name.length (1); - reactor_name[0].id = CORBA::string_dup ("nested_up_calls_reactor"); - this->naming_context_->bind (reactor_name, - reactor_.in (), - env); - TAO_CHECK_ENV_RETURN (env,-1); return 0; } int -NestedUpCalls_Server::run (CORBA::Environment& env) +NestedUpCalls_Server::run (CORBA::Environment& ACE_TRY_ENV) { - if (this->orb_manager_.run (env) == -1) + if (this->orb_manager_.run (ACE_TRY_ENV) == -1) ACE_ERROR_RETURN ((LM_ERROR, "NestedUpCalls_Server::run"), -1); @@ -150,28 +108,29 @@ main (int argc, char *argv[]) ACE_DEBUG ((LM_DEBUG, "\n \t NestedUpCalls:SERVER \n \n")); - TAO_TRY + + ACE_TRY_NEW_ENV { - if (nested_up_calls_server.init (argc,argv,TAO_TRY_ENV) == -1) + if (nested_up_calls_server.init (argc,argv, + ACE_TRY_ENV) == -1) return 1; - else - { - nested_up_calls_server.run (TAO_TRY_ENV); - TAO_CHECK_ENV; - } + + ACE_TRY_CHECK; + + nested_up_calls_server.run (ACE_TRY_ENV); + ACE_TRY_CHECK; } - TAO_CATCH (CORBA::SystemException, sysex) + ACE_CATCH (CORBA::SystemException, sysex) { - ACE_UNUSED_ARG (sysex); - TAO_TRY_ENV.print_exception ("System Exception"); - return -1; + ACE_PRINT_EXCEPTION (sysex, "System Exception"); + return 1; } - TAO_CATCH (CORBA::UserException, userex) + ACE_CATCH (CORBA::UserException, userex) { - ACE_UNUSED_ARG (userex); - TAO_TRY_ENV.print_exception ("User Exception"); - return -1; + ACE_PRINT_EXCEPTION (userex, "User Exception"); + return 1; } - TAO_ENDTRY; + ACE_ENDTRY; + return 0; } diff --git a/TAO/tests/NestedUpcall/Reactor/server.h b/TAO/tests/NestedUpcall/Reactor/server.h index 73acff90fcf..bab8bd7f491 100644 --- a/TAO/tests/NestedUpcall/Reactor/server.h +++ b/TAO/tests/NestedUpcall/Reactor/server.h @@ -10,16 +10,17 @@ // server.h // // = DESCRIPTION -// This class implements a simple NestedUpCalls CORBA server for the NestedUpCalls -// example using skeletons generated by the TAO ORB compiler. +// This class implements a simple NestedUpCalls CORBA server for +// the NestedUpCalls example using skeletons generated by the TAO +// ORB compiler. // // = AUTHORS // Nagarajan Surendran (naga@cs.wustl.edu) // // ============================================================================ -#ifndef _NUC_SERVER_H -#define _NUC_SERVER_H +#ifndef TAO_NUC_SERVER_H +#define TAO_NUC_SERVER_H #include "ace/Get_Opt.h" @@ -29,9 +30,7 @@ #include "ace/Log_Msg.h" #include "tao/TAO.h" -#include "orbsvcs/CosNamingC.h" #include "reactor_i.h" -#include "orbsvcs/Naming/Naming_Utils.h" class NestedUpCalls_Server { @@ -52,7 +51,7 @@ public: // Destructor int init (int argc, - char **argv, + char *argv[], CORBA::Environment& env); // Initialize the NestedUpCalls_Server state - parsing arguments and ... @@ -67,32 +66,18 @@ private: // Initialises the name server and registers NestedUpCalls reactor with the // name server. - int use_naming_service_; - //Flag to tell server not to use the TAO Naming Service to register - //the NestedUpCalls reactor. - FILE* ior_output_file_; // File to output the NestedUpCalls reactor IOR. TAO_ORB_Manager orb_manager_; // The ORB manager - TAO_Naming_Server my_name_server_; - // An instance of the name server used for registering the reactor - // objects. - Reactor_i reactor_impl_; // Implementation object of the NestedUpCalls reactor. Reactor_var reactor_; // Reactor_var to register with NamingService. - CosNaming::NamingContext_var NestedUpCalls_context_; - // Naming context for the NestedUpCalls_reactor. - - CosNaming::NamingContext_var naming_context_; - // Naming context for the Naming Service. - int argc_; // Number of commandline arguments. @@ -100,4 +85,4 @@ private: // commandline arguments. }; -#endif /* _NUC_SERVER_H */ +#endif /* TAO_NUC_SERVER_H */ diff --git a/TAO/tests/NestedUpcall/Reactor/svc.conf b/TAO/tests/NestedUpcall/Reactor/svc.conf new file mode 100644 index 00000000000..61618bf5694 --- /dev/null +++ b/TAO/tests/NestedUpcall/Reactor/svc.conf @@ -0,0 +1,6 @@ +# $Id$ +# +# Please see $TAO_ROOT/docs/Options.html for details on these options. +# + +static Client_Strategy_Factory "-ORBclientconnectionhandler ST" |