当前位置: 首页>>代码示例>>C++>>正文


C++ Servant::_add_ref方法代码示例

本文整理汇总了C++中portableserver::Servant::_add_ref方法的典型用法代码示例。如果您正苦于以下问题:C++ Servant::_add_ref方法的具体用法?C++ Servant::_add_ref怎么用?C++ Servant::_add_ref使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在portableserver::Servant的用法示例。


在下文中一共展示了Servant::_add_ref方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: non_servant_upcall

    void
    RequestProcessingStrategyDefaultServant::set_servant (
      PortableServer::Servant servant)
    {
      // This operation registers the specified servant with the POA as
      // the default servant. This servant will be used for all requests
      // for which no servant is found in the Active Object Map.
      this->default_servant_ = servant;

      // The implementation of set_servant 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.
      if (servant != 0)
        {
          // A recursive thread lock without using a recursive thread
          // lock.  Non_Servant_Upcall has a magic constructor and
          // destructor.  We unlock the Object_Adapter lock for the
          // duration of the servant activator upcalls; reacquiring once
          // the upcalls complete.  Even though we are releasing the lock,
          // other threads will not be able to make progress since
          // <Object_Adapter::non_servant_upcall_in_progress_> has been
          // set.
          Non_Servant_Upcall non_servant_upcall (*this->poa_);
          ACE_UNUSED_ARG (non_servant_upcall);

          servant->_add_ref ();
        }
    }
开发者ID:CCJY,项目名称:ATCD,代码行数:29,代码来源:RequestProcessingStrategyDefaultServant.cpp

示例2: preinvoke

PortableServer::Servant ServantLocatorImpl::preinvoke(
		const PortableServer::ObjectId&	oid,
		PortableServer::POA_ptr		poa,
		const char*			operation,
		PortableServer::ServantLocator::Cookie& cookie)
{
	printf("------- ServantLocator.preinvoke(.., op='%s', .. ) "
			"--------\n", operation);
	PortableServer::Servant servant 
			= _servant_array[(_round_robin_idx++)%5].in();
	servant->_add_ref();
	return servant;
}
开发者ID:JiphuTzu,项目名称:pococapsule,代码行数:13,代码来源:GreetingImpl.C

示例3: 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

示例4: 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

示例5: if


//.........这里部分代码省略.........
      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.
      servant->_add_ref ();
    }
开发者ID:OspreyHub,项目名称:ATCD,代码行数:101,代码来源:ServantRetentionStrategyRetain.cpp


注:本文中的portableserver::Servant::_add_ref方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。