diff options
author | mk1 <mk1@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1998-07-12 18:49:51 +0000 |
---|---|---|
committer | mk1 <mk1@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1998-07-12 18:49:51 +0000 |
commit | c99d40fef20568ad86fb790a4698ad0457f22911 (patch) | |
tree | 16cf70680318e7ee8b2478cb7b79211974f57a65 /TAO/tests/NestedUpcall | |
parent | 3b007ac3e547a794a6a49afba49393df34191c0e (diff) | |
download | ATCD-c99d40fef20568ad86fb790a4698ad0457f22911.tar.gz |
ChangeLog entry: Sun Jul 12 13:45:00 1998 Michael Kircher <mk1@cs.wustl.edu>
Diffstat (limited to 'TAO/tests/NestedUpcall')
18 files changed, 1664 insertions, 3 deletions
diff --git a/TAO/tests/NestedUpcall/MT_Client_Test/MT_Client_Test.dsw b/TAO/tests/NestedUpcall/MT_Client_Test/MT_Client_Test.dsw new file mode 100644 index 00000000000..f6006d20cb7 --- /dev/null +++ b/TAO/tests/NestedUpcall/MT_Client_Test/MT_Client_Test.dsw @@ -0,0 +1,41 @@ +Microsoft Developer Studio Workspace File, Format Version 5.00
+# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
+
+###############################################################################
+
+Project: "client"=.\client.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "server"=.\server.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Global:
+
+Package=<5>
+{{{
+}}}
+
+Package=<3>
+{{{
+}}}
+
+###############################################################################
+
diff --git a/TAO/tests/NestedUpcall/MT_Client_Test/MT_Client_Test.idl b/TAO/tests/NestedUpcall/MT_Client_Test/MT_Client_Test.idl new file mode 100644 index 00000000000..f93b53177b9 --- /dev/null +++ b/TAO/tests/NestedUpcall/MT_Client_Test/MT_Client_Test.idl @@ -0,0 +1,32 @@ +// $Id$ +// +// ============================================================================ +// +// = LIBRARY +// TAO/tests/NestedUpcall/Triangle_Test +// +// = FILENAME +// Triangle_Test.idl +// +// = DESCRIPTION +// An example of how nested upcalls work/fail? +// +// = AUTHORS +// Michael Kircher +// +// ============================================================================ + + + +interface Object_A { + + long foo (in long time); + +}; + +interface MT_Object; + +interface MT_Object +{ + long yadda (in long hop_count, in MT_Object partner); +}; diff --git a/TAO/tests/NestedUpcall/MT_Client_Test/MT_Object_Impl.cpp b/TAO/tests/NestedUpcall/MT_Client_Test/MT_Object_Impl.cpp new file mode 100644 index 00000000000..754cbd39cde --- /dev/null +++ b/TAO/tests/NestedUpcall/MT_Client_Test/MT_Object_Impl.cpp @@ -0,0 +1,54 @@ +// -*- c++ -*- +// $Id$ + +// ============================================================================ +// +// = LIBRARY +// TAO/tests/NestedUpCalls/MT_Client_Test +// +// = FILENAME +// MT_Object_Impl.cpp +// +// = DESCRIPTION +// This class implements the Object A of the +// Nested Upcalls - MT Client test. +// +// = AUTHORS +// Michael Kircher +// +// ============================================================================ + +#include "tao/corba.h" +#include "MT_Object_Impl.h" + +#define MAX_HOP_COUNT 4 + +// CTOR +MT_Object_Impl::MT_Object_Impl (void) +{ +} + +// DTOR +MT_Object_Impl::~MT_Object_Impl (void) +{ +} + + +CORBA::Long +MT_Object_Impl::yadda (CORBA::Long hop_count, + MT_Object_ptr partner, + CORBA::Environment &env) +{ + ACE_DEBUG ((LM_DEBUG, + "(%P|%t) MT_Object_Impl::yadda () hop count = %d\n", + hop_count)); + + if (hop_count < MAX_HOP_COUNT) + { + if (partner != 0) + return partner->yadda (hop_count + 1, this->_this (env), env) + 1; + } + + return 0; +} + diff --git a/TAO/tests/NestedUpcall/MT_Client_Test/MT_Object_Impl.h b/TAO/tests/NestedUpcall/MT_Client_Test/MT_Object_Impl.h new file mode 100644 index 00000000000..08163687252 --- /dev/null +++ b/TAO/tests/NestedUpcall/MT_Client_Test/MT_Object_Impl.h @@ -0,0 +1,44 @@ +// -*- c++ -*- +// $Id$ + +// ============================================================================ +// +// = LIBRARY +// TAO/tests/NestedUpCalls/MT_Client test +// +// = FILENAME +// MT_Object_A_Impl.h +// +// = DESCRIPTION +// This class implements the Object A of the +// Nested Upcalls - MT Client test +// +// = AUTHORS +// Michael Kircher +// +// ============================================================================ + +#if !defined (MT_OBJECT_IMPL_H) +# define MT_OBJECT_IMPL_H + +#include "MT_Client_TestS.h" +#include "MT_Client_TestC.h" + +class MT_Object_Impl : public POA_MT_Object +{ + // = TITLE + // Implement the <MT_Object> IDL interface. +public: + MT_Object_Impl (void); + // Constructor. + + virtual ~MT_Object_Impl (void); + // Destructor. + + virtual CORBA::Long yadda (CORBA::Long hop_count, + MT_Object_ptr partner, + CORBA::Environment &_tao_environment); + +}; + +#endif /* MT_OBJECT_IMPL_H */ diff --git a/TAO/tests/NestedUpcall/MT_Client_Test/README b/TAO/tests/NestedUpcall/MT_Client_Test/README new file mode 100644 index 00000000000..c8397f8d938 --- /dev/null +++ b/TAO/tests/NestedUpcall/MT_Client_Test/README @@ -0,0 +1,41 @@ + +Multiple Client and global resources test +========================================= + + +This test uses global resources, meaning one ORB and one Reactor. +Several client threads are created, which call one of the two servers. +This means, two server instances should be running. Also one +server thread is running, doing nested upcalls to the same server. + +The intention is to see if global resources with multiple threads work. + +The client understands the following switches: + +-f file of the ior of the first server, used by approx. half of the + client threads and the local server thread. + +-g file of the ior of the second server + +-n number of client threads {0..infty :-)} + +-i number of client iterations + +-s number of local server iterations + + +server switches: + +-o file to put the ior + + + +Usage: + +server_A -o ior1 -ORBport 10031 +server_A -o ior2 -ORBport 10032 + +//for two client threads, 10 iterations and 5 server iterations +client -f ior1 -g ior2 -n 2 -i 10 -s 5 -ORBport 10033 + +! Don't forget the ORB port for the client!
\ No newline at end of file diff --git a/TAO/tests/NestedUpcall/MT_Client_Test/client.conf b/TAO/tests/NestedUpcall/MT_Client_Test/client.conf new file mode 100644 index 00000000000..6eee002c688 --- /dev/null +++ b/TAO/tests/NestedUpcall/MT_Client_Test/client.conf @@ -0,0 +1,49 @@ +# $Id$ +# +# This file contains a sample ACE_Service_Config configuration +# file specifying the strategy factories utilized by an application +# using TAO. There are currently only two possible factories: +# Client_Strategy_Factory and Server_Strategy_Factory. These names +# must be used as the second argument to their corresponding line, +# because that's what the ORB uses to find the desired factory. +# +# Note that there are two unordinary characteristics of the way *this* +# file is set up: +# - both client and server strategies are specified in the same +# file, which would only make sense for co-located clients & servers +# - both of the factories are actually sourced out of libTAO.so +# (TAO.DLL on Win32), and they would normally be in a separate +# dll from the TAO ORB Core. +# +# The options which can be passed to the Resource Factory are: +# +# -ORBresources <which> +# where <which> can be 'global' to specify globally-held resources, +# or 'tss' to specify thread-specific resources. +# +# The options which can be passed to the Client are: +# <none currently> +# +# The options which can be passed to the Server are: +# +# -ORBconcurrency <which> +# where <which> can be 'thread-per-connection' to specify +# use of the ACE_Threaded_Strategy concurrency strategy, +# or 'reactive' to specify use of the ACE_Reactive_Strategy +# concurrency strategy. +# +# -ORBthreadflags <flags> +# specifies the default thread flags to use, where <flags> is a +# logical OR'ing of the flags THR_DETACHED, THR_BOUND, THR_NEW_LWP, +# THR_SUSPENDED, or THR_DAEMON. Note that not every flag may be valid +# on every platform. +# +# -ORBdemuxstrategy <which> +# where <which> can be one of 'dynamic', 'linear', 'active', or 'user', +# and specifies the type of object lookup strategy used internally. +# -ORBtablesize <unsigned> +# specifies the size of the object table +# +dynamic Resource_Factory Service_Object * TAO:_make_TAO_Resource_Factory() "-ORBresources tss" +dynamic Client_Strategy_Factory Service_Object * TAO:_make_TAO_Default_Client_Strategy_Factory() +dynamic Server_Strategy_Factory Service_Object * TAO:_make_TAO_Default_Server_Strategy_Factory() "-ORBconcurrency reactive -ORBdemuxstrategy dynamic -ORBtablesize 128" diff --git a/TAO/tests/NestedUpcall/MT_Client_Test/client.cpp b/TAO/tests/NestedUpcall/MT_Client_Test/client.cpp new file mode 100644 index 00000000000..751401c3914 --- /dev/null +++ b/TAO/tests/NestedUpcall/MT_Client_Test/client.cpp @@ -0,0 +1,310 @@ +// -*- c++ -*- +// $Id$ + +// ============================================================================ +// +// = LIBRARY +// TAO/tests/NestedUpCalls/MT_Client_Test +// +// = FILENAME +// client.cpp +// +// = DESCRIPTION +// Start one server thread calling a distant MT Object serveral times, +// also starting serveral client threads which call the MT Object too. +// The server does nested upcalls. +// +// = AUTHORS +// Michael Kircher +// +// ============================================================================ + +#include "ace/Read_Buffer.h" +#include "orbsvcs/CosNamingC.h" +#include "client.h" +#include "local_server.h" + + +MT_Client_Task::MT_Client_Task (int argc, + char **argv) + : argc_ (argc), + argv_ (argv) +{ +} + +int +MT_Client_Task::svc (void) +{ + if (this->mT_Client_.init (this->argc_, + this->argv_) == -1) + return 1; + else + return this->mT_Client_.run (); +} + +// Constructor. +MT_Client::MT_Client () + : object_key_ (0), + iterations_ (1) +{ +} + + +// Reads the Object A IOR from a file + +int +MT_Client::read_ior (char *filename) +{ + // Open the file for reading. + ACE_HANDLE f_handle = ACE_OS::open (filename,0); + + if (f_handle == ACE_INVALID_HANDLE) + ACE_ERROR_RETURN ((LM_ERROR, + "Unable to open %s for reading: %p\n", + filename), + -1); + + ACE_Read_Buffer ior_buffer (f_handle); + + this->object_key_ = ior_buffer.read (); + if (this->object_key_ == 0) + ACE_ERROR_RETURN ((LM_ERROR, + "Unable to allocate memory to read ior: %p\n"), + -1); + + ACE_OS::close (f_handle); + return 0; +} + + +// Parses the command line arguments and returns an error status. + +int +MT_Client::parse_args (void) +{ + ACE_Get_Opt get_opts (argc_, argv_, "df:g:h:i:n:s:"); + int c; + int result; + + while ((c = get_opts ()) != -1) + switch (c) + { + case 'd': // debug flag + TAO_debug_level++; + break; + // Depending on the thread ID we pick the IOR + case 'f': // read the IOR from the file. + if ((this->thread_ID_%2) == 0) + { + result = this->read_ior (get_opts.optarg); + // read IOR for MT Object + if (result < 0) + ACE_ERROR_RETURN ((LM_ERROR, + "Unable to read ior from %s : %p\n", + get_opts.optarg), + -1); + } + break; + case 'g': // read the IOR from the file. + if ((this->thread_ID_%2) == 1) + { + result = this->read_ior (get_opts.optarg); + // read IOR for Object A + if (result < 0) + ACE_ERROR_RETURN ((LM_ERROR, + "Unable to read ior from %s : %p\n", + get_opts.optarg), + -1); + } + break; + case 'i': this->iterations_ = ACE_OS::atoi (get_opts.optarg); + break; + case 'h': + case 'n': + case 's': + break; + case '?': + default: + ACE_ERROR_RETURN ((LM_ERROR, + "usage: %s\n" + " [-f] first server ior file\n" + " [-g] second server ior file\n" + " [-h] third server ior file\n" + " [-i] client iterations\n" + " [-n] number of client threads\n" + " [-s] number of server iterations\n", + this->argv_ [0]), + -1); + } + + // Indicates successful parsing of command line. + return 0; +} + +int +MT_Client::run (void) +{ + TAO_TRY + { + for (unsigned long i = 0; i < this->iterations_; i++) + { + ACE_DEBUG ((LM_DEBUG, + "(%P|%t) MT_Client::run: %d of %d\n", + i, + this->iterations_)); + + // call the recursive object MT_Object for nested upcalls + // testing + this->mT_Object_var_->yadda (0, + 0, + TAO_TRY_ENV); + TAO_CHECK_ENV; + } + } + TAO_CATCHANY + { + TAO_TRY_ENV.print_exception ("MT_Client:run"); + return -1; + } + TAO_ENDTRY; + + return 0; +} + +MT_Client::~MT_Client (void) +{ + if (this->object_key_ != 0) + ACE_OS::free (this->object_key_); + if (this->argv_ != 0) + delete [] this->argv_; +} + + +int +MT_Client::init (int argc, + char **argv) +{ + + // Make a copy of argv since ORB_init will change it. + this->argc_ = argc; + this->argv_ = new char *[argc]; + for (int i = 0; i < argc; i++) + this->argv_[i] = argv[i]; + + + this->thread_ID_ = ACE_Thread::self (); + + TAO_TRY + { + this->orb_var_ = CORBA::ORB::_duplicate (TAO_ORB_Core_instance()->orb()); + TAO_CHECK_ENV; + + // Parse command line and verify parameters. + if (this->parse_args () == -1) + return -1; + + if (this->object_key_ == 0) + ACE_ERROR_RETURN ((LM_ERROR, + "The IOR is nil, not able to get the object.\n"), + -1); + + + CORBA::Object_var object_var = this->orb_var_->string_to_object (this->object_key_, + TAO_TRY_ENV); + TAO_CHECK_ENV; + + if (CORBA::is_nil (object_var.in())) + ACE_ERROR_RETURN ((LM_ERROR, + "No proper object has been returned.\n"), + -1); + + this->mT_Object_var_ = MT_Object::_narrow (object_var.in(), + TAO_TRY_ENV); + TAO_CHECK_ENV; + + if (CORBA::is_nil (this->mT_Object_var_.in())) + { + ACE_ERROR_RETURN ((LM_ERROR, + "We have no proper reference to the Object.\n"), + -1); + } + + if (TAO_debug_level > 0) + ACE_DEBUG ((LM_DEBUG, "We have a proper reference to the Object.\n")); + + } + TAO_CATCHANY + { + TAO_TRY_ENV.print_exception ("MT_Client::init"); + return -1; + } + TAO_ENDTRY; + + return 0; +} + + +// This function runs the test. + +int +main (int argc, char **argv) +{ + CORBA::Environment env; + + TAO_ORB_Manager orb_manager; + + orb_manager.init (argc, + argv, + env); + + if (env.exception() != 0) + ACE_ERROR_RETURN ((LM_ERROR, + "main: Failure while initializing the ORB."), + -1); + + + ACE_DEBUG ((LM_DEBUG,"\n\tMT_Client: client\n\n")); + + int i; + int threads = 1; + + for (i = 0; i < argc; i++) + if (ACE_OS::strcmp (argv[i], "-n") == 0) + threads = ACE_OS::atoi(argv[i + 1]); + + // create a separate server thread + ACE_Thread_Manager server_thr_mgr; + // starting the server thread + MT_Server_Task *server = new MT_Server_Task (&server_thr_mgr, + argc, + argv, + &orb_manager); + server->activate (THR_BOUND | ACE_SCHED_FIFO, 1, 0, ACE_DEFAULT_THREAD_PRIORITY); + + // starting the client threads + MT_Client_Task **clients = new MT_Client_Task*[threads]; + + for (i = 0; i < threads; i++) + clients[i] = new MT_Client_Task (argc, + argv); + + for (i = 0; i < threads; i++) + clients[i]->activate (THR_BOUND | ACE_SCHED_FIFO, 1, 0, ACE_DEFAULT_THREAD_PRIORITY); + + int result = ACE_Thread_Manager::instance ()->wait (); + + for (i = 0; i < threads; i++) + delete clients[i]; + + delete [] clients; + + //orb_manager.orb ()->shutdown (); + + // wait for the server thread to end + result |= server_thr_mgr.wait (); + + delete server; + + return result; +} + diff --git a/TAO/tests/NestedUpcall/MT_Client_Test/client.dsp b/TAO/tests/NestedUpcall/MT_Client_Test/client.dsp new file mode 100644 index 00000000000..756d8a93ba5 --- /dev/null +++ b/TAO/tests/NestedUpcall/MT_Client_Test/client.dsp @@ -0,0 +1,169 @@ +# Microsoft Developer Studio Project File - Name="client" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 5.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=client - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "client.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "client.mak" CFG="client - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "client - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "client - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE
+
+# Begin Project
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "client - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+
+!ELSEIF "$(CFG)" == "client - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "client__"
+# PROP BASE Intermediate_Dir "client__"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "client__"
+# PROP Intermediate_Dir "client__"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\..\.." /I "..\.." /I "..\..\orbsvcs" /I "..\..\..\.." /I "..\..\..\orbsvcs" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 aced.lib TAO.lib orbsvcs.lib /nologo /subsystem:console /debug /machine:I386 /out:"client.exe" /pdbtype:sept /libpath:"..\..\..\..\ace" /libpath:"..\..\..\tao" /libpath:"..\..\..\orbsvcs\orbsvcs"
+
+!ENDIF
+
+# Begin Target
+
+# Name "client - Win32 Release"
+# Name "client - Win32 Debug"
+# Begin Group "source files"
+
+# PROP Default_Filter "*.cpp"
+# Begin Source File
+
+SOURCE=.\client.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\local_server.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\MT_Client_TestC.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\MT_Client_TestS.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\MT_Object_Impl.cpp
+# End Source File
+# End Group
+# Begin Group "header files"
+
+# PROP Default_Filter "*.h"
+# Begin Source File
+
+SOURCE=.\client.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\local_server.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\MT_Client_TestC.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\MT_Object_Impl.h
+# End Source File
+# End Group
+# Begin Group "IDL files"
+
+# PROP Default_Filter "*.idl"
+# Begin Source File
+
+SOURCE=.\MT_Client_Test.idl
+
+!IF "$(CFG)" == "client - Win32 Release"
+
+!ELSEIF "$(CFG)" == "client - Win32 Debug"
+
+# Begin Custom Build - Invoking TAO IDL compiler
+InputPath=.\MT_Client_Test.idl
+InputName=MT_Client_Test
+
+BuildCmds= \
+ tao_idl $(InputName).idl
+
+"$(InputName)C.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)C.i" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)C.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S.i" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+# End Custom Build
+
+!ENDIF
+
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/TAO/tests/NestedUpcall/MT_Client_Test/client.h b/TAO/tests/NestedUpcall/MT_Client_Test/client.h new file mode 100644 index 00000000000..29739ddbd18 --- /dev/null +++ b/TAO/tests/NestedUpcall/MT_Client_Test/client.h @@ -0,0 +1,102 @@ +// -*- c++ -*- +// $Id$ + +// ============================================================================ +// +// = LIBRARY +// TAO/tests/NestedUpCalls/MT_Client_Test +// +// = FILENAME +// client.h +// +// = DESCRIPTION +// Test for multithreaded client using one global ORB (and Reactor) +// +// = AUTHORS +// Michael Kircher +// +// ============================================================================ + +#if !defined (MT_CLIENT_H) +#define MT_CLIENT_H + +#include "ace/Get_Opt.h" +#include "ace/Task.h" +#include "ace/Thread_Manager.h" +#include "tao/corba.h" +#include "MT_Client_TestC.h" + +class MT_Client +{ + // = TITLE + // A simple client talking to one server + // + // = DESCRIPTION + // It is connecting to a server which holds the Object_A + // or using the "-m" switch to a server holding the MT_Object + +public: + MT_Client (void); + ~MT_Client (void); + // = Constructor and destructor. + + int run (void); + // Execute client example code. + + int init (int argc, + char **argv); + // Initialize the client communication endpoint with server. + +private: + int read_ior (char *filename); + // reading the IOR of object A in + + int parse_args (void); + // Parses the arguments passed on the command line. + + int argc_; + // # of arguments on the command line. + + char **argv_; + // arguments from command line. + + char *object_key_; + // Key of the object + + int shutdown_; + // Flag to tell server to shutdown. + + MT_Object_var mT_Object_var_; + // pointer to the mt Object + + CORBA::ORB_var orb_var_; + // Remember our orb. + + unsigned long thread_ID_; + // thread ID :-) + + unsigned long iterations_; + // number of loops + +}; + +class MT_Client_Task : public ACE_Task<ACE_SYNCH> +{ + // = TITLE + // Wrapper for the MT_Client to be an extra thread + // + // = DESCRIPTION + // No big purpose, just wrapping +public: + MT_Client_Task (int argc, + char **argv); + + virtual int svc (void); + +private: + MT_Client mT_Client_; + int argc_; + char **argv_; +}; + +#endif /* MT_CLIENT_H */ diff --git a/TAO/tests/NestedUpcall/MT_Client_Test/local_server.cpp b/TAO/tests/NestedUpcall/MT_Client_Test/local_server.cpp new file mode 100644 index 00000000000..b7d1f8df4bd --- /dev/null +++ b/TAO/tests/NestedUpcall/MT_Client_Test/local_server.cpp @@ -0,0 +1,268 @@ +// -*- c++ -*- +// $Id$ + +// ============================================================================ +// +// = LIBRARY +// TAO/tests/NestedUpCalls/MT_Client_Test +// +// = FILENAME +// local_server.cpp +// +// = DESCRIPTION +// This server will run the ORB briefly and then make +// several calls on the distant MT Object. +// +// = AUTHORS +// Michael Kircher +// +// ============================================================================ + +#include "ace/Read_Buffer.h" +#include "local_server.h" + +MT_Server_Task::MT_Server_Task (ACE_Thread_Manager* thr_mgr_ptr, + int argc, + char **argv, + TAO_ORB_Manager* orb_manager_ptr) + :ACE_Task<ACE_SYNCH> (thr_mgr_ptr), + argc_ (argc), + argv_ (argv), + orb_manager_ptr_ (orb_manager_ptr) +{ +} + +int +MT_Server_Task::svc (void) +{ + if (this->mT_Server_.init (this->argc_, + this->argv_, + this->orb_manager_ptr_) == -1) + return 1; + else + return this->mT_Server_.run_ORB_briefly (); +} + + +MT_Server::MT_Server () + : ior_output_file_ (0), + orb_manager_ptr_ (0), + object_key_ (0), + iterations_ (1) +{ +} + +// Reads the MT Object IOR from a file +int +MT_Server::read_ior (char *filename) +{ + // Open the file for reading. + ACE_HANDLE f_handle = ACE_OS::open (filename,0); + + if (f_handle == ACE_INVALID_HANDLE) + ACE_ERROR_RETURN ((LM_ERROR, + "Unable to open %s for reading: %p\n", + filename), + -1); + + ACE_Read_Buffer ior_buffer (f_handle); + + this->object_key_ = ior_buffer.read (); + if (this->object_key_ == 0) + ACE_ERROR_RETURN ((LM_ERROR, + "Unable to allocate memory to read ior: %p\n"), + -1); + + ACE_OS::close (f_handle); + return 0; +} + + + +int +MT_Server::parse_args (void) +{ + ACE_Get_Opt get_opts (argc_, argv_, "d:f:g:h:i:n:s:"); + int c; + + while ((c = get_opts ()) != -1) + switch (c) + { + case 'd': // debug flag. + TAO_debug_level++; + break; + case 'h': // read the IOR from the file. + int result; + result = this->read_ior (get_opts.optarg); + // read IOR for MT Object + if (result < 0) + ACE_ERROR_RETURN ((LM_ERROR, + "Unable to read ior from %s : %p\n", + get_opts.optarg), + -1); + break; + case 'f': + case 'g': + case 'i': + case 'n': + break; + case 's': this->iterations_ = atoi (get_opts.optarg); + break; + case '?': + default: + ACE_ERROR_RETURN ((LM_ERROR, + "usage: %s" + " [-d]\n" + " [-f] first server ior file\n" + " [-g] second server ior file\n" + " [-h] third server ior file\n" + " [-i] client iterations\n" + " [-n] number of client threads\n" + " [-s] number of server iterations\n" + "\n", + argv_ [0]), + -1); + } + + // Indicates successful parsing of command line. + return 0; +} + +int +MT_Server::init (int argc, + char** argv, + TAO_ORB_Manager* orb_manager_ptr) +{ + this->argc_ = argc; + this->argv_ = argv; + if ((this->orb_manager_ptr_ = orb_manager_ptr) == 0) + ACE_ERROR_RETURN ((LM_ERROR, + "MT_Server::init: ORB_Manager is nil!\n"), + -1); + + TAO_TRY + { + + // Call the init of TAO_ORB_Manager to create a child POA + // under the root POA. + this->orb_manager_ptr_->init_child_poa (argc, + argv, + "child_poa", + TAO_TRY_ENV); + + TAO_CHECK_ENV; + + this->parse_args (); + // ~~ check for the return value here + + CORBA::String_var str = + this->orb_manager_ptr_->activate_under_child_poa ("MT", + &this->mT_Object_Impl_, + TAO_TRY_ENV); + ACE_DEBUG ((LM_DEBUG, + "The IOR is: <%s>\n", + str.in ())); + + if (this->ior_output_file_) + { + ACE_OS::fprintf (this->ior_output_file_, + "%s", + str.in ()); + ACE_OS::fclose (this->ior_output_file_); + } + + // retrieve the object reference to the distant mt object + if (this->object_key_ == 0) + ACE_ERROR_RETURN ((LM_ERROR, + "The IOR is nil, not able to get the object.\n"), + -1); + + CORBA::ORB_var orb_var = this->orb_manager_ptr_->orb (); + + CORBA::Object_var object_var = orb_var->string_to_object (this->object_key_, + TAO_TRY_ENV); + TAO_CHECK_ENV; + + if (CORBA::is_nil (object_var.in())) + ACE_ERROR_RETURN ((LM_ERROR, + "No proper object has been returned.\n"), + -1); + + this->mT_Object_var_ = MT_Object::_narrow (object_var.in(), + TAO_TRY_ENV); + TAO_CHECK_ENV; + + if (CORBA::is_nil (this->mT_Object_var_.in())) + { + ACE_ERROR_RETURN ((LM_ERROR, + "We have no proper reference to the Object.\n"), + -1); + } + + if (TAO_debug_level > 0) + ACE_DEBUG ((LM_DEBUG, "We have a proper reference to the Object.\n")); + + } + TAO_CATCHANY + { + TAO_TRY_ENV.print_exception ("MT_Client::init"); + return -1; + } + TAO_ENDTRY; + + + return 0; +} + +int +MT_Server::run () +{ + CORBA::Environment env; + if (this->orb_manager_ptr_->run (env) == -1) + ACE_ERROR_RETURN ((LM_ERROR, + "MT_Server::run"), + -1); + return 0; +} + +MT_Server::~MT_Server (void) +{ + if (this->object_key_ != 0) + ACE_OS::free (this->object_key_); +} + + +int +MT_Server::run_ORB_briefly (void) +{ + if (this->iterations_ > 0) + { + CORBA::Environment env; + ACE_Time_Value tv = ACE_Time_Value::zero; + if (this->orb_manager_ptr_->run (env, &tv) == -1) + ACE_ERROR_RETURN ((LM_ERROR, + "MT_Server::run"), + -1); + ACE_DEBUG ((LM_DEBUG, + "(%P|%t) MT_Server::run: " + "going to call distant MT Object\n")); + + for (unsigned int i = 0; i < this->iterations_; i++) + { + this->mT_Object_var_->yadda (0, + this->mT_Object_Impl_._this (env), + env); + + if (env.exception () != 0) + ACE_ERROR_RETURN ((LM_ERROR, + "MT_Server::run: failed to call distant MT object\n"), + -1); + ACE_DEBUG ((LM_DEBUG, + "(%P|%t) MT_Server::run: " + "called distant MT Object i = %d\n", + i)); + } + } + return 0; +} + diff --git a/TAO/tests/NestedUpcall/MT_Client_Test/local_server.h b/TAO/tests/NestedUpcall/MT_Client_Test/local_server.h new file mode 100644 index 00000000000..97bd74a76f1 --- /dev/null +++ b/TAO/tests/NestedUpcall/MT_Client_Test/local_server.h @@ -0,0 +1,112 @@ +// -*- c++ -*- +// $Id$ + +// ============================================================================ +// +// = LIBRARY +// TAO/tests/NestedUpCalls/MT_Client_Test +// +// = FILENAME +// local_server.h +// +// = DESCRIPTION +// This class implements a simple server for the +// Nested Upcalls - MT Client test +// +// = AUTHORS +// Michael Kircher +// +// ============================================================================ + +#if !defined (MT_CLIENT_TEST_MT_SERVER_H) +#define MT_CLIENT_TEST_MT_SERVER_H + +#include "ace/Get_Opt.h" +#include "ace/Log_Msg.h" +#include "tao/TAO.h" +#include "MT_Object_Impl.h" + +class MT_Server +{ + // = TITLE + // This is the server for the mt_object + // + // = DESCRIPTION + // See the README file for more information. + +public: + + MT_Server (); + // Default constructor + + ~MT_Server (void); + // Destructor + + int init (int argc, + char **argv, + TAO_ORB_Manager* orb_manager_ptr); + // Initialize the MT_Server state - parsing arguments and ... + + int run (void); + // Run the orb + + int run_ORB_briefly (void); + // Just run it briefly + +private: + int read_ior (char *filename); + // reading the IOR of mt object in + + int parse_args (void); + // Parses the commandline arguments. + + char *object_key_; + // Key of the object + + FILE* ior_output_file_; + // File to output the IOR of the object A. + + TAO_ORB_Manager* orb_manager_ptr_; + // The ORB manager + + MT_Object_Impl mT_Object_Impl_; + // Implementation object + + MT_Object_var mT_Object_var_; + // reference for the distant MT Object + + int argc_; + // Number of commandline arguments. + + char **argv_; + // commandline arguments. + + unsigned int iterations_; + // number of times the server should call to the disted MT OBject +}; + + +class MT_Server_Task : public ACE_Task<ACE_SYNCH> +{ + // = TITLE + // Wrapper for the MT_Server to be an extra thread + // + // = DESCRIPTION + // No big purpose, just wrapping +public: + MT_Server_Task (ACE_Thread_Manager* thr_mgr_ptr, + int argc, + char **argv, + TAO_ORB_Manager* orb_manager_ptr); + + virtual int svc (void); + +private: + MT_Server mT_Server_; + int argc_; + char **argv_; + TAO_ORB_Manager* orb_manager_ptr_; +}; + + +#endif /* MT_CLIENT_TEST_MT_SERVER_H */ diff --git a/TAO/tests/NestedUpcall/MT_Client_Test/server.cpp b/TAO/tests/NestedUpcall/MT_Client_Test/server.cpp new file mode 100644 index 00000000000..6a3f4e3549b --- /dev/null +++ b/TAO/tests/NestedUpcall/MT_Client_Test/server.cpp @@ -0,0 +1,147 @@ +// -*- c++ -*- +// $Id$ + +// ============================================================================ +// +// = LIBRARY +// TAO/tests/NestedUpCalls/MT_Client_Test +// +// = FILENAME +// server.cpp +// +// = DESCRIPTION +// This class implements a simple server for the +// Nested Upcalls - MT_Client test. +// +// = AUTHORS +// Michael Kircher +// +// ============================================================================ + +#include "server.h" + +MT_Object_Server::MT_Object_Server (void) + : ior_output_file_ (0) +{ +} + +int +MT_Object_Server::parse_args (void) +{ + ACE_Get_Opt get_opts (argc_, argv_, "do:m"); + int c; + + while ((c = get_opts ()) != -1) + switch (c) + { + case 'd': // debug flag. + TAO_debug_level++; + break; + 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 '?': + default: + ACE_ERROR_RETURN ((LM_ERROR, + "usage: %s" + " [-d]" + " [-o] <ior_output_file>" + "\n", + argv_ [0]), + 1); + } + + // Indicates successful parsing of command line. + return 0; +} + +int +MT_Object_Server::init (int argc, + char** argv, + CORBA::Environment& 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); + + TAO_CHECK_ENV_RETURN (env,-1); + this->argc_ = argc; + this->argv_ = argv; + + this->parse_args (); + // ~~ check for the return value here + + CORBA::String_var str; + str = this->orb_manager_.activate_under_child_poa ("MT_Object", + &this->mT_Object_Impl_, + env); + ACE_DEBUG ((LM_DEBUG, + "The IOR is: <%s>\n", + str.in ())); + + if (this->ior_output_file_) + { + ACE_OS::fprintf (this->ior_output_file_, + "%s", + str.in ()); + ACE_OS::fclose (this->ior_output_file_); + } + + + return 0; +} + + +int +MT_Object_Server::run (CORBA::Environment& env) +{ + if (this->orb_manager_.run (env) == -1) + ACE_ERROR_RETURN ((LM_ERROR, + "NestedUpCalls_Server::run"), + -1); + return 0; +} + +MT_Object_Server::~MT_Object_Server (void) +{ +} + +int +main (int argc, char *argv[]) +{ + MT_Object_Server MT_Object_Server; + + ACE_DEBUG ((LM_DEBUG, + "\n \t NestedUpCalls.Triangle_Test: Object A Server \n \n")); + TAO_TRY + { + if (MT_Object_Server.init (argc,argv,TAO_TRY_ENV) == -1) + return 1; + else + { + MT_Object_Server.run (TAO_TRY_ENV); + TAO_CHECK_ENV; + } + } + TAO_CATCH (CORBA::SystemException, sysex) + { + ACE_UNUSED_ARG (sysex); + TAO_TRY_ENV.print_exception ("System Exception"); + return -1; + } + TAO_CATCH (CORBA::UserException, userex) + { + ACE_UNUSED_ARG (userex); + TAO_TRY_ENV.print_exception ("User Exception"); + return -1; + } + TAO_ENDTRY; + return 0; +} diff --git a/TAO/tests/NestedUpcall/MT_Client_Test/server.dsp b/TAO/tests/NestedUpcall/MT_Client_Test/server.dsp new file mode 100644 index 00000000000..3119a471857 --- /dev/null +++ b/TAO/tests/NestedUpcall/MT_Client_Test/server.dsp @@ -0,0 +1,167 @@ +# Microsoft Developer Studio Project File - Name="server" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 5.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=server - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "server.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "server.mak" CFG="server - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "server - Win32 Release" (based on\
+ "Win32 (x86) Console Application")
+!MESSAGE "server - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE
+
+# Begin Project
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "server - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\..\.." /I "..\..\..\.." /I "..\..\..\orbsvcs" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib tao.lib aced.lib orbsvcs.lib /nologo /subsystem:console /machine:I386 /out:"server.exe"
+
+!ELSEIF "$(CFG)" == "server - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\..\.." /I "..\.." /I "..\..\orbsvcs" /I "..\..\..\.." /I "..\..\..\orbsvcs" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 aced.lib TAO.lib orbsvcs.lib /nologo /subsystem:console /debug /machine:I386 /out:"server.exe" /pdbtype:sept /libpath:"..\..\..\..\ace" /libpath:"..\..\..\tao" /libpath:"..\..\..\orbsvcs\orbsvcs"
+
+!ENDIF
+
+# Begin Target
+
+# Name "server - Win32 Release"
+# Name "server - Win32 Debug"
+# Begin Group "source files"
+
+# PROP Default_Filter "*.cpp"
+# Begin Source File
+
+SOURCE=.\MT_Client_TestC.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\MT_Client_TestS.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\MT_Object_Impl.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\server.cpp
+# End Source File
+# End Group
+# Begin Group "header files"
+
+# PROP Default_Filter "*.h"
+# Begin Source File
+
+SOURCE=.\MT_Client_TestC.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\MT_Client_TestS.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\MT_Object_Impl.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\server.h
+# End Source File
+# End Group
+# Begin Group "IDL files"
+
+# PROP Default_Filter "*.idl"
+# Begin Source File
+
+SOURCE=.\MT_Client_Test.idl
+
+!IF "$(CFG)" == "server - Win32 Release"
+
+!ELSEIF "$(CFG)" == "server - Win32 Debug"
+
+# Begin Custom Build - Invoking TAO IDL compiler
+InputPath=.\MT_Client_Test.idl
+InputName=MT_Client_Test
+
+BuildCmds= \
+ tao_idl $(InputName).idl
+
+"$(InputName)C.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)C.i" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)C.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S.i" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+# End Custom Build
+
+!ENDIF
+
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/TAO/tests/NestedUpcall/MT_Client_Test/server.h b/TAO/tests/NestedUpcall/MT_Client_Test/server.h new file mode 100644 index 00000000000..cb314b2fa19 --- /dev/null +++ b/TAO/tests/NestedUpcall/MT_Client_Test/server.h @@ -0,0 +1,75 @@ +// -*- c++ -*- +// $Id$ + +// ============================================================================ +// +// = LIBRARY +// TAO/tests/NestedUpCalls/MT_Client_Test +// +// = FILENAME +// server_A.h +// +// = DESCRIPTION +// This class implements a simple server for the +// Nested Upcalls - MT Client test +// +// = AUTHORS +// Michael Kircher +// +// ============================================================================ + +#if !defined (MT_CLIENT_TEST_MT_OBJECT_SERVER_H) +#define MT_CLIENT_TEST_MT_OBJECT_SERVER_H + +#include "ace/Get_Opt.h" +#include "ace/Log_Msg.h" +#include "tao/TAO.h" +#include "MT_Object_Impl.h" + +class MT_Object_Server +{ + // = TITLE + // This is the server for the object A in the test. + // + // = DESCRIPTION + // See the README file for more information. + +public: + + MT_Object_Server (void); + // Default constructor + + ~MT_Object_Server (void); + // Destructor + + int init (int argc, + char **argv, + CORBA::Environment& env); + // Initialize the NestedUpCalls_Server state - parsing arguments and ... + + int run (CORBA::Environment& env); + // Run the orb + +private: + int parse_args (void); + // Parses the commandline arguments. + + FILE* ior_output_file_; + // File to output the IOR of the object A. + + TAO_ORB_Manager orb_manager_; + // The ORB manager + + MT_Object_Impl mT_Object_Impl_; + // Implementation object MT_OBject + + int argc_; + // Number of commandline arguments. + + char **argv_; + // commandline arguments. + + u_char use_mt_object_; +}; + +#endif /* MT_CLIENT_TEST_MT_OBJECT_SERVER_H */ diff --git a/TAO/tests/NestedUpcall/MT_Client_Test/svc.conf b/TAO/tests/NestedUpcall/MT_Client_Test/svc.conf new file mode 100644 index 00000000000..44c01ee1f07 --- /dev/null +++ b/TAO/tests/NestedUpcall/MT_Client_Test/svc.conf @@ -0,0 +1,49 @@ +# $Id$ +# +# This file contains a sample ACE_Service_Config configuration +# file specifying the strategy factories utilized by an application +# using TAO. There are currently only two possible factories: +# Client_Strategy_Factory and Server_Strategy_Factory. These names +# must be used as the second argument to their corresponding line, +# because that's what the ORB uses to find the desired factory. +# +# Note that there are two unordinary characteristics of the way *this* +# file is set up: +# - both client and server strategies are specified in the same +# file, which would only make sense for co-located clients & servers +# - both of the factories are actually sourced out of libTAO.so +# (TAO.DLL on Win32), and they would normally be in a separate +# dll from the TAO ORB Core. +# +# The options which can be passed to the Resource Factory are: +# +# -ORBresources <which> +# where <which> can be 'global' to specify globally-held resources, +# or 'tss' to specify thread-specific resources. +# +# The options which can be passed to the Client are: +# <none currently> +# +# The options which can be passed to the Server are: +# +# -ORBconcurrency <which> +# where <which> can be 'thread-per-connection' to specify +# use of the ACE_Threaded_Strategy concurrency strategy, +# or 'reactive' to specify use of the ACE_Reactive_Strategy +# concurrency strategy. +# +# -ORBthreadflags <flags> +# specifies the default thread flags to use, where <flags> is a +# logical OR'ing of the flags THR_DETACHED, THR_BOUND, THR_NEW_LWP, +# THR_SUSPENDED, or THR_DAEMON. Note that not every flag may be valid +# on every platform. +# +# -ORBdemuxstrategy <which> +# where <which> can be one of 'dynamic', 'linear', 'active', or 'user', +# and specifies the type of object lookup strategy used internally. +# -ORBtablesize <unsigned> +# specifies the size of the object table +# +dynamic Resource_Factory Service_Object * TAO:_make_TAO_Resource_Factory() "-ORBresources global" +dynamic Client_Strategy_Factory Service_Object * TAO:_make_TAO_Default_Client_Strategy_Factory() "-ORBresources global" +dynamic Server_Strategy_Factory Service_Object * TAO:_make_TAO_Default_Server_Strategy_Factory() "-ORBconcurrency reactive -ORBdemuxstrategy dynamic -ORBtablesize 128" diff --git a/TAO/tests/NestedUpcall/Reactor/client.dsp b/TAO/tests/NestedUpcall/Reactor/client.dsp index 419cb3f55d2..cec8ded6ac8 100644 --- a/TAO/tests/NestedUpcall/Reactor/client.dsp +++ b/TAO/tests/NestedUpcall/Reactor/client.dsp @@ -65,7 +65,7 @@ LINK32=link.exe # PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\..\..\.." /I "..\..\.." /I "..\..\..\orbsvcs" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\..\..\.." /I "..\..\.." /I "..\..\..\orbsvcs" /I "..\..\..\orbsvcs\orbsvcs" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
diff --git a/TAO/tests/NestedUpcall/Reactor/server.dsp b/TAO/tests/NestedUpcall/Reactor/server.dsp index 76c5544d10c..3f128a95d94 100644 --- a/TAO/tests/NestedUpcall/Reactor/server.dsp +++ b/TAO/tests/NestedUpcall/Reactor/server.dsp @@ -65,7 +65,7 @@ LINK32=link.exe # PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\..\..\.." /I "..\..\.." /I "..\..\..\orbsvcs" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\..\..\.." /I "..\..\.." /I "..\..\..\orbsvcs" /I "..\..\..\orbsvcs\orbsvcs" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
diff --git a/TAO/tests/NestedUpcall/Triangle_Test/initiator.cpp b/TAO/tests/NestedUpcall/Triangle_Test/initiator.cpp index 7105b866e07..fc2f9640955 100644 --- a/TAO/tests/NestedUpcall/Triangle_Test/initiator.cpp +++ b/TAO/tests/NestedUpcall/Triangle_Test/initiator.cpp @@ -64,7 +64,8 @@ Initiator_Server::read_ior (char *filename, unsigned int A_B) -1); } - return 0; + ACE_OS::close (f_handle); + return 0; } |