00001 // POA_Guard.cpp,v 1.5 2006/03/10 07:19:13 jtc Exp 00002 00003 #include "tao/PortableServer/POA_Guard.h" 00004 #include "tao/PortableServer/Root_POA.h" 00005 #include "tao/ORB_Constants.h" 00006 00007 ACE_RCSID(PortableServer, 00008 POA_Guard, 00009 "POA_Guard.cpp,v 1.5 2006/03/10 07:19:13 jtc Exp") 00010 00011 00012 TAO_BEGIN_VERSIONED_NAMESPACE_DECL 00013 00014 namespace TAO 00015 { 00016 namespace Portable_Server 00017 { 00018 POA_Guard::POA_Guard (::TAO_Root_POA &poa 00019 ACE_ENV_ARG_DECL, 00020 int check_for_destruction) 00021 : guard_ (poa.lock ()) 00022 { 00023 if (!this->guard_.locked ()) 00024 ACE_THROW ( 00025 CORBA::INTERNAL ( 00026 CORBA::SystemException::_tao_minor_code ( 00027 TAO_GUARD_FAILURE, 00028 0), 00029 CORBA::COMPLETED_NO)); 00030 00031 // Check if a non-servant upcall is in progress. If a non-servant 00032 // upcall is in progress, wait for it to complete. Unless of 00033 // course, the thread making the non-servant upcall is this thread. 00034 poa.object_adapter ().wait_for_non_servant_upcalls_to_complete (ACE_ENV_SINGLE_ARG_PARAMETER); 00035 ACE_CHECK; 00036 00037 if (check_for_destruction && 00038 poa.cleanup_in_progress ()) 00039 ACE_THROW ( 00040 CORBA::BAD_INV_ORDER ( 00041 CORBA::SystemException::_tao_minor_code ( 00042 TAO_POA_BEING_DESTROYED, 00043 0), 00044 CORBA::COMPLETED_NO)); 00045 } 00046 } 00047 } 00048 00049 TAO_END_VERSIONED_NAMESPACE_DECL