diff options
Diffstat (limited to 'TAO/tao/BiDir_GIOP/BiDirGIOP.cpp')
-rw-r--r-- | TAO/tao/BiDir_GIOP/BiDirGIOP.cpp | 61 |
1 files changed, 26 insertions, 35 deletions
diff --git a/TAO/tao/BiDir_GIOP/BiDirGIOP.cpp b/TAO/tao/BiDir_GIOP/BiDirGIOP.cpp index 945b3e00b14..8114dc49045 100644 --- a/TAO/tao/BiDir_GIOP/BiDirGIOP.cpp +++ b/TAO/tao/BiDir_GIOP/BiDirGIOP.cpp @@ -11,18 +11,14 @@ ACE_RCSID (BiDir_GIOP, // Set the flag to zero to start with -int TAO_BiDirGIOP_Loader::validator_loaded_ = 0; int TAO_BiDirGIOP_Loader::is_activated_ = 0; TAO_BiDirGIOP_Loader::TAO_BiDirGIOP_Loader (void) - : validator_ (0) { } TAO_BiDirGIOP_Loader::~TAO_BiDirGIOP_Loader (void) { - /* if (this->validator_) - delete this->validator_;*/ } int @@ -32,6 +28,8 @@ TAO_BiDirGIOP_Loader::activate (CORBA::ORB_ptr orb, ACE_ENV_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException)) { + ACE_UNUSED_ARG (orb); + if (TAO_BiDirGIOP_Loader::is_activated_ == 0 && TAO_DEF_GIOP_MINOR >= 2) { PortableInterceptor::ORBInitializer_ptr tmp_orb_initializer = @@ -55,19 +53,6 @@ TAO_BiDirGIOP_Loader::activate (CORBA::ORB_ptr orb, ACE_ENV_ARG_PARAMETER); ACE_CHECK_RETURN (-1); - TAO_ORB_Core *orb_core = - orb->orb_core (); - - ACE_NEW_THROW_EX (this->validator_, - TAO_BiDirPolicy_Validator (*orb_core), - CORBA::NO_MEMORY ( - CORBA::SystemException::_tao_minor_code ( - TAO_DEFAULT_MINOR_CODE, - ENOMEM), - CORBA::COMPLETED_NO)); - ACE_CHECK_RETURN (-1); - - TAO_BiDirGIOP_Loader::is_activated_ = 1; } @@ -75,12 +60,31 @@ TAO_BiDirGIOP_Loader::activate (CORBA::ORB_ptr orb, } void -TAO_BiDirGIOP_Loader::load_policy_validators (TAO_Policy_Validator &val) +TAO_BiDirGIOP_Loader::load_policy_validators (TAO_Policy_Validator &val + ACE_ENV_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException)) { - // Add our validator - if (!validator_loaded_) - val.add_validator (this->validator_); + // Is this true? Does the GIOP protocol version matter here? + if (TAO_DEF_GIOP_MINOR < 2) + return; + + TAO_BiDirPolicy_Validator *validator = 0; + ACE_NEW_THROW_EX (validator, + TAO_BiDirPolicy_Validator (val.orb_core ()), + CORBA::NO_MEMORY ( + CORBA::SystemException::_tao_minor_code ( + TAO_DEFAULT_MINOR_CODE, + ENOMEM), + CORBA::COMPLETED_NO)); + ACE_CHECK; + + // We may be adding another TAO_BiDirPolicy_Validator instance for the + // same ORB (different POA). In cases where huge numbers of bi-directional POA instances + // are created, having a validator instance per POA may introduce additional delays in + // policy validation and hence, the overal policy creation time. Since this is out of the + // critical invocation processing path, I plan to keep the design simple and not try to + // avoid an ineficiency of such small proportions. + val.add_validator (validator); } int @@ -89,24 +93,11 @@ TAO_BiDirGIOP_Loader::Initializer (void) return ACE_Service_Config::process_directive (ace_svc_desc_TAO_BiDirGIOP_Loader); } -/*static */ int -TAO_BiDirGIOP_Loader::validator_loaded (void) -{ - return validator_loaded_; -} - -/*static */ void -TAO_BiDirGIOP_Loader::validator_loaded (int f) -{ - // @@ TODO: Do we need synchronization? - validator_loaded_ = f; -} - - ACE_STATIC_SVC_DEFINE (TAO_BiDirGIOP_Loader, ACE_TEXT ("BiDirGIOP_Loader"), ACE_SVC_OBJ_T, &ACE_SVC_NAME (TAO_BiDirGIOP_Loader), ACE_Service_Type::DELETE_THIS | ACE_Service_Type::DELETE_OBJ, 0) + ACE_FACTORY_DEFINE (TAO_BiDirGIOP, TAO_BiDirGIOP_Loader) |