1 #include "tao/ORB_Core.h"
2 #include "tao/ORB_Core_TSS_Resources.h"
3 #include "tao/ORB_Table.h"
4 #include "tao/TAO_Internal.h"
5 #include "tao/default_server.h"
6 #include "tao/Profile.h"
8 #include "tao/LF_Follower.h"
9 #include "tao/Leader_Follower.h"
10 #include "tao/LF_Event_Loop_Thread_Helper.h"
11 #include "tao/Connector_Registry.h"
12 #include "tao/Transport_Queueing_Strategies.h"
13 #include "tao/Object_Loader.h"
14 #include "tao/ObjectIdListC.h"
15 #include "tao/BiDir_Adapter.h"
16 #include "tao/ZIOP_Adapter.h"
17 #include "tao/Collocation_Resolver.h"
18 #include "tao/Flushing_Strategy.h"
19 #include "tao/Request_Dispatcher.h"
20 #include "tao/Stub_Factory.h"
21 #include "tao/Thread_Lane_Resources.h"
22 #include "tao/Thread_Lane_Resources_Manager.h"
23 #include "tao/TSS_Resources.h"
24 #include "tao/Protocols_Hooks.h"
25 #include "tao/Network_Priority_Protocols_Hooks.h"
26 #include "tao/IORInterceptor_Adapter.h"
27 #include "tao/IORInterceptor_Adapter_Factory.h"
28 #include "tao/debug.h"
30 #include "tao/Endpoint_Selector_Factory.h"
31 #include "tao/Client_Strategy_Factory.h"
32 #include "tao/Adapter_Factory.h"
33 #include "tao/Adapter.h"
34 #include "tao/GUIResource_Factory.h"
35 #include "tao/PolicyFactory_Registry_Adapter.h"
36 #include "tao/PolicyFactory_Registry_Factory.h"
37 #include "tao/ORBInitializer_Registry_Adapter.h"
38 #include "tao/Codeset_Manager.h"
39 #include "tao/GIOP_Fragmentation_Strategy.h"
40 #include "tao/SystemException.h"
42 #include "tao/Valuetype_Adapter.h"
43 #include "tao/Valuetype_Adapter_Factory.h"
45 #if (TAO_HAS_CORBA_MESSAGING == 1)
46 #include "tao/Policy_Manager.h"
47 #include "tao/Policy_Current.h"
48 #endif /* TAO_HAS_CORBA_MESSAGING == 1 */
50 #include "ace/Reactor.h"
51 #include "ace/Dynamic_Service.h"
52 #include "ace/Arg_Shifter.h"
53 #include "ace/Argv_Type_Converter.h"
54 #include "ace/Static_Object_Lock.h"
56 #include "ace/CORBA_macros.h"
57 #include "ace/Logging_Strategy.h"
59 #if !defined (ACE_LACKS_IOSTREAM_TOTALLY)
60 // Needed to set ACE_LOG_MSG::msg_ostream()
61 // FUZZ: disable check_for_streams_include
62 # include "ace/streams.h"
63 #endif /* !ACE_LACKS_IOSTREAM_TOTALLY */
65 #include "ace/OS_NS_strings.h"
66 #include "ace/OS_NS_string.h"
67 #include "ace/Message_Block.h"
71 #if TAO_HAS_INTERCEPTORS == 1
72 # include "tao/ClientRequestInterceptor_Adapter.h"
73 # include "tao/ClientRequestInterceptor_Adapter_Factory.h"
74 # include "tao/ServerRequestInterceptor_Adapter.h"
75 # include "tao/ServerRequestInterceptor_Adapter_Factory.h"
76 #endif /* TAO_HAS_INTERCEPTORS == 1 */
78 #if !defined (__ACE_INLINE__)
79 # include "tao/ORB_Core.inl"
80 #endif /* ! __ACE_INLINE__ */
82 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
84 ACE_STATIC_SVC_DEFINE(TAO_ORB_Core_Static_Resources
,
85 ACE_TEXT ("TAO_ORB_Core_Static_Resources"),
87 &ACE_SVC_NAME (TAO_ORB_Core_Static_Resources
),
88 ACE_Service_Type::DELETE_THIS
| ACE_Service_Type::DELETE_OBJ
,
90 ACE_FACTORY_DEFINE (TAO
, TAO_ORB_Core_Static_Resources
)
92 // ****************************************************************
95 TAO_default_environment ()
97 return *TAO_TSS_Resources::instance ()->default_environment_
;
100 // ****************************************************************
102 // Initialize instance_ to 0, since this is what we test for in the call
103 // to instance (). Note that this does not require a constructor call, so
104 // it is always initialized by the time that instance () can be called.
105 //TAO_ORB_Core_Static_Resources* TAO_ORB_Core_Static_Resources::instance_ = 0;
107 // Force an instance to be created at module initialization time,
108 // since we do not want to worry about double checked locking and
109 // the race condition to initialize the lock.
110 TAO_ORB_Core_Static_Resources
*
111 TAO_ORB_Core_Static_Resources::initialization_reference_
=
112 TAO_ORB_Core_Static_Resources::instance ();
114 TAO_ORB_Core_Static_Resources
*
115 TAO_ORB_Core_Static_Resources::instance ()
117 ACE_Service_Gestalt
*current
= ACE_Service_Config::current();
118 TAO_ORB_Core_Static_Resources
* tocsr
=
119 ACE_Dynamic_Service
<TAO_ORB_Core_Static_Resources
>::instance
120 (current
, "TAO_ORB_Core_Static_Resources", true);
122 if (tocsr
== nullptr)
124 // This new is never freed on purpose. The data specified by
125 // it needs to be around for the last shared library that references
126 // this class. This could occur in a destructor in a shared library
127 // that is unloaded after this one. One solution to avoid this
128 // harmless memory leak would be to use reference counting.
129 current
->process_directive(ace_svc_desc_TAO_ORB_Core_Static_Resources
);
130 tocsr
= ACE_Dynamic_Service
<TAO_ORB_Core_Static_Resources
>::instance
131 (current
, "TAO_ORB_Core_Static_Resources", true);
133 ACE_Service_Gestalt
*global
= ACE_Service_Config::global();
134 if (current
!= global
)
136 TAO_ORB_Core_Static_Resources
* global_tocsr
=
137 ACE_Dynamic_Service
<TAO_ORB_Core_Static_Resources
>::instance
138 (global
,"TAO_ORB_Core_Static_Resources");
140 if (global_tocsr
!= nullptr)
141 *tocsr
= *global_tocsr
;
148 TAO_ORB_Core_Static_Resources::TAO_ORB_Core_Static_Resources ()
149 : network_priority_protocols_hooks_name_ (
150 "Network_Priority_Protocols_Hooks"),
151 connection_timeout_hook_ (nullptr),
152 resource_factory_name_ ("Resource_Factory"),
153 dynamic_adapter_name_ ("Dynamic_Adapter"),
154 ifr_client_adapter_name_ ("IFR_Client_Adapter"),
155 typecodefactory_adapter_name_ ("TypeCodeFactory_Adapter"),
156 iorinterceptor_adapter_factory_name_ ("IORInterceptor_Adapter_Factory"),
157 valuetype_adapter_factory_name_ ("Valuetype_Adapter_Factory"),
158 alt_connection_timeout_hook_ (nullptr)
162 TAO_ORB_Core_Static_Resources
&
163 TAO_ORB_Core_Static_Resources::operator=(const TAO_ORB_Core_Static_Resources
& other
)
165 this->network_priority_protocols_hooks_name_
=
166 other
.network_priority_protocols_hooks_name_
;
167 this->connection_timeout_hook_
= other
.connection_timeout_hook_
;
168 this->resource_factory_name_
= other
.resource_factory_name_
;
169 this->dynamic_adapter_name_
= other
.dynamic_adapter_name_
;
170 this->ifr_client_adapter_name_
= other
.ifr_client_adapter_name_
;
171 this->typecodefactory_adapter_name_
= other
.typecodefactory_adapter_name_
;
172 this->iorinterceptor_adapter_factory_name_
=
173 other
.iorinterceptor_adapter_factory_name_
;
174 this->valuetype_adapter_factory_name_
=
175 other
.valuetype_adapter_factory_name_
;
176 this->alt_connection_timeout_hook_
= other
.alt_connection_timeout_hook_
;
180 // ****************************************************************
182 TAO_ORB_Core::TAO_ORB_Core (const char *orbid
,
183 ACE_Intrusive_Auto_Ptr
<ACE_Service_Gestalt
> gestalt
)
184 : protocols_hooks_ (nullptr),
185 network_priority_protocols_hooks_ (nullptr),
186 #if TAO_USE_LOCAL_MEMORY_POOL == 1
187 use_local_memory_pool_ (true),
189 use_local_memory_pool_ (false),
192 thread_lane_resources_manager_ (nullptr),
193 collocation_resolver_ (nullptr),
194 stub_factory_ (nullptr),
195 protocol_factories_ (nullptr),
196 implrepo_service_ (CORBA::Object::_nil ()),
198 imr_endpoints_in_ior_ (1),
199 typecode_factory_ (CORBA::Object::_nil ()),
200 codec_factory_ (CORBA::Object::_nil ()),
201 compression_manager_ (CORBA::Object::_nil ()),
202 dynany_factory_ (CORBA::Object::_nil ()),
203 ior_manip_factory_ (CORBA::Object::_nil ()),
204 ior_table_ (CORBA::Object::_nil ()),
205 async_ior_table_ (CORBA::Object::_nil ()),
206 monitor_ (CORBA::Object::_nil ()),
207 orb_ (CORBA::ORB::_nil ()),
210 init_ref_map_ (TAO_DEFAULT_OBJECT_REF_TABLE_SIZE
),
211 object_ref_table_ (),
212 object_key_table_ (),
213 orbid_ (ACE_OS::strdup (orbid
? orbid
: "")),
214 resource_factory_ (nullptr),
215 client_factory_ (nullptr),
216 server_factory_ (nullptr),
217 ft_send_extended_sc_ (false),
218 opt_for_collocation_ (true),
219 use_global_collocation_ (true),
220 collocation_strategy_ (TAO_DEFAULT_COLLOCATION_STRATEGY
),
222 #if (TAO_HAS_CORBA_MESSAGING == 1)
224 policy_manager_ (nullptr),
225 default_policies_ (nullptr),
226 policy_current_ (nullptr),
228 #endif /* TAO_HAS_CORBA_MESSAGING == 1 */
231 adapter_registry_ (this),
232 poa_adapter_ (nullptr),
234 tss_cleanup_funcs_ (),
236 has_shutdown_ (true), // Start the ORB in a "shutdown" state. Only
237 // after CORBA::ORB_init() is called will the
238 // ORB no longer be shutdown. This does not
239 // mean that the ORB can be reinitialized. It
240 // can only be initialized once.
241 thread_per_connection_use_timeout_ (1),
243 endpoint_selector_factory_ (nullptr),
244 #if (TAO_HAS_BUFFERING_CONSTRAINT_POLICY == 1)
245 eager_transport_queueing_strategy_ (nullptr),
246 delayed_transport_queueing_strategy_ (nullptr),
247 flush_transport_queueing_strategy_ (nullptr),
248 #endif /* TAO_HAS_BUFFERING_CONSTRAINT_POLICY == 1 */
250 policy_factory_registry_ (nullptr),
251 orbinitializer_registry_ (nullptr),
252 #if (TAO_HAS_INTERCEPTORS == 1)
253 pi_current_ (CORBA::Object::_nil ()),
254 client_request_interceptor_adapter_ (nullptr),
255 server_request_interceptor_adapter_ (nullptr),
256 #endif /* TAO_HAS_INTERCEPTORS == 1 */
257 ior_interceptor_adapter_ (nullptr),
258 valuetype_adapter_ (nullptr),
260 bidir_adapter_ (nullptr),
261 bidir_giop_policy_ (false),
262 ziop_adapter_ (nullptr),
263 ziop_enabled_ (false),
264 flushing_strategy_ (nullptr),
265 codeset_manager_ (nullptr),
267 sync_scope_hook_ (nullptr),
268 default_sync_scope_ (Messaging::SYNC_WITH_TRANSPORT
),
269 timeout_hook_ (nullptr)
271 #if (TAO_HAS_BUFFERING_CONSTRAINT_POLICY == 1)
273 ACE_NEW (this->flush_transport_queueing_strategy_
,
274 TAO::Flush_Transport_Queueing_Strategy
);
276 #endif /* TAO_HAS_BUFFERING_CONSTRAINT_POLICY == 1 */
278 #if (TAO_HAS_CORBA_MESSAGING == 1)
280 ACE_NEW (this->policy_manager_
,
283 ACE_NEW (this->default_policies_
,
284 TAO_Policy_Set (TAO_POLICY_ORB_SCOPE
));
286 ACE_NEW (this->policy_current_
,
289 #endif /* TAO_HAS_CORBA_MESSAGING == 1 */
291 // Initialize the default request dispatcher.
292 ACE_NEW (this->request_dispatcher_
,
293 TAO_Request_Dispatcher
);
295 this->set_sync_scope_hook (TAO_ORB_Core::default_sync_scope_hook
);
298 TAO_ORB_Core::~TAO_ORB_Core ()
300 delete this->thread_lane_resources_manager_
;
302 delete this->flushing_strategy_
;
304 ACE_OS::free (this->orbid_
);
306 #if (TAO_HAS_BUFFERING_CONSTRAINT_POLICY == 1)
308 delete this->eager_transport_queueing_strategy_
;
309 delete this->delayed_transport_queueing_strategy_
;
310 delete this->flush_transport_queueing_strategy_
;
312 #endif /* TAO_HAS_BUFFERING_CONSTRAINT_POLICY == 1 */
314 #if (TAO_HAS_CORBA_MESSAGING == 1)
316 ::CORBA::release (this->policy_manager_
);
317 delete this->default_policies_
;
318 ::CORBA::release (this->policy_current_
);
320 #endif /* TAO_HAS_CORBA_MESSAGING == 1 */
322 delete this->request_dispatcher_
;
324 delete this->policy_factory_registry_
;
326 // Don't delete, is a process wide singleton shared by all orbs
327 orbinitializer_registry_
= nullptr;
329 ::CORBA::release (this->orb_
);
331 delete this->codeset_manager_
;
332 this->codeset_manager_
= nullptr;
334 // This will destroy the service repository for this core
335 (void) TAO::ORB::close_services (this->config_
);
339 TAO_ORB_Core::init (int &argc
, char *argv
[] )
341 // Right now, this code expects to begin parsing in argv[1] rather
342 // than argv[0]. I don't think that's wise. I think we need to
343 // change that convention to argv[0] and let the initializing code
344 // make any necessary shifts.
346 // Parse arguments to the ORB. Typically the ORB is passed
347 // arguments straight from the command line, so we will simply pass
348 // through them and respond to the ones we understand and ignore
351 // In some instances, we may actually build another vector of
352 // arguments and stash it for use initializing other components such
356 int cdr_tradeoff
= ACE_DEFAULT_CDR_MEMCPY_TRADEOFF
;
358 // The following things should be changed to use the ACE_Env_Value<>
359 // template sometime.
361 // Name Service port use for Multicast
362 unsigned short ns_port
= 0;
364 // Trading Service port used for Multicast
365 unsigned short ts_port
= 0;
367 // Implementation Repository Service port #.
368 unsigned short ir_port
= 0;
370 // Buffer sizes for kernel socket buffers
371 // @@ should be a default defined for each protocol implementation?
372 // since we may have protocols loaded which use shared memory of
374 int rcv_sock_size
= -1;
375 int snd_sock_size
= -1;
380 // Use SO_KEEPALIVE (default 0).
381 int so_keepalive
= 0;
383 // Use SO_DONTROUTE (default 0)
384 int so_dontroute
= 0;
386 // Number of hops for a datagram sent through socket.
387 int ip_hoplimit
= -1;
389 // Use IP_MILTICAST_LOOP (default 1).
390 int ip_multicastloop
= 1;
392 // Use dotted decimal addresses
393 // @@ This option will be treated as a suggestion to each loaded
394 // protocol to use a character representation for the numeric
395 // address, otherwise use a logical name. fredk
396 #if (TAO_USE_DOTTED_DECIMAL_ADDRESSES == 1)
397 int dotted_decimal_addresses
= 1;
399 int dotted_decimal_addresses
= 0;
400 #endif /* TAO_USE_DOTTED_DECIMAL_ADDRESSES */
402 // Disable looking up the host name for incoming connections.
403 int no_server_side_name_lookups
= 0;
405 #if defined (TAO_STD_PROFILE_COMPONENTS)
406 bool std_profile_components
= true;
408 bool std_profile_components
= false;
409 #endif /* TAO_STD_PROFILE_COMPONENTS */
411 int linger
= TAO_SO_LINGER
;
412 time_t accept_error_delay
= TAO_ACCEPT_ERROR_DELAY
;
413 bool use_parallel_connects
= TAO_USE_PARALLEL_CONNECT
;
415 // Copy command line parameter not to use original.
416 ACE_Argv_Type_Converter
command_line (argc
, argv
);
418 ACE_Arg_Shifter
arg_shifter (command_line
.get_argc (),
419 command_line
.get_TCHAR_argv ());
421 ACE_GUARD_RETURN (TAO_SYNCH_MUTEX
,
426 #if (TAO_NEGOTIATE_CODESETS == 1)
427 bool negotiate_codesets
= true;
429 bool negotiate_codesets
= false;
430 #endif /* TAO_NEGOTIATE_CODESETS */
432 // Pick up the value of the use_implrepo_ flag from an environment variable
433 // called "TAO_USE_IMR". Do it here so that it can be overridden by
434 // the "-ORBUseIMR" command line argument.
436 char* const use_IMR_env_var_value
= ACE_OS::getenv ("TAO_USE_IMR") ;
437 if (use_IMR_env_var_value
!= nullptr)
439 this->use_implrepo_
= ACE_OS::atoi (use_IMR_env_var_value
) ;
442 while (arg_shifter
.is_anything_left ())
444 const ACE_TCHAR
*current_arg
= nullptr;
446 ////////////////////////////////////////////////////////////////
447 // begin with the 'parameterless' flags //
448 ////////////////////////////////////////////////////////////////
449 if (nullptr != (current_arg
= arg_shifter
.get_the_parameter
450 (ACE_TEXT("-ORBDottedDecimalAddresses"))))
452 // Use dotted decimal addresses
453 // @@ this should be renamed. See above comment. fredk
454 dotted_decimal_addresses
=
455 ACE_OS::atoi (current_arg
);
457 arg_shifter
.consume_arg ();
459 else if (nullptr != (current_arg
= arg_shifter
.get_the_parameter
460 (ACE_TEXT("-ORBNoServerSideNameLookups"))))
462 // Don't look up the host name for incoming connections
463 no_server_side_name_lookups
=
464 ACE_OS::atoi (current_arg
);
466 arg_shifter
.consume_arg ();
468 else if (nullptr != (current_arg
= arg_shifter
.get_the_parameter
469 (ACE_TEXT("-ORBNameServicePort"))))
471 // Specify the port number for the NameService.
472 // Unrelated to ORB Protocols, this is used for multicast.
474 ns_port
= static_cast <CORBA::UShort
> (ACE_OS::atoi (current_arg
));
476 arg_shifter
.consume_arg ();
478 else if (nullptr != (current_arg
= arg_shifter
.get_the_parameter
479 (ACE_TEXT("-ORBMulticastDiscoveryEndpoint"))))
481 // Specify mcast address:port@network_interface for the
482 // Naming Service Multicast Discovery Protocol.
483 // If there is no colon, its only the port no.
484 // If there is a '@' also, it means that the network
485 // interface name is specified.
486 this->orb_params ()->mcast_discovery_endpoint (
487 ACE_TEXT_ALWAYS_CHAR(current_arg
));
489 arg_shifter
.consume_arg ();
491 else if (nullptr != (current_arg
= arg_shifter
.get_the_parameter
492 (ACE_TEXT("-ORBNodelay"))))
494 // Use TCP_NODELAY or not.
496 ACE_OS::atoi (current_arg
);
498 arg_shifter
.consume_arg ();
500 else if (nullptr != (current_arg
= arg_shifter
.get_the_parameter
501 (ACE_TEXT("-ORBKeepalive"))))
503 // Use SO_KEEPALIVE or not.
505 ACE_OS::atoi (current_arg
);
507 arg_shifter
.consume_arg ();
509 else if (nullptr != (current_arg
= arg_shifter
.get_the_parameter
510 (ACE_TEXT("-ORBDontRoute"))))
512 // Use SO_DONTROUTE or not.
514 ACE_OS::atoi (current_arg
);
516 arg_shifter
.consume_arg ();
518 else if (nullptr != (current_arg
= arg_shifter
.get_the_parameter
519 (ACE_TEXT("-ORBIPHopLimit"))))
521 // Number of IP hops.
523 ACE_OS::atoi (current_arg
);
525 arg_shifter
.consume_arg ();
527 else if (nullptr != (current_arg
= arg_shifter
.get_the_parameter
528 (ACE_TEXT("-ORBIPMulticastLoop"))))
530 // Use IP_MULTICAST_LOOP or not.
532 ACE_OS::atoi (current_arg
);
534 arg_shifter
.consume_arg ();
536 else if (nullptr != (current_arg
= arg_shifter
.get_the_parameter
537 (ACE_TEXT("-ORBTradingServicePort"))))
539 // Specify the port number for the TradingService.
541 ts_port
= static_cast <CORBA::UShort
> (ACE_OS::atoi (current_arg
));
543 arg_shifter
.consume_arg ();
545 else if (nullptr != (current_arg
= arg_shifter
.get_the_parameter
546 (ACE_TEXT("-ORBImplRepoServicePort"))))
548 // Specify the multicast port number for the Implementation
550 ir_port
= static_cast <CORBA::UShort
> (ACE_OS::atoi (current_arg
));
552 arg_shifter
.consume_arg ();
554 else if (nullptr != (current_arg
= arg_shifter
.get_the_parameter
555 (ACE_TEXT("-ORBRcvSock"))))
557 // @@ All protocol implementation may not use sockets, so
558 // this can either be a generic I/O Buffer size or
559 // Buffer info can be a per protocol specification, fredk
561 // Specify the size of the socket's receive buffer
563 rcv_sock_size
= ACE_OS::atoi (current_arg
);
565 arg_shifter
.consume_arg ();
567 else if (nullptr != (current_arg
= arg_shifter
.get_the_parameter
568 (ACE_TEXT("-ORBSndSock"))))
570 // @@ All protocol implementation may not use sockets, so
571 // this can either be a generic I/O Buffer size or
572 // Buffer info can be a per protocol specification, fredk
574 // Specify the size of the socket's send buffer
575 snd_sock_size
= ACE_OS::atoi (current_arg
);
577 arg_shifter
.consume_arg ();
579 else if (nullptr != (current_arg
= arg_shifter
.get_the_parameter
580 (ACE_TEXT("-ORBObjRefStyle"))))
582 // Specifies the style of printed objrefs: URL or IOR
584 // BEGIN COMMENTS FROM IIOP-1.4 On Win32, we should be
585 // collecting information from the Registry such as what
586 // ORBs are configured, specific configuration details like
587 // whether they generate IOR or URL style stringified
588 // objrefs and which addresses they listen to (e.g. allowing
589 // multihomed hosts to implement firewalls), user-meaningful
590 // orb names (they will normally indicate domains), and
593 // On UNIX, we should collect that from some private config
596 // Instead, this just treats the "internet" ORB name
597 // specially and makes it always use URL-style stringified
598 // objrefs, where the hostname and TCP port number are
599 // explicit (and the whole objref is readable by mortals).
600 // BEGIN COMMENTS FROM IIOP-1.4
601 const ACE_TCHAR
*opt
= current_arg
;
602 if (ACE_OS::strcasecmp (opt
, ACE_TEXT("URL")) == 0)
604 else if (ACE_OS::strcasecmp (opt
, ACE_TEXT("IOR")) == 0)
607 arg_shifter
.consume_arg ();
609 else if (nullptr != (current_arg
= arg_shifter
.get_the_parameter
610 (ACE_TEXT("-ORBCollocationStrategy"))))
612 // Specify which collocation policy we want to use.
613 const ACE_TCHAR
*opt
= current_arg
;
614 if (ACE_OS::strcasecmp (opt
, ACE_TEXT("thru_poa")) == 0)
616 this->collocation_strategy_
= TAO_COLLOCATION_THRU_POA
;
618 else if (ACE_OS::strcasecmp (opt
, ACE_TEXT("direct")) == 0)
620 this->collocation_strategy_
= TAO_COLLOCATION_DIRECT
;
622 else if (ACE_OS::strcasecmp (opt
, ACE_TEXT("best")) == 0)
624 this->collocation_strategy_
= TAO_COLLOCATION_BEST
;
627 arg_shifter
.consume_arg ();
629 else if (nullptr != (current_arg
= arg_shifter
.get_the_parameter
630 (ACE_TEXT("-ORBCollocation"))))
632 // Specify whether we want to optimize against collocation
633 // objects. Valid arguments are: "global", "no", and "per-orb".
634 // Default is global.
636 const ACE_TCHAR
*opt
= current_arg
;
637 if (ACE_OS::strcasecmp (opt
, ACE_TEXT("global")) == 0)
639 this->opt_for_collocation_
= true;
640 this->use_global_collocation_
= true;
642 else if (ACE_OS::strcasecmp (opt
, ACE_TEXT("NO")) == 0)
644 this->opt_for_collocation_
= false;
645 this->use_global_collocation_
= false;
647 else if (ACE_OS::strcasecmp (opt
, ACE_TEXT("per-orb")) == 0)
649 this->opt_for_collocation_
= true;
650 this->use_global_collocation_
= false;
654 TAOLIB_DEBUG ((LM_WARNING
,
655 ACE_TEXT ("WARNING: Unknown option to ")
656 ACE_TEXT ("'-ORBCollocation': %s\n"), opt
));
659 arg_shifter
.consume_arg ();
661 else if (nullptr != (current_arg
= arg_shifter
.get_the_parameter
662 (ACE_TEXT("-ORBIIOPClientPortBase"))))
664 this->orb_params ()->iiop_client_port_base (ACE_OS::atoi (current_arg
));
665 arg_shifter
.consume_arg ();
667 else if (nullptr != (current_arg
= arg_shifter
.get_the_parameter
668 (ACE_TEXT("-ORBIIOPClientPortSpan"))))
670 this->orb_params ()->iiop_client_port_span (ACE_OS::atoi (current_arg
));
671 arg_shifter
.consume_arg ();
673 else if (nullptr != (current_arg
= arg_shifter
.get_the_parameter
674 (ACE_TEXT("-ORBPreferredInterfaces"))) ||
675 nullptr != (current_arg
= arg_shifter
.get_the_parameter
676 (ACE_TEXT("-ORBPreferredInterface"))) )
678 if (this->orb_params ()->preferred_interfaces (
679 ACE_TEXT_ALWAYS_CHAR (current_arg
)) == false)
680 throw ::CORBA::INTERNAL (
681 CORBA::SystemException::_tao_minor_code (
682 TAO_ORB_CORE_INIT_LOCATION_CODE
,
684 CORBA::COMPLETED_NO
);
686 arg_shifter
.consume_arg ();
688 else if (nullptr != (current_arg
= arg_shifter
.get_the_parameter
689 (ACE_TEXT("-ORBEnforcePreferredInterfaces"))) ||
690 nullptr != (current_arg
= arg_shifter
.get_the_parameter
691 (ACE_TEXT("-ORBEnforcePreferredInterface"))) )
693 this->orb_params ()->enforce_pref_interfaces (
694 !!ACE_OS::atoi (current_arg
));
695 arg_shifter
.consume_arg ();
697 #if defined (ACE_HAS_IPV6)
698 else if (0 != (current_arg
= arg_shifter
.get_the_parameter
699 (ACE_TEXT("-ORBPreferIPV6Interfaces"))))
701 int const prefer_ipv6_interfaces
= ACE_OS::atoi (current_arg
);
702 if (prefer_ipv6_interfaces
)
703 this->orb_params ()->prefer_ipv6_interfaces (true);
705 this->orb_params ()->prefer_ipv6_interfaces (false);
707 arg_shifter
.consume_arg ();
709 else if (0 != (current_arg
= arg_shifter
.get_the_parameter
710 (ACE_TEXT("-ORBConnectIPV6Only"))))
712 int const connect_ipv6_only
= ACE_OS::atoi (current_arg
);
713 if (connect_ipv6_only
)
714 this->orb_params ()->connect_ipv6_only (true);
716 this->orb_params ()->connect_ipv6_only (false);
718 arg_shifter
.consume_arg ();
720 else if ((current_arg
= arg_shifter
.get_the_parameter
721 (ACE_TEXT("-ORBUseIPV6LinkLocal"))))
723 int const use_ipv6_link_local
= ACE_OS::atoi (current_arg
);
724 if (use_ipv6_link_local
)
725 this->orb_params ()->use_ipv6_link_local (true);
727 this->orb_params ()->use_ipv6_link_local (false);
729 arg_shifter
.consume_arg ();
731 #endif /* ACE_HAS_IPV6 */
732 else if (nullptr != (current_arg
= arg_shifter
.get_the_parameter
733 (ACE_TEXT("-ORBCDRTradeoff"))))
735 cdr_tradeoff
= ACE_OS::atoi (current_arg
);
737 arg_shifter
.consume_arg ();
740 // A new <ObjectID>:<IOR> mapping has been specified. This will be
741 // used by the resolve_initial_references ().
743 else if (nullptr != (current_arg
= arg_shifter
.get_the_parameter
744 (ACE_TEXT("-ORBInitRef"))))
746 const ACE_TCHAR
*pos
= ACE_OS::strchr (current_arg
, '=');
749 TAOLIB_ERROR ((LM_ERROR
,
750 ACE_TEXT ("Invalid ORBInitRef argument '%s'")
751 ACE_TEXT ("format is ObjectID=IOR\n"),
753 throw ::CORBA::INTERNAL (
754 CORBA::SystemException::_tao_minor_code (
755 TAO_ORB_CORE_INIT_LOCATION_CODE
,
757 CORBA::COMPLETED_NO
);
759 ACE_CString
object_id (ACE_TEXT_ALWAYS_CHAR(current_arg
),
761 ACE_CString
IOR (ACE_TEXT_ALWAYS_CHAR(pos
+ 1));
762 if (!this->init_ref_map_
.insert (
763 std::make_pair (InitRefMap::key_type (object_id
),
764 InitRefMap::data_type (IOR
))).second
)
766 TAOLIB_ERROR ((LM_ERROR
,
767 ACE_TEXT ("Duplicate -ORBInitRef ")
768 ACE_TEXT ("argument '%s'\n"),
770 throw ::CORBA::INTERNAL (
771 CORBA::SystemException::_tao_minor_code (
772 TAO_ORB_CORE_INIT_LOCATION_CODE
,
774 CORBA::COMPLETED_NO
);
776 arg_shifter
.consume_arg ();
778 else if (nullptr != (current_arg
= arg_shifter
.get_the_parameter
779 (ACE_TEXT("-ORBDefaultInitRef"))))
781 // Set the list of prefixes from -ORBDefaultInitRef.
782 this->orb_params ()->default_init_ref
783 (ACE_TEXT_ALWAYS_CHAR(current_arg
));
785 arg_shifter
.consume_arg ();
787 else if (nullptr != (current_arg
= arg_shifter
.get_the_parameter
788 (ACE_TEXT("-ORBStdProfileComponents"))))
790 std_profile_components
=
791 ACE_OS::atoi (current_arg
);
792 arg_shifter
.consume_arg ();
794 else if (nullptr != (current_arg
= arg_shifter
.get_the_parameter
795 (ACE_TEXT("-ORBAMICollocation"))))
797 int const ami_collocation
= ACE_OS::atoi (current_arg
);
799 this->orb_params ()->ami_collication (true);
801 this->orb_params ()->ami_collication (false);
803 arg_shifter
.consume_arg ();
805 else if (nullptr != (current_arg
= arg_shifter
.get_the_parameter
806 (ACE_TEXT("-ORBLogFile"))))
808 // redirect all TAOLIB_DEBUG and TAOLIB_ERROR output to a file
809 // USAGE: -ORBLogFile <file>
810 // default: if <file> is present = append
811 // if <file> is not present = create
813 const ACE_TCHAR
*file_name
= current_arg
;
814 arg_shifter
.consume_arg ();
816 // would rather use ACE_OSTREAM_TYPE out here..
817 // but need ACE_FSTREAM_TYPE to call ->open(...)
818 // and haven't found such a macro to rep FILE* and/or fstream*
820 #if defined (ACE_LACKS_IOSTREAM_TOTALLY)
822 FILE* output_stream
= ACE_OS::fopen (file_name
, ACE_TEXT ("a"));
824 ACE_LOG_MSG
->msg_ostream (output_stream
, 1);
826 #else /* ! ACE_LACKS_IOSTREAM_TOTALLY */
828 ofstream
* output_stream
= nullptr;
831 // note: we are allocating dynamic memory here....but
832 // I assume it will persist for the life of the program
835 ACE_NEW_THROW_EX (output_stream
,
838 CORBA::SystemException::_tao_minor_code (
839 TAO_ORB_CORE_INIT_LOCATION_CODE
,
841 CORBA::COMPLETED_NO
));
843 output_stream
->open (ACE_TEXT_ALWAYS_CHAR (file_name
),
844 ios::out
| ios::app
);
846 if (!output_stream
->bad ())
848 ACE_LOG_MSG
->msg_ostream (output_stream
, 1);
851 #endif /* ACE_LACKS_IOSTREAM_TOTALLY */
853 ACE_LOG_MSG
->clr_flags (ACE_Log_Msg::STDERR
| ACE_Log_Msg::LOGGER
);
854 ACE_LOG_MSG
->set_flags (ACE_Log_Msg::OSTREAM
);
856 else if (nullptr != (current_arg
= arg_shifter
.get_the_parameter
857 (ACE_TEXT("-ORBVerboseLogging"))))
859 unsigned long const verbose_logging
= ACE_OS::atoi (current_arg
);
861 arg_shifter
.consume_arg ();
863 typedef void (ACE_Log_Msg::*PTMF
)(u_long
);
864 PTMF flagop
= &ACE_Log_Msg::set_flags
;
867 switch (verbose_logging
)
870 flagop
= &ACE_Log_Msg::clr_flags
;
871 value
= ACE_Log_Msg::VERBOSE
| ACE_Log_Msg::VERBOSE_LITE
;
874 value
= ACE_Log_Msg::VERBOSE_LITE
; break;
876 value
= ACE_Log_Msg::VERBOSE
; break;
879 (ACE_LOG_MSG
->*flagop
)(value
);
881 else if ((current_arg
= arg_shifter
.get_the_parameter
882 (ACE_TEXT("-ORBHandleLoggingStrategyEvents"))))
884 ACE_Logging_Strategy
*logging_strategy
=
885 dynamic_cast<ACE_Logging_Strategy
*> (
886 ACE_Dynamic_Service
<ACE_Service_Object
>::instance (current_arg
));
888 if (logging_strategy
!= nullptr)
890 logging_strategy
->reactor (this->reactor ());
893 arg_shifter
.consume_arg ();
895 else if (nullptr != (current_arg
= arg_shifter
.get_the_parameter
896 (ACE_TEXT("-ORBUseIMR"))))
899 this->use_implrepo_
= ACE_OS::atoi (current_arg
);
901 arg_shifter
.consume_arg ();
903 else if (nullptr != (current_arg
= arg_shifter
.get_the_parameter
904 (ACE_TEXT("-ORBIMREndpointsInIOR"))))
906 this->imr_endpoints_in_ior_
= ACE_OS::atoi (current_arg
);
908 arg_shifter
.consume_arg ();
910 else if (nullptr != (current_arg
= arg_shifter
.get_the_parameter
911 (ACE_TEXT("-ORBid"))))
913 // The ORBid is actually set in ORB_init(), and then passed
914 // to the TAO_ORB_Core() constructor. However, in the case
915 // where the ORBid third argument to ORB_init() is not zero,
916 // any "-ORBid" arguments in the argv argument list are
917 // supposed to be ignored, according to the CORBA spec. As
918 // such, "-ORBid" must be removed from the argument list
919 // since ORB_init() must remove all "-ORB" option
922 // We obtain a lock on the ORB table when setting the
923 // ORBid. For this reason we should *not* set the ORBid
924 // here. CORBA::ORB_init() does all of the proper locking
927 arg_shifter
.consume_arg ();
929 else if (nullptr != (current_arg
= arg_shifter
.get_the_parameter
930 (ACE_TEXT("-ORBServerId"))))
932 // The this->server_id_ is to uniquely identify a server to
935 this->server_id_
.set(ACE_TEXT_ALWAYS_CHAR(current_arg
));
937 arg_shifter
.consume_arg ();
939 else if (nullptr != (current_arg
= arg_shifter
.get_the_parameter
940 (ACE_TEXT("-ORBLingerTimeout"))))
942 linger
= ACE_OS::atoi (current_arg
);
944 arg_shifter
.consume_arg ();
946 else if (nullptr != (current_arg
= arg_shifter
.get_the_parameter
947 (ACE_TEXT("-ORBAcceptErrorDelay"))))
949 accept_error_delay
= ACE_OS::atoi (current_arg
);
951 arg_shifter
.consume_arg ();
953 else if (nullptr != (current_arg
= arg_shifter
.get_the_parameter
954 (ACE_TEXT("-ORBEndpoint"))))
956 // Each "endpoint" is of the form:
958 // protocol://V.v@addr1,addr2,...,addrN
962 // protocol://addr1,addr2,...,addrN
964 // where "V.v" is an optional protocol version for each
965 // addr. All endpoint strings should be of the above
968 // Multiple sets of endpoint may be separated by a semi-colon `;'.
971 // corbaloc:space:2001,1.2@odyssey:2010;uiop://foo,bar
973 // All endpoint strings should be of the above form(s).
975 this->set_endpoint_helper (TAO_DEFAULT_LANE
,
976 ACE_TEXT_ALWAYS_CHAR (current_arg
));
978 arg_shifter
.consume_arg ();
980 else if (nullptr != (current_arg
= arg_shifter
.get_the_parameter
981 (ACE_TEXT("-ORBListenEndpoints"))))
983 // This option is similar to the -ORBEndPoint option. May be
984 // ORBEndpoint option will be deprecated in future. But, for
985 // now, I (Priyanka) am leaving so that both options can be
988 this->set_endpoint_helper (TAO_DEFAULT_LANE
,
989 ACE_TEXT_ALWAYS_CHAR (current_arg
));
991 arg_shifter
.consume_arg ();
993 else if ((nullptr != (current_arg
= arg_shifter
.get_the_parameter
994 (ACE_TEXT("-ORBLaneEndpoint")))) ||
995 (nullptr != (current_arg
= arg_shifter
.get_the_parameter
996 (ACE_TEXT("-ORBLaneListenEndpoints")))))
998 // This option is similar to the -ORBEndPoint option but
999 // specifies endpoints for each lane.
1001 if (arg_shifter
.is_option_next ())
1004 ACE_CString
lane (ACE_TEXT_ALWAYS_CHAR (current_arg
));
1005 arg_shifter
.consume_arg ();
1007 if (arg_shifter
.is_option_next ())
1010 ACE_CString
endpoints (ACE_TEXT_ALWAYS_CHAR
1011 (arg_shifter
.get_current ()));
1012 arg_shifter
.consume_arg ();
1014 this->set_endpoint_helper (lane
, endpoints
);
1016 else if (nullptr != (current_arg
= arg_shifter
.get_the_parameter
1017 (ACE_TEXT("-ORBNoProprietaryActivation"))))
1019 // This option can be used to set to not use any proprietary
1020 // activation framework. The only TAO proprietary activation
1021 // framework is IMR. So, by setting this option in TAO, the
1022 // IMR shouldnt be used .. even if the ORBUseIMR option is
1025 // @@ To do later: Priyanka.
1027 throw ::CORBA::NO_IMPLEMENT ();
1029 else if (nullptr != (current_arg
= arg_shifter
.get_the_parameter
1030 (ACE_TEXT("-ORBUseSharedProfile"))))
1032 this->orb_params ()->shared_profile (ACE_OS::atoi (current_arg
));
1034 arg_shifter
.consume_arg ();
1036 else if (nullptr != (current_arg
= arg_shifter
.get_the_parameter
1037 (ACE_TEXT("-ORBNegotiateCodesets"))))
1039 negotiate_codesets
= (ACE_OS::atoi (current_arg
));
1041 arg_shifter
.consume_arg ();
1043 else if (nullptr != (current_arg
= arg_shifter
.get_the_parameter
1044 (ACE_TEXT("-ORBUseParallelConnects"))))
1046 use_parallel_connects
= ACE_OS::atoi (current_arg
);
1047 arg_shifter
.consume_arg ();
1049 else if (nullptr != (current_arg
= arg_shifter
.get_the_parameter
1050 (ACE_TEXT("-ORBParallelConnectDelay"))))
1052 this->orb_params ()->parallel_connect_delay
1053 (ACE_OS::atoi (current_arg
));
1054 arg_shifter
.consume_arg ();
1056 else if (nullptr != (current_arg
= arg_shifter
.get_the_parameter
1057 (ACE_TEXT("-ORBSingleReadOptimization"))))
1059 this->orb_params ()->single_read_optimization
1060 (ACE_OS::atoi (current_arg
));
1062 arg_shifter
.consume_arg ();
1064 else if (nullptr != (current_arg
= arg_shifter
.get_the_parameter
1065 (ACE_TEXT("-ORBDisableRTCollocation"))))
1067 int disable_rt_collocation
= ACE_OS::atoi (current_arg
);
1068 if (disable_rt_collocation
)
1069 this->orb_params ()->disable_rt_collocation_resolver (true);
1071 this->orb_params ()->disable_rt_collocation_resolver (false);
1073 arg_shifter
.consume_arg ();
1075 else if (nullptr != (current_arg
= arg_shifter
.get_the_parameter
1076 (ACE_TEXT("-ORBUseLocalMemoryPool"))))
1078 this->use_local_memory_pool_
= (0 != ACE_OS::atoi (current_arg
));
1080 arg_shifter
.consume_arg ();
1082 else if (nullptr != (current_arg
= arg_shifter
.get_the_parameter
1083 (ACE_TEXT("-ORBMaxMessageSize"))))
1085 this->orb_params_
.max_message_size (ACE_OS::atoi (current_arg
));
1087 arg_shifter
.consume_arg ();
1089 else if (nullptr != (current_arg
= arg_shifter
.get_the_parameter
1090 (ACE_TEXT("-ORBFTSendFullGroupTC"))))
1092 this->ft_send_extended_sc_
= ACE_OS::atoi (current_arg
);
1094 arg_shifter
.consume_arg ();
1096 else if (nullptr != (current_arg
= arg_shifter
.get_the_parameter
1097 (ACE_TEXT("-ORBForwardInvocationOnObjectNotExist"))))
1099 int const forward
= ACE_OS::atoi (current_arg
);
1101 this->orb_params_
.forward_invocation_on_object_not_exist (true);
1103 this->orb_params_
.forward_invocation_on_object_not_exist (false);
1105 arg_shifter
.consume_arg ();
1107 else if (nullptr != (current_arg
= arg_shifter
.get_the_parameter
1108 (ACE_TEXT("-ORBForwardOnTransientLimit"))))
1110 int const limit
= ACE_OS::atoi (current_arg
);
1111 this->orb_params_
.forward_on_exception_limit (TAO::FOE_TRANSIENT
, limit
);
1112 arg_shifter
.consume_arg ();
1114 else if (nullptr != (current_arg
= arg_shifter
.get_the_parameter
1115 (ACE_TEXT("-ORBForwardOnCommFailureLimit"))))
1117 int const limit
= ACE_OS::atoi (current_arg
);
1118 this->orb_params_
.forward_on_exception_limit (
1119 TAO::FOE_COMM_FAILURE
, limit
);
1120 arg_shifter
.consume_arg ();
1122 else if (nullptr != (current_arg
= arg_shifter
.get_the_parameter
1123 (ACE_TEXT("-ORBForwardOnObjectNotExistLimit"))))
1125 int const limit
= ACE_OS::atoi (current_arg
);
1126 this->orb_params_
.forward_on_exception_limit (
1127 TAO::FOE_OBJECT_NOT_EXIST
, limit
);
1128 arg_shifter
.consume_arg ();
1130 else if (nullptr != (current_arg
= arg_shifter
.get_the_parameter
1131 (ACE_TEXT("-ORBForwardOnInvObjrefLimit"))))
1133 int const limit
= ACE_OS::atoi (current_arg
);
1134 this->orb_params_
.forward_on_exception_limit (
1135 TAO::FOE_INV_OBJREF
, limit
);
1136 arg_shifter
.consume_arg ();
1138 else if (nullptr != (current_arg
= arg_shifter
.get_the_parameter
1139 (ACE_TEXT("-ORBForwardOnReplyClosedLimit"))))
1141 int const limit
= ACE_OS::atoi (current_arg
);
1142 this->orb_params_
.invocation_retry_params ()
1143 .forward_on_reply_closed_limit_
= limit
;
1144 arg_shifter
.consume_arg ();
1146 else if (nullptr != (current_arg
= arg_shifter
.get_the_parameter
1147 (ACE_TEXT("-ORBForwardDelay"))))
1149 int const msecs
= ACE_OS::atoi (current_arg
);
1150 ACE_Time_Value
delay(0, 1000*msecs
);
1151 this->orb_params_
.forward_on_exception_delay (delay
);
1152 arg_shifter
.consume_arg ();
1154 else if (nullptr != (current_arg
= arg_shifter
.get_the_parameter
1155 (ACE_TEXT("-ORBForwardOnceOnObjectNotExist"))))
1157 int const forward
= ACE_OS::atoi (current_arg
);
1159 this->orb_params_
.forward_once_exception (TAO::FOE_OBJECT_NOT_EXIST
);
1161 arg_shifter
.consume_arg ();
1163 else if (nullptr != (current_arg
= arg_shifter
.get_the_parameter
1164 (ACE_TEXT("-ORBForwardOnceOnCommFailure"))))
1166 int const forward
= ACE_OS::atoi (current_arg
);
1168 this->orb_params_
.forward_once_exception (TAO::FOE_COMM_FAILURE
);
1170 arg_shifter
.consume_arg ();
1172 else if (nullptr != (current_arg
= arg_shifter
.get_the_parameter
1173 (ACE_TEXT("-ORBForwardOnceOnTransient"))))
1175 int const forward
= ACE_OS::atoi (current_arg
);
1177 this->orb_params_
.forward_once_exception (TAO::FOE_TRANSIENT
);
1179 arg_shifter
.consume_arg ();
1181 else if (nullptr != (current_arg
= arg_shifter
.get_the_parameter
1182 (ACE_TEXT("-ORBForwardOnceOnInvObjref"))))
1184 int forward
= ACE_OS::atoi (current_arg
);
1186 this->orb_params_
.forward_once_exception (TAO::FOE_INV_OBJREF
);
1188 arg_shifter
.consume_arg ();
1190 else if (nullptr != (current_arg
= arg_shifter
.get_the_parameter
1191 (ACE_TEXT("-ORBAllowZIOPNoServerPolicies"))))
1193 // This option takes a boolean 0 (off/dissallow) or 1 (on/allow)
1194 this->orb_params_
.allow_ziop_no_server_policies (!!ACE_OS::atoi (current_arg
));
1195 arg_shifter
.consume_arg ();
1197 else if (nullptr != (current_arg
= arg_shifter
.get_the_parameter
1198 (ACE_TEXT("-ORBDynamicThreadPoolName"))))
1200 this->orb_params_
.dynamic_thread_pool_config_name (ACE_TEXT_ALWAYS_CHAR
1202 arg_shifter
.consume_arg ();
1205 ////////////////////////////////////////////////////////////////
1206 // catch any unknown -ORB args //
1207 ////////////////////////////////////////////////////////////////
1208 else if (arg_shifter
.cur_arg_strncasecmp (ACE_TEXT("-ORB")) != -1)
1210 if (TAO_debug_level
> 0)
1212 current_arg
= arg_shifter
.get_current ();
1213 TAOLIB_ERROR ((LM_ERROR
,
1214 ACE_TEXT ("ERROR: Unknown \"-ORB\" option ")
1215 ACE_TEXT ("<%s>.\n"),
1216 ((current_arg
== nullptr) ? ACE_TEXT("<NULL>")
1220 throw ::CORBA::BAD_PARAM (
1221 CORBA::SystemException::_tao_minor_code (
1222 TAO_ORB_CORE_INIT_LOCATION_CODE
,
1224 CORBA::COMPLETED_NO
);
1227 ////////////////////////////////////////////////////////////////
1228 // ok, we can't interpret this argument, move to next argument//
1229 ////////////////////////////////////////////////////////////////
1232 // Any arguments that don't match are ignored so that the
1233 // caller can still use them.
1234 arg_shifter
.ignore_arg ();
1238 const char *env_endpoint
=
1239 ACE_OS::getenv ("TAO_ORBENDPOINT");
1241 if (env_endpoint
!= nullptr)
1244 this->orb_params ()->add_endpoints (TAO_DEFAULT_LANE
, env_endpoint
);
1248 if (TAO_debug_level
> 0)
1250 TAOLIB_ERROR ((LM_ERROR
,
1251 ACE_TEXT ("ERROR: Environment variable ")
1252 ACE_TEXT ("TAO_ORBENDPOINT set to invalid value ")
1253 ACE_TEXT ("<%C>.\n"),
1257 throw ::CORBA::BAD_PARAM (
1258 CORBA::SystemException::_tao_minor_code (
1259 TAO_ORB_CORE_INIT_LOCATION_CODE
,
1261 CORBA::COMPLETED_NO
);
1265 #if defined (SIGPIPE) && !defined (ACE_LACKS_UNIX_SIGNALS)
1266 // There's really no way to deal with this in a portable manner, so
1267 // we just have to suck it up and get preprocessor conditional and
1270 // Impractical to have each call to the ORB protect against the
1271 // implementation artifact of potential writes to dead connections,
1272 // as it'd be way expensive. Do it here; who cares about SIGPIPE in
1273 // these kinds of applications, anyway?
1274 (void) ACE_OS::signal (SIGPIPE
, (ACE_SignalHandler
) SIG_IGN
);
1275 #endif /* SIGPIPE */
1277 // Calling the open method here so that the svc.conf file is
1278 // opened and TAO_default_resource_factory::init () is called by the
1279 // time this method is called.
1280 this->parser_registry_
.open (this);
1282 // Initialize the pointers to resources in the ORB Core instance,
1283 // e.g., reactor, connector, etc. Must do this after we open
1284 // services because we'll load the factory from there.
1285 TAO_Resource_Factory
*trf
= this->resource_factory ();
1289 TAOLIB_ERROR ((LM_ERROR
,
1290 ACE_TEXT ("TAO (%P|%t) - %p\n"),
1291 ACE_TEXT ("ORB Core unable to find a ")
1292 ACE_TEXT ("Resource Factory instance")));
1293 throw ::CORBA::INTERNAL (
1294 CORBA::SystemException::_tao_minor_code (
1295 TAO_ORB_CORE_INIT_LOCATION_CODE
,
1297 CORBA::COMPLETED_NO
);
1300 // Set whether or not to use the local memory pool for the cdr allocators.
1302 trf
->use_local_memory_pool (this->use_local_memory_pool_
);
1305 // Make sure the reactor is initialized...
1306 ACE_Reactor
*reactor
= this->reactor ();
1307 if (reactor
== nullptr)
1309 TAOLIB_ERROR ((LM_ERROR
,
1310 ACE_TEXT ("TAO (%P|%t) - %p\n"),
1311 ACE_TEXT ("ORB Core unable to initialize reactor")));
1312 throw ::CORBA::INITIALIZE (
1313 CORBA::SystemException::_tao_minor_code (
1314 TAO_ORB_CORE_INIT_LOCATION_CODE
,
1316 CORBA::COMPLETED_NO
);
1319 TAO_Server_Strategy_Factory
*ssf
= this->server_factory ();
1323 TAOLIB_ERROR ((LM_ERROR
,
1324 ACE_TEXT ("TAO (%P|%t) - %p\n"),
1325 ACE_TEXT ("ORB Core unable to find a ")
1326 ACE_TEXT ("Server Strategy Factory instance")));
1327 throw ::CORBA::INTERNAL (
1328 CORBA::SystemException::_tao_minor_code (
1329 TAO_ORB_CORE_INIT_LOCATION_CODE
,
1331 CORBA::COMPLETED_NO
);
1336 // Obtain the timeout value for the thread-per-connection model
1337 this->thread_per_connection_use_timeout_
=
1338 ssf
->thread_per_connection_timeout (this->thread_per_connection_timeout_
);
1340 if (thread_per_connection_use_timeout_
== -1)
1342 if (ACE_OS::strcasecmp (TAO_DEFAULT_THREAD_PER_CONNECTION_TIMEOUT
,
1345 this->thread_per_connection_use_timeout_
= 0;
1349 this->thread_per_connection_use_timeout_
= 1;
1350 int const milliseconds
=
1351 ACE_OS::atoi (TAO_DEFAULT_THREAD_PER_CONNECTION_TIMEOUT
);
1352 // Use a temporary to obtain automatic normalization.
1353 this->thread_per_connection_timeout_
=
1354 ACE_Time_Value (0, 1000 * milliseconds
);
1357 if (this->thread_per_connection_use_timeout_
== 0)
1359 // Do not wait for the server threads because they may block
1361 this->tm_
.wait_on_exit (0);
1364 // Initialize the "ORB" pseudo-object now.
1365 this->orb_
= CORBA::ORB::_tao_make_ORB (this);
1367 // This should probably move into the ORB Core someday rather then
1368 // being done at this level.
1369 this->orb_
->_use_omg_ior_format (use_ior
);
1371 // Set all kinds of orb parameters whose setting needed to be
1372 // deferred until after the service config entries had been
1375 this->orb_params ()->service_port (TAO::MCAST_NAMESERVICE
, ns_port
);
1379 static char const mcast_fmt
[] = "mcast://:%d::";
1380 static size_t const PORT_BUF_SIZE
= 256;
1382 char def_init_ref
[PORT_BUF_SIZE
] = { 0 };
1384 ACE_OS::snprintf (def_init_ref
,
1389 this->orb_params ()->default_init_ref (def_init_ref
);
1392 this->orb_params ()->service_port (TAO::MCAST_TRADINGSERVICE
, ts_port
);
1393 this->orb_params ()->service_port (TAO::MCAST_IMPLREPOSERVICE
, ir_port
);
1395 this->orb_params ()->use_dotted_decimal_addresses (dotted_decimal_addresses
);
1396 // When caching incoming transports don't use the host name if
1397 // -ORBDottedDecimalAddresses or -ORBNoServerSideNameLookups is true.
1398 this->orb_params ()->cache_incoming_by_dotted_decimal_address
1399 (no_server_side_name_lookups
1400 || dotted_decimal_addresses
);
1402 this->orb_params ()->use_parallel_connects (use_parallel_connects
!= 0);
1404 this->orb_params ()->linger (linger
);
1405 this->orb_params ()->accept_error_delay (accept_error_delay
);
1406 this->orb_params ()->nodelay (nodelay
);
1407 this->orb_params ()->sock_keepalive (so_keepalive
);
1408 this->orb_params ()->sock_dontroute (so_dontroute
);
1409 this->orb_params ()->ip_hoplimit (ip_hoplimit
);
1410 this->orb_params ()->ip_multicastloop (ip_multicastloop
);
1411 if (rcv_sock_size
>= 0)
1412 this->orb_params ()->sock_rcvbuf_size (rcv_sock_size
);
1413 if (snd_sock_size
>= 0)
1414 this->orb_params ()->sock_sndbuf_size (snd_sock_size
);
1415 if (cdr_tradeoff
>= 0)
1416 this->orb_params ()->cdr_memcpy_tradeoff (cdr_tradeoff
);
1418 this->orb_params ()->std_profile_components (std_profile_components
);
1420 this->orb_params ()->negotiate_codesets (negotiate_codesets
);
1422 if (this->codeset_manager())
1423 this->codeset_manager_
->open(*this);
1425 if (TAO_debug_level
> 0)
1426 TAOLIB_DEBUG ((LM_DEBUG
,
1427 ACE_TEXT("TAO (%P|%t) - ORB_Core: ")
1428 ACE_TEXT("Codeset Manager not available\n")));
1430 // Set up the pluggable protocol infrastructure. First get a
1431 // pointer to the protocol factories set, then obtain pointers to
1432 // all factories loaded by the service configurator.
1433 // Load all protocol factories!
1434 if (trf
->init_protocol_factories () == -1)
1435 throw ::CORBA::INITIALIZE (
1436 CORBA::SystemException::_tao_minor_code (
1437 TAO_ORB_CORE_INIT_LOCATION_CODE
,
1439 CORBA::COMPLETED_NO
);
1441 // init the ORB core's pointer
1442 this->protocol_factories_
= trf
->get_protocol_factories ();
1444 // Initialize the flushing strategy
1445 this->flushing_strategy_
= trf
->create_flushing_strategy ();
1447 // Initialize the default sync scope value
1448 this->default_sync_scope_
= this->client_factory()->sync_scope ();
1450 // Look in the service repository for an instance of the Protocol Hooks.
1451 const char *protocols_hooks_name
= this->orb_params ()->protocols_hooks_name ();
1453 this->protocols_hooks_
=
1454 ACE_Dynamic_Service
<TAO_Protocols_Hooks
>::instance
1455 (this->configuration (),
1456 ACE_TEXT_CHAR_TO_TCHAR (protocols_hooks_name
));
1458 if (this->protocols_hooks_
!= nullptr)
1460 // Initialize the protocols hooks instance.
1461 this->protocols_hooks_
->init_hooks (this);
1464 // If available, allow the Adapter Factory to setup.
1465 ACE_Service_Object
*adapter_factory
=
1466 ACE_Dynamic_Service
<ACE_Service_Object
>::instance (
1467 this->configuration (),
1468 this->orb_params ()->poa_factory_name ());
1470 if (adapter_factory
!= nullptr)
1472 adapter_factory
->init (0, nullptr);
1475 // Look in the service repository for an instance of the
1476 // Network Priority Protocol Hooks.
1477 const ACE_CString
&network_priority_protocols_hooks_name
=
1478 TAO_ORB_Core_Static_Resources::instance ()->
1479 network_priority_protocols_hooks_name_
;
1481 this->network_priority_protocols_hooks_
=
1482 ACE_Dynamic_Service
<TAO_Network_Priority_Protocols_Hooks
>::instance
1483 (this->configuration (),
1484 ACE_TEXT_CHAR_TO_TCHAR (network_priority_protocols_hooks_name
.c_str()));
1486 if (this->network_priority_protocols_hooks_
!= nullptr)
1488 // Initialize the protocols hooks instance.
1489 this->network_priority_protocols_hooks_
->init_hooks (this);
1492 // As a last step perform initializations of the service callbacks
1493 this->services_callbacks_init ();
1495 // The ORB has been initialized, meaning that the ORB is no longer
1496 // in the shutdown state.
1497 this->has_shutdown_
= false;
1504 TAO_ORB_Core::fini ()
1508 // Shutdown the ORB and block until the shutdown is complete.
1511 catch (const ::CORBA::Exception
& ex
)
1513 ACE_CString message
=
1514 "Exception caught in trying to shutdown ";
1515 message
+= this->orbid_
;
1518 ex
._tao_print_exception (message
.c_str ());
1521 // Wait for any server threads, ignoring any failures.
1522 (void) this->thr_mgr ()->wait ();
1524 ::CORBA::release (this->typecode_factory_
);
1526 ::CORBA::release (this->codec_factory_
);
1528 ::CORBA::release (this->compression_manager_
);
1530 ::CORBA::release (this->dynany_factory_
);
1532 ::CORBA::release (this->ior_manip_factory_
);
1534 ::CORBA::release (this->ior_table_
);
1536 ::CORBA::release (this->async_ior_table_
);
1538 ::CORBA::release (this->monitor_
);
1540 if (TAO_debug_level
> 2)
1542 TAOLIB_DEBUG ((LM_DEBUG
,
1543 ACE_TEXT ("TAO (%P|%t) - Destroying ORB <%C>\n"),
1547 // Finalize lane resources.
1549 // @@ Do not call this->thread_lane_resources_manager().finalize().
1550 // this->thread_lane_manager_resources() can seg fault if the
1551 // factory method it invokes returns a zero pointer, which can
1552 // easily occur if the ORB is partially initialized due to a Service
1553 // Configurator initialization failure. Instead check if the
1554 // cached pointer is non-zero and then finalize.
1556 // @todo Fix potential seg fault in
1557 // TAO_ORB_Core::thread_lane_resources_manager().
1558 if (this->thread_lane_resources_manager_
!= nullptr)
1559 this->thread_lane_resources_manager_
->finalize ();
1561 // Destroy the object_key table
1562 this->object_key_table_
.destroy ();
1570 TAO_ORB_Core::set_resource_factory (const char *resource_factory_name
)
1572 TAO_ORB_Core_Static_Resources::instance ()->resource_factory_name_
=
1573 resource_factory_name
;
1577 TAO_ORB_Core::set_gui_resource_factory (TAO::GUIResource_Factory
*gui_resource_factory
)
1579 if (TAO_TSS_Resources::instance ()->gui_resource_factory_
!= nullptr)
1581 if (TAO_debug_level
> 2)
1583 TAOLIB_DEBUG ((LM_DEBUG
,
1584 "TAO (%P|%t) - Deleting old gui_resource_factory.\n"));
1586 delete TAO_TSS_Resources::instance ()->gui_resource_factory_
;
1589 TAO_TSS_Resources::instance ()->gui_resource_factory_
= gui_resource_factory
;
1593 TAO_ORB_Core::dynamic_adapter_name (const char *name
)
1595 TAO_ORB_Core_Static_Resources::instance ()->dynamic_adapter_name_
= name
;
1599 TAO_ORB_Core::dynamic_adapter_name ()
1601 return TAO_ORB_Core_Static_Resources::instance ()->dynamic_adapter_name_
.c_str();
1605 TAO_ORB_Core::ifr_client_adapter_name (const char *name
)
1607 TAO_ORB_Core_Static_Resources::instance ()->ifr_client_adapter_name_
= name
;
1611 TAO_ORB_Core::ifr_client_adapter_name ()
1613 return TAO_ORB_Core_Static_Resources::instance ()->ifr_client_adapter_name_
.c_str();
1617 TAO_ORB_Core::typecodefactory_adapter_name (const char *name
)
1619 TAO_ORB_Core_Static_Resources::instance ()->typecodefactory_adapter_name_
= name
;
1623 TAO_ORB_Core::typecodefactory_adapter_name ()
1625 return TAO_ORB_Core_Static_Resources::instance ()->typecodefactory_adapter_name_
.c_str();
1629 TAO_ORB_Core::iorinterceptor_adapter_factory_name (const char *name
)
1631 TAO_ORB_Core_Static_Resources::instance ()->iorinterceptor_adapter_factory_name_
= name
;
1635 TAO_ORB_Core::iorinterceptor_adapter_factory_name ()
1637 return TAO_ORB_Core_Static_Resources::instance ()->iorinterceptor_adapter_factory_name_
.c_str();
1641 TAO_ORB_Core::valuetype_adapter_factory_name (const char *name
)
1643 TAO_ORB_Core_Static_Resources::instance ()->valuetype_adapter_factory_name_
= name
;
1647 TAO_ORB_Core::valuetype_adapter_factory_name ()
1649 return TAO_ORB_Core_Static_Resources::instance ()->valuetype_adapter_factory_name_
.c_str();
1652 TAO_Resource_Factory
*
1653 TAO_ORB_Core::resource_factory ()
1655 // Check if there is a cached reference.
1656 if (this->resource_factory_
!= nullptr)
1658 return this->resource_factory_
;
1661 // Look in the service repository for an instance.
1662 ACE_CString
&resource_factory_name
=
1663 TAO_ORB_Core_Static_Resources::instance ()->resource_factory_name_
;
1665 this->resource_factory_
=
1666 ACE_Dynamic_Service
<TAO_Resource_Factory
>::instance
1667 (this->configuration (),
1668 ACE_TEXT_CHAR_TO_TCHAR (resource_factory_name
.c_str()));
1670 return this->resource_factory_
;
1673 TAO::GUIResource_Factory
*
1674 TAO_ORB_Core::gui_resource_factory ()
1676 return TAO_TSS_Resources::instance ()->gui_resource_factory_
;
1680 TAO_Thread_Lane_Resources_Manager
&
1681 TAO_ORB_Core::thread_lane_resources_manager ()
1683 // Check if there is a cached reference.
1684 if (this->thread_lane_resources_manager_
!= nullptr)
1685 return *this->thread_lane_resources_manager_
;
1687 // If not, lookup the corresponding factory and ask it to make one.
1688 const char *thread_lane_resources_manager_factory_name
=
1689 this->orb_params ()->thread_lane_resources_manager_factory_name ();
1691 TAO_Thread_Lane_Resources_Manager_Factory
*factory
=
1692 ACE_Dynamic_Service
<TAO_Thread_Lane_Resources_Manager_Factory
>::instance
1693 (this->configuration (),
1694 ACE_TEXT_CHAR_TO_TCHAR (thread_lane_resources_manager_factory_name
));
1696 this->thread_lane_resources_manager_
=
1697 factory
->create_thread_lane_resources_manager (*this);
1699 return *this->thread_lane_resources_manager_
;
1702 TAO_Collocation_Resolver
&
1703 TAO_ORB_Core::collocation_resolver ()
1705 // Check if there is a cached reference.
1706 if (this->collocation_resolver_
!= nullptr)
1707 return *this->collocation_resolver_
;
1709 // If not, lookup it up.
1710 this->collocation_resolver_
=
1711 ACE_Dynamic_Service
<TAO_Collocation_Resolver
>::instance
1712 (this->configuration (),
1713 ACE_TEXT_CHAR_TO_TCHAR (this->orb_params ()->collocation_resolver_name ()));
1715 return *this->collocation_resolver_
;
1718 TAO::PolicyFactory_Registry_Adapter
*
1719 TAO_ORB_Core::policy_factory_registry_i ()
1721 TAO_PolicyFactory_Registry_Factory
*loader
=
1722 ACE_Dynamic_Service
<TAO_PolicyFactory_Registry_Factory
>::instance
1723 (this->configuration (),
1724 ACE_TEXT ("PolicyFactory_Loader"));
1726 if (loader
== nullptr)
1728 this->configuration ()->process_directive (
1729 ACE_DYNAMIC_VERSIONED_SERVICE_DIRECTIVE("PolicyFactory_Loader",
1732 "_make_TAO_PolicyFactory_Loader",
1735 ACE_Dynamic_Service
<TAO_PolicyFactory_Registry_Factory
>::instance
1736 (this->configuration (),
1737 ACE_TEXT ("PolicyFactory_Loader"));
1740 if (loader
!= nullptr)
1742 this->policy_factory_registry_
=
1746 return this->policy_factory_registry_
;
1750 TAO_ORB_Core::ziop_adapter_i ()
1752 // Check if there is a cached reference.
1753 if (this->ziop_adapter_
!= nullptr)
1754 return this->ziop_adapter_
;
1756 this->ziop_adapter_
=
1757 ACE_Dynamic_Service
<TAO_ZIOP_Adapter
>::instance
1758 (this->configuration (),
1759 ACE_TEXT ("ZIOP_Loader"));
1761 return this->ziop_adapter_
;
1764 TAO::ORBInitializer_Registry_Adapter
*
1765 TAO_ORB_Core::orbinitializer_registry_i ()
1767 // @todo The ORBInitializer_Registry is supposed to be a singleton.
1769 // If not, lookup it up.
1770 this->orbinitializer_registry_
=
1771 ACE_Dynamic_Service
<TAO::ORBInitializer_Registry_Adapter
>::instance
1772 (this->configuration (),
1773 ACE_TEXT ("ORBInitializer_Registry"));
1775 #if !defined (TAO_AS_STATIC_LIBS) && !(defined (ACE_VXWORKS) && !defined (__RTP__))
1776 // In case we build shared, try to load the PI Client library, in a
1777 // static build we just can't do this, so don't try it, lower layers
1778 // output an error then.
1779 if (this->orbinitializer_registry_
== nullptr)
1781 this->configuration ()->process_directive (
1782 ACE_DYNAMIC_VERSIONED_SERVICE_DIRECTIVE ("ORBInitializer_Registry",
1785 "_make_ORBInitializer_Registry",
1787 this->orbinitializer_registry_
=
1788 ACE_Dynamic_Service
<TAO::ORBInitializer_Registry_Adapter
>::instance
1789 (this->configuration (),
1790 ACE_TEXT ("ORBInitializer_Registry"));
1792 #endif /* !TAO_AS_STATIC_LIBS && !(ACE_VXWORKS && !__RTP__) */
1794 return this->orbinitializer_registry_
;
1798 TAO_ORB_Core::stub_factory ()
1800 // Check if there is a cached reference.
1801 if (this->stub_factory_
!= nullptr)
1802 return this->stub_factory_
;
1804 // If not, look in the service repository for an instance.
1805 const char *stub_factory_name
=
1806 this->orb_params ()->stub_factory_name ();
1808 this->stub_factory_
=
1809 ACE_Dynamic_Service
<TAO_Stub_Factory
>::instance
1810 (this->configuration (),
1811 ACE_TEXT_CHAR_TO_TCHAR (stub_factory_name
));
1813 return this->stub_factory_
;
1816 TAO_Endpoint_Selector_Factory
*
1817 TAO_ORB_Core::endpoint_selector_factory ()
1819 // Check if there is a cached reference.
1820 if (this->endpoint_selector_factory_
!= nullptr)
1821 return this->endpoint_selector_factory_
;
1823 // If not, look in the service repository for an instance.
1824 const char* endpoint_selector_factory_name
=
1825 this->orb_params ()->endpoint_selector_factory_name ();
1827 this->endpoint_selector_factory_
=
1828 ACE_Dynamic_Service
<TAO_Endpoint_Selector_Factory
>::instance
1829 (this->configuration (),
1830 ACE_TEXT_CHAR_TO_TCHAR (endpoint_selector_factory_name
));
1832 return this->endpoint_selector_factory_
;
1836 TAO_ORB_Core::set_network_priority_protocols_hooks (
1837 const char *network_priority_protocols_hooks_name
)
1839 // Is synchronization necessary?
1840 TAO_ORB_Core_Static_Resources::instance ()->
1841 network_priority_protocols_hooks_name_
=
1842 network_priority_protocols_hooks_name
;
1846 TAO_ORB_Core::services_callbacks_init ()
1848 // We (should) know what are the services that would need
1849 // callbacks. So, what we do is go through the Service Configurator
1850 // list for looking at the services that we want to load.
1851 this->ft_service_
.init (this);
1853 // @@ Other service callbacks can be added here
1856 TAO::Invocation_Status
1857 TAO_ORB_Core::service_raise_comm_failure (
1858 IOP::ServiceContextList
&clist
,
1859 TAO_Profile
*profile
)
1861 if (this->ft_service_
.service_callback ())
1863 return this->ft_service_
.service_callback ()->
1864 raise_comm_failure (clist
, profile
);
1867 throw ::CORBA::COMM_FAILURE (
1868 CORBA::SystemException::_tao_minor_code (
1869 TAO_INVOCATION_RECV_REQUEST_MINOR_CODE
,
1871 CORBA::COMPLETED_MAYBE
);
1875 TAO::Invocation_Status
1876 TAO_ORB_Core::service_raise_transient_failure (
1877 IOP::ServiceContextList
&clist
,
1878 TAO_Profile
*profile
)
1880 if (this->ft_service_
.service_callback ())
1883 this->ft_service_
.service_callback ()->raise_transient_failure (clist
,
1887 return TAO::TAO_INVOKE_FAILURE
;
1890 TAO_Client_Strategy_Factory
*
1891 TAO_ORB_Core::client_factory ()
1893 if (this->client_factory_
== nullptr)
1895 // Look in the service repository for an instance.
1896 this->client_factory_
=
1897 ACE_Dynamic_Service
<TAO_Client_Strategy_Factory
>::instance
1898 (this->configuration (),
1899 ACE_TEXT ("Client_Strategy_Factory"));
1902 return this->client_factory_
;
1905 TAO_Server_Strategy_Factory
*
1906 TAO_ORB_Core::server_factory ()
1908 if (this->server_factory_
== nullptr)
1910 // Look in the service repository for an instance.
1911 this->server_factory_
=
1912 ACE_Dynamic_Service
<TAO_Server_Strategy_Factory
>::instance
1913 (this->configuration (),
1914 ACE_TEXT ("Server_Strategy_Factory"));
1917 return this->server_factory_
;
1921 TAO_ORB_Core::root_poa ()
1924 if (CORBA::is_nil (this->root_poa_
.in ()))
1926 // Making sure the initialization process in the current thread uses
1927 // the correct service repository (ours), instead of the global one.
1928 ACE_Service_Config_Guard
scg (this->configuration ());
1930 TAO_Adapter_Factory
*factory
=
1931 ACE_Dynamic_Service
<TAO_Adapter_Factory
>::instance
1932 (this->configuration (),
1933 this->orb_params ()->poa_factory_name ());
1935 if (factory
== nullptr)
1937 this->configuration()->process_directive (
1938 this->orb_params ()->poa_factory_directive ());
1941 ACE_Dynamic_Service
<TAO_Adapter_Factory
>::instance
1942 (this->configuration (),
1943 this->orb_params ()->poa_factory_name ());
1946 if (factory
== nullptr)
1948 return CORBA::Object::_nil ();
1951 ACE_GUARD_RETURN (TAO_SYNCH_MUTEX
,
1956 if (CORBA::is_nil (this->root_poa_
.in ()))
1958 std::unique_ptr
<TAO_Adapter
> poa_adapter (factory
->create (this));
1959 poa_adapter
->open ();
1961 // @@ Not exception safe
1962 this->root_poa_
= poa_adapter
->root ();
1964 this->adapter_registry_
.insert (poa_adapter
.get ());
1966 poa_adapter
.release ();
1970 return CORBA::Object::_duplicate (this->root_poa_
.in ());
1974 TAO_ORB_Core::poa_adapter ()
1976 if (this->poa_adapter_
== nullptr)
1978 ACE_GUARD_RETURN (TAO_SYNCH_MUTEX
, ace_mon
, this->lock_
, nullptr);
1979 if (this->poa_adapter_
== nullptr)
1981 this->poa_adapter_
=
1982 this->adapter_registry_
.find_adapter ("RootPOA");
1985 return this->poa_adapter_
;
1989 TAO_ORB_Core::create_stub (const char *repository_id
,
1990 const TAO_MProfile
&profiles
)
1993 this->stub_factory ()->create_stub (repository_id
, profiles
, this);
1998 TAO_ORB_Core::request_dispatcher (TAO_Request_Dispatcher
*request_dispatcher
)
2000 // Assume ownership of the request dispatcher.
2001 TAO_Request_Dispatcher
*tmp
= this->request_dispatcher_
;
2002 this->request_dispatcher_
= request_dispatcher
;
2007 TAO_ORB_Core::create_stub_object (TAO_MProfile
&mprofile
,
2008 const char *type_id
,
2009 CORBA::PolicyList
*policy_list
)
2011 // Add the Polices contained in "policy_list" to each profile so
2012 // that those policies will be exposed to the client in the IOR. In
2013 // particular each CORBA::Policy has to be converted in to
2014 // Messaging::PolicyValue, and then all the Messaging::PolicyValue
2015 // should be embedded inside a Messaging::PolicyValueSeq which
2016 // became in turns the "body" of the IOP::TaggedComponent. This
2017 // conversion is a responsability of the CORBA::Profile class. (See
2018 // orbos\98-05-05.pdf Section 5.4)
2019 if (policy_list
->length () != 0)
2021 TAO_Profile
* profile
= nullptr;
2023 CORBA::ULong
const count
= mprofile
.profile_count ();
2024 for (CORBA::ULong i
= 0; i
< count
; ++i
)
2026 // Get the ith profile
2027 profile
= mprofile
.get_profile (i
);
2028 profile
->policies (policy_list
);
2032 /// Initialize a TAO_Stub object with the mprofile thats passed.
2033 TAO_Stub
*stub
= this->create_stub (type_id
, mprofile
);
2035 stub
->base_profiles ().policy_list (policy_list
);
2041 TAO_ORB_Core::load_policy_validators (TAO_Policy_Validator
&validator
)
2043 if (this->bidir_adapter_
== nullptr)
2045 this->bidir_adapter_
=
2046 ACE_Dynamic_Service
<TAO_BiDir_Adapter
>::instance
2047 (this->configuration (), ACE_TEXT ("BiDirGIOP_Loader"));
2050 // Call the BiDir library if it has been loaded
2051 if (this->bidir_adapter_
)
2053 this->bidir_adapter_
->load_policy_validators (validator
);
2056 // Call the ZIOP library if it has been loaded
2057 if (this->ziop_adapter_
)
2059 this->ziop_adapter_
->load_policy_validators (validator
);
2064 TAO_ORB_Core::create_object (TAO_Stub
*stub
)
2066 // @@ What about forwarding. With this approach we are never forwarded
2067 // when we use collocation!
2068 const TAO_MProfile
&mprofile
= stub
->base_profiles ();
2070 // @@ We should thow CORBA::NO_MEMORY in platforms with exceptions,
2071 // but we are stuck in platforms without exceptions!
2072 TAO_ORB_Core_Auto_Ptr collocated_orb_core
;
2073 CORBA::Object_ptr x
= nullptr;
2076 // Lock the ORB_Table against concurrent modification while we
2077 // iterate through the ORBs.
2078 ACE_GUARD_RETURN (TAO_SYNCH_MUTEX
,
2080 TAO::ORB_Table::instance()->lock (),
2081 CORBA::Object::_nil ());
2083 TAO::ORB_Table
* const table
= TAO::ORB_Table::instance ();
2084 TAO::ORB_Table::iterator
const end
= table
->end ();
2085 for (TAO::ORB_Table::iterator i
= table
->begin (); i
!= end
; ++i
)
2087 ::TAO_ORB_Core
* const other_core
= (*i
).second
.core ();
2089 if (this->is_collocation_enabled (other_core
, mprofile
))
2091 other_core
->_incr_refcnt();
2092 collocated_orb_core
.reset(other_core
);
2098 if (collocated_orb_core
.get ())
2100 x
= collocated_orb_core
.get ()->adapter_registry ().create_collocated_object (stub
, mprofile
);
2106 // The constructor sets the proxy broker as the
2109 CORBA::Object (stub
, 0),
2117 TAO_ORB_Core::initialize_object (TAO_Stub
*stub
, CORBA::Object_ptr
)
2119 // @@ What about forwarding. With this approach we are never forwarded
2120 // when we use collocation!
2121 const TAO_MProfile
&mprofile
=
2122 stub
->base_profiles ();
2124 return initialize_object_i (stub
, mprofile
);
2128 TAO_ORB_Core::reinitialize_object (TAO_Stub
*stub
)
2130 return initialize_object_i (stub
, stub
->forward_profiles ()
2131 ? *(stub
->forward_profiles ())
2132 : stub
->base_profiles ());
2136 TAO_ORB_Core::initialize_object_i (TAO_Stub
*stub
, const TAO_MProfile
&mprofile
)
2139 CORBA::Long retval
= 0;
2140 TAO_ORB_Core_Auto_Ptr collocated_orb_core
;
2143 // Lock the ORB_Table against concurrent modification while we
2144 // iterate through the ORBs.
2145 ACE_MT (ACE_GUARD_RETURN (TAO_SYNCH_MUTEX
,
2147 TAO::ORB_Table::instance()->lock (),
2150 TAO::ORB_Table
* const table
= TAO::ORB_Table::instance ();
2151 TAO::ORB_Table::iterator
const end
= table
->end ();
2152 for (TAO::ORB_Table::iterator i
= table
->begin (); i
!= end
; ++i
)
2154 TAO_ORB_Core
* const other_core
= (*i
).second
.core ();
2156 if (this->is_collocation_enabled (other_core
, mprofile
))
2158 other_core
->_incr_refcnt ();
2159 collocated_orb_core
.reset(other_core
);
2165 if (collocated_orb_core
.get ())
2167 retval
= collocated_orb_core
.get ()->adapter_registry ().initialize_collocated_object (stub
);
2171 stub
->is_collocated (false);
2178 TAO_ORB_Core::is_collocation_enabled (TAO_ORB_Core
*orb_core
,
2179 const TAO_MProfile
&mp
)
2181 TAO_MProfile mp_temp
;
2183 TAO_Profile
* profile
= nullptr;
2184 if (this->service_profile_selection(mp
, profile
) && profile
)
2186 if (mp_temp
.add_profile(profile
) == -1)
2192 if (!orb_core
->optimize_collocation_objects ())
2195 if (!orb_core
->use_global_collocation () && orb_core
!= this)
2198 if (!orb_core
->is_collocated (profile
? mp_temp
: mp
))
2205 TAO_ORB_Core::is_collocated (const TAO_MProfile
& mprofile
)
2207 // @@ Lots of issues arise when dealing with collocation. What about
2208 // forwarding or what if this is a multi-profile IOR where the order is
2209 // significant and only one of the profiles is collocated. For example
2210 // when using a multiple servers for fault tolerance. For now, we just
2211 // look through all profiles and if any are colocated then we assume
2212 // the object is collocated.
2213 // @@ Note, if collocated we can not be forwarded!
2214 // Also, acceptor_registry_->is_collocated (...) will check the
2215 // address (ORB Host) but not the object_key. This should be checked
2218 return this->thread_lane_resources_manager ().is_collocated (mprofile
);
2221 // ****************************************************************
2223 TAO_Leader_Follower
&
2224 TAO_ORB_Core::leader_follower ()
2226 return this->lane_resources ().leader_follower ();
2230 TAO_ORB_Core::lf_strategy ()
2232 return this->thread_lane_resources_manager ().lf_strategy ();
2236 TAO_ORB_Core::run (ACE_Time_Value
*tv
, int perform_work
)
2238 // ORB::run may be called from a thread, different from the one that
2239 // did the ORB_init, consequently we must establish the Service
2240 // Gestalt, this thread will consider "global"
2242 ACE_Service_Config_Guard
use_orbs (this->configuration());
2244 if (TAO_debug_level
> 10)
2246 TAOLIB_DEBUG ((LM_DEBUG
,
2247 ACE_TEXT ("TAO (%P|%t) - ORB_Core::run, ")
2248 ACE_TEXT ("start [%s]\n"),
2249 perform_work
?ACE_TEXT("perform_work"):ACE_TEXT("run")));
2252 // Fetch the Reactor
2253 ACE_Reactor
*r
= this->reactor ();
2256 // 1 to detect that nothing went wrong
2258 // Loop handling client requests until the ORB is shutdown.
2260 // We could use the leader-follower lock to check for the state
2261 // if this variable or use the lock <create_event_loop_lock> in
2262 // the server strategy factory.
2263 // We don't need to do this because we use the Reactor
2264 // mechanisms to shutdown in a thread-safe way.
2266 while (this->has_shutdown () == false)
2268 // Every time we perform an interaction we have to become the
2269 // leader again, because it is possible that a client has
2270 // acquired the leader role...
2271 TAO_Leader_Follower
&leader_follower
= this->leader_follower ();
2272 TAO_LF_Strategy
&lf_strategy
= this->lf_strategy ();
2274 TAO_LF_Event_Loop_Thread_Helper
helper (leader_follower
, lf_strategy
, tv
);
2276 result
= helper
.event_loop_return ();
2285 // Set the owning thread of the Reactor to the one which we're
2286 // currently in. This is necessary b/c it's possible that the
2287 // application is calling us from a thread other than that in which
2288 // the Reactor's CTOR (which sets the owner) was called.
2290 // We need to do this on every iteration because the reactor may be
2291 // acquired by one of the client threads in the LF waiting
2293 r
->owner (ACE_Thread::self ());
2295 if (TAO_debug_level
> 10)
2297 TAOLIB_DEBUG ((LM_DEBUG
,
2298 ACE_TEXT ("TAO (%P|%t) - ORB_Core::run, ")
2299 ACE_TEXT ( "calling handle_events()\n")));
2302 result
= r
->handle_events (tv
);
2304 if (TAO_debug_level
> 10)
2306 TAOLIB_DEBUG ((LM_DEBUG
,
2307 ACE_TEXT ("TAO (%P|%t) - ORB_Core::run, ")
2308 ACE_TEXT ("handle_events() returns %d\n"),
2314 // An error, terminate the loop
2319 && *tv
== ACE_Time_Value::zero
)
2321 // A timeout, terminate the loop...
2327 // This is running on behalf of a perform_work() call,
2328 // The loop should run only once.
2331 // Otherwise just continue..
2334 // wait only in the parent thread.
2335 if (this->has_shutdown () == true &&
2336 (this->server_factory_
->activate_server_connections () ||
2337 (this->tm_
.task() == nullptr && this->tm_
.count_threads() > 0) ) )
2342 if (TAO_debug_level
> 10)
2344 TAOLIB_DEBUG ((LM_DEBUG
,
2345 ACE_TEXT ("TAO (%P|%t) - ORB_Core::run, ")
2346 ACE_TEXT ("ends with result = %d\n"),
2355 TAO_ORB_Core::shutdown (CORBA::Boolean wait_for_completion
)
2358 ACE_GUARD (TAO_SYNCH_MUTEX
, monitor
, this->lock_
);
2360 if (this->has_shutdown () == true)
2363 // Check if we are on the right state, i.e. do not accept
2364 // shutdowns with the 'wait_for_completion' flag set in the middle
2365 // of an upcall (because those deadlock).
2366 this->adapter_registry_
.check_close (wait_for_completion
);
2368 // Set the 'has_shutdown' flag, so any further attempt to shutdown
2370 this->has_shutdown_
= true;
2372 // need to release the mutex, because some of the shutdown
2373 // operations invoke application code, that could (and in practice
2374 // does!) callback into ORB Core code.
2377 this->adapter_registry_
.close (wait_for_completion
);
2379 // Shutdown reactor.
2380 this->thread_lane_resources_manager ().shutdown_reactor ();
2382 // Cleanup transports
2383 this->thread_lane_resources_manager ().close_all_transports ();
2385 // Grab the thread manager
2386 ACE_Thread_Manager
*tm
= this->thr_mgr ();
2388 // Try to cancel all the threads in the ORB.
2391 // If <wait_for_completion> is set, wait for all threads to exit.
2392 if (wait_for_completion
== true)
2395 // Explicitly destroy the valuetype adapter
2397 ACE_GUARD (TAO_SYNCH_MUTEX
, monitor
, this->lock_
);
2399 delete this->valuetype_adapter_
;
2400 this->valuetype_adapter_
= nullptr;
2403 // Explicitly destroy the object reference table since it
2404 // contains references to objects, which themselves may contain
2405 // reference to this ORB.
2406 this->object_ref_table_
.destroy ();
2408 // Release implrepo_service_ if one existed. If everything went
2409 // fine then this must release reference from implrepo_service_
2410 // object to this orb core.
2411 ::CORBA::release (this->implrepo_service_
);
2412 this->implrepo_service_
= CORBA::Object::_nil ();
2414 #if (TAO_HAS_INTERCEPTORS == 1)
2415 CORBA::release (this->pi_current_
);
2416 this->pi_current_
= CORBA::Object::_nil ();
2417 #endif /* TAO_HAS_INTERCEPTORS == 1 */
2421 TAO_ORB_Core::destroy ()
2423 // All destroy() should do is (a) call shutdown() and (b) unbind()
2424 // from the ORB table. Nothing else should really be added to this
2425 // method. Everything else should go to the shutdown() method.
2426 // Remember when the ORB Core is finally removed from the ORB table,
2427 // the reference count goes to zero and fini() is called. fini()
2428 // calls shutdown() and does not call destroy() since destroy() will
2429 // try to unbind from the ORB table again. Additional code should
2430 // not be added to destroy() since there is no guarantee that
2431 // orb->destroy() will ever be called by the user. Since TAO
2432 // guarantees that shutdown() will be called, all cleanup code
2436 // Shutdown the ORB and block until the shutdown is complete.
2437 this->shutdown (true);
2439 // Invoke Interceptor::destroy() on all registered interceptors.
2440 this->destroy_interceptors ();
2442 // Clean TSS resources. This cannot be done in shutdown() since the later
2443 // can be called during an upcall and once it's done it will remove
2444 // resources such as PICurrent that are required after the upcall. And this
2445 // cannot be postponed to TAO_ORB_Core's destructor as fini() needs access
2446 // to orb core and what is more important orb core can be destroyed too late
2447 // when some required libraries are already unloaded and we'll get
2448 // 'pure virtual method called' during cleanup.
2449 this->get_tss_resources ()->fini ();
2451 // Now remove it from the ORB table so that it's ORBid may be
2453 TAO::ORB_Table::instance ()->unbind (this->orbid_
);
2457 TAO_ORB_Core::check_shutdown ()
2459 if (this->has_shutdown ())
2461 // As defined by the CORBA 2.3 specification, throw a
2462 // CORBA::BAD_INV_ORDER exception with minor code 4 if the ORB
2463 // has shutdown by the time an ORB function is called.
2465 throw ::CORBA::BAD_INV_ORDER (CORBA::OMGVMCID
| 4, CORBA::COMPLETED_NO
);
2470 TAO_ORB_Core::destroy_interceptors ()
2474 ACE_GUARD (TAO_SYNCH_MUTEX
, monitor
, this->lock_
);
2476 #if TAO_HAS_INTERCEPTORS == 1
2477 if (this->client_request_interceptor_adapter_
!= nullptr)
2479 this->client_request_interceptor_adapter_
->destroy_interceptors ();
2481 delete this->client_request_interceptor_adapter_
;
2482 this->client_request_interceptor_adapter_
= nullptr;
2485 if (this->server_request_interceptor_adapter_
!= nullptr)
2487 this->server_request_interceptor_adapter_
->destroy_interceptors ();
2489 delete this->server_request_interceptor_adapter_
;
2490 this->server_request_interceptor_adapter_
= nullptr;
2493 #endif /* TAO_HAS_INTERCEPTORS == 1 */
2495 if (this->ior_interceptor_adapter_
!= nullptr)
2497 this->ior_interceptor_adapter_
->destroy_interceptors ();
2499 this->ior_interceptor_adapter_
= nullptr;
2505 // .. catch all the exceptions..
2506 if (TAO_debug_level
> 3)
2508 TAOLIB_DEBUG ((LM_DEBUG
,
2509 ACE_TEXT ("TAO (%P|%t) - Exception in TAO_ORB_Core")
2510 ACE_TEXT ("::destroy_interceptors ()\n")));
2517 TAO_Thread_Lane_Resources
&
2518 TAO_ORB_Core::lane_resources ()
2520 return this->thread_lane_resources_manager ().lane_resources ();
2524 TAO_ORB_Core::resolve_typecodefactory_i ()
2526 TAO_Object_Loader
*loader
=
2527 ACE_Dynamic_Service
<TAO_Object_Loader
>::instance
2528 (this->configuration (),
2529 ACE_TEXT ("TypeCodeFactory_Loader"));
2531 if (loader
== nullptr)
2533 this->configuration ()->process_directive
2534 (ACE_DYNAMIC_VERSIONED_SERVICE_DIRECTIVE("TypeCodeFactory",
2535 "TAO_TypeCodeFactory",
2537 "_make_TAO_TypeCodeFactory_Loader",
2540 ACE_Dynamic_Service
<TAO_Object_Loader
>::instance
2541 (this->configuration (),
2542 ACE_TEXT ("TypeCodeFactory_Loader"));
2544 if (loader
== nullptr)
2546 TAOLIB_ERROR ((LM_ERROR
,
2547 ACE_TEXT ("TAO (%P|%t) Unable to instantiate ")
2548 ACE_TEXT ("a TypeCodeFactory_Loader\n")));
2549 throw ::CORBA::ORB::InvalidName ();
2553 this->typecode_factory_
=
2554 loader
->create_object (this->orb_
, 0, nullptr);
2558 TAO_ORB_Core::resolve_codecfactory_i ()
2560 TAO_Object_Loader
*loader
=
2561 ACE_Dynamic_Service
<TAO_Object_Loader
>::instance
2562 (this->configuration (),
2563 ACE_TEXT ("CodecFactory_Loader"));
2565 if (loader
== nullptr)
2567 this->configuration()->process_directive
2568 (ACE_DYNAMIC_VERSIONED_SERVICE_DIRECTIVE("CodecFactory",
2571 "_make_TAO_CodecFactory_Loader",
2574 ACE_Dynamic_Service
<TAO_Object_Loader
>::instance
2575 (this->configuration (), ACE_TEXT ("CodecFactory_Loader"));
2578 if (loader
!= nullptr)
2580 this->codec_factory_
=
2581 loader
->create_object (this->orb_
, 0, nullptr);
2586 TAO_ORB_Core::resolve_compression_manager_i ()
2588 TAO_Object_Loader
*loader
=
2589 ACE_Dynamic_Service
<TAO_Object_Loader
>::instance
2590 (this->configuration (),
2591 ACE_TEXT ("Compression_Loader"));
2593 if (loader
== nullptr)
2595 this->configuration()->process_directive
2596 (ACE_DYNAMIC_VERSIONED_SERVICE_DIRECTIVE("Compression",
2599 "_make_TAO_Compression_Loader",
2602 ACE_Dynamic_Service
<TAO_Object_Loader
>::instance
2603 (this->configuration (), ACE_TEXT ("Compression_Loader"));
2606 if (loader
!= nullptr)
2608 this->compression_manager_
= loader
->create_object (this->orb_
, 0, nullptr);
2613 TAO_ORB_Core::resolve_poa_current_i ()
2615 TAO_Object_Loader
*loader
=
2616 ACE_Dynamic_Service
<TAO_Object_Loader
>::instance
2617 (this->configuration(),
2618 ACE_TEXT ("TAO_POA_Current_Factory"));
2620 if (loader
== nullptr)
2622 this->configuration()->process_directive
2623 (ACE_DYNAMIC_VERSIONED_SERVICE_DIRECTIVE("TAO_POA_Current_Factory",
2624 "TAO_PortableServer",
2626 "_make_TAO_POA_Current_Factory",
2629 ACE_Dynamic_Service
<TAO_Object_Loader
>::instance
2630 (this->configuration(), ACE_TEXT ("TAO_POA_Current_Factory"));
2633 if (loader
!= nullptr)
2635 this->poa_current_
= loader
->create_object (this->orb_
, 0, nullptr);
2640 #if TAO_HAS_INTERCEPTORS == 1
2643 TAO_ORB_Core::resolve_picurrent_i ()
2645 TAO_Object_Loader
*loader
=
2646 ACE_Dynamic_Service
<TAO_Object_Loader
>::instance
2647 (this->configuration (),
2648 ACE_TEXT ("PICurrent_Loader"));
2650 if (loader
== nullptr)
2652 this->configuration ()->process_directive
2653 (ACE_DYNAMIC_VERSIONED_SERVICE_DIRECTIVE("PICurrent_Loader",
2656 "_make_TAO_PICurrent_Loader",
2659 ACE_Dynamic_Service
<TAO_Object_Loader
>::instance
2660 (this->configuration (), ACE_TEXT ("PICurrent_Loader"));
2663 if (loader
!= nullptr)
2665 CORBA::Object_ptr pi
= loader
->create_object (this->orb_
, 0, nullptr);
2667 this->pi_current_
= pi
;
2671 #endif /* TAO_HAS_INTERCEPTORS == 1 */
2675 TAO_ORB_Core::resolve_dynanyfactory_i ()
2677 TAO_Object_Loader
*loader
=
2678 ACE_Dynamic_Service
<TAO_Object_Loader
>::instance
2679 (this->configuration (),
2680 ACE_TEXT ("DynamicAny_Loader"));
2682 if (loader
== nullptr)
2684 this->configuration ()->process_directive
2685 (ACE_DYNAMIC_VERSIONED_SERVICE_DIRECTIVE("DynamicAny_Loader",
2688 "_make_TAO_DynamicAny_Loader",
2691 ACE_Dynamic_Service
<TAO_Object_Loader
>::instance
2692 (this->configuration (),
2693 ACE_TEXT ("DynamicAny_Loader"));
2696 if (loader
!= nullptr)
2698 this->dynany_factory_
= loader
->create_object (this->orb_
, 0, nullptr);
2703 TAO_ORB_Core::resolve_iormanipulation_i ()
2705 TAO_Object_Loader
*loader
=
2706 ACE_Dynamic_Service
<TAO_Object_Loader
>::instance
2707 (this->configuration (),
2708 ACE_TEXT ("IORManip_Loader"));
2710 if (loader
== nullptr)
2712 this->configuration()->process_directive
2713 (ACE_DYNAMIC_VERSIONED_SERVICE_DIRECTIVE("IORManip_Loader",
2716 "_make_TAO_IORManip_Loader",
2719 ACE_Dynamic_Service
<TAO_Object_Loader
>::instance
2720 (this->configuration (), ACE_TEXT ("IORManip_Loader"));
2723 if (loader
!= nullptr)
2725 this->ior_manip_factory_
= loader
->create_object (this->orb_
, 0, nullptr);
2730 TAO_ORB_Core::resolve_ior_table_i ()
2732 TAO_Adapter_Factory
*factory
=
2733 ACE_Dynamic_Service
<TAO_Adapter_Factory
>::instance
2734 (this->configuration (), ACE_TEXT("TAO_IORTable"));
2735 if (factory
== nullptr)
2737 this->configuration ()->process_directive
2738 (ACE_DYNAMIC_VERSIONED_SERVICE_DIRECTIVE("TAO_IORTable",
2741 "_make_TAO_Table_Adapter_Factory",
2744 ACE_Dynamic_Service
<TAO_Adapter_Factory
>::instance
2745 (this->configuration (), ACE_TEXT("TAO_IORTable"));
2748 if (factory
!= nullptr)
2750 std::unique_ptr
<TAO_Adapter
> iortable_adapter (factory
->create (this));
2751 iortable_adapter
->open ();
2753 CORBA::Object_var tmp_root
= iortable_adapter
->root ();
2755 this->adapter_registry_
.insert (iortable_adapter
.get ());
2757 // It is now (exception) safe to release ownership from the unique pointers
2758 this->ior_table_
= tmp_root
._retn ();
2759 iortable_adapter
.release ();
2764 TAO_ORB_Core::resolve_async_ior_table_i ()
2766 TAO_Adapter_Factory
*factory
=
2767 ACE_Dynamic_Service
<TAO_Adapter_Factory
>::instance
2768 (this->configuration (), ACE_TEXT("TAO_Async_IORTable"));
2769 if (factory
== nullptr)
2771 this->configuration ()->process_directive
2772 (ACE_DYNAMIC_VERSIONED_SERVICE_DIRECTIVE("TAO_Async_IORTable",
2773 "TAO_Async_IORTable",
2775 "_make_TAO_Async_Table_Adapter_Factory",
2778 ACE_Dynamic_Service
<TAO_Adapter_Factory
>::instance
2779 (this->configuration (), ACE_TEXT("TAO_Async_IORTable"));
2782 if (factory
!= nullptr)
2784 std::unique_ptr
<TAO_Adapter
> iortable_adapter (factory
->create (this));
2785 iortable_adapter
->open ();
2787 CORBA::Object_var tmp_root
= iortable_adapter
->root ();
2789 this->adapter_registry_
.insert (iortable_adapter
.get ());
2791 // It is now (exception) safe to release ownership from the unique pointers
2792 this->async_ior_table_
= tmp_root
._retn ();
2793 iortable_adapter
.release ();
2798 TAO_ORB_Core::resolve_monitor_i ()
2800 TAO_Object_Loader
*loader
=
2801 ACE_Dynamic_Service
<TAO_Object_Loader
>::instance
2802 (this->configuration (),
2803 ACE_TEXT ("Monitor_Init"));
2805 if (loader
== nullptr)
2807 this->configuration ()->process_directive
2808 (ACE_DYNAMIC_VERSIONED_SERVICE_DIRECTIVE("Monitor_Init",
2811 "_make_TAO_Monitor_Init",
2814 ACE_Dynamic_Service
<TAO_Object_Loader
>::instance
2815 (this->configuration (),
2816 ACE_TEXT ("Monitor_Init"));
2819 if (loader
!= nullptr)
2821 this->monitor_
= loader
->create_object (this->orb_
, 0, nullptr);
2826 TAO_ORB_Core::set_endpoint_helper (const ACE_CString
&lane
,
2827 const ACE_CString
&endpoints
)
2829 if (this->orb_params ()->add_endpoints (lane
, endpoints
) != 0)
2831 TAOLIB_ERROR ((LM_ERROR
,
2832 ACE_TEXT ("(%P|%t) ")
2833 ACE_TEXT ("Invalid endpoint(s) specified: <%C>.\n"),
2834 endpoints
.c_str ()));
2835 throw ::CORBA::BAD_PARAM (
2836 CORBA::SystemException::_tao_minor_code (
2837 TAO_ORB_CORE_INIT_LOCATION_CODE
,
2839 CORBA::COMPLETED_NO
);
2846 TAO_ORB_Core::resolve_rir (const char *name
)
2848 // Get the table of initial references specified through
2851 ACE_CString
object_id ((const char *) name
);
2853 // Get the list of initial reference prefixes specified through
2854 // -ORBDefaultInitRef.
2855 CORBA::String_var default_init_ref
=
2856 this->orb_params ()->default_init_ref ();
2858 // Check if a DefaultInitRef was specified.
2859 if (std::strlen (default_init_ref
.in ()) != 0)
2861 static const char corbaloc_prefix
[] = "corbaloc:";
2862 static const char mcast_prefix
[] = "mcast:";
2863 char object_key_delimiter
= 0;
2865 ACE_CString
list_of_profiles (default_init_ref
.in ());
2867 // Check if the protocol is corbaloc: or mcast:.
2868 // If it is, set the object_key_delimiter.
2869 if ((ACE_OS::strncmp (default_init_ref
.in (),
2871 sizeof corbaloc_prefix
-1) == 0) ||
2872 (ACE_OS::strncmp (default_init_ref
.in (),
2874 sizeof mcast_prefix
-1) == 0))
2876 object_key_delimiter
= '/';
2880 TAO_Connector_Registry
*conn_reg
= this->connector_registry ();
2882 // Obtain the appropriate object key delimiter for the
2883 // specified protocol.
2884 object_key_delimiter
=
2885 conn_reg
->object_key_delimiter (list_of_profiles
.c_str ());
2888 // Make sure that the default initial reference doesn't end
2889 // with the object key delimiter character.
2890 if (list_of_profiles
[list_of_profiles
.length() - 1] !=
2891 object_key_delimiter
)
2892 list_of_profiles
+= ACE_CString (object_key_delimiter
);
2894 list_of_profiles
+= object_id
;
2896 return this->orb ()->string_to_object (list_of_profiles
.c_str ());
2899 return CORBA::Object::_nil ();
2902 CORBA::ORB::ObjectIdList
*
2903 TAO_ORB_Core::list_initial_references ()
2905 // Unsupported initial services should NOT be included in the below list!
2906 static const char *initial_services
[] = { TAO_LIST_OF_INITIAL_SERVICES
};
2907 // Make sure the "terminating" zero is the last array element so
2908 // that there is a stop condition when iterating through the list.
2910 static const size_t initial_services_size
=
2911 sizeof (initial_services
) / sizeof (initial_services
[0]);
2913 const size_t total_size
=
2914 initial_services_size
2915 + this->init_ref_map_
.size ()
2916 + this->object_ref_table_
.current_size ();
2918 CORBA::ORB::ObjectIdList
*tmp
= nullptr;
2920 ACE_NEW_THROW_EX (tmp
,
2921 CORBA::ORB::ObjectIdList (
2922 static_cast<CORBA::ULong
> (total_size
)),
2923 CORBA::NO_MEMORY ());
2925 CORBA::ORB::ObjectIdList_var
list (tmp
);
2926 list
->length (static_cast<CORBA::ULong
> (total_size
));
2928 CORBA::ULong index
= 0;
2929 // Index for ObjectIdList members.
2931 // Iterate over the registered initial references.
2932 for (index
= 0; index
< initial_services_size
; ++index
)
2933 list
[index
] = initial_services
[index
];
2935 // Now iterate over the initial references created by the user and
2936 // add them to the sequence.
2938 // References registered via
2939 // ORBInitInfo::register_initial_reference().
2940 TAO_Object_Ref_Table::iterator
const obj_ref_end
=
2941 this->object_ref_table_
.end ();
2943 for (TAO_Object_Ref_Table::iterator i
= this->object_ref_table_
.begin ();
2946 list
[index
] = CORBA::string_dup ((*i
).first
.in ());
2948 // References registered via INS.
2949 InitRefMap::iterator
const end
= this->init_ref_map_
.end ();
2951 for (InitRefMap::iterator j
= this-> init_ref_map_
.begin ();
2954 list
[index
] = (*j
).first
.c_str ();
2956 return list
._retn ();
2959 // ****************************************************************
2961 TAO_ORB_Core::input_cdr_dblock_allocator ()
2963 return this->lane_resources ().input_cdr_dblock_allocator ();
2967 TAO_ORB_Core::input_cdr_buffer_allocator ()
2969 return this->lane_resources ().input_cdr_buffer_allocator ();
2973 TAO_ORB_Core::input_cdr_msgblock_allocator ()
2975 return this->lane_resources ().input_cdr_msgblock_allocator ();
2979 TAO_ORB_Core::output_cdr_dblock_allocator ()
2981 return this->lane_resources ().output_cdr_dblock_allocator ();
2985 TAO_ORB_Core::output_cdr_buffer_allocator ()
2987 return this->lane_resources ().output_cdr_buffer_allocator ();
2992 TAO_ORB_Core::output_cdr_msgblock_allocator ()
2994 return this->lane_resources ().output_cdr_msgblock_allocator ();
2999 TAO_ORB_Core::transport_message_buffer_allocator ()
3001 return this->lane_resources ().transport_message_buffer_allocator ();
3006 TAO_ORB_Core::create_input_cdr_data_block (size_t size
)
3008 ACE_Allocator
*dblock_allocator
= nullptr;
3009 ACE_Allocator
*buffer_allocator
= nullptr;
3012 this->input_cdr_dblock_allocator ();
3014 this->input_cdr_buffer_allocator ();
3016 ACE_Lock
* lock_strategy
= nullptr;
3017 if (this->resource_factory ()->use_locked_data_blocks ())
3019 lock_strategy
= &this->data_block_lock_
;
3022 return this->create_data_block_i (size
,
3029 TAO_ORB_Core::create_data_block_i (size_t size
,
3030 ACE_Allocator
*buffer_allocator
,
3031 ACE_Allocator
*dblock_allocator
,
3032 ACE_Lock
*lock_strategy
)
3034 ACE_Data_Block
*nb
= nullptr;
3036 ACE_NEW_MALLOC_RETURN (
3038 static_cast<ACE_Data_Block
*> (
3039 dblock_allocator
->malloc (sizeof (ACE_Data_Block
))),
3040 ACE_Data_Block (size
,
3041 ACE_Message_Block::MB_DATA
,
3052 TAO_Connector_Registry
*
3053 TAO_ORB_Core::connector_registry ()
3055 TAO_Connector_Registry
*conn
=
3056 this->lane_resources ().connector_registry ();
3061 TAO_GIOP_Fragmentation_Strategy
*
3062 TAO_ORB_Core::fragmentation_strategy (TAO_Transport
* transport
)
3065 this->resource_factory ()->create_fragmentation_strategy (
3067 this->orb_params_
.max_message_size ());
3071 TAO_ORB_Core::reactor ()
3073 return this->leader_follower ().reactor ();
3077 TAO_ORB_Core::implrepo_service ()
3079 if (!this->use_implrepo_
)
3080 return CORBA::Object::_nil ();
3082 if (CORBA::is_nil (this->implrepo_service_
))
3086 CORBA::Object_var temp
=
3087 this->orb_
->resolve_initial_references ("ImplRepoService");
3089 ACE_GUARD_RETURN (TAO_SYNCH_MUTEX
, ace_mon
, this->lock_
, CORBA::Object::_nil ());
3091 // @@ Worry about assigning a different IOR? (brunsch)
3092 this->implrepo_service_
= temp
._retn ();
3094 catch (const ::CORBA::Exception
&)
3096 // Just make sure that we have a null pointer. Ignore the exception
3098 this->implrepo_service_
= CORBA::Object::_nil ();
3102 return CORBA::Object::_duplicate (this->implrepo_service_
);
3106 TAO_ORB_Core::default_sync_scope_hook (TAO_ORB_Core
*oc
,
3108 bool &has_synchronization
,
3109 Messaging::SyncScope
&scope
)
3111 has_synchronization
= true;
3112 scope
= (oc
== nullptr) ? Messaging::SYNC_WITH_TRANSPORT
: oc
->default_sync_scope_
;
3116 TAO_ORB_Core::call_sync_scope_hook (TAO_Stub
*stub
,
3117 bool &has_synchronization
,
3118 Messaging::SyncScope
&scope
)
3120 Sync_Scope_Hook sync_scope_hook
= this->sync_scope_hook_
;
3122 if (sync_scope_hook
== nullptr)
3124 has_synchronization
= false;
3128 (*sync_scope_hook
) (this, stub
, has_synchronization
, scope
);
3131 #if (TAO_HAS_BUFFERING_CONSTRAINT_POLICY == 1)
3133 TAO::Transport_Queueing_Strategy
*
3134 TAO_ORB_Core::get_transport_queueing_strategy (TAO_Stub
*,
3135 Messaging::SyncScope
&scope
)
3139 case Messaging::SYNC_WITH_TRANSPORT
:
3140 case Messaging::SYNC_WITH_SERVER
:
3141 case Messaging::SYNC_WITH_TARGET
:
3143 return this->flush_transport_queueing_strategy_
;
3146 case Messaging::SYNC_NONE
:
3148 return this->eager_transport_queueing_strategy_
;
3151 case TAO::SYNC_DELAYED_BUFFERING
:
3153 return this->delayed_transport_queueing_strategy_
;
3163 #endif /* TAO_HAS_BUFFERING_CONSTRAINT_POLICY == 1 */
3166 TAO_ORB_Core::add_tss_cleanup_func (ACE_CLEANUP_FUNC cleanup
, size_t &slot_id
)
3168 return this->tss_cleanup_funcs_
.register_cleanup_function (cleanup
, slot_id
);
3172 TAO_ORB_Core::call_timeout_hook (TAO_Stub
*stub
,
3174 ACE_Time_Value
&time_value
)
3176 Timeout_Hook timeout_hook
= this->timeout_hook_
;
3178 if (timeout_hook
== nullptr)
3180 has_timeout
= false;
3183 (*timeout_hook
) (this, stub
, has_timeout
, time_value
);
3187 TAO_ORB_Core::connection_timeout (TAO_Stub
*stub
,
3189 ACE_Time_Value
&time_value
)
3191 Timeout_Hook connection_timeout_hook
=
3192 TAO_ORB_Core_Static_Resources::instance ()->connection_timeout_hook_
;
3194 if (connection_timeout_hook
== nullptr)
3196 has_timeout
= false;
3200 (*connection_timeout_hook
) (this, stub
, has_timeout
, time_value
);
3202 Timeout_Hook alt_connection_timeout_hook
=
3203 TAO_ORB_Core_Static_Resources::instance ()->alt_connection_timeout_hook_
;
3205 if (alt_connection_timeout_hook
== nullptr)
3208 if (!has_timeout
|| time_value
== ACE_Time_Value::zero
)
3210 (*alt_connection_timeout_hook
) (this, stub
, has_timeout
,time_value
);
3214 // At this point, both the primary and alternate hooks are defined, and
3215 // the primary did indeed set a value
3218 (*alt_connection_timeout_hook
) (this, stub
, ht1
,tv1
);
3219 if (ht1
&& tv1
> ACE_Time_Value::zero
&& tv1
< time_value
)
3224 TAO_ORB_Core::connection_timeout_hook (Timeout_Hook hook
)
3226 // Saving the hook pointer so that we can use it later when needed.
3227 // For now there are only two entry points that may supply a connection
3228 // timeout hook. But there might be future entry points, so this should
3229 // probably be addressed by a more sophisticated mechanism.
3231 #define TOCSRi TAO_ORB_Core_Static_Resources::instance ()
3233 // A concern was raised that since this function is called by two
3234 // different initializers there may be a race condition that might
3235 // require a lock. We are not using a lock at this time because of
3236 // two callers, one happens only during service directive processing
3237 // and the other only during ORB Initialization time. The former
3238 // happens when the OC_Endpoint_Selector_Factory is loaded, the
3239 // latter is part of the messaging library. The messaging library
3240 // calls this function as part of pre_init processing, and this call
3241 // happens for every ORB instance. This was the case before these The
3242 // latter call occurs when the messaging library is loaded. The
3243 // redundant calls occurred then as well. Second, it isn't clear how
3244 // a lock in this static method would react in the face of windows
3245 // dlls, shared memory segments, etc. Therefore we are continuing to
3246 // keep this code lockless as it always was, assuming no
3247 // simultaneous overwrite will occur.
3248 if (TOCSRi
->connection_timeout_hook_
== nullptr)
3250 if (TAO_debug_level
> 2)
3252 TAOLIB_DEBUG ((LM_DEBUG
,
3253 ACE_TEXT("TAO (%P|%t) - Setting primary connection ")
3254 ACE_TEXT("timeout hook\n")));
3256 TOCSRi
->connection_timeout_hook_
= hook
;
3258 else if (TOCSRi
->connection_timeout_hook_
!= hook
&&
3259 TOCSRi
->alt_connection_timeout_hook_
== nullptr)
3261 if (TAO_debug_level
> 2)
3263 TAOLIB_DEBUG ((LM_DEBUG
,
3264 ACE_TEXT("TAO (%P|%t) - Setting alternate connection ")
3265 ACE_TEXT("timeout hook\n")));
3267 TOCSRi
->alt_connection_timeout_hook_
= hook
;
3270 if (TAO_debug_level
> 2)
3272 TAOLIB_DEBUG ((LM_DEBUG
,
3273 ACE_TEXT ("TAO (%P|%t) - Not overwriting alternate ")
3274 ACE_TEXT ("connection timeout hook. It is %@\n"),
3275 TOCSRi
->alt_connection_timeout_hook_
));
3281 #if (TAO_HAS_CORBA_MESSAGING == 1)
3284 TAO_ORB_Core::get_policy (CORBA::PolicyType type
)
3286 CORBA::Policy_var result
;
3288 TAO_Policy_Manager
*policy_manager
= this->policy_manager ();
3289 if (policy_manager
!= nullptr)
3291 result
= policy_manager
->get_policy (type
);
3294 if (CORBA::is_nil (result
.in ()))
3296 result
= this->get_default_policies ()->get_policy (type
);
3299 return result
._retn ();
3303 TAO_ORB_Core::get_policy_including_current (CORBA::PolicyType type
)
3305 TAO_Policy_Current
&policy_current
= this->policy_current ();
3307 CORBA::Policy_var result
= policy_current
.get_policy (type
);
3309 if (CORBA::is_nil (result
.in ()))
3311 result
= this->get_policy (type
);
3314 return result
._retn ();
3318 TAO_ORB_Core::get_cached_policy (TAO_Cached_Policy_Type type
)
3320 CORBA::Policy_var result
;
3322 TAO_Policy_Manager
*policy_manager
= this->policy_manager ();
3323 if (policy_manager
!= nullptr)
3325 result
= policy_manager
->get_cached_policy (type
);
3328 if (CORBA::is_nil (result
.in ()))
3330 result
= this->get_default_policies ()->get_cached_policy (type
);
3333 return result
._retn ();
3337 TAO_ORB_Core::get_cached_policy_including_current (TAO_Cached_Policy_Type type
)
3339 TAO_Policy_Current
&policy_current
= this->policy_current ();
3341 CORBA::Policy_var result
= policy_current
.get_cached_policy (type
);
3343 if (CORBA::is_nil (result
.in ()))
3345 result
= this->get_cached_policy (type
);
3348 return result
._retn ();
3351 #endif /* (TAO_HAS_CORBA_MESSAGING == 1) */
3353 CORBA::Environment
*
3354 TAO_ORB_Core::default_environment () const
3356 return TAO_TSS_Resources::instance ()->default_environment_
;
3360 TAO_ORB_Core::default_environment (CORBA::Environment
*env
)
3362 TAO_TSS_Resources::instance ()->default_environment_
= env
;
3366 TAO_ORB_Core::add_interceptor (
3367 PortableInterceptor::IORInterceptor_ptr interceptor
)
3369 if (this->ior_interceptor_adapter ())
3371 this->ior_interceptor_adapter_
->add_interceptor (interceptor
);
3375 TAOLIB_ERROR ((LM_ERROR
,
3376 ACE_TEXT ("TAO (%P|%t) - %p\n"),
3377 ACE_TEXT ("ERROR: ORB Core unable to find the ")
3378 ACE_TEXT ("IORInterceptor Adapter Factory instance")));
3380 throw ::CORBA::INTERNAL ();
3384 TAO_IORInterceptor_Adapter
*
3385 TAO_ORB_Core::ior_interceptor_adapter ()
3387 if (this->ior_interceptor_adapter_
== nullptr)
3389 ACE_GUARD_RETURN (TAO_SYNCH_MUTEX
,
3394 if (this->ior_interceptor_adapter_
== nullptr)
3398 TAO_IORInterceptor_Adapter_Factory
* ior_ap_factory
=
3399 ACE_Dynamic_Service
<TAO_IORInterceptor_Adapter_Factory
>::instance
3400 (this->configuration (),
3401 ACE_TEXT_CHAR_TO_TCHAR (TAO_ORB_Core::iorinterceptor_adapter_factory_name ()));
3405 this->ior_interceptor_adapter_
= ior_ap_factory
->create ();
3408 catch (const ::CORBA::Exception
& ex
)
3410 ex
._tao_print_exception (
3411 "Cannot initialize the ior_interceptor_adapter\n");
3416 return this->ior_interceptor_adapter_
;
3419 #if TAO_HAS_INTERCEPTORS == 1
3422 TAO_ORB_Core::add_interceptor (
3423 PortableInterceptor::ClientRequestInterceptor_ptr interceptor
3426 if (this->clientrequestinterceptor_adapter_i ())
3428 this->client_request_interceptor_adapter_
->add_interceptor (interceptor
);
3432 TAOLIB_ERROR ((LM_ERROR
,
3433 ACE_TEXT ("TAO (%P|%t) - %p\n"),
3434 ACE_TEXT ("ERROR: ORB Core unable to find the ")
3435 ACE_TEXT ("Client Request Interceptor Adapter Factory ")
3436 ACE_TEXT ("instance")));
3438 throw ::CORBA::INTERNAL ();
3442 TAO::ClientRequestInterceptor_Adapter
*
3443 TAO_ORB_Core::clientrequestinterceptor_adapter_i ()
3445 if (this->client_request_interceptor_adapter_
== nullptr)
3447 ACE_GUARD_RETURN (TAO_SYNCH_MUTEX
,
3452 if (this->client_request_interceptor_adapter_
== nullptr)
3454 TAO_ClientRequestInterceptor_Adapter_Factory
*factory
=
3455 ACE_Dynamic_Service
<TAO_ClientRequestInterceptor_Adapter_Factory
>::instance
3456 (this->configuration (),
3457 ACE_TEXT ("ClientRequestInterceptor_Adapter_Factory"));
3461 this->client_request_interceptor_adapter_
=
3467 return this->client_request_interceptor_adapter_
;
3471 TAO_ORB_Core::add_interceptor (
3472 PortableInterceptor::ServerRequestInterceptor_ptr interceptor
3475 if (this->serverrequestinterceptor_adapter_i ())
3477 this->server_request_interceptor_adapter_
->add_interceptor (interceptor
);
3481 TAOLIB_ERROR ((LM_ERROR
,
3482 ACE_TEXT ("TAO (%P|%t) - %p\n"),
3483 ACE_TEXT ("ERROR: ORB Core unable to find the ")
3484 ACE_TEXT ("Server Request Interceptor Adapter Factory ")
3485 ACE_TEXT ("instance")));
3487 throw ::CORBA::INTERNAL ();
3492 TAO_ORB_Core::add_interceptor (
3493 PortableInterceptor::ClientRequestInterceptor_ptr interceptor
,
3494 const CORBA::PolicyList
& policies
)
3496 if (this->clientrequestinterceptor_adapter_i ())
3498 this->client_request_interceptor_adapter_
->add_interceptor (
3504 TAOLIB_ERROR ((LM_ERROR
,
3505 ACE_TEXT ("TAO (%P|%t) - %p\n"),
3506 ACE_TEXT ("ERROR: ORB Core unable to find the ")
3507 ACE_TEXT ("Client Request Interceptor Adapter Factory ")
3508 ACE_TEXT ("instance")));
3510 throw ::CORBA::INTERNAL ();
3515 TAO_ORB_Core::add_interceptor (
3516 PortableInterceptor::ServerRequestInterceptor_ptr interceptor
,
3517 const CORBA::PolicyList
& policies
)
3519 if (this->serverrequestinterceptor_adapter_i ())
3521 this->server_request_interceptor_adapter_
->add_interceptor (
3527 TAOLIB_ERROR ((LM_ERROR
,
3528 ACE_TEXT ("TAO (%P|%t) - %p\n"),
3529 ACE_TEXT ("ERROR: ORB Core unable to find the ")
3530 ACE_TEXT ("Server Request Interceptor Adapter Factory ")
3531 ACE_TEXT ("instance")));
3533 throw ::CORBA::INTERNAL ();
3537 TAO::ServerRequestInterceptor_Adapter
*
3538 TAO_ORB_Core::serverrequestinterceptor_adapter_i ()
3540 if (this->server_request_interceptor_adapter_
== nullptr)
3542 ACE_GUARD_RETURN (TAO_SYNCH_MUTEX
,
3547 if (this->server_request_interceptor_adapter_
== nullptr)
3549 TAO_ServerRequestInterceptor_Adapter_Factory
*factory
=
3550 ACE_Dynamic_Service
<TAO_ServerRequestInterceptor_Adapter_Factory
>::instance
3551 (this->configuration (),
3552 ACE_TEXT ("ServerRequestInterceptor_Adapter_Factory"));
3556 this->server_request_interceptor_adapter_
=
3562 return this->server_request_interceptor_adapter_
;
3565 #endif /* TAO_HAS_INTERCEPTORS == 1 */
3567 TAO_Valuetype_Adapter
*
3568 TAO_ORB_Core::valuetype_adapter ()
3570 if (this->valuetype_adapter_
== nullptr)
3572 ACE_GUARD_RETURN (TAO_SYNCH_MUTEX
,
3577 if (this->valuetype_adapter_
== nullptr)
3581 TAO_Valuetype_Adapter_Factory
* vt_ap_factory
=
3582 ACE_Dynamic_Service
<TAO_Valuetype_Adapter_Factory
>::instance (
3583 TAO_ORB_Core::valuetype_adapter_factory_name ());
3587 this->valuetype_adapter_
= vt_ap_factory
->create ();
3590 catch (const ::CORBA::Exception
& ex
)
3592 ex
._tao_print_exception (
3593 "Cannot initialize the valuetype_adapter\n");
3597 if (this->valuetype_adapter_
== nullptr)
3599 throw ::CORBA::INTERNAL ();
3603 return this->valuetype_adapter_
;
3606 // *************************************************************
3607 // Valuetype factory operations
3608 // *************************************************************
3610 #if !defined(CORBA_E_MICRO)
3612 TAO_ORB_Core::register_value_factory (const char *repository_id
,
3613 CORBA::ValueFactory factory
)
3615 if (this->valuetype_adapter ())
3617 ACE_GUARD_RETURN (TAO_SYNCH_MUTEX
, ace_mon
, this->lock_
, nullptr);
3619 if (this->valuetype_adapter_
== nullptr)
3625 this->valuetype_adapter_
->vf_map_rebind (repository_id
, factory
);
3627 if (result
== 0) // No previous factory found
3635 throw ::CORBA::MARSHAL ();
3639 return factory
; // previous factory was found
3643 #if !defined(CORBA_E_MICRO)
3645 TAO_ORB_Core::unregister_value_factory (const char *repository_id
)
3647 if (this->valuetype_adapter ())
3649 ACE_GUARD (TAO_SYNCH_MUTEX
, ace_mon
, this->lock_
);
3651 if (this->valuetype_adapter_
== nullptr)
3656 // Dont care whther it was successful or not!
3657 (void) this->valuetype_adapter_
->vf_map_unbind (repository_id
);
3662 #if !defined(CORBA_E_MICRO)
3664 TAO_ORB_Core::lookup_value_factory (const char *repository_id
)
3666 if (this->valuetype_adapter ())
3668 ACE_GUARD_RETURN (TAO_SYNCH_MUTEX
, ace_mon
, this->lock_
, nullptr);
3670 if (this->valuetype_adapter_
== nullptr)
3675 return this->valuetype_adapter_
->vf_map_find (repository_id
);
3682 // ****************************************************************
3684 TAO_Export TAO_ORB_Core
*
3685 TAO_ORB_Core_instance ()
3687 // @@ This is a slight violation of layering, we should use
3688 // TAO_ORB_Core_instance(), but that breaks during startup.
3689 TAO::ORB_Table
* const orb_table
= TAO::ORB_Table::instance ();
3690 if (orb_table
->first_orb () == nullptr)
3692 ACE_MT (ACE_GUARD_RETURN (TAO_SYNCH_RECURSIVE_MUTEX
, guard
,
3693 *ACE_Static_Object_Lock::instance (), nullptr));
3695 if (orb_table
->first_orb () == nullptr)
3697 // Calling CORBA::ORB_init() returns a duplicated ORB
3698 // reference, so make sure that reference is stored in an
3699 // ORB_var so that no leak occurs. The duplicate ORB
3700 // reference isn't needed outside the scope of this function
3701 // since the corresponding ORB Core instance will still
3702 // exist in the ORB table after the ORB reference is
3708 ACE_TCHAR
**const argv
= nullptr;
3709 CORBA::ORB_var orb
=
3710 CORBA::ORB_init (argc
, argv
);
3712 catch (const ::CORBA::Exception
&)
3714 // @@ What should we do here?
3719 return orb_table
->first_orb ();
3722 TAO_END_VERSIONED_NAMESPACE_DECL