#include <LifespanStrategyFactoryImpl.h>
Inheritance diagram for TAO::Portable_Server::LifespanStrategyFactoryImpl:
Public Member Functions | |
virtual LifespanStrategy * | create (::PortableServer::LifespanPolicyValue value) |
Create a new servant retention strategy. | |
virtual void | destroy (LifespanStrategy *strategy) |
Cleanup the given strategy instance. |
Definition at line 32 of file LifespanStrategyFactoryImpl.h.
LifespanStrategy * TAO::Portable_Server::LifespanStrategyFactoryImpl::create | ( | ::PortableServer::LifespanPolicyValue | value | ) | [virtual] |
Create a new servant retention strategy.
Implements TAO::Portable_Server::LifespanStrategyFactory.
Definition at line 18 of file LifespanStrategyFactoryImpl.cpp.
References ACE_ERROR, ACE_TEXT(), TAO::Portable_Server::LifespanStrategyFactory::create(), ACE_Dynamic_Service< TYPE >::instance(), and LM_ERROR.
00020 { 00021 LifespanStrategy *strategy = 0; 00022 const char *strategy_name = 0; 00023 00024 switch (value) 00025 { 00026 case ::PortableServer::PERSISTENT : 00027 { 00028 strategy_name = "LifespanStrategyPersistentFactory"; 00029 break; 00030 } 00031 case ::PortableServer::TRANSIENT : 00032 { 00033 strategy_name = "LifespanStrategyTransientFactory"; 00034 break; 00035 } 00036 } 00037 00038 LifespanStrategyFactory *strategy_factory = 00039 ACE_Dynamic_Service<LifespanStrategyFactory>::instance (strategy_name); 00040 00041 if (strategy_factory != 0) 00042 strategy = strategy_factory->create (value); 00043 else 00044 ACE_ERROR ((LM_ERROR, 00045 ACE_TEXT ("(%P|%t) ERROR, Unable to get %s\n"), 00046 strategy_name)); 00047 00048 00049 return strategy; 00050 }
void TAO::Portable_Server::LifespanStrategyFactoryImpl::destroy | ( | LifespanStrategy * | strategy | ) | [virtual] |
Cleanup the given strategy instance.
Implements TAO::Portable_Server::LifespanStrategyFactory.
Definition at line 53 of file LifespanStrategyFactoryImpl.cpp.
References TAO::Portable_Server::LifespanStrategyFactory::destroy(), ACE_Dynamic_Service< TYPE >::instance(), and TAO::Portable_Server::LifespanStrategy::type().
00054 { 00055 switch (strategy->type ()) 00056 { 00057 case ::PortableServer::PERSISTENT : 00058 { 00059 LifespanStrategyFactory *strategy_factory = 00060 ACE_Dynamic_Service<LifespanStrategyFactory>::instance ("LifespanStrategyPersistentFactory"); 00061 00062 if (strategy_factory != 0) 00063 { 00064 strategy_factory->destroy (strategy); 00065 } 00066 break; 00067 } 00068 case ::PortableServer::TRANSIENT : 00069 { 00070 LifespanStrategyFactory *strategy_factory = 00071 ACE_Dynamic_Service<LifespanStrategyFactory>::instance ("LifespanStrategyTransientFactory"); 00072 00073 if (strategy_factory != 0) 00074 { 00075 strategy_factory->destroy (strategy); 00076 } 00077 break; 00078 } 00079 } 00080 }