00001
00002
00003 #include "tao/orbconf.h"
00004
00005 ACE_RCSID (PortableServer,
00006 ThreadStrategyFactoryImpl,
00007 "$Id: ThreadStrategySingleFactoryImpl.cpp 76687 2007-01-29 19:18:13Z johnnyw $")
00008
00009 #if (TAO_HAS_MINIMUM_POA == 0) && !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO)
00010
00011 #include "tao/PortableServer/ThreadStrategySingleFactoryImpl.h"
00012 #include "tao/PortableServer/ThreadStrategy.h"
00013 #include "tao/PortableServer/ThreadStrategySingle.h"
00014 #include "ace/Dynamic_Service.h"
00015 #include "ace/Log_Msg.h"
00016
00017 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00018
00019 namespace TAO
00020 {
00021 namespace Portable_Server
00022 {
00023 ThreadStrategy*
00024 ThreadStrategySingleFactoryImpl::create (
00025 ::PortableServer::ThreadPolicyValue value)
00026 {
00027 ThreadStrategy* strategy = 0;
00028
00029 switch (value)
00030 {
00031 case ::PortableServer::SINGLE_THREAD_MODEL :
00032 {
00033 ACE_NEW_RETURN (strategy, ThreadStrategySingle, 0);
00034 break;
00035 }
00036 case ::PortableServer::ORB_CTRL_MODEL :
00037 {
00038 ACE_ERROR ((LM_ERROR, "Incorrect type in ThreadStrategySingleFactoryImpl"));
00039 break;
00040 }
00041 }
00042
00043 return strategy;
00044 }
00045
00046 void
00047 ThreadStrategySingleFactoryImpl::destroy (ThreadStrategy *strategy)
00048 {
00049 strategy->strategy_cleanup ();
00050
00051 delete strategy;
00052 }
00053 }
00054 }
00055
00056 TAO_END_VERSIONED_NAMESPACE_DECL
00057
00058 ACE_STATIC_SVC_DEFINE (
00059 ThreadStrategySingleFactoryImpl,
00060 ACE_TEXT ("ThreadStrategySingleFactory"),
00061 ACE_SVC_OBJ_T,
00062 &ACE_SVC_NAME (ThreadStrategySingleFactoryImpl),
00063 ACE_Service_Type::DELETE_THIS | ACE_Service_Type::DELETE_OBJ,
00064 0)
00065
00066 ACE_FACTORY_NAMESPACE_DEFINE (
00067 ACE_Local_Service,
00068 ThreadStrategySingleFactoryImpl,
00069 TAO::Portable_Server::ThreadStrategySingleFactoryImpl)
00070
00071 #endif