diff options
author | Johnny Willemsen <jwillemsen@remedy.nl> | 2008-03-17 09:15:14 +0000 |
---|---|---|
committer | Johnny Willemsen <jwillemsen@remedy.nl> | 2008-03-17 09:15:14 +0000 |
commit | 6afb8fecf366abe7b0fb9794b3b12160f518d4d5 (patch) | |
tree | 942411e7011c2f45bb7593b09f7627bdb2814f74 | |
parent | 237d647a5a496aa83ecc41462c26fce832c1d03f (diff) | |
download | ATCD-6afb8fecf366abe7b0fb9794b3b12160f518d4d5.tar.gz |
8 files changed, 713 insertions, 0 deletions
diff --git a/TAO/orbsvcs/tests/Notify/Bug_3252_Regression/Bug_3252_Regression.mpc b/TAO/orbsvcs/tests/Notify/Bug_3252_Regression/Bug_3252_Regression.mpc new file mode 100644 index 00000000000..244c2b4e3dd --- /dev/null +++ b/TAO/orbsvcs/tests/Notify/Bug_3252_Regression/Bug_3252_Regression.mpc @@ -0,0 +1,18 @@ +// $Id$ + +project(*server): notification_serv, taoexe { + exename=server + libs += Bug_3252 + Source_Files { + server.cpp + } +} + +project: portableserver { + sharedname = Bug_3252 + dynamicflags += BUG_3252_BUILD_DLL + Source_Files { + DllOrb.cpp + PersistentPoa.cpp + } +} diff --git a/TAO/orbsvcs/tests/Notify/Bug_3252_Regression/DllOrb.cpp b/TAO/orbsvcs/tests/Notify/Bug_3252_Regression/DllOrb.cpp new file mode 100644 index 00000000000..04ad7150e6c --- /dev/null +++ b/TAO/orbsvcs/tests/Notify/Bug_3252_Regression/DllOrb.cpp @@ -0,0 +1,176 @@ +// $Id$ + +#include "DllOrb.h" +#include "ace/Arg_Shifter.h" +#include "ace/Argv_Type_Converter.h" +#include "ace/OS_NS_unistd.h" +#include "tao/TAO_Singleton_Manager.h" + + +DllOrb::DllOrb (void) + : + ma_barrier_(), + mv_orb_ (), + mv_rootPOA_ () +{ +} + + +DllOrb::~DllOrb (void) +{ +} + + +int +DllOrb::init (int argc, ACE_TCHAR *argv[]) +{ + int threadCnt = 1; + + try + { + ACE_Arg_Shifter as (argc, argv); + const ACE_TCHAR *currentArg = 0; + while (as.is_anything_left ()) + { + if (0 != (currentArg = as.get_the_parameter (ACE_TEXT ("-NumThreads")))) + { + int num = ACE_OS::atoi (currentArg); + if (num >= 1) + threadCnt = num; + as.consume_arg (); + } + else + as.ignore_arg (); + } + + // Initialize the ORB + ACE_Argv_Type_Converter argcon (argc, argv); + mv_orb_ = CORBA::ORB_init (argcon.get_argc (), argcon.get_ASCII_argv ()); + if (CORBA::is_nil (mv_orb_.in ())) + { + ACE_DEBUG ((LM_ERROR, ACE_TEXT ("nil ORB\n"))); + return -1; + } + + CORBA::Object_var v_poa = + mv_orb_->resolve_initial_references ("RootPOA"); + + mv_rootPOA_ = PortableServer::POA::_narrow (v_poa.in ()); + if (CORBA::is_nil (mv_rootPOA_.in ())) + { + ACE_DEBUG ((LM_ERROR, ACE_TEXT ("nil RootPOA\n"))); + return -1; + } + + mv_poaManager_ = mv_rootPOA_->the_POAManager (); + if (CORBA::is_nil (mv_poaManager_.in ())) + { + ACE_DEBUG ((LM_ERROR, ACE_TEXT ("nil POAManager\n"))); + return -1; + } + + mv_poaManager_->activate (); + } + catch (...) + { + ACE_DEBUG ((LM_ERROR, ACE_TEXT ("ERROR: exception\n"))); + return -1; + } + + ma_barrier_ = std::auto_ptr < ACE_Thread_Barrier >( + new ACE_Thread_Barrier(threadCnt + 1) + ); + + this->activate( + THR_NEW_LWP|THR_JOINABLE|THR_INHERIT_SCHED, + threadCnt + ); + ACE_DEBUG ((LM_INFO, ACE_TEXT ("init mp_barrier->wait() ...\n"))); + ma_barrier_->wait(); + ACE_DEBUG ((LM_INFO, ACE_TEXT ("init mp_barrier->wait() done\n"))); + + return 0; +} + + +int +DllOrb::fini (void) +{ + try + { + mv_poaManager_->deactivate (1, 1); + mv_poaManager_ = PortableServer::POAManager::_nil (); + + // attempt to protect against sporadic BAD_INV_ORDER exceptions + ACE_OS::sleep (ACE_Time_Value (0, 500)); + + mv_orb_->shutdown (1); + + ACE_DEBUG ((LM_ERROR, ACE_TEXT ("wait() ...\n"))); + // wait for our threads to finish + wait(); + ACE_DEBUG ((LM_ERROR, ACE_TEXT ("wait() done\n"))); + + ma_barrier_.reset(); + } + catch (...) + { + ACE_DEBUG ((LM_ERROR, ACE_TEXT ("ERROR: exception\n"))); + return -1; + } + + try + { + mv_orb_->destroy (); + mv_orb_ = CORBA::ORB::_nil (); + } + catch (const CORBA::Exception& ex) + { + ex._tao_print_exception ("Exception caught:"); + return -1; + } + + return 0; +} + + +int DllOrb::svc (void) +{ + ACE_DEBUG ((LM_INFO, ACE_TEXT ("svc mp_barrier->wait() ...\n"))); + ma_barrier_->wait(); + ACE_DEBUG ((LM_INFO, ACE_TEXT ("svc mp_barrier->wait() done\n"))); + + try + { + ACE_DEBUG ((LM_INFO, ACE_TEXT ("mv_orb->run ...\n"))); + try + { + mv_orb_->run(); + ACE_DEBUG ((LM_INFO, ACE_TEXT ("mv_orb->run returned\n"))); + } + catch(CORBA::BAD_INV_ORDER const & rc_ex) + { + const CORBA::ULong VMCID = rc_ex.minor() & 0xFFFFF000U; + const CORBA::ULong minorCode = rc_ex.minor() & 0xFFFU; + if (VMCID == CORBA::OMGVMCID && minorCode == 4) + { + ACE_DEBUG ((LM_INFO, ACE_TEXT ("ignored 'CORBA::BAD_INV_ORDER: ORB has shutdown.'\n"))); + } + else + { + throw; + } + } + ACE_DEBUG ((LM_INFO, ACE_TEXT ("mv_orb->run done\n"))); + } + catch(...) + { + ACE_DEBUG ((LM_INFO, ACE_TEXT ("Exception\n"))); + return -1; + } + + return 0; +} /* end of DllOrb::svc ( ) */ + + +ACE_FACTORY_DEFINE (bug_3252, DllOrb) diff --git a/TAO/orbsvcs/tests/Notify/Bug_3252_Regression/DllOrb.h b/TAO/orbsvcs/tests/Notify/Bug_3252_Regression/DllOrb.h new file mode 100644 index 00000000000..34f7b7ae4f8 --- /dev/null +++ b/TAO/orbsvcs/tests/Notify/Bug_3252_Regression/DllOrb.h @@ -0,0 +1,38 @@ +// $Id$ + +#ifndef bug_3252_DllORB_h +#define bug_3252_DllORB_h + +#include "ace/Barrier.h" +#include "ace/Task.h" +#include "tao/ORB.h" +#include "tao/Auto_Ptr.h" + +#include "tao/PortableServer/PortableServer.h" +#include "bug_3252_export.h" + + +class bug_3252_Export DllOrb: public ACE_Task_Base +{ +public: + DllOrb (void); + virtual ~DllOrb (void); + + CORBA::ORB_ptr orb (void) const { return CORBA::ORB::_duplicate(mv_orb_.in()); } + + virtual int init (int argc, ACE_TCHAR *argv[]); + + virtual int fini (void); + + virtual int svc (void); + +private: + auto_ptr < ACE_Thread_Barrier > ma_barrier_; + CORBA::ORB_var mv_orb_; + PortableServer::POA_var mv_rootPOA_; + PortableServer::POAManager_var mv_poaManager_; +}; + +ACE_FACTORY_DECLARE (bug_3252, DllOrb) + +#endif /* bug_3252_DllORB_h */ diff --git a/TAO/orbsvcs/tests/Notify/Bug_3252_Regression/PersistentPoa.cpp b/TAO/orbsvcs/tests/Notify/Bug_3252_Regression/PersistentPoa.cpp new file mode 100644 index 00000000000..fd530a1687a --- /dev/null +++ b/TAO/orbsvcs/tests/Notify/Bug_3252_Regression/PersistentPoa.cpp @@ -0,0 +1,106 @@ +// $Id$ + +#include "ace/Arg_Shifter.h" +#include "tao/PortableServer/POAManager.h" +#include "tao/PortableServer/PortableServer.h" + +#include "PersistentPoa.h" + + + +PersistentPoa::PersistentPoa ( ) +{ +} /* end of PersistentPoa::PersistentPoa ( ) */ + + +PersistentPoa::~PersistentPoa ( ) + throw () +{ +} /* end of PersistentPoa::~PersistentPoa ( ) */ + + +int PersistentPoa::init (int argc, char *argv[]) +{ + ACE_Arg_Shifter as(argc, argv); + m_poaName = std::string(as.get_current()); + as.ignore_arg(); + + std::string orbName(as.get_current()); + as.ignore_arg(); + + while(as.is_anything_left()) + { + as.ignore_arg(); + } + + try + { + // left out all safety checks + DllOrb * p_orb = ACE_Dynamic_Service<DllOrb>::instance (orbName.c_str()); + mv_orb = p_orb->orb(); + CORBA::Object_var v_poa = mv_orb->resolve_initial_references("RootPOA"); + mv_rootPOA = PortableServer::POA::_narrow(v_poa.in ()); + + // Threading policy + CORBA::Policy_var v_threadingPolicy = + mv_rootPOA->create_thread_policy(PortableServer::ORB_CTRL_MODEL); + + // Lifespan policy + CORBA::Policy_var v_lifespanPolicy = + mv_rootPOA->create_lifespan_policy(PortableServer::PERSISTENT); + + // ID assignment policy + CORBA::Policy_var v_idAssignmentPolicy = + mv_rootPOA->create_id_assignment_policy(PortableServer::USER_ID); + + // Policies for the new POA + CORBA::PolicyList policies(3); + policies.length (3); + policies[0] = v_threadingPolicy.in(); + policies[1] = v_lifespanPolicy.in(); + policies[2] = v_idAssignmentPolicy.in(); + + mv_thisPOA = mv_rootPOA->create_POA( + m_poaName.c_str(), + PortableServer::POAManager::_nil(), + policies + ); + + mv_poaManager = mv_thisPOA->the_POAManager(); + mv_poaManager->activate(); + } + catch(...) + { + ACE_DEBUG ((LM_ERROR, ACE_TEXT ("activate failed\n"))); + return -1; + } + + ACE_DEBUG ((LM_ERROR, ACE_TEXT ("POA activated\n"))); + + return 0; +} /* end of PersistentPoa::init ( ) */ + + +int PersistentPoa::fini (void) +{ + try + { + mv_poaManager->deactivate(1, 1); + mv_poaManager = PortableServer::POAManager::_nil(); + + mv_thisPOA->destroy(1, 1); + mv_thisPOA = PortableServer::POA::_nil(); + } + catch(...) + { + ACE_DEBUG ((LM_ERROR, ACE_TEXT ("deactivate failed\n"))); + return -1; + } + + ACE_DEBUG ((LM_ERROR, ACE_TEXT ("POA deactivated\n"))); + + return 0; +} /* end of PersistentPoa::fini ( ) */ + + +ACE_FACTORY_DEFINE (bug_3252, PersistentPoa) diff --git a/TAO/orbsvcs/tests/Notify/Bug_3252_Regression/PersistentPoa.h b/TAO/orbsvcs/tests/Notify/Bug_3252_Regression/PersistentPoa.h new file mode 100644 index 00000000000..37370b566ff --- /dev/null +++ b/TAO/orbsvcs/tests/Notify/Bug_3252_Regression/PersistentPoa.h @@ -0,0 +1,46 @@ +// $Id$ + +#ifndef bug_3252_PersistentPoa_h +#define bug_3252_PersistentPoa_h + +#include <string> + +#include "ace/Service_Object.h" +#include "tao/ORB.h" +#include "tao/PortableServer/PortableServer.h" + +#include "DllOrb.h" +#include "bug_3252_export.h" + + +class PersistentPoa +: + public ACE_Service_Object +{ + // public types and methods + public: + PersistentPoa ( ); + + ~PersistentPoa ( ) + throw (); + + // protected types and methods + protected: + virtual int init (int argc, char *argv[]); + + virtual int fini (void); + + // private methods and instance variables + private: + std::string m_poaName; + CORBA::ORB_var mv_orb; + PortableServer::POA_var mv_rootPOA; + PortableServer::POA_var mv_thisPOA; + PortableServer::POAManager_var mv_poaManager; +}; /* end of class PersistentPoa */ + + +ACE_FACTORY_DECLARE (bug_3252, PersistentPoa) + + +#endif /* bug_3252_PersistentPoa_h */ diff --git a/TAO/orbsvcs/tests/Notify/Bug_3252_Regression/bug_3252_export.h b/TAO/orbsvcs/tests/Notify/Bug_3252_Regression/bug_3252_export.h new file mode 100644 index 00000000000..b9ec40223b0 --- /dev/null +++ b/TAO/orbsvcs/tests/Notify/Bug_3252_Regression/bug_3252_export.h @@ -0,0 +1,58 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl bug_3252 +// ------------------------------ +#ifndef BUG_3252_REGRESSION_EXPORT_H +#define BUG_3252_REGRESSION_EXPORT_H + +#include "ace/config-all.h" + +#if defined (ACE_AS_STATIC_LIBS) && !defined (BUG_3252_REGRESSION_HAS_DLL) +# define BUG_3252_REGRESSION_HAS_DLL 0 +#endif /* ACE_AS_STATIC_LIBS && BUG_3252_REGRESSION_HAS_DLL */ + +#if !defined (BUG_3252_REGRESSION_HAS_DLL) +# define BUG_3252_REGRESSION_HAS_DLL 1 +#endif /* ! BUG_3252_REGRESSION_HAS_DLL */ + +#if defined (BUG_3252_REGRESSION_HAS_DLL) && (BUG_3252_REGRESSION_HAS_DLL == 1) +# if defined (BUG_3252_REGRESSION_BUILD_DLL) +# define bug_3252_Export ACE_Proper_Export_Flag +# define BUG_3252_REGRESSION_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define BUG_3252_REGRESSION_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* BUG_3252_REGRESSION_BUILD_DLL */ +# define bug_3252_Export ACE_Proper_Import_Flag +# define BUG_3252_REGRESSION_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define BUG_3252_REGRESSION_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* BUG_3252_REGRESSION_BUILD_DLL */ +#else /* BUG_3252_REGRESSION_HAS_DLL == 1 */ +# define bug_3252_Export +# define BUG_3252_REGRESSION_SINGLETON_DECLARATION(T) +# define BUG_3252_REGRESSION_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* BUG_3252_REGRESSION_HAS_DLL == 1 */ + +// Set BUG_3252_REGRESSION_NTRACE = 0 to turn on library specific tracing even if +// tracing is turned off for ACE. +#if !defined (BUG_3252_REGRESSION_NTRACE) +# if (ACE_NTRACE == 1) +# define BUG_3252_REGRESSION_NTRACE 1 +# else /* (ACE_NTRACE == 1) */ +# define BUG_3252_REGRESSION_NTRACE 0 +# endif /* (ACE_NTRACE == 1) */ +#endif /* !BUG_3252_REGRESSION_NTRACE */ + +#if (BUG_3252_REGRESSION_NTRACE == 1) +# define BUG_3252_REGRESSION_TRACE(X) +#else /* (BUG_3252_REGRESSION_NTRACE == 1) */ +# if !defined (ACE_HAS_TRACE) +# define ACE_HAS_TRACE +# endif /* ACE_HAS_TRACE */ +# define BUG_3252_REGRESSION_TRACE(X) ACE_TRACE_IMPL(X) +# include "ace/Trace.h" +#endif /* (BUG_3252_REGRESSION_NTRACE == 1) */ + +#endif /* BUG_3252_REGRESSION_EXPORT_H */ + +// End of auto generated file. diff --git a/TAO/orbsvcs/tests/Notify/Bug_3252_Regression/run_test.pl b/TAO/orbsvcs/tests/Notify/Bug_3252_Regression/run_test.pl new file mode 100755 index 00000000000..bacca8c802f --- /dev/null +++ b/TAO/orbsvcs/tests/Notify/Bug_3252_Regression/run_test.pl @@ -0,0 +1,31 @@ +eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' + & eval 'exec perl -S $0 $argv:q' + if 0; + +# $Id$ +# -*- perl -*- + +use lib "$ENV{ACE_ROOT}/bin"; +use PerlACE::Run_Test; + +if (PerlACE::is_vxworks_test()) { + $SVP = new PerlACE::ProcessVX ("server", ""); +} +else { + $SVP = new PerlACE::Process ("server", ""); +} +# Run the AMH server. +$sv = $SVP->Spawn (); + +if ($sv != 0) { + print STDERR "ERROR: server returned $sv\n"; + exit 1; +} + +$svnk = $SVP->WaitKill (60); +if ($svnk != 0) { + print STDERR "ERROR: Server returned $svnk\n"; + $status = 1; +} + +exit $status; diff --git a/TAO/orbsvcs/tests/Notify/Bug_3252_Regression/server.cpp b/TAO/orbsvcs/tests/Notify/Bug_3252_Regression/server.cpp new file mode 100644 index 00000000000..66fce2ea01d --- /dev/null +++ b/TAO/orbsvcs/tests/Notify/Bug_3252_Regression/server.cpp @@ -0,0 +1,240 @@ +// $Id$ + +#include "ace/ARGV.h" +#include "ace/OS.h" +#include "ace/Service_Config.h" +#include "ace/Log_Msg.h" + + +#include "tao/corba.h" +#include "tao/ORB.h" +#include "tao/PortableServer/PortableServer.h" +#include "orbsvcs/CosNotifyChannelAdminC.h" +#include "orbsvcs/Notify/CosNotify_Service.h" + + +#include "DllOrb.h" + + +char const * const scpc_loadOrb = ACE_DYNAMIC_SERVICE_DIRECTIVE( + "testDllOrb", + "Bug_3252", + "_make_DllOrb", + "testDllOrb -ORBDebugLevel 0 -ORBId testDllOrb -NumThreads 2 " + "-ORBDottedDecimalAddresses 1 -ORBCollocationStrategy thru_poa" +); + +char const * const scpc_unloadOrb = ACE_REMOVE_SERVICE_DIRECTIVE("testDllOrb"); + +char const * const scpc_loadNotifyService = ACE_DYNAMIC_SERVICE_DIRECTIVE( + "testNotifyService", + "TAO_CosNotification_Serv", + "_make_TAO_CosNotify_Service", + "-UseSeparateDispatchingORB 1" +); + +char const * const scpc_unloadNotifyService = ACE_REMOVE_SERVICE_DIRECTIVE("testNotifyService"); + + +int unloadNotify(ACE_Service_Config & r_serviceConfig) +{ + ACE_DEBUG ((LM_INFO, ACE_TEXT ("Unloading NotifyService ...\n"))); + int result = r_serviceConfig.process_directive(scpc_unloadNotifyService); + if(0 != result) + { + ACE_DEBUG ((LM_ERROR, ACE_TEXT ("Unloading NotifyService failed\n"))); + return -1; + } + ACE_DEBUG ((LM_INFO, ACE_TEXT ("unloading NotifyService done.\n"))); + return 0; +} + +int loadNotify(ACE_Service_Config & r_serviceConfig) +{ + int result = 0; + try + { + DllOrb * p_orb = ACE_Dynamic_Service<DllOrb>::instance ("testDllOrb"); + CORBA::ORB_var v_orb = p_orb->orb(); + + CORBA::Object_var v_poa = v_orb->resolve_initial_references("RootPOA"); + PortableServer::POA_var v_rootPOA = PortableServer::POA::_narrow(v_poa.in ()); + ACE_DEBUG ((LM_INFO, ACE_TEXT ("RootPOA OK.\n"))); + + ACE_DEBUG ((LM_INFO, ACE_TEXT ("Loading NotifyService ...\n"))); + result = r_serviceConfig.process_directive(scpc_loadNotifyService); + if(0 != result) + { + ACE_DEBUG ((LM_ERROR, ACE_TEXT ("Loading NotifyService failed\n"))); + return -1; + } + ACE_DEBUG ((LM_INFO, ACE_TEXT ("Loading NotifyService done.\n"))); + + TAO_CosNotify_Service * p_notifyService = + ACE_Dynamic_Service<TAO_CosNotify_Service>::instance("testNotifyService"); + + p_notifyService->init_service(v_orb.in()); + + CosNotifyChannelAdmin::EventChannelFactory_var v_notifyFactory = + p_notifyService->create( + v_rootPOA.in() + ); + ACE_DEBUG ((LM_INFO, ACE_TEXT ("got EventChannelFactory\n"))); + + // create an event channel + CosNotifyChannelAdmin::ChannelID id; + + CosNotification::QoSProperties initialQos; + CosNotification::AdminProperties initialAdmin; + + CosNotifyChannelAdmin::EventChannel_var v_eventChannel = + v_notifyFactory->create_channel( + initialQos, + initialAdmin, + id + ); + ACE_DEBUG ((LM_INFO, ACE_TEXT ("got EventChannel\n"))); + + CosNotifyFilter::FilterFactory_var v_filterFactory = + v_eventChannel->default_filter_factory(); + ACE_DEBUG ((LM_INFO, ACE_TEXT ("got FilterFactory\n"))); + + CosNotifyFilter::Filter_var v_filter = + v_filterFactory->create_filter("ETCL"); + ACE_DEBUG ((LM_INFO, ACE_TEXT ("got Filter\n"))); + } + catch(CORBA::Exception const & rc_ex) + { + ACE_PRINT_TAO_EXCEPTION(rc_ex, "Unexpected CORBA Exception: "); + return -1; + } + catch(...) + { + ACE_DEBUG ((LM_ERROR, ACE_TEXT ("Unexpected C++ Exception\n"))); + return -1; + } + + return 0; +} + + +int unloadOrb(ACE_Service_Config & r_serviceConfig) +{ + ACE_DEBUG ((LM_INFO, ACE_TEXT ("Unloading ORB ...\n"))); + int result = r_serviceConfig.process_directive(scpc_unloadOrb); + if(0 != result) + { + ACE_DEBUG ((LM_ERROR, ACE_TEXT ("Unloading ORB failed\n"))); + return -1; + } + ACE_DEBUG ((LM_INFO, ACE_TEXT ("unloading ORB done.\n"))); + return 0; +} + +int loadOrb(ACE_Service_Config & r_serviceConfig) +{ + ACE_DEBUG ((LM_INFO, ACE_TEXT ("Loading ORB ...\n"))); + int result = r_serviceConfig.process_directive(scpc_loadOrb); + if(0 != result) + { + ACE_DEBUG ((LM_ERROR, ACE_TEXT ("Loading ORB failed\n"))); + return -1; + } + ACE_DEBUG ((LM_INFO, ACE_TEXT ("Loading ORB done.\n"))); + return 0; +} + + + +int +ACE_TMAIN(int, ACE_TCHAR ** argv) +{ + int result = 0; + + ACE_Service_Config serviceConfig; + + char signum[64]; + ACE_OS::sprintf(signum, "%d", SIGUSR1); + + ACE_ARGV args; + args.add(argv[0]); + args.add("-s"); + args.add(signum); + + result = serviceConfig.open ( + args.argc(), + args.argv(), + ACE_DEFAULT_LOGGER_KEY, + 1, // ignore_static_svcs = 1, + 1, // ignore_default_svc_conf_file = 0, + 0 // ignore_debug_flag = 0 + ); + + if(0 != result) + { + ACE_DEBUG ((LM_ERROR, ACE_TEXT ("serviceConfig.open failed\n"))); + return result; + } + ACE_DEBUG ((LM_INFO, ACE_TEXT ("serviceConfig.open done\n"))); + + for(int i = 0; i < 2; ++i) + { + ACE_DEBUG ((LM_INFO, ACE_TEXT ("loadOrb ...\n"))); + result = loadOrb(serviceConfig); + if(0 != result) + { + ACE_DEBUG ((LM_ERROR, ACE_TEXT ("loadOrb failed\n"))); + return result; + } + ACE_DEBUG ((LM_INFO, ACE_TEXT ("loadOrb done\n"))); + + + ACE_DEBUG ((LM_INFO, ACE_TEXT ("loadNotify ...\n"))); + result = loadNotify(serviceConfig); + if(0 != result) + { + ACE_DEBUG ((LM_ERROR, ACE_TEXT ("loadNotify failed\n"))); + return result; + } + ACE_DEBUG ((LM_INFO, ACE_TEXT ("loadNotify done\n"))); + + ACE_DEBUG ((LM_INFO, ACE_TEXT ("unloadNotify ...\n"))); + result = unloadNotify(serviceConfig); + if(0 != result) + { + ACE_DEBUG ((LM_ERROR, ACE_TEXT ("unloadNotify failed\n"))); + return result; + } + ACE_DEBUG ((LM_INFO, ACE_TEXT ("unloadNotify done\n"))); + + + ACE_DEBUG ((LM_INFO, ACE_TEXT ("unloadOrb ...\n"))); + result = unloadOrb(serviceConfig); + if(0 != result) + { + ACE_DEBUG ((LM_ERROR, ACE_TEXT ("unloadOrb failed\n"))); + return result; + } + ACE_DEBUG ((LM_INFO, ACE_TEXT ("unloadOrb done\n"))); + } + + ACE_DEBUG ((LM_INFO, ACE_TEXT ("serviceConfig.fini_svcs ...\n"))); + result = serviceConfig.fini_svcs(); + if(0 != result) + { + ACE_DEBUG ((LM_ERROR, ACE_TEXT ("serviceConfig.fini_svcs failed\n"))); + return result; + } + ACE_DEBUG ((LM_INFO, ACE_TEXT ("serviceConfig.fini_svcs done\n"))); + + ACE_DEBUG ((LM_INFO, ACE_TEXT ("serviceConfig.close ...\n"))); + result = serviceConfig.close(); + if(0 != result) + { + ACE_DEBUG ((LM_ERROR, ACE_TEXT ("serviceConfig.close failed\n"))); + return result; + } + ACE_DEBUG ((LM_INFO, ACE_TEXT ("serviceConfig.close done\n"))); + + return 0; +} |