From 69b63895ea08b72681ebb7d98362b19cdef26ab3 Mon Sep 17 00:00:00 2001 From: iliyan Date: Fri, 15 Dec 2006 18:33:56 +0000 Subject: ChangeLogTag: Fri Dec 15 18:17:36 UTC 2006 Iliyan Jeliazkov --- TAO/tests/ORB_Local_Config/Bug_2612/Bug_2612.mpc | 9 +++- TAO/tests/ORB_Local_Config/Bug_2612/DllOrb.cpp | 65 ++++++++++++++++++++---- TAO/tests/ORB_Local_Config/Bug_2612/DllOrb.h | 15 ++++-- TAO/tests/ORB_Local_Config/Bug_2612/Test.cpp | 6 +-- TAO/tests/ORB_Local_Config/ORB_Local_Config.mwc | 1 + 5 files changed, 75 insertions(+), 21 deletions(-) (limited to 'TAO/tests/ORB_Local_Config') diff --git a/TAO/tests/ORB_Local_Config/Bug_2612/Bug_2612.mpc b/TAO/tests/ORB_Local_Config/Bug_2612/Bug_2612.mpc index fc17619cd0d..88f1ede13cf 100644 --- a/TAO/tests/ORB_Local_Config/Bug_2612/Bug_2612.mpc +++ b/TAO/tests/ORB_Local_Config/Bug_2612/Bug_2612.mpc @@ -1,5 +1,5 @@ -// $Id:$ +// $Id$ project (DllOrb) : taolib, portableserver { @@ -14,7 +14,12 @@ project (DllOrb) : taolib, portableserver { } } -project (sig) : taoexe { +project : taoexe { + + exename = Test + + after += DllOrb + source_files { Test.cpp } diff --git a/TAO/tests/ORB_Local_Config/Bug_2612/DllOrb.cpp b/TAO/tests/ORB_Local_Config/Bug_2612/DllOrb.cpp index 01f77663612..fe629b8d48d 100644 --- a/TAO/tests/ORB_Local_Config/Bug_2612/DllOrb.cpp +++ b/TAO/tests/ORB_Local_Config/Bug_2612/DllOrb.cpp @@ -9,16 +9,20 @@ #include "ace/Arg_Shifter.h" #include "ace/SString.h" #include "ace/OS_NS_unistd.h" + #include "tao/corba.h" #include "tao/TAO_Singleton_Manager.h" #include "DllOrb.h" -DllOrb::DllOrb ( ) +DllOrb::DllOrb (int nthreads) : + m_nthreads_ (nthreads), m_failPrePostInit(0), +#if defined (ACE_HAS_THREADS) mp_barrier(0), +#endif mv_orb(), mv_rootPOA() { @@ -27,14 +31,16 @@ DllOrb::DllOrb ( ) DllOrb::~DllOrb ( ) throw () { +#if defined (ACE_HAS_THREADS) delete mp_barrier; +#endif } int DllOrb::init (int argc, char *argv[]) { int result = 0; - int threadCnt = 1; + int threadCnt = this->m_nthreads_; try { @@ -93,11 +99,20 @@ int DllOrb::init (int argc, char *argv[]) mv_poaManager->activate(); } - catch(...) + catch(CORBA::Exception& ex) { + ACE_PRINT_EXCEPTION (ex, + ACE_TEXT ("(%P|%t) init failed:")); return -1; } + catch(...) + { + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("(%P|%t) init failed\n")), + -1); + } +#if defined (ACE_HAS_THREADS) mp_barrier = new ACE_Thread_Barrier(threadCnt + 1); this->activate( @@ -105,6 +120,7 @@ int DllOrb::init (int argc, char *argv[]) threadCnt ); mp_barrier->wait(); +#endif return 0; } @@ -126,27 +142,39 @@ int DllOrb::fini (void) mv_orb->shutdown(1); } + catch(CORBA::Exception& ex) + { + ACE_PRINT_EXCEPTION (ex, + ACE_TEXT ("(%P|%t) fini failed:")); + return -1; + } catch(...) { - return -1; + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("(%P|%t) fini failed to deactivate/shutdown\n")), + -1); } // wait for our threads to finish wait(); +#if defined (ACE_HAS_THREADS) delete mp_barrier; mp_barrier = 0; +#endif try { mv_orb->destroy(); mv_orb = CORBA::ORB::_nil(); } - catch(CORBA::Exception const &) - { - return -1; - } + catch(CORBA::Exception& ex) + { + ACE_PRINT_EXCEPTION (ex, + ACE_TEXT ("(%P|%t) init failed to destroy the orb:")); + return -1; + } if (m_failPrePostInit < 3) { @@ -161,7 +189,9 @@ int DllOrb::fini (void) TAO_Singleton_Manager * p_tsm = TAO_Singleton_Manager::instance(); result = p_tsm->fini(); if (result == -1 && m_failPrePostInit == 0) - return -1; + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("(%P|%t) fini failed to destroy TAO_Singleton_Manager\n")), + -1); } /* end of if */ return 0; @@ -170,7 +200,10 @@ int DllOrb::fini (void) int DllOrb::svc (void) { +#if defined (ACE_HAS_THREADS) mp_barrier->wait(); +#endif + try { mv_orb->run(); @@ -180,11 +213,21 @@ int DllOrb::svc (void) const CORBA::ULong VMCID = rc_ex.minor() & 0xFFFFF000U; const CORBA::ULong minorCode = rc_ex.minor() & 0xFFFU; if (VMCID != CORBA::OMGVMCID || minorCode != 4) - return -1; + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("(%P|%t) svc exits (-1)\n")), + -1); } + catch(CORBA::Exception& ex) + { + ACE_PRINT_EXCEPTION (ex, + ACE_TEXT ("(%P|%t) svc - orb->run() failed:")); + return -1; + } catch(...) { - return -1; + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("(%P|%t) svc got some exception\n")), + -1); } return 0; } diff --git a/TAO/tests/ORB_Local_Config/Bug_2612/DllOrb.h b/TAO/tests/ORB_Local_Config/Bug_2612/DllOrb.h index 7e3f0a9ba42..9832228d6e4 100644 --- a/TAO/tests/ORB_Local_Config/Bug_2612/DllOrb.h +++ b/TAO/tests/ORB_Local_Config/Bug_2612/DllOrb.h @@ -2,7 +2,7 @@ * @author Iliyan jeliazkov * @author Lothar Werzinger * - * $Id:$ + * $Id$ */ #ifndef DllOrb_h @@ -10,6 +10,7 @@ #include "ace/Barrier.h" #include "ace/Task.h" + #include "tao/ORB.h" #include "tao/PortableServer/PortableServer.h" @@ -24,13 +25,12 @@ class DllOrb_Export DllOrb { public: /// Default constructor. - DllOrb ( ); + DllOrb (int nthreads = 1); /// Destructor. - ~DllOrb ( ) - throw (); + ~DllOrb (void) throw (); - CORBA::ORB_ptr orb ( ) const; + CORBA::ORB_ptr orb (void) const; virtual int init (int argc, char *argv[]); @@ -42,8 +42,13 @@ class DllOrb_Export DllOrb // private methods and instance variables private: + int m_nthreads_; unsigned int m_failPrePostInit; + +#if defined (ACE_HAS_THREADS) ACE_Thread_Barrier * mp_barrier; +#endif + CORBA::ORB_var mv_orb; PortableServer::POA_var mv_rootPOA; PortableServer::POAManager_var mv_poaManager; diff --git a/TAO/tests/ORB_Local_Config/Bug_2612/Test.cpp b/TAO/tests/ORB_Local_Config/Bug_2612/Test.cpp index ba2e77b6bb9..f0bf0a340eb 100644 --- a/TAO/tests/ORB_Local_Config/Bug_2612/Test.cpp +++ b/TAO/tests/ORB_Local_Config/Bug_2612/Test.cpp @@ -2,7 +2,7 @@ * @author Iliyan jeliazkov * @author Lothar Werzinger * - * $Id:$ + * $Id$ */ #include "ace/OS.h" @@ -13,13 +13,13 @@ char const * const scpc_loadOrb = ACE_DYNAMIC_SERVICE_DIRECTIVE ("testDllOrb", "DllOrb", "_make_DllOrb", - "DllOrb -ORBDebugLevel 30 -ORBId testORB -ORBInitRef " + "DllOrb -t 1 -ORBDebugLevel 3 -ORBId testORB -ORBInitRef " "NameService=file:///tmp/test-ns.ior -ORBDottedDecimalAddresses 1" ); char const * const scpc_unloadOrb = ACE_REMOVE_SERVICE_DIRECTIVE ("testDllOrb"); -int main(int, char **) +int ACE_TMAIN(int, char **) { if (0 > ACE_Service_Config::process_directive(scpc_loadOrb)) return -1; diff --git a/TAO/tests/ORB_Local_Config/ORB_Local_Config.mwc b/TAO/tests/ORB_Local_Config/ORB_Local_Config.mwc index b5b8a6b963e..b9b3417f5ee 100644 --- a/TAO/tests/ORB_Local_Config/ORB_Local_Config.mwc +++ b/TAO/tests/ORB_Local_Config/ORB_Local_Config.mwc @@ -5,6 +5,7 @@ workspace { lib Bunch Bug_1459 + Bug_2612 Separation Service_Dependency Shared -- cgit v1.2.1