diff options
author | irfan <irfan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2001-08-27 04:36:40 +0000 |
---|---|---|
committer | irfan <irfan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2001-08-27 04:36:40 +0000 |
commit | 6a816521b84213922b2ccecd8293d773bcc8a8db (patch) | |
tree | f6edff2a439dd73d476de8ee6f5b49adf0a50cb2 | |
parent | 6d2739d3d0314c2e42c07a2625f0efd08aacf7c1 (diff) | |
download | ATCD-6a816521b84213922b2ccecd8293d773bcc8a8db.tar.gz |
Improved handling of Persistent IORs and added corresponding test.
28 files changed, 1393 insertions, 99 deletions
diff --git a/TAO/tao/Acceptor_Registry.cpp b/TAO/tao/Acceptor_Registry.cpp index b261d26b399..2c9e324c692 100644 --- a/TAO/tao/Acceptor_Registry.cpp +++ b/TAO/tao/Acceptor_Registry.cpp @@ -103,10 +103,10 @@ TAO_Acceptor_Registry::get_acceptor (CORBA::ULong tag) return 0; } - int TAO_Acceptor_Registry::open (TAO_ORB_Core *orb_core, ACE_Reactor *reactor, + int ignore_address, CORBA::Environment &ACE_TRY_ENV) ACE_THROW_SPEC ((CORBA::SystemException)) { @@ -248,6 +248,7 @@ TAO_Acceptor_Registry::open (TAO_ORB_Core *orb_core, reactor, addrs, factory, + ignore_address, ACE_TRY_ENV); ACE_CHECK_RETURN (-1); @@ -468,6 +469,7 @@ TAO_Acceptor_Registry::open_i (TAO_ORB_Core *orb_core, ACE_Reactor *reactor, ACE_CString &addrs, TAO_ProtocolFactorySetItor &factory, + int ignore_address, CORBA::Environment &ACE_TRY_ENV) { ACE_CString options_tmp; @@ -509,7 +511,8 @@ TAO_Acceptor_Registry::open_i (TAO_ORB_Core *orb_core, minor); // Check for existence of endpoint. - if (address.length () == 0) + if (address.length () == 0 || + ignore_address) { // Protocol prefix was specified without any endpoints. // All TAO pluggable protocols are expected to have the diff --git a/TAO/tao/Acceptor_Registry.h b/TAO/tao/Acceptor_Registry.h index d352a4cc70e..2253cad75c2 100644 --- a/TAO/tao/Acceptor_Registry.h +++ b/TAO/tao/Acceptor_Registry.h @@ -65,6 +65,7 @@ public: /// Initialize all registered acceptors. Return -1 on error. int open (TAO_ORB_Core *orb_core, ACE_Reactor *reactor, + int ignore_address, CORBA::Environment &ACE_TRY_ENV) ACE_THROW_SPEC ((CORBA::SystemException)); @@ -117,6 +118,7 @@ private: ACE_Reactor *reactor, ACE_CString &address, TAO_ProtocolFactorySetItor &factory, + int ignore_address, CORBA::Environment &ACE_TRY_ENV); private: diff --git a/TAO/tao/Default_Thread_Lane_Resources_Manager.cpp b/TAO/tao/Default_Thread_Lane_Resources_Manager.cpp index 7a9bf435299..2c949126968 100644 --- a/TAO/tao/Default_Thread_Lane_Resources_Manager.cpp +++ b/TAO/tao/Default_Thread_Lane_Resources_Manager.cpp @@ -15,7 +15,6 @@ ACE_RCSID(tao, Default_Thread_Lane_Resources_Manager, "$Id$") TAO_Default_Thread_Lane_Resources_Manager::TAO_Default_Thread_Lane_Resources_Manager (TAO_ORB_Core &orb_core) : TAO_Thread_Lane_Resources_Manager (orb_core), - open_called_ (0), lane_resources_ (0) { // Create the default resources. @@ -32,33 +31,12 @@ TAO_Default_Thread_Lane_Resources_Manager::~TAO_Default_Thread_Lane_Resources_Ma int TAO_Default_Thread_Lane_Resources_Manager::open_default_resources (CORBA_Environment &ACE_TRY_ENV) { - // Double check pattern - if (this->open_called_ == 1) - return 1; - - ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, tao_mon, this->open_lock_, -1); - - if (this->open_called_ == 1) - return 1; - - // Get a reference to the acceptor_registry. - TAO_Acceptor_Registry &ar = - this->lane_resources_->acceptor_registry (); - - // Open it. - int ret = - ar.open (this->orb_core_, - this->lane_resources_->leader_follower ().reactor (), - ACE_TRY_ENV); + int result = + this->lane_resources_->open_acceptor_registry (0, + ACE_TRY_ENV); ACE_CHECK_RETURN (-1); - if (ret == -1) - return -1; - - // Remember that the acceptor registry has already been opened. - this->open_called_ = 1; - - return 0; + return result; } void diff --git a/TAO/tao/Default_Thread_Lane_Resources_Manager.h b/TAO/tao/Default_Thread_Lane_Resources_Manager.h index 06307d35b89..6b2c3011eae 100644 --- a/TAO/tao/Default_Thread_Lane_Resources_Manager.h +++ b/TAO/tao/Default_Thread_Lane_Resources_Manager.h @@ -60,12 +60,6 @@ public: protected: - /// Mutual exclusion for calling open. - TAO_SYNCH_MUTEX open_lock_; - - /// Flag which denotes that the open method was called. - int open_called_; - /// Default lane resources. TAO_Thread_Lane_Resources *lane_resources_; }; diff --git a/TAO/tao/RTCORBA/RT_Thread_Lane_Resources_Manager.cpp b/TAO/tao/RTCORBA/RT_Thread_Lane_Resources_Manager.cpp index b957b6a9241..b89b3615fe9 100644 --- a/TAO/tao/RTCORBA/RT_Thread_Lane_Resources_Manager.cpp +++ b/TAO/tao/RTCORBA/RT_Thread_Lane_Resources_Manager.cpp @@ -16,7 +16,6 @@ ACE_RCSID(RTCORBA, RT_Thread_Lane_Resources_Manager, "$Id$") TAO_RT_Thread_Lane_Resources_Manager::TAO_RT_Thread_Lane_Resources_Manager (TAO_ORB_Core &orb_core) : TAO_Thread_Lane_Resources_Manager (orb_core), - open_called_ (0), default_lane_resources_ (0), tp_manager_ (0) { @@ -42,34 +41,12 @@ TAO_RT_Thread_Lane_Resources_Manager::~TAO_RT_Thread_Lane_Resources_Manager (voi int TAO_RT_Thread_Lane_Resources_Manager::open_default_resources (CORBA_Environment &ACE_TRY_ENV) { - // Check if we have been already opened. - if (this->open_called_ == 1) - return 1; - - // Double check pattern - ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, tao_mon, this->open_lock_, -1); - - if (this->open_called_ == 1) - return 1; - - // Get a reference to the acceptor_registry. - TAO_Acceptor_Registry &ar = - this->default_lane_resources_->acceptor_registry (); - - // Open it. - int ret = - ar.open (this->orb_core_, - this->default_lane_resources_->leader_follower ().reactor (), - ACE_TRY_ENV); + int result = + this->default_lane_resources_->open_acceptor_registry (0, + ACE_TRY_ENV); ACE_CHECK_RETURN (-1); - if (ret == -1) - return -1; - - // Remember that the acceptor registry has already been opened. - this->open_called_ = 1; - - return 0; + return result; } void diff --git a/TAO/tao/RTCORBA/RT_Thread_Lane_Resources_Manager.h b/TAO/tao/RTCORBA/RT_Thread_Lane_Resources_Manager.h index 4e3fda3ee90..4cb3587b592 100644 --- a/TAO/tao/RTCORBA/RT_Thread_Lane_Resources_Manager.h +++ b/TAO/tao/RTCORBA/RT_Thread_Lane_Resources_Manager.h @@ -65,12 +65,6 @@ public: protected: - /// Mutual exclusion for calling open. - TAO_SYNCH_MUTEX open_lock_; - - /// Flag which denotes that the open method was called. - int open_called_; - /// Default lane resources. TAO_Thread_Lane_Resources *default_lane_resources_; diff --git a/TAO/tao/RTCORBA/Thread_Pool.cpp b/TAO/tao/RTCORBA/Thread_Pool.cpp index 4616ca6817d..4e1243953ea 100644 --- a/TAO/tao/RTCORBA/Thread_Pool.cpp +++ b/TAO/tao/RTCORBA/Thread_Pool.cpp @@ -141,7 +141,8 @@ TAO_Thread_Lane::open (CORBA::Environment &ACE_TRY_ENV) // Open the acceptor registry. int result = 0; result = - this->resources_.open_acceptor_registry (ACE_TRY_ENV); + this->resources_.open_acceptor_registry (1, + ACE_TRY_ENV); ACE_CHECK; if (result == -1) diff --git a/TAO/tao/RTPortableServer/RT_Policy_Validator.cpp b/TAO/tao/RTPortableServer/RT_Policy_Validator.cpp index 1d0edd7b526..1bace70d392 100644 --- a/TAO/tao/RTPortableServer/RT_Policy_Validator.cpp +++ b/TAO/tao/RTPortableServer/RT_Policy_Validator.cpp @@ -43,6 +43,9 @@ TAO_POA_RT_Policy_Validator::validate_impl (TAO_Policy_Set &policies, this->validate_thread_pool (policies, ACE_TRY_ENV); ACE_CHECK; + this->validate_lifespan (policies, ACE_TRY_ENV); + ACE_CHECK; + this->validate_server_protocol (policies, ACE_TRY_ENV); ACE_CHECK; @@ -307,6 +310,33 @@ TAO_POA_RT_Policy_Validator::validate_thread_pool (TAO_Policy_Set &policies, } void +TAO_POA_RT_Policy_Validator::validate_lifespan (TAO_Policy_Set &policies, + CORBA::Environment &ACE_TRY_ENV) +{ + // If this POA is using a RTCORBA thread pool, make sure the + // lifespan policy is not persistent since we cannot support it + // right now. + if (this->thread_pool_ != 0) + { + CORBA::Policy_var policy = + policies.get_cached_policy (TAO_CACHED_POLICY_LIFESPAN); + PortableServer::LifespanPolicy_var lifespan_policy = + PortableServer::LifespanPolicy::_narrow (policy.in (), + ACE_TRY_ENV); + ACE_CHECK; + + PortableServer::LifespanPolicyValue lifespan = + lifespan_policy->value (ACE_TRY_ENV); + ACE_CHECK; + + if (lifespan == PortableServer::PERSISTENT) + { + ACE_THROW (PortableServer::POA::InvalidPolicy ()); + } + } +} + +void TAO_POA_RT_Policy_Validator::merge_policies_impl (TAO_Policy_Set &policies, CORBA::Environment &ACE_TRY_ENV) { diff --git a/TAO/tao/RTPortableServer/RT_Policy_Validator.h b/TAO/tao/RTPortableServer/RT_Policy_Validator.h index 5af4d403c84..1c6b6148b66 100644 --- a/TAO/tao/RTPortableServer/RT_Policy_Validator.h +++ b/TAO/tao/RTPortableServer/RT_Policy_Validator.h @@ -77,6 +77,9 @@ private: void validate_thread_pool (TAO_Policy_Set &policies, CORBA::Environment &ACE_TRY_ENV); + void validate_lifespan (TAO_Policy_Set &policies, + CORBA::Environment &ACE_TRY_ENV); + TAO_Acceptor_Registry *acceptor_registry (void); TAO_Acceptor_Registry *acceptor_registry_; diff --git a/TAO/tao/Thread_Lane_Resources.cpp b/TAO/tao/Thread_Lane_Resources.cpp index cf90efa4619..61107192b52 100644 --- a/TAO/tao/Thread_Lane_Resources.cpp +++ b/TAO/tao/Thread_Lane_Resources.cpp @@ -84,7 +84,8 @@ TAO_Thread_Lane_Resources::leader_follower (void) } int -TAO_Thread_Lane_Resources::open_acceptor_registry (CORBA::Environment &ACE_TRY_ENV) +TAO_Thread_Lane_Resources::open_acceptor_registry (int ignore_address, + CORBA::Environment &ACE_TRY_ENV) { /// Access the acceptor registry. TAO_Acceptor_Registry &ar = @@ -94,6 +95,7 @@ TAO_Thread_Lane_Resources::open_acceptor_registry (CORBA::Environment &ACE_TRY_E int result = ar.open (&this->orb_core_, this->leader_follower ().reactor (), + ignore_address, ACE_TRY_ENV); ACE_CHECK_RETURN (-1); diff --git a/TAO/tao/Thread_Lane_Resources.h b/TAO/tao/Thread_Lane_Resources.h index 54c887e8627..66fdd55f918 100644 --- a/TAO/tao/Thread_Lane_Resources.h +++ b/TAO/tao/Thread_Lane_Resources.h @@ -46,7 +46,8 @@ public: int has_acceptor_registry_been_created (void) const; /// Open the acceptor registry. - int open_acceptor_registry (CORBA::Environment &ACE_TRY_ENV); + int open_acceptor_registry (int ignore_address, + CORBA::Environment &ACE_TRY_ENV); /// Finalize resources. void finalize (void); diff --git a/TAO/tests/RTCORBA/Makefile b/TAO/tests/RTCORBA/Makefile index b882fa87ab4..dae9e7c5506 100644 --- a/TAO/tests/RTCORBA/Makefile +++ b/TAO/tests/RTCORBA/Makefile @@ -10,20 +10,22 @@ # Local macros #---------------------------------------------------------------------------- -DIRS = Banded_Connections \ +DIRS = \ + Banded_Connections \ Client_Propagated \ Client_Protocol \ Destroy_Thread_Pool \ Explicit_Binding \ - Server_Declared \ - Server_Protocol \ - Private_Connection \ - Thread_Pool \ + Linear_Priority \ MT_Client_Protocol_Priority \ - RTMutex \ + ORB_init \ + Persistent_IOR \ Policy_Combinations \ - Linear_Priority \ - ORB_init + Private_Connection \ + RTMutex \ + Server_Declared \ + Server_Protocol \ + Thread_Pool ifndef TAO_ROOT TAO_ROOT = $(ACE_ROOT)/TAO diff --git a/TAO/tests/RTCORBA/Makefile.bor b/TAO/tests/RTCORBA/Makefile.bor index 8346e8ec5a6..f188bbc8d35 100644 --- a/TAO/tests/RTCORBA/Makefile.bor +++ b/TAO/tests/RTCORBA/Makefile.bor @@ -8,13 +8,15 @@ DIRS = \ Client_Protocol \ Destroy_Thread_Pool \ Explicit_Binding \ - Server_Declared \ - Server_Protocol \ - Private_Connection \ - Thread_Pool \ + Linear_Priority \ MT_Client_Protocol_Priority \ - RTMutex \ + ORB_init \ + Persistent_IOR \ Policy_Combinations \ - ORB_init + Private_Connection \ + RTMutex \ + Server_Declared \ + Server_Protocol \ + Thread_Pool !include <$(ACE_ROOT)\include\makeinclude\recurse.bor> diff --git a/TAO/tests/RTCORBA/Persistent_IOR/Makefile b/TAO/tests/RTCORBA/Persistent_IOR/Makefile new file mode 100644 index 00000000000..17855638ebc --- /dev/null +++ b/TAO/tests/RTCORBA/Persistent_IOR/Makefile @@ -0,0 +1,60 @@ +#---------------------------------------------------------------------------- +# +# $Id$ +# +#---------------------------------------------------------------------------- + +#---------------------------------------------------------------------------- +# Local macros +#---------------------------------------------------------------------------- + +ifndef TAO_ROOT + TAO_ROOT = $(ACE_ROOT)/TAO +endif # ! TAO_ROOT + +IDL_FILES = test +IDL_SRC = testC.cpp testS.cpp +BIN_UNCHECKED = client server + +SRC = $(addsuffix .cpp, $(BIN)) $(IDL_SRC) + +CLIENT_OBJS = client.o testC.o +SERVER_OBJS = server.o $(IDL_SRC:.cpp=.o) + +TAO_IDLFLAGS += -Ge 1 +#---------------------------------------------------------------------------- +# Include macros and targets +#---------------------------------------------------------------------------- + +include $(ACE_ROOT)/include/makeinclude/wrapper_macros.GNU +include $(ACE_ROOT)/include/makeinclude/macros.GNU +include $(TAO_ROOT)/rules.tao.GNU + +ifeq ($(rt_corba),1) +BIN=$(BIN_UNCHECKED) +endif # rt_corba + +include $(ACE_ROOT)/include/makeinclude/rules.common.GNU +include $(ACE_ROOT)/include/makeinclude/rules.nonested.GNU +include $(ACE_ROOT)/include/makeinclude/rules.local.GNU +include $(TAO_ROOT)/taoconfig.mk + +#---------------------------------------------------------------------------- +# Local targets +#---------------------------------------------------------------------------- + +.PRECIOUS: $(foreach ext, $(IDL_EXT), test$(ext)) + +server: $(addprefix $(VDIR),$(SERVER_OBJS)) + $(LINK.cc) $(LDFLAGS) -o $@ $^ $(RT_TAO_SRVR_LIBS) $(POSTLINK) + +client: $(addprefix $(VDIR),$(CLIENT_OBJS)) + $(LINK.cc) $(LDFLAGS) -o $@ $^ $(TAO_BASE_LIBS) $(POSTLINK) + +realclean: clean + -$(RM) $(foreach ext, $(IDL_EXT), test$(ext)) + +# DO NOT DELETE THIS LINE -- g++dep uses it. +# DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY. + +# IF YOU PUT ANYTHING HERE IT WILL GO AWAY diff --git a/TAO/tests/RTCORBA/Persistent_IOR/Makefile.bor b/TAO/tests/RTCORBA/Persistent_IOR/Makefile.bor new file mode 100644 index 00000000000..e2ee4acd23a --- /dev/null +++ b/TAO/tests/RTCORBA/Persistent_IOR/Makefile.bor @@ -0,0 +1,7 @@ +# +# Makefile for building the Faults test executables +# + +MAKEFILES = server.bor client.bor + +!include <$(ACE_ROOT)\include\makeinclude\recurse.bor> diff --git a/TAO/tests/RTCORBA/Persistent_IOR/Persistent_IOR.dsw b/TAO/tests/RTCORBA/Persistent_IOR/Persistent_IOR.dsw new file mode 100644 index 00000000000..d17cf7c9604 --- /dev/null +++ b/TAO/tests/RTCORBA/Persistent_IOR/Persistent_IOR.dsw @@ -0,0 +1,41 @@ +Microsoft Developer Studio Workspace File, Format Version 6.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/RTCORBA/Persistent_IOR/README b/TAO/tests/RTCORBA/Persistent_IOR/README new file mode 100644 index 00000000000..e1789a6b204 --- /dev/null +++ b/TAO/tests/RTCORBA/Persistent_IOR/README @@ -0,0 +1,16 @@ +$Id$ + +Description: + +This test makes sure that: + +- For POAs using the default thread pool, the user can continue to use +-ORBEndpoint option. + +- Makes sure that if the user tries to combine thread pools and +persistence, an InvalidPolicy exception is thrown. + +- Makes sure that for POAs using thread pools, the user can specify +the protocol selection, protocol version, and other protocol specific +options (basically everything other than the endpoint address) +through the -ORBEndpoint option. diff --git a/TAO/tests/RTCORBA/Persistent_IOR/client.bor b/TAO/tests/RTCORBA/Persistent_IOR/client.bor new file mode 100644 index 00000000000..848c8e927dc --- /dev/null +++ b/TAO/tests/RTCORBA/Persistent_IOR/client.bor @@ -0,0 +1,35 @@ +# +# Makefile for building the Faults ping executable +# + +NAME = client + +TAO_IDL = $(CORE_BINDIR)\tao_idl -g $(CORE_BINDIR)\gperf.exe -Ge 1 + +OBJFILES = \ + $(OBJDIR)\testC.obj \ + $(OBJDIR)\client.obj + +CFLAGS = \ + $(ACE_CFLAGS) \ + $(TAO_CFLAGS) + +LIBFILES = \ + $(ACE_LIB) \ + $(TAO_LIB) + +IDLFILES = \ + $(IDLDIR)\test.idl + +CPPDIR = . + +IDLDIR = . + +!include <$(ACE_ROOT)\include\makeinclude\build_exe.bor> + +# +# IDL Build rules +# + +$(IDLDIR)\testS.cpp $(IDLDIR)\testC.cpp: $(IDLDIR)\test.idl + $(TAO_IDL) $** diff --git a/TAO/tests/RTCORBA/Persistent_IOR/client.cpp b/TAO/tests/RTCORBA/Persistent_IOR/client.cpp new file mode 100644 index 00000000000..96fe92a903d --- /dev/null +++ b/TAO/tests/RTCORBA/Persistent_IOR/client.cpp @@ -0,0 +1,99 @@ +// $Id$ + +#include "ace/Get_Opt.h" +#include "testC.h" + +static int iterations = 5; +static int shutdown_server = 0; + +static const char *ior = 0; + +static int +parse_args (int argc, char **argv) +{ + ACE_Get_Opt get_opts (argc, argv, "k:i:x"); + int c; + + while ((c = get_opts ()) != -1) + switch (c) + { + case 'k': + ior = get_opts.optarg; + break; + + case 'i': + iterations = ::atoi (get_opts.optarg); + break; + + case 'x': + shutdown_server = 1; + break; + + case '?': + default: + ACE_ERROR_RETURN ((LM_ERROR, + "usage: %s " + "-k ior " + "-i iterations " + "-x shutdown server " + "\n", + argv [0]), + -1); + } + + if (ior == 0) + ACE_ERROR_RETURN ((LM_ERROR, + "Error: No IOR specified\n"), + -1); + + return 0; +} + +int +main (int argc, char **argv) +{ + ACE_TRY_NEW_ENV + { + CORBA::ORB_var orb = + CORBA::ORB_init (argc, + argv, + 0, + ACE_TRY_ENV); + ACE_TRY_CHECK; + + int result = + parse_args (argc, argv); + if (result != 0) + return result; + + CORBA::Object_var object = + orb->string_to_object (ior, + ACE_TRY_ENV); + ACE_TRY_CHECK; + + test_var test = + test::_narrow (object.in (), + ACE_TRY_ENV); + ACE_TRY_CHECK; + + for (int i = 0; i < iterations; i++) + { + test->method (ACE_TRY_ENV); + ACE_TRY_CHECK; + } + + if (shutdown_server) + { + test->shutdown (ACE_TRY_ENV); + ACE_TRY_CHECK; + } + } + ACE_CATCHANY + { + ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, "Unexpected exception!"); + return -1; + } + ACE_ENDTRY; + + return 0; +} diff --git a/TAO/tests/RTCORBA/Persistent_IOR/client.dsp b/TAO/tests/RTCORBA/Persistent_IOR/client.dsp new file mode 100644 index 00000000000..c19efbdd523 --- /dev/null +++ b/TAO/tests/RTCORBA/Persistent_IOR/client.dsp @@ -0,0 +1,204 @@ +# Microsoft Developer Studio Project File - Name="Persistent_IOR Client" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=Persistent_IOR Client - Win32 Release
+!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="Persistent_IOR Client - Win32 Release"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "Persistent_IOR Client - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "Persistent_IOR Client - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "Persistent_IOR 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 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 "..\..\..\..\\" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /FD /c
+# SUBTRACT CPP /YX
+# 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 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 ace.lib TAO.lib TAO_RTCORBA.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\..\..\ace" /libpath:"..\..\..\tao" /libpath:"..\..\..\tao\RTCORBA"
+
+!ELSEIF "$(CFG)" == "Persistent_IOR Client - 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 ""
+# 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 "..\..\..\\" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FD /c
+# SUBTRACT CPP /YX
+# 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 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 TAOd.lib TAO_RTCORBAd.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\..\ace" /libpath:"..\..\..\tao" /libpath:"..\..\..\tao\RTCORBA"
+
+!ENDIF
+
+# Begin Target
+
+# Name "Persistent_IOR Client - Win32 Release"
+# Name "Persistent_IOR Client - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=.\client.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\testC.cpp
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# Begin Source File
+
+SOURCE=.\testC.h
+# End Source File
+# End Group
+# Begin Group "Inline Files"
+
+# PROP Default_Filter "i"
+# Begin Source File
+
+SOURCE=.\testC.i
+# End Source File
+# End Group
+# Begin Group "IDL Files"
+
+# PROP Default_Filter "idl"
+# Begin Source File
+
+SOURCE=.\test.idl
+
+!IF "$(CFG)" == "Persistent_IOR Client - Win32 Release"
+
+USERDEP__TEST_="..\..\..\..\bin\Release\tao_idl.exe"
+# Begin Custom Build
+InputPath=.\test.idl
+InputName=test
+
+BuildCmds= \
+ ..\..\..\..\bin\Release\tao_idl.exe -Ge 1 $(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)
+
+"$(InputName)S_T.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S_T.i" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S_T.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+# End Custom Build
+
+!ELSEIF "$(CFG)" == "Persistent_IOR Client - Win32 Debug"
+
+# PROP Ignore_Default_Tool 1
+USERDEP__TEST_="..\..\..\..\bin\tao_idl.exe"
+# Begin Custom Build - Invoking TAO_IDL on $(InputName)
+InputPath=.\test.idl
+InputName=test
+
+BuildCmds= \
+ ..\..\..\..\bin\tao_idl -Ge 1 $(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)
+
+"$(InputName)S_T.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S_T.i" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S_T.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+# End Custom Build
+
+!ENDIF
+
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/TAO/tests/RTCORBA/Persistent_IOR/run_test.pl b/TAO/tests/RTCORBA/Persistent_IOR/run_test.pl new file mode 100755 index 00000000000..538e82e98a1 --- /dev/null +++ b/TAO/tests/RTCORBA/Persistent_IOR/run_test.pl @@ -0,0 +1,119 @@ +eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' + & eval 'exec perl -S $0 $argv:q' + if 0; + +# $Id$ +# -*- perl -*- + +use lib '../../../../bin'; +use PerlACE::Run_Test; + +$iiop_port = 27532; + +$extra_server_args = "-d 1 -ORBobjrefstyle url -ORBEndpoint iiop://1.0\@:$iiop_port"; + +@iorfiles = + ( + "persistent_ior", + "transient_ior", + "not_used_ior", + ); + +@configurations = + ( + { + iorfiles => [ "persistent_ior", "transient_ior" ], + server => "-p persistent_ior -t transient_ior $extra_server_args", + clients => [ "-k file://persistent_ior", "-k file://transient_ior -x" ], + }, + { + iorfiles => [ "persistent_ior", "transient_ior", "not_used_ior" ], + server => "-p not_used_ior -t transient_ior $extra_server_args", + clients => [ "-k file://not_used_ior", "-k file://transient_ior -x" ], + }, + ); + +sub run_client +{ + $CL = new PerlACE::Process ("client", @_); + + $CL->Spawn (); + + $client = $CL->WaitKill (120); + + if ($client != 0) + { + print STDERR "ERROR: client returned $client\n"; + $status = 1; + zap_server (1); + } +} + +sub run_server +{ + my @parms = @_; + my $args = $parms[0]; + my $iorfiles = $parms[1]; + + $SV = new PerlACE::Process ("server", $args); + + $SV->Spawn (); + + for $file (@$iorfiles) + { + if (PerlACE::waitforfile_timed ($file, 5) == -1) + { + print STDERR "ERROR: cannot find ior file: $file\n"; + $status = 1; + zap_server (1); + } + } +} + +sub zap_server +{ + $server = $SV->WaitKill (5); + + if ($server != 0) + { + print STDERR "ERROR: server returned $server\n"; + $status = 1; + } + + if ($_[0]) + { + for $file (@iorfiles) + { + unlink $file; + } + + exit $status; + } +} + +for $file (@iorfiles) +{ + unlink $file; +} + +for $test (@configurations) +{ + print STDERR "\n******************************************************\n"; + + run_server ($test->{server}, $test->{iorfiles}); + + my $clients = $test->{clients}; + for $args (@$clients) + { + run_client ($args); + } + + zap_server (0); +} + +for $file (@iorfiles) +{ + unlink $file; +} + +exit $status; diff --git a/TAO/tests/RTCORBA/Persistent_IOR/server.bor b/TAO/tests/RTCORBA/Persistent_IOR/server.bor new file mode 100644 index 00000000000..0a158b04444 --- /dev/null +++ b/TAO/tests/RTCORBA/Persistent_IOR/server.bor @@ -0,0 +1,42 @@ +# +# Makefile for building the Faults test executable +# + +NAME = server + +TAO_IDL = $(CORE_BINDIR)\tao_idl -g $(CORE_BINDIR)\gperf.exe -Ge 1 + +OBJFILES = \ + $(OBJDIR)\testC.obj \ + $(OBJDIR)\testS.obj \ + $(OBJDIR)\server.obj + +CFLAGS = \ + $(ACE_CFLAGS) \ + $(TAO_CFLAGS) \ + $(TAO_PORTABLESERVER_CFLAGS) \ + $(TAO_RTCORBA_CFLAGS) \ + $(TAO_RTPORTABLESERVER_CFLAGS) + +LIBFILES = \ + $(ACE_LIB) \ + $(TAO_LIB) \ + $(TAO_PORTABLESERVER_LIB) \ + $(TAO_RTCORBA_LIB) \ + $(TAO_RTPORTABLESERVER_LIB) + +IDLFILES = \ + $(IDLDIR)\test.idl + +CPPDIR = . + +IDLDIR = . + +!include <$(ACE_ROOT)\include\makeinclude\build_exe.bor> + +# +# IDL Build rules +# + +$(IDLDIR)\testS.cpp $(IDLDIR)\testC.cpp: $(IDLDIR)\test.idl + $(TAO_IDL) $** diff --git a/TAO/tests/RTCORBA/Persistent_IOR/server.cpp b/TAO/tests/RTCORBA/Persistent_IOR/server.cpp new file mode 100644 index 00000000000..7d056800e6a --- /dev/null +++ b/TAO/tests/RTCORBA/Persistent_IOR/server.cpp @@ -0,0 +1,404 @@ +// $Id$ + +#include "ace/Get_Opt.h" +#include "testS.h" +#include "tao/RTPortableServer/RTPortableServer.h" + +class test_i : + public POA_test, + public PortableServer::RefCountServantBase +{ +public: + test_i (CORBA::ORB_ptr orb, + PortableServer::POA_ptr poa); + + void method (CORBA::Environment &ACE_TRY_ENV) + ACE_THROW_SPEC ((CORBA::SystemException)); + + void shutdown (CORBA::Environment &ACE_TRY_ENV) + ACE_THROW_SPEC ((CORBA::SystemException)); + + PortableServer::POA_ptr _default_POA (CORBA_Environment &ACE_TRY_ENV); + +private: + + CORBA::ORB_var orb_; + PortableServer::POA_var poa_; +}; + +test_i::test_i (CORBA::ORB_ptr orb, + PortableServer::POA_ptr poa) + : orb_ (CORBA::ORB::_duplicate (orb)), + poa_ (PortableServer::POA::_duplicate (poa)) +{ +} + +void +test_i::method (CORBA::Environment &) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + ACE_DEBUG ((LM_DEBUG, + "test_i::method\n")); +} + +void +test_i::shutdown (CORBA::Environment &ACE_TRY_ENV) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + ACE_DEBUG ((LM_DEBUG, + "test_i::shutdown\n")); + + this->orb_->shutdown (0, + ACE_TRY_ENV); + ACE_CHECK; +} + +PortableServer::POA_ptr +test_i::_default_POA (CORBA_Environment &) +{ + return PortableServer::POA::_duplicate (this->poa_.in ()); +} + +static const char *persistent_ior = "persistent_ior"; +static const char *transient_ior = "transient_ior"; +static int debug = 0; + +static CORBA::ULong stacksize = 0; +static CORBA::ULong static_threads = 2; +static CORBA::ULong dynamic_threads = 2; +static RTCORBA::Priority default_thread_priority = +RTCORBA::Priority (ACE_DEFAULT_THREAD_PRIORITY); +static CORBA::Boolean allow_request_buffering = 0; +static CORBA::ULong max_buffered_requests = 0; +static CORBA::ULong max_request_buffer_size = 0; + +int +parse_args (int argc, char *argv[]) +{ + ACE_Get_Opt get_opts (argc, argv, "p:t:d:"); + int c; + + while ((c = get_opts ()) != -1) + switch (c) + { + case 'p': + persistent_ior = get_opts.optarg; + break; + + case 't': + transient_ior = get_opts.optarg; + break; + + case 'd': + debug = ACE_OS::atoi (get_opts.optarg); + break; + + case '?': + default: + ACE_ERROR_RETURN ((LM_ERROR, + "usage: %s " + "-p <persistent ior file> " + "-t <transient ior file> " + "-d <debug> " + "\n", + argv [0]), + -1); + } + + // Indicates sucessful parsing of the command line + return 0; +} + +static void +write_iors_to_file (CORBA::Object_ptr object, + CORBA::ORB_ptr orb, + const char *filename, + CORBA::Environment &ACE_TRY_ENV) +{ + FILE *file = + ACE_OS::fopen (filename, "w"); + ACE_ASSERT (file != 0); + + CORBA::String_var ior = + orb->object_to_string (object, + ACE_TRY_ENV); + ACE_CHECK; + + if (debug) + ACE_DEBUG ((LM_DEBUG, + "%s\n", + ior.in ())); + + u_int result = 0; + result = + ACE_OS::fprintf (file, + "%s", + ior.in ()); + + ACE_ASSERT (result == ACE_OS::strlen (ior.in ())); + + ACE_OS::fclose (file); +} + +void +create_poa_and_servant_with_persistent_policy (CORBA::ORB_ptr orb, + RTCORBA::RTORB_ptr rt_orb, + PortableServer::POA_ptr root_poa, + PortableServer::POAManager_ptr poa_manager, + CORBA::Environment &ACE_TRY_ENV) +{ + CORBA::PolicyList policies; + + CORBA::Policy_var implicit_activation_policy = + root_poa->create_implicit_activation_policy (PortableServer::IMPLICIT_ACTIVATION, + ACE_TRY_ENV); + ACE_CHECK; + + CORBA::Policy_var lifespan_policy = + root_poa->create_lifespan_policy (PortableServer::PERSISTENT, + ACE_TRY_ENV); + ACE_CHECK; + + policies.length (policies.length () + 1); + policies[policies.length () - 1] = + implicit_activation_policy; + + policies.length (policies.length () + 1); + policies[policies.length () - 1] = + lifespan_policy; + + PortableServer::POA_var poa = + root_poa->create_POA ("persistent_child", + poa_manager, + policies, + ACE_TRY_ENV); + ACE_CHECK; + + test_i *servant = 0; + ACE_NEW_THROW_EX (servant, + test_i (orb, + poa.in ()), + CORBA::NO_MEMORY ()); + ACE_CHECK; + + PortableServer::ServantBase_var safe_servant (servant); + + test_var test = + servant->_this (ACE_TRY_ENV); + ACE_CHECK; + + write_iors_to_file (test.in (), + orb, + persistent_ior, + ACE_TRY_ENV); + ACE_CHECK; +} + +void +create_poa_and_servant_with_tp_policy (CORBA::ORB_ptr orb, + RTCORBA::RTORB_ptr rt_orb, + PortableServer::POA_ptr root_poa, + PortableServer::POAManager_ptr poa_manager, + CORBA::Environment &ACE_TRY_ENV) +{ + RTCORBA::ThreadpoolId threadpool_id = + rt_orb->create_threadpool (stacksize, + static_threads, + dynamic_threads, + default_thread_priority, + allow_request_buffering, + max_buffered_requests, + max_request_buffer_size, + ACE_TRY_ENV); + ACE_TRY_CHECK; + + CORBA::Policy_var threadpool_policy = + rt_orb->create_threadpool_policy (threadpool_id, + ACE_TRY_ENV); + ACE_TRY_CHECK; + + CORBA::Policy_var implicit_activation_policy = + root_poa->create_implicit_activation_policy (PortableServer::IMPLICIT_ACTIVATION, + ACE_TRY_ENV); + ACE_CHECK; + + CORBA::PolicyList policies; + + policies.length (policies.length () + 1); + policies[policies.length () - 1] = + implicit_activation_policy; + + policies.length (policies.length () + 1); + policies[policies.length () - 1] = + threadpool_policy; + + PortableServer::POA_var poa = + root_poa->create_POA ("tp_child", + poa_manager, + policies, + ACE_TRY_ENV); + ACE_CHECK; + + test_i *servant = 0; + ACE_NEW_THROW_EX (servant, + test_i (orb, + poa.in ()), + CORBA::NO_MEMORY ()); + ACE_CHECK; + + PortableServer::ServantBase_var safe_servant (servant); + + test_var test = + servant->_this (ACE_TRY_ENV); + ACE_CHECK; + + write_iors_to_file (test.in (), + orb, + transient_ior, + ACE_TRY_ENV); + ACE_CHECK; +} + +void +create_poa_with_tp_and_persistent_policy (RTCORBA::RTORB_ptr rt_orb, + PortableServer::POA_ptr root_poa, + CORBA::Environment &ACE_TRY_ENV) +{ + ACE_TRY + { + CORBA::PolicyList policies; + + RTCORBA::ThreadpoolId threadpool_id = + rt_orb->create_threadpool (stacksize, + static_threads, + dynamic_threads, + default_thread_priority, + allow_request_buffering, + max_buffered_requests, + max_request_buffer_size, + ACE_TRY_ENV); + ACE_TRY_CHECK; + + CORBA::Policy_var threadpool_policy = + rt_orb->create_threadpool_policy (threadpool_id, + ACE_TRY_ENV); + ACE_TRY_CHECK; + + CORBA::Policy_var lifespan_policy = + root_poa->create_lifespan_policy (PortableServer::PERSISTENT, + ACE_TRY_ENV); + ACE_CHECK; + + policies.length (policies.length () + 1); + policies[policies.length () - 1] = + lifespan_policy; + + policies.length (policies.length () + 1); + policies[policies.length () - 1] = + threadpool_policy; + + PortableServer::POA_var invalid_poa = + root_poa->create_POA ("invalid", + PortableServer::POAManager::_nil (), + policies, + ACE_TRY_ENV); + ACE_TRY_CHECK; + + // This next line of code should not run because an exception + // should have been raised. + ACE_DEBUG ((LM_DEBUG, "ERROR: no exception caught\n")); + } + ACE_CATCH (PortableServer::POA::InvalidPolicy, ex) + { + // Expected exception. + ACE_DEBUG ((LM_DEBUG, + "InvalidPolicy exception is caught as expected.\n")); + } + ACE_CATCHANY + { + // Unexpected exception. + ACE_DEBUG ((LM_DEBUG, "ERROR: unexpected exception caught\n")); + ACE_RE_THROW; + } + ACE_ENDTRY; + ACE_CHECK; +} + +int +main (int argc, char **argv) +{ + ACE_TRY_NEW_ENV + { + CORBA::ORB_var orb = + CORBA::ORB_init (argc, + argv, + 0, + ACE_TRY_ENV); + ACE_TRY_CHECK; + + int result = + parse_args (argc, argv); + if (result != 0) + return result; + + CORBA::Object_var object = + orb->resolve_initial_references ("RTORB", + ACE_TRY_ENV); + ACE_TRY_CHECK; + + RTCORBA::RTORB_var rt_orb = + RTCORBA::RTORB::_narrow (object.in (), + ACE_TRY_ENV); + ACE_TRY_CHECK; + + object = + orb->resolve_initial_references ("RootPOA", + ACE_TRY_ENV); + ACE_TRY_CHECK; + + PortableServer::POA_var root_poa = + PortableServer::POA::_narrow (object.in (), + ACE_TRY_ENV); + ACE_TRY_CHECK; + + PortableServer::POAManager_var poa_manager = + root_poa->the_POAManager (ACE_TRY_ENV); + ACE_TRY_CHECK; + + create_poa_and_servant_with_tp_policy (orb.in (), + rt_orb.in (), + root_poa.in (), + poa_manager.in (), + ACE_TRY_ENV); + ACE_TRY_CHECK; + + create_poa_and_servant_with_persistent_policy (orb.in (), + rt_orb.in (), + root_poa.in (), + poa_manager.in (), + ACE_TRY_ENV); + ACE_TRY_CHECK; + + create_poa_with_tp_and_persistent_policy (rt_orb.in (), + root_poa.in (), + ACE_TRY_ENV); + ACE_TRY_CHECK; + + poa_manager->activate (ACE_TRY_ENV); + ACE_TRY_CHECK; + + orb->run (ACE_TRY_ENV); + ACE_TRY_CHECK; + + orb->destroy (ACE_TRY_ENV); + ACE_TRY_CHECK; + } + ACE_CATCHANY + { + ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, "Exception caught"); + return -1; + } + ACE_ENDTRY; + + return 0; +} diff --git a/TAO/tests/RTCORBA/Persistent_IOR/server.dsp b/TAO/tests/RTCORBA/Persistent_IOR/server.dsp new file mode 100644 index 00000000000..3c20a7f7f4a --- /dev/null +++ b/TAO/tests/RTCORBA/Persistent_IOR/server.dsp @@ -0,0 +1,216 @@ +# Microsoft Developer Studio Project File - Name="Persistent_IOR Server" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=Persistent_IOR Server - Win32 Release
+!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="Persistent_IOR Server - Win32 Release"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "Persistent_IOR Server - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "Persistent_IOR Server - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "Persistent_IOR 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 "..\..\..\..\\" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /FD /c
+# SUBTRACT CPP /YX
+# 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 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 ace.lib TAO.lib TAO_PortableServer.lib TAO_RTCORBA.lib TAO_RTPortableServer.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\..\..\ace" /libpath:"..\..\..\tao" /libpath:"..\..\..\tao\PortableServer" /libpath:"..\..\..\tao\RTCORBA" /libpath:"..\..\..\tao\RTPortableServer"
+
+!ELSEIF "$(CFG)" == "Persistent_IOR 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 ""
+# 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 "..\..\..\\" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FD /c
+# SUBTRACT CPP /YX
+# 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 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 TAOd.lib TAO_PortableServerd.lib TAO_RTCORBAd.lib TAO_RTPortableServerd.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\..\ace" /libpath:"..\..\..\tao" /libpath:"..\..\..\tao\PortableServer" /libpath:"..\..\..\tao\RTCORBA" /libpath:"..\..\..\tao\RTPortableServer"
+
+!ENDIF
+
+# Begin Target
+
+# Name "Persistent_IOR Server - Win32 Release"
+# Name "Persistent_IOR Server - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=.\server.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\testC.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\testS.cpp
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# Begin Source File
+
+SOURCE=.\testC.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\testS.h
+# End Source File
+# End Group
+# Begin Group "Inline Files"
+
+# PROP Default_Filter "i"
+# Begin Source File
+
+SOURCE=.\testC.i
+# End Source File
+# Begin Source File
+
+SOURCE=.\testS.i
+# End Source File
+# End Group
+# Begin Group "IDL Files"
+
+# PROP Default_Filter "idl"
+# Begin Source File
+
+SOURCE=.\test.idl
+
+!IF "$(CFG)" == "Persistent_IOR Server - Win32 Release"
+
+USERDEP__TEST_="..\..\..\..\bin\Release\tao_idl.exe"
+# Begin Custom Build
+InputPath=.\test.idl
+InputName=test
+
+BuildCmds= \
+ ..\..\..\..\bin\Release\tao_idl.exe -Ge 1 $(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)
+
+"$(InputName)S_T.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S_T.i" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S_T.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+# End Custom Build
+
+!ELSEIF "$(CFG)" == "Persistent_IOR Server - Win32 Debug"
+
+# PROP Ignore_Default_Tool 1
+USERDEP__TEST_="..\..\..\..\bin\tao_idl.exe"
+# Begin Custom Build - Invoking TAO_IDL on $(InputName)
+InputPath=.\test.idl
+InputName=test
+
+BuildCmds= \
+ ..\..\..\..\bin\tao_idl -Ge 1 $(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)
+
+"$(InputName)S_T.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S_T.i" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S_T.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+# End Custom Build
+
+!ENDIF
+
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/TAO/tests/RTCORBA/Persistent_IOR/test.idl b/TAO/tests/RTCORBA/Persistent_IOR/test.idl new file mode 100644 index 00000000000..93c7ac56f50 --- /dev/null +++ b/TAO/tests/RTCORBA/Persistent_IOR/test.idl @@ -0,0 +1,8 @@ +// $Id$ + +interface test +{ + void method (); + + void shutdown (); +}; diff --git a/TAO/tests/RTCORBA/RTCORBA_tests.dsw b/TAO/tests/RTCORBA/RTCORBA_tests.dsw index 39e58be4d54..98c72b5ccb5 100644 --- a/TAO/tests/RTCORBA/RTCORBA_tests.dsw +++ b/TAO/tests/RTCORBA/RTCORBA_tests.dsw @@ -75,6 +75,18 @@ Package=<4> ###############################################################################
+Project: "Destroy_Thread_Pool"=.\Destroy_Thread_Pool\Destroy_Thread_Pool.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
Project: "Explicit_Binding Client"=.\Explicit_Binding\client.dsp - Package Owner=<4>
Package=<5>
@@ -171,7 +183,19 @@ Package=<4> ###############################################################################
-Project: "Destroy_Thread_Pool"=.\Destroy_Thread_Pool\Destroy_Thread_Pool.dsp - Package Owner=<4>
+Project: "Persistent_IOR Client"=.\Persistent_IOR\client.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "Persistent_IOR Server"=.\Persistent_IOR\server.dsp - Package Owner=<4>
Package=<5>
{{{
diff --git a/TAO/threadpool-changes b/TAO/threadpool-changes index 6784f27b281..102f0347536 100644 --- a/TAO/threadpool-changes +++ b/TAO/threadpool-changes @@ -54,6 +54,10 @@ Fri Aug 24 18:08:37 2001 Irfan Pyarali <irfan@cs.wustl.edu> return success only if we match all the protocols specified by the user. + - (validate_lifespan): If a POA is using a RTCORBA thread + pool, make sure the lifespan policy is not persistent + since we cannot support it right now. + - (merge_policies_impl): Merging of policies specified at the ORB level was not done before. Check if the user has specified the priority model, server protocol, and thread @@ -488,6 +492,17 @@ Fri Aug 24 18:08:37 2001 Irfan Pyarali <irfan@cs.wustl.edu> passed to these methods instead of getting it from the ORB Core. + - (open, open_i): The acceptor endpoints used by thread + lanes are selected randomly from the ones available on the + local machine. There is no way for the user to associate + thread lanes with endpoints because the thread lanes are + unnamed. + + A new parameter <ignore_address> was added to open() and + open_i() that ignores the address specified in the + -ORBEndpoint option. <ignore_address> is 1 for lane + acceptors and 0 for default acceptors. + - (make_mprofile): This function was removed because it was doing too much, i.e., calling fill_mprofile() which was creating and encoding the mprofile. Since the POA has to @@ -743,6 +758,20 @@ Fri Aug 24 18:08:37 2001 Irfan Pyarali <irfan@cs.wustl.edu> the creation and destruction of thread pools (with and without lanes). + * tests/RTCORBA/Persistent_IOR: New test added that: + + - For POAs using the default thread pool, the user can + continue to use -ORBEndpoint option. + + - Makes sure that if the user tries to combine thread pools + and persistence, an InvalidPolicy exception is thrown. + + - Makes sure that for POAs using thread pools, the user can + specify the protocol selection, protocol version, and + other protocol specific options (basically everything + other than the endpoint address) through the -ORBEndpoint + option. + * tests/RTCORBA/Banded_Connections: - server.cpp: @@ -859,7 +888,7 @@ Fri Aug 24 18:08:37 2001 Irfan Pyarali <irfan@cs.wustl.edu> * tests/RTCORBA/Makefile.bor: Added new tests ORB_init, Policy_Combinations, - Destroy_Thread_Pool, and Linear_Priority. + Destroy_Thread_Pool, Persistent_IOR, and Linear_Priority. * tests/RTCORBA/Banded_Connections/Makefile: * tests/RTCORBA/Banded_Connections/client.bor: diff --git a/bin/auto_run_tests.lst b/bin/auto_run_tests.lst index 10cef47f5b1..c9809653bd2 100644 --- a/bin/auto_run_tests.lst +++ b/bin/auto_run_tests.lst @@ -39,20 +39,21 @@ TAO/tests/Leader_Followers/run_test.pl: !ST TAO/tests/Leader_Followers/run_test_mt.pl: !ST TAO/tests/Multiple_Inheritance/run_test.pl -TAO/tests/RTCORBA/Banded_Connections/run_test.pl: !ST !Linux -TAO/tests/RTCORBA/Client_Propagated/run_test.pl: !ST !Linux -TAO/tests/RTCORBA/Client_Protocol/run_test.pl -TAO/tests/RTCORBA/Destroy_Thread_Pool/run_test.pl: !ST -TAO/tests/RTCORBA/Explicit_Binding/run_test.pl -TAO/tests/RTCORBA/Linear_Priority/run_test.pl: !ST !Linux -TAO/tests/RTCORBA/MT_Client_Protocol_Priority/run_test.pl: !ST !Linux -TAO/tests/RTCORBA/ORB_init/run_test.pl -TAO/tests/RTCORBA/Policy_Combinations/run_test.pl: !ST !Linux +TAO/tests/RTCORBA/Banded_Connections/run_test.pl: !MINIMUM !ST !Linux +TAO/tests/RTCORBA/Client_Propagated/run_test.pl: !MINIMUM !ST !Linux +TAO/tests/RTCORBA/Client_Protocol/run_test.pl: !MINIMUM +TAO/tests/RTCORBA/Destroy_Thread_Pool/run_test.pl: !MINIMUM !ST +TAO/tests/RTCORBA/Explicit_Binding/run_test.pl: !MINIMUM +TAO/tests/RTCORBA/Linear_Priority/run_test.pl: !MINIMUM !ST !Linux +TAO/tests/RTCORBA/MT_Client_Protocol_Priority/run_test.pl: !MINIMUM !ST !Linux +TAO/tests/RTCORBA/ORB_init/run_test.pl: !MINIMUM +TAO/tests/RTCORBA/Persistent_IOR/run_test.pl: !MINIMUM !ST +TAO/tests/RTCORBA/Policy_Combinations/run_test.pl: !MINIMUM !ST !Linux TAO/tests/RTCORBA/Private_Connection/run_test.pl -TAO/tests/RTCORBA/RTMutex/run_test.pl: !ST -TAO/tests/RTCORBA/Server_Declared/run_test.pl: !ST !Linux -TAO/tests/RTCORBA/Server_Protocol/run_test.pl -TAO/tests/RTCORBA/Thread_Pool/run_test.pl: !ST !Linux +TAO/tests/RTCORBA/RTMutex/run_test.pl: !MINIMUM !ST +TAO/tests/RTCORBA/Server_Declared/run_test.pl: !MINIMUM !ST !Linux +TAO/tests/RTCORBA/Server_Protocol/run_test.pl: !MINIMUM +TAO/tests/RTCORBA/Thread_Pool/run_test.pl: !MINIMUM !ST !Linux TAO/tests/Hello/run_test.pl TAO/tests/Muxing/run_test.pl: !ST |