RT_POA.i

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 //
00003 // RT_POA.i,v 1.9 2005/11/04 09:26:56 ossama Exp
00004 
00005 // Exception macros
00006 #include "tao/PortableServer/poa_macros.h"
00007 #include "tao/PortableServer/POA_Guard.h"
00008 #include "tao/Environment.h"
00009 
00010 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00011 
00012 ACE_INLINE CORBA::Object_ptr
00013 TAO_RT_POA::create_reference_with_priority (const char * intf,
00014                                             RTCORBA::Priority priority
00015                                             ACE_ENV_ARG_DECL)
00016   ACE_THROW_SPEC ((CORBA::SystemException,
00017                    PortableServer::POA::WrongPolicy))
00018 {
00019   // Check that this method can be used based on this POA's policies.
00020   this->validate_policies (ACE_ENV_SINGLE_ARG_PARAMETER);
00021   ACE_CHECK_RETURN (CORBA::Object::_nil ());
00022 
00023   this->validate_priority (priority ACE_ENV_ARG_PARAMETER);
00024   ACE_CHECK_RETURN (CORBA::Object::_nil ());
00025 
00026   // Lock access for the duration of this transaction.
00027   TAO_POA_GUARD_RETURN (0);
00028 
00029   return this->create_reference_i (intf,
00030                                    priority
00031                                    ACE_ENV_ARG_PARAMETER);
00032 }
00033 
00034 ACE_INLINE CORBA::Object_ptr
00035 TAO_RT_POA::create_reference_with_id_and_priority (const PortableServer::ObjectId & oid,
00036                                                    const char * intf,
00037                                                    RTCORBA::Priority priority
00038                                                    ACE_ENV_ARG_DECL)
00039   ACE_THROW_SPEC ((CORBA::SystemException,
00040                    PortableServer::POA::WrongPolicy))
00041 {
00042   // Check that this method can be used based on this POA's policies.
00043   this->validate_policies (ACE_ENV_SINGLE_ARG_PARAMETER);
00044   ACE_CHECK_RETURN (CORBA::Object::_nil ());
00045 
00046   this->validate_priority (priority ACE_ENV_ARG_PARAMETER);
00047   ACE_CHECK_RETURN (CORBA::Object::_nil ());
00048 
00049   // Lock access for the duration of this transaction.
00050   TAO_POA_GUARD_RETURN (0);
00051 
00052   return this->create_reference_with_id_i (oid,
00053                                            intf,
00054                                            priority
00055                                            ACE_ENV_ARG_PARAMETER);
00056 }
00057 
00058 ACE_INLINE PortableServer::ObjectId *
00059 TAO_RT_POA::activate_object_with_priority (PortableServer::Servant servant,
00060                                            RTCORBA::Priority priority
00061                                            ACE_ENV_ARG_DECL)
00062   ACE_THROW_SPEC ((CORBA::SystemException,
00063                    PortableServer::POA::ServantAlreadyActive,
00064                    PortableServer::POA::WrongPolicy))
00065 {
00066   // Check that this method can be used based on this POA's policies.
00067   this->validate_policies (ACE_ENV_SINGLE_ARG_PARAMETER);
00068   ACE_CHECK_RETURN (0);
00069 
00070   this->validate_priority (priority ACE_ENV_ARG_PARAMETER);
00071   ACE_CHECK_RETURN (0);
00072 
00073   while (1)
00074     {
00075       int wait_occurred_restart_call = 0;
00076 
00077       // Lock access for the duration of this transaction.
00078       TAO_POA_GUARD_RETURN (0);
00079 
00080       PortableServer::ObjectId *result =
00081         this->activate_object_i (servant,
00082                                  priority,
00083                                  wait_occurred_restart_call
00084                                  ACE_ENV_ARG_PARAMETER);
00085       ACE_CHECK_RETURN (0);
00086 
00087       // If we ended up waiting on a condition variable, the POA state
00088       // may have changed while we are waiting.  Therefore, we need to
00089       // restart this call.
00090       if (wait_occurred_restart_call)
00091         continue;
00092       else
00093         return result;
00094     }
00095 }
00096 
00097 ACE_INLINE void
00098 TAO_RT_POA::activate_object_with_id_and_priority (const PortableServer::ObjectId & oid,
00099                                                   PortableServer::Servant servant,
00100                                                   RTCORBA::Priority priority
00101                                                   ACE_ENV_ARG_DECL)
00102   ACE_THROW_SPEC ((CORBA::SystemException,
00103                    PortableServer::POA::ServantAlreadyActive,
00104                    PortableServer::POA::ObjectAlreadyActive,
00105                    PortableServer::POA::WrongPolicy))
00106 {
00107   // Check that this method can be used based on this POA's policies.
00108   this->validate_policies (ACE_ENV_SINGLE_ARG_PARAMETER);
00109   ACE_CHECK;
00110 
00111   this->validate_priority (priority ACE_ENV_ARG_PARAMETER);
00112   ACE_CHECK;
00113 
00114   while (1)
00115     {
00116       int wait_occurred_restart_call = 0;
00117 
00118       // Lock access for the duration of this transaction.
00119       TAO_POA_GUARD;
00120 
00121       this->activate_object_with_id_i (oid,
00122                                        servant,
00123                                        priority,
00124                                        wait_occurred_restart_call
00125                                        ACE_ENV_ARG_PARAMETER);
00126       ACE_CHECK;
00127 
00128       // If we ended up waiting on a condition variable, the POA state
00129       // may have changed while we are waiting.  Therefore, we need to
00130       // restart this call.
00131       if (wait_occurred_restart_call)
00132         continue;
00133       else
00134         return;
00135     }
00136 }
00137 
00138 ACE_INLINE void *
00139 TAO_RT_POA::thread_pool (void) const
00140 {
00141   return this->thread_pool_;
00142 }
00143 
00144 TAO_END_VERSIONED_NAMESPACE_DECL

Generated on Thu Nov 9 12:55:46 2006 for TAO_RTPortableServer by doxygen 1.3.6