servant_activator.cpp
来自「这是广泛使用的通信开源项目,对于大容量,高并发的通讯要求完全能够胜任,他广泛可用」· C++ 代码 · 共 70 行
CPP
70 行
// Servant_Activator.cpp,v 1.11 2003/11/04 08:12:59 dhinton Exp
// ============================================================================
//
// = LIBRARY
// TAO/tests/POA/On_Demand_Activation/Servant_Activator
//
// = FILENAME
// Servant_Activator.cpp
//
// = DESCRIPTION
// Implementation of ServantActivator, which is used by a POA with
// a RETAIN policy.
//
// = AUTHOR
// Irfan Pyarali
//
// ============================================================================
#include "Servant_Activator.h"
#include "test_i.h"
#include "ace/OS_NS_string.h"
ACE_RCSID (On_Demand_Activation,
Servant_Activator,
"Servant_Activator.cpp,v 1.11 2003/11/04 08:12:59 dhinton Exp")
ServantActivator::ServantActivator (CORBA::ORB_ptr orb)
: orb_ (CORBA::ORB::_duplicate (orb))
{
}
PortableServer::Servant
ServantActivator::incarnate (const PortableServer::ObjectId &oid,
PortableServer::POA_ptr poa
ACE_ENV_ARG_DECL)
ACE_THROW_SPEC ((CORBA::SystemException,
PortableServer::ForwardRequest))
{
// Convert ObjectId to String.
CORBA::String_var s = PortableServer::ObjectId_to_string (oid);
// If ObjectId string has a test substring, create and return a
// test_i.
if (ACE_OS::strstr (s.in (), "test") != 0)
return new test_i (this->orb_.in (), poa);
else
{
ACE_THROW_RETURN (CORBA::OBJECT_NOT_EXIST (), 0);
}
}
void
ServantActivator::etherealize (const PortableServer::ObjectId &,
PortableServer::POA_ptr ,
PortableServer::Servant servant,
CORBA::Boolean ,
CORBA::Boolean remaining_activations
ACE_ENV_ARG_DECL_NOT_USED)
ACE_THROW_SPEC ((CORBA::SystemException))
{
// If there are no remaining activations i.e ObjectIds associated
// with test_i delete it.
if (remaining_activations == 0)
delete servant;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?