1 #include "tao/PortableServer/ThreadStrategyFactoryImpl.h"
2 #include "tao/PortableServer/ThreadStrategy.h"
3 #include "ace/Dynamic_Service.h"
4 #include "ace/Log_Msg.h"
6 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
10 namespace Portable_Server
13 ThreadStrategyFactoryImpl::create (
14 ::PortableServer::ThreadPolicyValue value
)
16 ThreadStrategy
* strategy
= 0;
20 case ::PortableServer::SINGLE_THREAD_MODEL
:
22 ThreadStrategyFactory
*strategy_factory
=
23 ACE_Dynamic_Service
<ThreadStrategyFactory
>::instance ("ThreadStrategySingleFactory");
27 strategy
= strategy_factory
->create (value
);
30 TAOLIB_ERROR ((LM_ERROR
,
31 ACE_TEXT ("(%P|%t) %p\n"),
32 ACE_TEXT ("ERROR, Unable to get ")
33 ACE_TEXT ("ThreadStrategySingleFactory")));
37 case ::PortableServer::ORB_CTRL_MODEL
:
40 ACE_Dynamic_Service
<ThreadStrategy
>::instance ("ThreadStrategyORBControl");
43 TAOLIB_ERROR ((LM_ERROR
,
44 ACE_TEXT ("(%P|%t) %p\n"),
45 ACE_TEXT ("ERROR, Unable to get ")
46 ACE_TEXT ("ThreadStrategyORBControl")));
56 ThreadStrategyFactoryImpl::destroy (
57 ThreadStrategy
*strategy
)
59 switch (strategy
->type ())
61 case ::PortableServer::SINGLE_THREAD_MODEL
:
63 ThreadStrategyFactory
*strategy_factory
=
64 ACE_Dynamic_Service
<ThreadStrategyFactory
>::instance ("ThreadStrategySingleFactory");
68 strategy_factory
->destroy (strategy
);
72 case ::PortableServer::ORB_CTRL_MODEL
:
82 ACE_STATIC_SVC_DEFINE (
83 ThreadStrategyFactoryImpl
,
84 ACE_TEXT ("ThreadStrategyFactory"),
86 &ACE_SVC_NAME (ThreadStrategyFactoryImpl
),
87 ACE_Service_Type::DELETE_THIS
| ACE_Service_Type::DELETE_OBJ
,
90 ACE_FACTORY_NAMESPACE_DEFINE (
92 ThreadStrategyFactoryImpl
,
93 TAO::Portable_Server::ThreadStrategyFactoryImpl
)
95 TAO_END_VERSIONED_NAMESPACE_DECL