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