2 #include "tao/BiDir_GIOP/BiDir_ORBInitializer.h"
3 #include "tao/BiDir_GIOP/BiDirGIOP.h"
4 #include "tao/BiDir_GIOP/BiDirPolicy_Validator.h"
5 #include "tao/ORB_Core.h"
7 #include "tao/ORBInitializer_Registry.h"
8 #include "ace/CORBA_macros.h"
10 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
13 TAO_BiDirGIOP_Loader::init (int, ACE_TCHAR
* [])
15 if (this->initialized_
)
18 this->initialized_
= true;
20 ACE_Service_Gestalt
*gestalt
= ACE_Service_Config::current ();
22 ACE_Service_Object
* const bidir_loader
=
23 ACE_Dynamic_Service
<ACE_Service_Object
>::instance (
28 if (bidir_loader
!= 0 && bidir_loader
!= this)
30 return bidir_loader
->init (0, 0);
33 if (TAO_DEF_GIOP_MINOR
>= 2)
35 PortableInterceptor::ORBInitializer_ptr tmp_orb_initializer
=
36 PortableInterceptor::ORBInitializer::_nil ();
37 PortableInterceptor::ORBInitializer_var bidir_orb_initializer
;
41 /// Register the BiDir ORBInitializer.
42 ACE_NEW_THROW_EX (tmp_orb_initializer
,
43 TAO_BiDir_ORBInitializer
,
45 CORBA::SystemException::_tao_minor_code (
48 CORBA::COMPLETED_NO
));
50 bidir_orb_initializer
= tmp_orb_initializer
;
52 PortableInterceptor::register_orb_initializer (
53 bidir_orb_initializer
.in ());
55 catch (const ::CORBA::Exception
& ex
)
57 if (TAO_debug_level
> 0)
59 ex
._tao_print_exception ("Caught exception:");
69 TAO_BiDirGIOP_Loader::load_policy_validators (TAO_Policy_Validator
&val
)
71 // Is this true? Does the GIOP protocol version matter here?
72 if (TAO_DEF_GIOP_MINOR
< 2)
75 TAO_BiDirPolicy_Validator
*validator
= nullptr;
76 ACE_NEW_THROW_EX (validator
,
77 TAO_BiDirPolicy_Validator (val
.orb_core ()),
79 CORBA::SystemException::_tao_minor_code (
82 CORBA::COMPLETED_NO
));
84 // We may be adding another TAO_BiDirPolicy_Validator instance for
85 // the same ORB (different POA). In cases where huge numbers of
86 // bi-directional POA instances are created, having a validator
87 // instance per POA may introduce additional delays in policy
88 // validation and hence, the overall policy creation time. Since this
89 // is out of the critical invocation processing path, I plan to keep
90 // the design simple and not try to avoid an inefficiency of such
92 val
.add_validator (validator
);
96 TAO_BiDirGIOP_Loader::Initializer ()
98 return ACE_Service_Config::process_directive (ace_svc_desc_TAO_BiDirGIOP_Loader
);
101 ACE_STATIC_SVC_DEFINE (TAO_BiDirGIOP_Loader
,
102 ACE_TEXT ("BiDirGIOP_Loader"),
104 &ACE_SVC_NAME (TAO_BiDirGIOP_Loader
),
105 ACE_Service_Type::DELETE_THIS
| ACE_Service_Type::DELETE_OBJ
,
108 ACE_FACTORY_DEFINE (TAO_BIDIRGIOP
, TAO_BiDirGIOP_Loader
)
110 TAO_END_VERSIONED_NAMESPACE_DECL