本文整理汇总了C++中portableserver::Servant类的典型用法代码示例。如果您正苦于以下问题:C++ Servant类的具体用法?C++ Servant怎么用?C++ Servant使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Servant类的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1:
void
ServantLocator::postinvoke (const PortableServer::ObjectId& oid,
PortableServer::POA_ptr adapter,
const char* operation,
PortableServer::ServantLocator::Cookie the_cookie,
PortableServer::Servant the_servant )
throw (CORBA::SystemException)
{
//
// call services registered for postinvoke
//
if(home_servant_->service_name_ == "")
{
std::vector <Qedo::ComponentInstance_var> ::iterator iter;
Components::CCMService_ptr service;
for (iter = home_servant_->container_->services_postinvoke_.begin();
iter != home_servant_->container_->services_postinvoke_.end(); iter++)
{
service = dynamic_cast<Components::CCMService_ptr>((*iter)->executor_locator_.in());
service->postinvoke((*iter)->ccm_object_executor_->uuid_.c_str(), operation);
}
}
the_servant->_remove_ref();
}
开发者ID:BackupTheBerlios,项目名称:qedo-svn,代码行数:26,代码来源:ServantLocator.cpp
示例2: postinvoke
void GCServantLocator::postinvoke(const PortableServer::ObjectId& oid,
PortableServer::POA_ptr adapter,
const char* operation,
PortableServer::ServantLocator::Cookie the_cookie,
PortableServer::Servant the_servant)
{
the_servant->_remove_ref();
}
开发者ID:RedhawkSDR,项目名称:framework-core,代码行数:8,代码来源:CorbaGC.cpp
示例3:
Implicit_Deactivator::Implicit_Deactivator (PortableServer::Servant servant)
{
this->poa_ =
servant->_default_POA ();
this->id_ =
this->poa_->servant_to_id (servant);
}
开发者ID:OspreyHub,项目名称:ATCD,代码行数:8,代码来源:Implicit_Deactivator.cpp
示例4:
void
deactivate_servant (PortableServer::Servant servant)
{
PortableServer::POA_var poa =
servant->_default_POA ();
PortableServer::ObjectId_var id =
poa->servant_to_id (servant);
poa->deactivate_object (id.in ());
}
开发者ID:asdlei00,项目名称:ACE,代码行数:9,代码来源:Shutdown.cpp
示例5:
void
Servant_Activator::etherealize (const PortableServer::ObjectId &,
PortableServer::POA_ptr,
PortableServer::Servant servant,
CORBA::Boolean,
CORBA::Boolean)
{
servant->_remove_ref ();
}
开发者ID:chenbk85,项目名称:ACE-Middleware,代码行数:9,代码来源:Nested_Non_Servant_Upcalls.cpp
示例6: idstr
int
TAO_System_Id_With_Multiple_Id_Strategy::bind_using_system_id (
PortableServer::Servant servant,
CORBA::Short priority,
TAO_Active_Object_Map_Entry *&entry)
{
ACE_NEW_RETURN (entry,
TAO_Active_Object_Map_Entry,
-1);
int result =
this->active_object_map_->user_id_map_->bind_create_key (entry,
entry->user_id_);
if (result == 0)
{
entry->servant_ = servant;
entry->priority_ = priority;
result = this->active_object_map_->id_hint_strategy_->bind (*entry);
if (result != 0)
{
this->active_object_map_->user_id_map_->unbind (entry->user_id_);
delete entry;
}
#if defined (TAO_HAS_MONITOR_POINTS) && (TAO_HAS_MONITOR_POINTS == 1)
this->active_object_map_->monitor_->receive (
this->active_object_map_->user_id_map_->current_size ());
#endif /* TAO_HAS_MONITOR_POINTS==1 */
}
else
{
delete entry;
}
#if (TAO_HAS_MINIMUM_CORBA == 0)
if (result == 0 && TAO_debug_level > 7)
{
CORBA::String_var idstr (
PortableServer::ObjectId_to_string (entry->user_id_));
CORBA::String_var repository_id (
servant ? servant->_repository_id () : 0);
ACE_CString hex_idstr;
hexstring (hex_idstr, idstr.in (), entry->user_id_.length ());
TAOLIB_DEBUG ((LM_DEBUG,
"TAO (%P|%t) - TAO_System_Id_With_Multiple_Id_Strategy::"
"bind_using_system_id: type=%C, id=%C\n",
repository_id.in (),
hex_idstr.c_str()
));
}
#endif
return result;
}
开发者ID:milan-mpathix,项目名称:ATCD,代码行数:56,代码来源:Active_Object_Map.cpp
示例7:
void
ServantLocator::postinvoke (const PortableServer::ObjectId& oid,
PortableServer::POA_ptr adapter,
const char* operation,
PortableServer::ServantLocator::Cookie the_cookie,
PortableServer::Servant the_servant )
throw (CORBA::SystemException)
{
the_servant->_remove_ref();
}
开发者ID:BackupTheBerlios,项目名称:qedo-svn,代码行数:10,代码来源:ServantLocator.cpp
示例8: etherealize
void ServantActivatorImpl::etherealize(
const PortableServer::ObjectId& oid,
PortableServer::POA_ptr poa,
PortableServer::Servant servant,
CORBA::Boolean cleanup_in_progress,
CORBA::Boolean remaining_activations)
{
printf("------- ServantActivator.etherealize() --------\n");
servant->_remove_ref();
}
开发者ID:JiphuTzu,项目名称:pococapsule,代码行数:10,代码来源:GreetingImpl.C
示例9:
CORBA::Object_ptr
ServantRetentionStrategyRetain::servant_to_reference (
PortableServer::Servant servant)
{
// Note: The allocation of an Object Id value and installation in
// the Active Object Map caused by implicit activation may actually
// be deferred until an attempt is made to externalize the
// reference. The real requirement here is that a reference is
// produced that will behave appropriately (that is, yield a
// consistent Object Id value when asked politely).
CORBA::Short priority = this->poa_->server_priority ();
PortableServer::ObjectId_var system_id =
this->servant_to_system_id_i (servant, priority);
PortableServer::ObjectId user_id;
// This operation requires the RETAIN, therefore don't worry about
// the NON_RETAIN case.
if (this->active_object_map_->
find_user_id_using_system_id (system_id.in (), user_id) != 0)
{
throw ::CORBA::OBJ_ADAPTER ();
}
// Remember params for potentially invoking <key_to_object> later.
this->poa_->key_to_object_params_.set (
system_id,
servant->_interface_repository_id (),
servant,
1,
priority,
true);
// Ask the ORT to create the object.
// @@NOTE:There is a possible deadlock lurking here. We held the
// lock, and we are possibly trying to make a call into the
// application code. Think what would happen if the app calls us
// back. We need to get to this at some point.
return this->poa_->invoke_key_to_object_helper_i (
servant->_interface_repository_id (), user_id);
}
开发者ID:OspreyHub,项目名称:ATCD,代码行数:42,代码来源:ServantRetentionStrategyRetain.cpp
示例10: postinvoke
void ServantLocatorImpl::postinvoke(
const PortableServer::ObjectId& oid,
PortableServer::POA_ptr poa,
const char* operation,
PortableServer::ServantLocator::Cookie cookie,
PortableServer::Servant servant)
{
printf("------- ServantLocator.postinvoke(.., op='%s', .. ) "
"--------\n", operation);
servant->_remove_ref();
}
开发者ID:JiphuTzu,项目名称:pococapsule,代码行数:11,代码来源:GreetingImpl.C
示例11: preinvoke
PortableServer::Servant GCServantLocator::preinvoke(const PortableServer::ObjectId& oid,
PortableServer::POA_ptr adapter,
const char* operation,
PortableServer::ServantLocator::Cookie& the_cookie)
{
boost::mutex::scoped_lock lock(activeMapMutex_);
ServantMap::iterator iter = activeMap_.find(oid);
if (iter == activeMap_.end()) {
throw CORBA::OBJECT_NOT_EXIST();
}
PortableServer::Servant servant = iter->second.servant;
if (iter->second.destroy == std::string(operation)) {
LOG_TRACE(GCServantLocator, "untracking " << (void*)servant);
activeMap_.erase(iter);
} else {
servant->_add_ref();
iter->second.last_access = boost::get_system_time();
}
return servant;
}
开发者ID:RedhawkSDR,项目名称:framework-core,代码行数:20,代码来源:CorbaGC.cpp
示例12: register_servant
void GCServantLocator::register_servant(const PortableServer::ObjectId& oid,
PortableServer::Servant servant,
boost::posix_time::time_duration ttl,
const std::string& destroy)
{
boost::mutex::scoped_lock lock(activeMapMutex_);
if (activeMap_.count(oid) > 0) {
throw PortableServer::POA::ObjectAlreadyActive();
}
LOG_TRACE(GCServantLocator, "tracking " << (void*)servant);
ServantEntry& entry = activeMap_[oid];
entry.servant = servant;
servant->_add_ref();
entry.ttl = ttl;
entry.last_access = boost::get_system_time();
entry.destroy = destroy;
}
开发者ID:RedhawkSDR,项目名称:framework-core,代码行数:17,代码来源:CorbaGC.cpp
示例13:
void
Servant_Activator::etherealize (const PortableServer::ObjectId &id,
PortableServer::POA_ptr ,
PortableServer::Servant servant,
CORBA::Boolean,
CORBA::Boolean)
{
CORBA::String_var object_name =
PortableServer::ObjectId_to_string (id);
ACE_DEBUG ((LM_DEBUG,
"Etherealize called with id = \"%C\"\n",
object_name.in ()));
if (ACE_OS::strcmp (object_name.in (),
"without reference counting") == 0)
delete servant;
else
{
servant->_remove_ref ();
}
}
开发者ID:OspreyHub,项目名称:ATCD,代码行数:22,代码来源:Etherealization.cpp
示例14: catch
/* static */
int
TAO_AV_Core::deactivate_servant (PortableServer::Servant servant)
{
// Because of reference counting, the POA will automatically delete
// the servant when all pending requests on this servant are
// complete.
try
{
PortableServer::POA_var poa = servant->_default_POA ();
PortableServer::ObjectId_var id = poa->servant_to_id (servant);
poa->deactivate_object (id.in ());
}
catch (const CORBA::Exception& ex)
{
ex._tao_print_exception ("deactivate_servant");
return -1;
}
return 0;
}
开发者ID:asdlei00,项目名称:ACE,代码行数:23,代码来源:AV_Core.cpp
示例15: OBJECT_NOT_EXIST
void
TimeServantLocator::postinvoke (const PortableServer::ObjectId & oid,
PortableServer::POA_ptr poa,
const char *operation,
void *cookie,
PortableServer::Servant servant)
throw (CORBA::SystemException)
{
// Check to see if the object ID is valid (CORBA)
CORBA::String_var oidString;
try
{
oidString = PortableServer::ObjectId_to_string (oid);
}
catch (const CORBA::BAD_PARAM&)
{
throw CORBA::OBJECT_NOT_EXIST ();
}
debug ("TimeServantLocator::%s(%s)", __FUNCTION__, oidString.in());
// Decrement servant reference count
servant->_remove_ref ();
}
开发者ID:justinkamerman,项目名称:CBoss,代码行数:24,代码来源:TimeServantLocator.cpp
示例16: bindServiceObject
bool ServiceOptions::bindServiceObject(CORBA::ORB_ptr orb,
CORBA::Object_ptr object,
PortableServer::Servant p_servant,
const char* objName,
bool rebind)
{
if(is_set("with-naming")) {
CosNaming::Name name;
name.length(1);
name[0].id=CORBA::string_dup(objName);
name[0].kind=CORBA::string_dup("");
CORBA::Object_var obj ;
try {
obj = orb->resolve_initial_references("NameService");
}catch(const CORBA::ORB::InvalidName& ex){
std::cerr << argv()[0] << ": can't resolve `NameService'" << std::endl;
return false;
}
CosNaming::NamingContext_var nc;
try {
nc = CosNaming::NamingContext::_narrow(obj.in());
}catch(const CORBA::SystemException& ex){
std::cerr << argv()[0] << ": can't narrow naming service" << std::endl;
return false;
}
try {
if(rebind){
nc->rebind(name,object);
}else{
try{
nc->bind(name,object);
}catch(const CosNaming::NamingContext::AlreadyBound&){
std::cerr<<argv()[0]<<":can't bind "<<objName<<" (AlreadyBound)"<< std::endl;
return false;
}
}
}catch(const CosNaming::NamingContext::CannotProceed&){
std::cerr<<argv()[0]<<": can't bind "<<objName<<" (CannotProceed)"<< std::endl;
return false;
}catch(const CosNaming::NamingContext::InvalidName&){
std::cerr<<argv()[0]<<":can't bind "<<objName<<" (InvalidName)"<< std::endl;
return false;
}
std::cout<<argv()[0]<<": binding completed successfully"<<std::endl;
}
CORBA::String_var ior ;
try {
ior = orb->object_to_string(object);
}catch(const CORBA::SystemException& ex){
#ifdef CORBA_SYSTEM_EXCEPTION_IS_STREAMBLE
std::cerr << ex << std::endl;
#else
std::cerr << "CORBA::SystemException" << std::endl;
#endif
return false;
}
const char* fname = get_ior_fname(objName);
if (fname!=NULL && strcmp(fname,"")!=0) {
std::ofstream ofs (fname);
if (ofs.bad()) {
std::cerr << argv()[0] << ": can't open file " << fname << std::endl;
perror(argv()[0]);
return false;
}
ofs << ior.in();
ofs.close();
}
if (is_set("ior-stdout")) {
std::cout << ior << std::flush;
}
#ifdef ORBACUS
CORBA::Object_var bmgrObj = orb->resolve_initial_references("BootManager");
OB::BootManager_var bootManager = OB::BootManager::_narrow(bmgrObj);
PortableServer::ObjectId_var oid = PortableServer::string_to_ObjectId(objName);
bootManager -> add_binding(oid.in(),object);
#elif defined(OMNIORB)
PortableServer::POA_var objPOA = p_servant->_default_POA();
CORBA::String_var objPOAName = objPOA->the_name();
if (strcmp(objPOAName.in(),"omniINSPOA")!=0) {
CORBA::Object_var insPOAObj = orb->resolve_initial_references("omniINSPOA");
PortableServer::POA_var insPOA = PortableServer::POA::_narrow(insPOAObj);
PortableServer::POAManager_var insPOAManager=insPOA->the_POAManager();
insPOAManager->activate();
PortableServer::ObjectId_var oid =
PortableServer::string_to_ObjectId(objName);
insPOA->activate_object_with_id(oid.in(),p_servant);
}
#elif defined(RSSH_TAO)
#ifdef TAO_HAVE_IORTABLE_ADAPTER
CORBA::Object_var table = orb->resolve_initial_references ("IORTable");
IORTable::Table_var adapter = IORTable::Table::_narrow (table.in());
if (CORBA::is_nil(adapter.in())) {
cerr<<argv()[0]<<": nil IORTable reference"<<endl;
} else {
adapter->bind (objName, ior.in ());
}
#else
ACE_CString ins(objName);
if (orb->_tao_add_to_IOR_table(ins,object)!=0) {
return false;
//.........这里部分代码省略.........
开发者ID:rssh,项目名称:Gen,代码行数:101,代码来源:ServiceOptions.cpp
示例17: non_servant_upcall
void
RequestProcessingStrategyServantActivator::cleanup_servant (
PortableServer::Servant servant,
const PortableServer::ObjectId &user_id
)
{
// If a servant manager is associated with the POA,
// ServantLocator::etherealize will be invoked with the oid and the
// servant. (The deactivate_object operation does not wait for the
// etherealize operation to complete before deactivate_object
// returns.)
//
// Note: If the servant associated with the oid is serving multiple
// Object Ids, ServantLocator::etherealize may be invoked multiple
// times with the same servant when the other objects are
// deactivated. It is the responsibility of the object
// implementation to refrain from destroying the servant while it is
// active with any Id.
// If the POA has no ServantActivator associated with it, the POA
// implementation calls _remove_ref when all operation invocations
// have completed. If there is a ServantActivator, the Servant is
// consumed by the call to ServantActivator::etherealize instead.
// @bala, is this order correct, see 11.3.9.17 of the spec, it
// says first remove from the map, then etherealize. not the
// other way around
// @@ Johnny, you are right! This will not show up until a
// thread is trying to activate the object in another thread
// using activate_object_with_id (). A test case is a must for
// atleast this issue.
if (servant)
{
if (this->etherealize_objects_ &&
!CORBA::is_nil (this->servant_activator_.in ()))
{
this->etherealize_servant (user_id,
servant,
this->poa_->cleanup_in_progress ());
}
else
{
// ATTENTION: Trick locking here, see class header for details
Non_Servant_Upcall non_servant_upcall (*this->poa_);
ACE_UNUSED_ARG (non_servant_upcall);
try
{
servant->_remove_ref ();
}
catch (...)
{
// Ignore exceptions from servant cleanup.
}
}
}
// This operation causes the association of the Object Id specified
// by the oid parameter and its servant to be removed from the
// Active Object Map.
if (this->poa_->unbind_using_user_id (user_id) != 0)
throw ::CORBA::OBJ_ADAPTER ();
}
开发者ID:akostrikov,项目名称:ATCD,代码行数:63,代码来源:RequestProcessingStrategyServantActivator.cpp
示例18: if
void
ServantRetentionStrategyRetain::activate_object_with_id (
const PortableServer::ObjectId &id,
PortableServer::Servant servant,
CORBA::Short priority,
bool &wait_occurred_restart_call)
{
// If the POA has the SYSTEM_ID policy and it detects that the
// Object Id value was not generated by the system or for this POA,
// the activate_object_with_id operation may raise the BAD_PARAM
// system exception. An ORB is not required to detect all such
// invalid Object Id values, but a portable application must not
// invoke activate_object_with_id on a POA that has the SYSTEM_ID
// policy with an Object Id value that was not previously generated
// by the system for that POA, or, if the POA also has the
// PERSISTENT policy, for a previous instantiation of the same POA.
if (this->poa_->has_system_id () &&
!this->poa_->is_poa_generated_id (id))
{
throw ::CORBA::BAD_PARAM ();
}
// If the CORBA object denoted by the Object Id value is already
// active in this POA (there is a servant bound to it in the Active
// Object Map), the ObjectAlreadyActive exception is raised.
bool priorities_match = true;
bool result =
this->is_user_id_in_map (id,
priority,
priorities_match,
wait_occurred_restart_call);
// @johnny the implementation is not complete, this does the spec also say
// If the POA has the UNIQUE_ID policy and the servant is already
// in the Active Object Map, the ServantAlreadyActive exception is raised.
if (result)
{
throw PortableServer::POA::ObjectAlreadyActive ();
}
else if (wait_occurred_restart_call)
{
// We ended up waiting on a condition variable, the POA state
// may have changed while we are waiting. Therefore, we need to
// restart this call.
return;
}
// If the activate_object_with_id_and_priority operation is invoked
// with a different priority to an earlier invocation of one of the
// create reference with priority operations, for the same object,
// then the ORB shall raise a BAD_INV_ORDER system exception (with a
// Standard Minor Exception Code of 1). If the priority value is the
// same then the ORB shall return SUCCESS.
if (!priorities_match)
{
throw ::CORBA::BAD_INV_ORDER (CORBA::OMGVMCID | 1,
CORBA::COMPLETED_NO);
}
bool const may_activate =
this->poa_->is_servant_activation_allowed (servant, wait_occurred_restart_call);
if (!may_activate)
{
if (wait_occurred_restart_call)
{
return;
}
else
{
throw PortableServer::POA::ServantAlreadyActive ();
}
}
// Otherwise, the activate_object_with_id operation enters an
// association between the specified Object Id and the specified
// servant in the Active Object Map.
if (this->active_object_map_->bind_using_user_id (servant,
id,
priority) != 0)
{
throw ::CORBA::OBJ_ADAPTER ();
}
//
// Everything is finally ok
//
// Inform the custom servant dispatching (CSD) strategy that the
// sevant is activated.
this->poa_->servant_activated_hook (servant, id);
// ATTENTION: Trick locking here, see class header for details
Non_Servant_Upcall non_servant_upcall (*this->poa_);
ACE_UNUSED_ARG (non_servant_upcall);
// The implementation of activate_object_with_id will invoke
// _add_ref at least once on the Servant argument before
// returning. When the POA no longer needs the Servant, it will
// invoke _remove_ref on it the same number of times.
//.........这里部分代码省略.........
开发者ID:OspreyHub,项目名称:ATCD,代码行数:101,代码来源:ServantRetentionStrategyRetain.cpp
注:本文中的portableserver::Servant类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论