2 #include "tao/PI/PI_ORBInitializer.h"
4 #if TAO_HAS_INTERCEPTORS == 1
6 #include "tao/PI/PI_PolicyFactory.h"
7 #include "tao/PI/ProcessingModePolicyC.h"
8 #include "tao/ORB_Core.h"
9 #include "tao/PI/ORBInitInfoC.h"
10 #include "ace/CORBA_macros.h"
12 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
15 TAO_PI_ORBInitializer::pre_init (PortableInterceptor::ORBInitInfo_ptr
)
20 TAO_PI_ORBInitializer::post_init (PortableInterceptor::ORBInitInfo_ptr info
)
22 // The PI policy factory is stateless and reentrant, so share a
23 // single instance between all ORBs.
24 if (CORBA::is_nil (this->policy_factory_
.in ()))
26 PortableInterceptor::PolicyFactory_ptr policy_factory
;
27 ACE_NEW_THROW_EX (policy_factory
,
30 CORBA::SystemException::_tao_minor_code (
33 CORBA::COMPLETED_NO
));
35 this->policy_factory_
= policy_factory
;
38 this->register_policy_factories (info
);
42 TAO_PI_ORBInitializer::register_policy_factories (
43 PortableInterceptor::ORBInitInfo_ptr info
)
45 // Register the PI policy factory.
47 // Bind the same policy factory to all PortableInterceptor related policy
48 // types since a single policy factory is used to create each of the
49 // different types of PortableInterceptor policies.
50 CORBA::PolicyType type
[] = {
51 PortableInterceptor::PROCESSING_MODE_POLICY_TYPE
54 const CORBA::PolicyType
*end
= type
+ sizeof (type
) / sizeof (type
[0]);
56 for (CORBA::PolicyType
*i
= type
; i
!= end
; ++i
)
60 info
->register_policy_factory (*i
, this->policy_factory_
.in ());
62 catch (const ::CORBA::BAD_INV_ORDER
& ex
)
64 if (ex
.minor () == (CORBA::OMGVMCID
| 16))
66 // The factory is already there, it happens because the
67 // magic initializer in PI_Initializer.cpp registers
68 // with the ORB multiple times. This is an indication
69 // that we should do no more work in this
78 TAO_END_VERSIONED_NAMESPACE_DECL
80 #endif /* TAO_HAS_INTERCEPTORS == 1 */