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


C++ Messenger_var::shutdownOrb方法代码示例

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


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

示例1: svc

int TestClient::svc()
{
  // Every invocation of svc increates the thread count
  instance_++;
  int threadNum = instance_;
  size_t vec_size = iors_.size();

  ACE_DEBUG((LM_DEBUG, "* Client Thread started (%d.%d.%d.%d)\n",
             threadNum, iterations_, vec_size, requestCount_));

  int     i           = 0;
  size_t  objIter     = 0;
  int     requestIter = 0;

  ACE_TString currentIOR;

  ACE_OS::srand(static_cast<u_int> (ACE_OS::time()));

  try
  {
    int holdingCount    = 0;
    int noProfileCount  = 0;

    // For each iteration
    for (i = 1; i <= iterations_; i++)
    {
      // For each object reference read from file
      for (objIter = 1; objIter <= vec_size; objIter++)
      {
        requestIter = -1;
        // Get a imr_test_var
        currentIOR = iors_[objIter - 1];
        CORBA::Object_var obj = orb_->string_to_object(currentIOR.c_str());
        if (CORBA::is_nil(obj.in()) == false)
        {
          requestIter = 0;
          Messenger_var test = Messenger::_narrow(obj.in());

          if (CORBA::is_nil(test.in()) == false)
          {
            // Calculate the number of requests
            int newReqCount (randomRequests_ == false ? requestCount_ :
            (int)((((double)ACE_OS::rand() / (double)RAND_MAX) * (double)(requestCount_ - 1)) + .5) + 1);
            // For each request
            for (requestIter = 1; requestIter <= newReqCount;  requestIter++)
            {
              try
              {
                ::CORBA::Long instance = test->send_message(threadNum, i, objIter, requestIter);
                ACE_UNUSED_ARG (instance);
              }
              catch (const CORBA::SystemException& ex)
              {
                // If these exceptions are expected record the number of instances, otherwise rethrow
                if (expectHolding_ == true && ex.minor() == TAO_POA_HOLDING)
                {
                   ACE_ERROR((LM_ERROR, "Caught expected holding exception with (%d.%d.%d)\n",
                     threadNum, objIter, requestIter));
                  holdingCount++;
                }
                else
                {
                  throw;
                }
                if (expectNoProfile_ == true
                  && ex.minor() == TAO_INVOCATION_SEND_REQUEST_MINOR_CODE)
                {
                   ACE_ERROR((LM_ERROR, "Caught expected holding exception with (%d.%d.%d)\n",
                     threadNum, objIter, requestIter));
                  noProfileCount++;
                }
                else
                {
                  throw;
                }
              } // catch
            } // for request
            // We are done with our non-nil narrowed obj ref
            if (shutdownOrb_ == true) test->shutdownOrb();
          } // if narrow
        } // if obj
      } // for obj
    } // for iter
    // Report expected exceptions
    if (holdingCount > 0)
    {
      ACE_DEBUG((LM_DEBUG,"Client thread %d received %d holding error(s).\n",
                 threadNum, holdingCount));
    }

    if (noProfileCount > 0)
    {
      ACE_DEBUG((LM_DEBUG,"Client thread %d received %d no profile error(s).\n",
                 threadNum, noProfileCount));
    }

    return 0;
  } // try
  catch (const CORBA::Exception& ex)
  {
//.........这里部分代码省略.........
开发者ID:OspreyHub,项目名称:ATCD,代码行数:101,代码来源:TestClient.cpp


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