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


C++ ORB_var::_refcount方法代码示例

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


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

示例1: owner_transfer


//.........这里部分代码省略.........
      PortableServer::POAManager_var poa_manager =
        root_poa->the_POAManager ();

      poa_manager->activate ();

      // Let the client perform the test in a separate thread
      Handler* handler = 0;
      ACE_NEW_RETURN (handler,
                      Handler,
                      1);
      PortableServer::ServantBase_var owner_transfer(handler);

      PortableServer::ObjectId_var id =
        root_poa->activate_object (handler);

      CORBA::Object_var object2 = root_poa->id_to_reference (id.in ());

      A::AMI_AMI_TestHandler_var hello = A::AMI_AMI_TestHandler::_narrow (object2.in ());
      object2 = CORBA::Object::_nil ();

      server->shutdown (); // oneway, so returns here immediately but server waits 5 sec

      Client client (server.in (), niterations, hello.in ());
      if (client.activate (THR_NEW_LWP | THR_JOINABLE,
                           nthreads) != 0)
        ACE_ERROR_RETURN ((LM_ERROR,
                           "Cannot activate client threads\n"),
                          1);

      // Main thread collects replies. It needs to collect
      // <nthreads*niterations> replies.
      number_of_replies = nthreads *niterations;

      if (debug)
        {
          ACE_DEBUG ((LM_DEBUG,
                      "(%P|%t) : Entering perform_work loop to receive <%d> replies\n",
                      number_of_replies));
        }

      // ORB loop.
      ACE_Time_Value tv (1,0);
      orb->run (tv);

      if (debug)
        {
          ACE_DEBUG ((LM_DEBUG,
                      "(%P|%t) : Exited perform_work loop Received <%d> replies\n",
                      (nthreads*niterations) - number_of_replies));
        }

      ACE_DEBUG ((LM_DEBUG, "threads finished\n"));

      client.wait ();

      tv = ACE_Time_Value (1,0);
      orb->run (tv);

      root_poa->deactivate_object (id.in ());
      root_poa->destroy (1,  // ethernalize objects
                         0);  // wait for completion

      hello = A::AMI_AMI_TestHandler::_nil ();
      root_poa = PortableServer::POA::_nil ();
      poa_object = CORBA::Object::_nil ();
      object = CORBA::Object::_nil ();
      server = A::AMI_Test::_nil ();
      poa_manager = PortableServer::POAManager::_nil ();
      client.clear ();

      orb->shutdown ();
      orb->destroy ();

      CORBA::ULong ref_count  = orb->_refcount();

      if (ref_count > 1)
        {
          ACE_DEBUG ((LM_DEBUG, ACE_TEXT("Refcount orb %d\n"), ref_count));
          ++parameter_corruption;
        }
      else
        {
          TAO_ORB_Core* core = orb->orb_core ();
          if (core != 0)
            {
              ACE_DEBUG ((LM_DEBUG, ACE_TEXT("Core <> null\n")));
              ++parameter_corruption;
            }
        }
      orb = CORBA::ORB::_nil ();
    }
  catch (const CORBA::Exception& ex)
    {
      ex._tao_print_exception ("Caught exception:");
      return 1;

    }

  return parameter_corruption;
}
开发者ID:OspreyHub,项目名称:ATCD,代码行数:101,代码来源:client.cpp


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