2 #include "tao/ORB_Core_TSS_Resources.h"
3 #include "tao/ORB_Table.h"
5 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
7 ACE_INLINE ACE_Service_Gestalt*
8 TAO_ORB_Core::configuration () const
10 return this->config_.get ();
13 ACE_INLINE unsigned long
14 TAO_ORB_Core::_incr_refcnt ()
16 return this->refcount_++;
19 ACE_INLINE unsigned long
20 TAO_ORB_Core::_refcnt () const
22 return this->refcount_;
25 ACE_INLINE unsigned long
26 TAO_ORB_Core::_decr_refcnt ()
28 unsigned long const count = --this->refcount_;
37 TAO_ORB_Core::locking_strategy ()
39 if (this->resource_factory ()->use_locked_data_blocks ())
40 return &this->data_block_lock_;
45 ACE_INLINE CORBA::Boolean
46 TAO_ORB_Core::bidir_giop_policy ()
48 return this->bidir_giop_policy_;
52 TAO_ORB_Core::bidir_giop_policy (CORBA::Boolean val)
54 this->bidir_giop_policy_ = val;
57 ACE_INLINE TAO_Object_Ref_Table &
58 TAO_ORB_Core::object_ref_table ()
60 return this->object_ref_table_;
63 ACE_INLINE TAO::ObjectKey_Table &
64 TAO_ORB_Core::object_key_table ()
66 return this->object_key_table_;
69 ACE_INLINE TAO_Flushing_Strategy *
70 TAO_ORB_Core::flushing_strategy ()
72 return this->flushing_strategy_;
75 ACE_INLINE TAO_Protocols_Hooks *
76 TAO_ORB_Core::get_protocols_hooks ()
78 return this->protocols_hooks_;
81 ACE_INLINE TAO_Network_Priority_Protocols_Hooks *
82 TAO_ORB_Core::get_network_priority_protocols_hooks ()
84 return this->network_priority_protocols_hooks_;
87 ACE_INLINE CORBA::Boolean
88 TAO_ORB_Core::service_profile_selection (const TAO_MProfile &mprofile,
89 TAO_Profile *&profile)
91 CORBA::Boolean retval = false;
92 // @@ If different services have the same feature we may want to
93 // prioritise them here. We need to decide here whose selection of
94 // profile is more important.
95 if (this->ft_service_.service_callback ())
98 this->ft_service_.service_callback ()->select_profile (mprofile,
104 ACE_INLINE CORBA::Boolean
105 TAO_ORB_Core::object_is_nil (CORBA::Object_ptr obj)
107 CORBA::Boolean retval = false;
108 if (this->ft_service_.service_callback ())
110 retval = this->ft_service_.service_callback ()->object_is_nil (obj);
116 ACE_INLINE TAO_Service_Callbacks::Profile_Equivalence
117 TAO_ORB_Core::is_profile_equivalent (const TAO_Profile *this_p,
118 const TAO_Profile *that_p)
120 TAO_Service_Callbacks::Profile_Equivalence retval
121 = TAO_Service_Callbacks::DONT_KNOW;
123 if (this->ft_service_.service_callback ())
126 this->ft_service_.service_callback ()->is_profile_equivalent (this_p,
133 ACE_INLINE CORBA::ULong
134 TAO_ORB_Core::hash_service (TAO_Profile *p, CORBA::ULong m)
136 if (this->ft_service_.service_callback ())
138 return this->ft_service_.service_callback ()->hash_ft (p, m);
144 ACE_INLINE TAO_Fault_Tolerance_Service &
145 TAO_ORB_Core::fault_tolerance_service ()
147 return this->ft_service_;
150 ACE_INLINE CORBA::Boolean
151 TAO_ORB_Core::ft_send_extended_sc ()
153 return this->ft_send_extended_sc_;
156 ACE_INLINE ACE_Thread_Manager *
157 TAO_ORB_Core::thr_mgr ()
162 ACE_INLINE CORBA::ORB_ptr
168 ACE_INLINE TAO_Adapter_Registry &
169 TAO_ORB_Core::adapter_registry ()
171 return this->adapter_registry_;
174 ACE_INLINE TAO_Request_Dispatcher *
175 TAO_ORB_Core::request_dispatcher ()
177 return this->request_dispatcher_;
180 ACE_INLINE TAO_ORB_Core::InitRefMap *
181 TAO_ORB_Core::init_ref_map ()
183 return &this->init_ref_map_;
187 TAO_ORB_Core::set_default (const char * orb_id)
189 TAO::ORB_Table * const table = TAO::ORB_Table::instance ();
190 table->set_default (orb_id);
194 TAO_ORB_Core::not_default (const char * orb_id)
196 TAO::ORB_Table * const table = TAO::ORB_Table::instance ();
197 table->not_default (orb_id);
201 TAO_ORB_Core::optimize_collocation_objects (CORBA::Boolean opt)
203 this->opt_for_collocation_ = opt;
206 ACE_INLINE CORBA::Boolean
207 TAO_ORB_Core::optimize_collocation_objects () const
209 return this->opt_for_collocation_;
213 TAO_ORB_Core::use_global_collocation (CORBA::Boolean opt)
215 this->use_global_collocation_ = opt;
218 ACE_INLINE CORBA::Boolean
219 TAO_ORB_Core::use_global_collocation () const
221 return this->use_global_collocation_;
224 ACE_INLINE CORBA::ULong
225 TAO_ORB_Core::get_collocation_strategy () const
227 return this->collocation_strategy_;
230 ACE_INLINE TAO_ORB_Parameters *
231 TAO_ORB_Core::orb_params()
233 return &(this->orb_params_);
236 #define TAO_OC_RETRIEVE(member) \
237 ((this->member##_ == 0) \
238 ? (this->member##_ = this->resource_factory ()->get_##member ()) \
241 ACE_INLINE TAO_ProtocolFactorySet *
242 TAO_ORB_Core::protocol_factories ()
244 return TAO_OC_RETRIEVE (protocol_factories);
247 ACE_INLINE TAO_Parser_Registry *
248 TAO_ORB_Core::parser_registry ()
250 return &this->parser_registry_;
253 #undef TAO_OC_RETRIEVE
255 #if (TAO_HAS_CORBA_MESSAGING == 1)
257 ACE_INLINE TAO_Policy_Manager *
258 TAO_ORB_Core::policy_manager ()
260 return this->policy_manager_;
263 #endif /* TAO_HAS_CORBA_MESSAGING == 1 */
265 ACE_INLINE TAO_ORB_Core_TSS_Resources*
266 TAO_ORB_Core::get_tss_resources ()
268 return ACE_TSS_GET (&this->tss_resources_,TAO_ORB_Core_TSS_Resources);
272 TAO_ORB_Core::get_tss_resource (size_t slot_id)
274 TAO_ORB_Core_TSS_Resources *tss_resources =
275 this->get_tss_resources ();
277 if (slot_id >= tss_resources->ts_objects_.size ())
280 return tss_resources->ts_objects_[slot_id];
284 TAO_ORB_Core::set_tss_resource (size_t slot_id, void *ts_object)
286 TAO_ORB_Core_TSS_Resources *tss_resources =
287 this->get_tss_resources ();
289 // The number of allocated slots is equal to the number of
290 // registered TSS cleanup functions, *not* the size of the array in
291 // the ORB core TSS resources.
292 if (slot_id >= this->tss_cleanup_funcs_.size ())
298 // If the TSS array isn't large enough, then increase its size.
299 // We're guaranteed not to exceed the number of allocated slots by
301 const size_t old_size = tss_resources->ts_objects_.size ();
302 const size_t new_size = slot_id + 1;
303 if (slot_id >= old_size
304 && tss_resources->ts_objects_.size (new_size) != 0)
307 // Initialize intermediate array elements to zero, since they
308 // haven't been initialized yet. This ensures that garbage is not
309 // returned when accessing any of those elements at a later point in
311 for (size_t i = old_size; i < slot_id; ++i)
312 tss_resources->ts_objects_[i] = 0;
314 tss_resources->ts_objects_[slot_id] = ts_object;
316 // Make sure the ORB core pointer is set in the ORB core's TSS
317 // resources so that the TSS cleanup functions stored in the ORB
318 // core can be invoked.
319 tss_resources->orb_core_ = this;
325 TAO_ORB_Core::tss_cleanup (ACE_Array_Base<void *> &ts_objects)
327 this->tss_cleanup_funcs_.cleanup (ts_objects);
331 TAO_ORB_Core::has_shutdown () const
333 return this->has_shutdown_;
337 TAO_ORB_Core::thread_per_connection_timeout (ACE_Time_Value &timeout) const
339 timeout = this->thread_per_connection_timeout_;
340 return this->thread_per_connection_use_timeout_;
343 ACE_INLINE const char *
344 TAO_ORB_Core::orbid () const
350 TAO_ORB_Core::implrepo_service (const CORBA::Object_ptr ir)
352 this->implrepo_service_ = ir;
355 ACE_INLINE CORBA::Boolean
356 TAO_ORB_Core::use_implrepo ()
358 return use_implrepo_;
361 ACE_INLINE CORBA::Boolean
362 TAO_ORB_Core::imr_endpoints_in_ior ()
364 return imr_endpoints_in_ior_;
367 ACE_INLINE CORBA::Object_ptr
368 TAO_ORB_Core::resolve_typecodefactory ()
370 ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, mon, this->lock_,
371 CORBA::Object::_nil ());
372 if (CORBA::is_nil (this->typecode_factory_))
374 this->resolve_typecodefactory_i ();
376 return CORBA::Object::_duplicate (this->typecode_factory_);
379 #if TAO_HAS_INTERCEPTORS == 1
381 ACE_INLINE CORBA::Object_ptr
382 TAO_ORB_Core::resolve_picurrent ()
384 ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, mon, this->lock_,
385 CORBA::Object::_nil ());
386 if (CORBA::is_nil (this->pi_current_))
388 this->resolve_picurrent_i ();
390 return CORBA::Object::_duplicate (this->pi_current_);
393 #endif /* TAO_HAS_INTERCEPTORS == 1 */
395 ACE_INLINE CORBA::Object_ptr
396 TAO_ORB_Core::resolve_codecfactory ()
398 ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, mon, this->lock_,
399 CORBA::Object::_nil ());
400 if (CORBA::is_nil (this->codec_factory_))
402 this->resolve_codecfactory_i ();
404 return CORBA::Object::_duplicate (this->codec_factory_);
407 ACE_INLINE CORBA::Object_ptr
408 TAO_ORB_Core::resolve_compression_manager ()
410 ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, mon, this->lock_,
411 CORBA::Object::_nil ());
412 if (CORBA::is_nil (this->compression_manager_))
414 this->resolve_compression_manager_i ();
416 return CORBA::Object::_duplicate (this->compression_manager_);
419 ACE_INLINE const char *
420 TAO_ORB_Core::server_id () const
422 return this->server_id_.c_str();
425 ACE_INLINE TAO_Codeset_Manager *
426 TAO_ORB_Core::codeset_manager()
428 if (this->orb_params()->negotiate_codesets() == 0)
430 if (this->codeset_manager_ == 0)
432 // This causes a factory to be loaded which will call
433 // the codeset_manager setter in this thread.
434 this->codeset_manager_ =
435 this->resource_factory()->codeset_manager();
436 if (this->codeset_manager_ == 0)
437 this->orb_params()->negotiate_codesets(false);
439 return this->codeset_manager_;
442 ACE_INLINE TAO_ZIOP_Adapter *
443 TAO_ORB_Core::ziop_adapter () const
445 return this->ziop_adapter_;
449 TAO_ORB_Core::ziop_adapter (TAO_ZIOP_Adapter *adapter)
451 this->ziop_adapter_ = adapter;
454 ACE_INLINE TAO::ORBInitializer_Registry_Adapter *
455 TAO_ORB_Core::orbinitializer_registry ()
457 ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, mon, this->lock_,
459 if (orbinitializer_registry_ == 0)
461 return this->orbinitializer_registry_i ();
463 return this->orbinitializer_registry_;
466 ACE_INLINE TAO_Service_Context_Registry &
467 TAO_ORB_Core::service_context_registry ()
469 return this->service_context_registry_;
472 ACE_INLINE TAO::PolicyFactory_Registry_Adapter *
473 TAO_ORB_Core::policy_factory_registry ()
475 ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, mon, this->lock_,
477 if (policy_factory_registry_ == 0)
479 return this->policy_factory_registry_i ();
481 return this->policy_factory_registry_;
484 ACE_INLINE CORBA::Object_ptr
485 TAO_ORB_Core::resolve_dynanyfactory ()
487 ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, mon, this->lock_,
488 CORBA::Object::_nil ());
489 if (CORBA::is_nil (this->dynany_factory_))
491 this->resolve_dynanyfactory_i ();
493 return CORBA::Object::_duplicate (this->dynany_factory_);
496 ACE_INLINE CORBA::Object_ptr
497 TAO_ORB_Core::resolve_ior_manipulation ()
499 ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, mon, this->lock_,
500 CORBA::Object::_nil ());
501 if (CORBA::is_nil (this->ior_manip_factory_))
503 this->resolve_iormanipulation_i ();
505 return CORBA::Object::_duplicate (this->ior_manip_factory_);
508 ACE_INLINE CORBA::Object_ptr
509 TAO_ORB_Core::resolve_ior_table ()
511 ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, mon, this->lock_,
512 CORBA::Object::_nil ());
513 if (CORBA::is_nil (this->ior_table_))
515 this->resolve_ior_table_i ();
517 return CORBA::Object::_duplicate (this->ior_table_);
520 ACE_INLINE CORBA::Object_ptr
521 TAO_ORB_Core::resolve_async_ior_table ()
523 ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, mon, this->lock_,
524 CORBA::Object::_nil ());
525 if (CORBA::is_nil (this->async_ior_table_))
527 this->resolve_async_ior_table_i ();
529 return CORBA::Object::_duplicate (this->async_ior_table_);
532 ACE_INLINE CORBA::Object_ptr
533 TAO_ORB_Core::resolve_monitor ()
535 ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, mon, this->lock_,
536 CORBA::Object::_nil ());
537 if (CORBA::is_nil (this->monitor_))
539 this->resolve_monitor_i ();
541 return CORBA::Object::_duplicate (this->monitor_);
544 // ****************************************************************
546 #if (TAO_HAS_CORBA_MESSAGING == 1)
548 ACE_INLINE TAO_Policy_Current &
549 TAO_ORB_Core::policy_current ()
551 return *this->policy_current_;
554 #endif /* TAO_HAS_CORBA_MESSAGING == 1 */
556 ACE_INLINE CORBA::Object_ptr
557 TAO_ORB_Core::resolve_poa_current ()
559 ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, mon, this->lock_,
560 CORBA::Object::_nil ());
561 if (CORBA::is_nil (this->poa_current_.in ()))
563 this->resolve_poa_current_i ();
565 return CORBA::Object::_duplicate (this->poa_current_.in ());
568 #if (TAO_HAS_CORBA_MESSAGING == 1)
570 ACE_INLINE TAO_Policy_Set *
571 TAO_ORB_Core::get_default_policies ()
573 return this->default_policies_;
576 #endif /* TAO_HAS_CORBA_MESSAGING == 1 */
578 #if defined (TAO_HAS_CORBA_MESSAGING) && TAO_HAS_CORBA_MESSAGING != 0
579 ACE_INLINE CORBA::Object_ptr
580 TAO_ORB_Core::resolve_rt_orb ()
582 if (CORBA::is_nil (this->rt_orb_.in ()))
584 ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, mon, this->lock_,
585 CORBA::Object::_nil ());
586 if (CORBA::is_nil (this->rt_orb_.in ()))
588 // Save a reference to the priority mapping manager.
590 this->object_ref_table ().resolve_initial_reference (
595 return CORBA::Object::_duplicate (this->rt_orb_.in ());
599 #if (TAO_HAS_INTERCEPTORS == 1)
600 ACE_INLINE CORBA::Object_ptr
601 TAO_ORB_Core::pi_current ()
603 // A pointer/reference to PICurrent is cached in the ORB Core since
604 // it is accessed in the critical path (i.e. the request invocation
605 // path). Caching it prevents additional overhead to due object
606 // resolution from occurring.
607 return this->pi_current_;
611 TAO_ORB_Core::pi_current (CORBA::Object_ptr current)
613 // Not duplicated since the ORB Core's "object_ref_table" already
614 // contains a duplicate of the PICurrent object.
615 this->pi_current_ = current;
618 ACE_INLINE TAO::ClientRequestInterceptor_Adapter *
619 TAO_ORB_Core::clientrequestinterceptor_adapter ()
621 return this->client_request_interceptor_adapter_;
624 ACE_INLINE TAO::ServerRequestInterceptor_Adapter *
625 TAO_ORB_Core::serverrequestinterceptor_adapter ()
627 return this->server_request_interceptor_adapter_;
630 #endif /* TAO_HAS_INTERCEPTORS */
632 /// Verify condition for permanent forward is given,
633 /// both parameters must provide group attributes.
634 ACE_INLINE CORBA::Boolean
635 TAO_ORB_Core::is_permanent_forward_condition
636 (const CORBA::Object_ptr obj,
637 const TAO_Service_Context &service_context)
639 const TAO_Service_Callbacks *service_callback =
640 this->fault_tolerance_service ().service_callback ();
642 // Since forward location is allowed to be nil then check for it.
643 CORBA::Boolean const permanent_forward_condition =
644 service_callback && obj &&
645 service_callback->is_permanent_forward_condition (obj,
648 return permanent_forward_condition;
653 TAO_ORB_Core::set_sync_scope_hook (Sync_Scope_Hook hook)
655 this->sync_scope_hook_ = hook;
660 TAO_ORB_Core::default_sync_scope ()
662 return this->default_sync_scope_;
667 TAO_ORB_Core::set_timeout_hook (Timeout_Hook hook)
669 // Saving the hook pointer so that we can use it later when needed.
670 this->timeout_hook_ = hook;
673 #if (TAO_HAS_BUFFERING_CONSTRAINT_POLICY == 1)
677 TAO_ORB_Core::set_eager_transport_queueing_strategy (
678 TAO::Transport_Queueing_Strategy* strategy)
680 this->eager_transport_queueing_strategy_ = strategy;
685 TAO_ORB_Core::set_delayed_transport_queueing_strategy (
686 TAO::Transport_Queueing_Strategy* strategy)
688 this->delayed_transport_queueing_strategy_ = strategy;
693 TAO_END_VERSIONED_NAMESPACE_DECL