1 #include "tao/RTCORBA/RT_Thread_Lane_Resources_Manager.h"
3 #if defined (TAO_HAS_CORBA_MESSAGING) && TAO_HAS_CORBA_MESSAGING != 0
5 #include "tao/ORB_Core.h"
6 #include "tao/ORB_Core_TSS_Resources.h"
7 #include "tao/Acceptor_Registry.h"
8 #include "tao/Thread_Lane_Resources.h"
9 #include "tao/RTCORBA/Thread_Pool.h"
10 #include "tao/LF_Follower.h"
11 #include "tao/Leader_Follower.h"
13 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
15 TAO_RT_Thread_Lane_Resources_Manager::TAO_RT_Thread_Lane_Resources_Manager (TAO_ORB_Core
&orb_core
)
16 : TAO_Thread_Lane_Resources_Manager (orb_core
),
17 default_lane_resources_ (0),
20 // Create the default resources.
21 ACE_NEW (this->default_lane_resources_
,
22 TAO_Thread_Lane_Resources (orb_core
));
24 // Create the thread-pool manager.
25 ACE_NEW (this->tp_manager_
,
26 TAO_Thread_Pool_Manager (orb_core
));
29 TAO_RT_Thread_Lane_Resources_Manager::~TAO_RT_Thread_Lane_Resources_Manager ()
31 // Delete the default resources.
32 delete this->default_lane_resources_
;
34 // Delete the thread-pool manager.
35 delete this->tp_manager_
;
39 TAO_RT_Thread_Lane_Resources_Manager::open_default_resources ()
41 TAO_ORB_Parameters
*params
=
42 this->orb_core_
->orb_params ();
44 TAO_EndpointSet endpoint_set
;
46 params
->get_endpoint_set (TAO_DEFAULT_LANE
, endpoint_set
);
48 bool ignore_address
= false;
51 this->default_lane_resources_
->open_acceptor_registry (endpoint_set
,
58 TAO_RT_Thread_Lane_Resources_Manager::finalize ()
60 // Finalize resources managed by the thread-pool manager.
61 this->tp_manager_
->finalize ();
63 // Finalize default resources.
64 this->default_lane_resources_
->finalize ();
68 TAO_RT_Thread_Lane_Resources_Manager::shutdown_reactor ()
70 // Shutdown default reactors.
71 this->default_lane_resources_
->shutdown_reactor ();
73 // Shutdown reactors managed by the thread-pool manager.
74 this->tp_manager_
->shutdown_reactor ();
78 TAO_RT_Thread_Lane_Resources_Manager::close_all_transports ()
80 // Shutdown default reactors.
81 this->default_lane_resources_
->close_all_transports ();
85 TAO_RT_Thread_Lane_Resources_Manager::is_collocated (const TAO_MProfile
&mprofile
)
88 this->default_lane_resources_
->is_collocated (mprofile
);
93 return this->tp_manager_
->is_collocated (mprofile
);
96 TAO_Thread_Lane_Resources
&
97 TAO_RT_Thread_Lane_Resources_Manager::lane_resources ()
99 // Get the ORB_Core's TSS resources.
100 TAO_ORB_Core_TSS_Resources
&tss
=
101 *this->orb_core_
->get_tss_resources ();
103 // Get the lane for this thread.
104 TAO_Thread_Lane
*lane
=
105 static_cast <TAO_Thread_Lane
*> (tss
.lane_
);
107 // If we have a valid lane, use that lane's resources.
109 return lane
->resources ();
111 // Otherwise, return the default resources.
112 return *this->default_lane_resources_
;
115 TAO_Thread_Lane_Resources
&
116 TAO_RT_Thread_Lane_Resources_Manager::default_lane_resources ()
118 return *this->default_lane_resources_
;
121 TAO_Thread_Pool_Manager
&
122 TAO_RT_Thread_Lane_Resources_Manager::tp_manager ()
124 return *this->tp_manager_
;
127 TAO_Thread_Lane_Resources_Manager
*
128 TAO_RT_Thread_Lane_Resources_Manager_Factory::create_thread_lane_resources_manager (TAO_ORB_Core
&core
)
130 TAO_Thread_Lane_Resources_Manager
*manager
= 0;
132 /// Create the RT Thread Lane Resources Manager.
133 ACE_NEW_RETURN (manager
,
134 TAO_RT_Thread_Lane_Resources_Manager (core
),
140 ACE_STATIC_SVC_DEFINE (TAO_RT_Thread_Lane_Resources_Manager_Factory
,
141 ACE_TEXT ("RT_Thread_Lane_Resources_Manager_Factory"),
143 &ACE_SVC_NAME (TAO_RT_Thread_Lane_Resources_Manager_Factory
),
144 ACE_Service_Type::DELETE_THIS
| ACE_Service_Type::DELETE_OBJ
,
146 ACE_FACTORY_DEFINE (TAO_RTCORBA
, TAO_RT_Thread_Lane_Resources_Manager_Factory
)
148 TAO_END_VERSIONED_NAMESPACE_DECL
150 #endif /* TAO_HAS_CORBA_MESSAGING && TAO_HAS_CORBA_MESSAGING != 0 */