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


C++ Test_var::shutdown方法代码示例

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


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

示例1: catch

int
ACE_TMAIN(int argc, ACE_TCHAR *argv[])
{
  try
    {
      // Initialize and obtain reference to the Test object.
      CORBA::ORB_var orb = CORBA::ORB_init (argc, argv);

      if (parse_args (argc, argv) != 0)
        return -1;

      CORBA::Object_var object = orb->string_to_object (ior);

      Test_var server = Test::_narrow (object.in ());

      if (CORBA::is_nil (server.in ()))
        {
          ACE_ERROR_RETURN ((LM_ERROR,
                             "ERROR: Object reference <%s> is nil\n",
                             ior),
                            -1);
        }

      // Make an invocation on the obtained Test object.
      server->shutdown ();
    }
  catch (const CORBA::Exception& ex)
    {
      ex._tao_print_exception ("Caught exception:");
      return -1;
    }

  return 0;
}
开发者ID:asdlei00,项目名称:ACE,代码行数:34,代码来源:client.cpp

示例2: catch

int
ACE_TMAIN(int argc, ACE_TCHAR *argv[])
{
  try
    {
      PortableInterceptor::ORBInitializer_ptr temp_initializer =
        PortableInterceptor::ORBInitializer::_nil ();

      ACE_NEW_RETURN (temp_initializer,
                      Client_ORBInitializer,
                      -1);  // No exceptions yet!
      PortableInterceptor::ORBInitializer_var orb_initializer =
        temp_initializer;

      PortableInterceptor::register_orb_initializer (orb_initializer.in ());

      CORBA::ORB_var orb = CORBA::ORB_init (argc,
                                            argv,
                                            "Client ORB");

      if (::parse_args (argc, argv) != 0)
        return -1;

      CORBA::Object_var object =
        orb->string_to_object (ior);

      Test_var server =
        Test::_narrow (object.in ());

      if (CORBA::is_nil (server.in ()))
        {
          ACE_ERROR_RETURN ((LM_ERROR,
                             "Object reference <%s> is nil.\n",
                             ior),
                            1);
        }

      ::client_test (server.in ());

      ::server_test (server.in ());

      server->shutdown ();

      orb->destroy ();
    }
  catch (const CORBA::Exception& ex)
    {
      ex._tao_print_exception ("Caught exception:");
      return -1;
    }

  ACE_DEBUG ((LM_INFO,
              "Request interceptor flow test passed.\n"));

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

示例3: catch

int
ACE_TMAIN(int argc, ACE_TCHAR *argv[])
{
  int result = 0;
  try
    {
      CORBA::ORB_var orb =
        CORBA::ORB_init (argc, argv);

      if (parse_args (argc, argv) != 0)
        return 1;

      CORBA::Object_var tmp =
        orb->string_to_object(ior);

      Test_var server =
        Test::_narrow(tmp.in ());

      if (CORBA::is_nil (server.in ()))
        {
          ACE_ERROR_RETURN ((LM_DEBUG,
                             "Nil Test::Server reference <%s>\n",
                             ior),
                            1);
        }

      server->test_method();
      result =0;

      if (shutdown_server)
        {
          server->shutdown ();
        }

      orb->destroy ();
    }
  catch (const CORBA::Exception&)
    {
      result = 1;
    }

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

示例4: catch

int
run_test (CORBA::ORB_ptr orb_ptr,
          int target)
{
  CORBA::ORB_var orb = CORBA::ORB::_duplicate (orb_ptr);
  CORBA::Object_var object;
  try
    {
      if (target == 1)
        {
          object =
            orb->string_to_object (ior1);
        }
      else
        {
          object =
            orb->string_to_object (ior2);
        }

      Test_var server =
        Test::_narrow (object.in ());

      if (CORBA::is_nil (server.in ()))
        ACE_ERROR_RETURN ((LM_ERROR,
                           "Object reference is nil\n"),
                          1);

      server->method (0);

      server->shutdown ();
    }
  catch (const CORBA::Exception& ex)
    {
      ex._tao_print_exception ("Client-side exception:");
    }
return 0;
}
开发者ID:svn2github,项目名称:ACE-Middleware,代码行数:37,代码来源:client.cpp

示例5: test_impl

void test_impl(
    CORBA::ORB_ptr orb,
    ACE_TCHAR const * ior,
    bool shutdown)
{
  CORBA::Object_var object = orb->string_to_object(ior);
  Test_var test = Test::_narrow(object.in());

  if(CORBA::is_nil(test.in()))
  {
    throw "Nil reference after narrow";
  }

  for(int i = 0; i != niterations; ++i)
  {
    test->sendc_the_operation(AMI_TestHandler::_nil());
  }

  ACE_Time_Value wait_for_responses_interval(1, 0);
  orb->run(wait_for_responses_interval);

  if (shutdown)
    test->shutdown ();
}
开发者ID:asdlei00,项目名称:ACE,代码行数:24,代码来源:client.cpp

示例6: policy_list

int
ACE_TMAIN (int argc, ACE_TCHAR *argv[])
{
  try {
    // Initialize orb
    CORBA::ORB_var orb = CORBA::ORB_init( argc, argv );

    if (parse_args (argc, argv) != 0)
      return 1;

    CORBA::Object_var obj;

    //Specify the relative round trip policy
    if (rt_timeout_msecs > 0)
      {
        // Timeout specified in hundreds of nanoseconds which is
        // 10000 milliseconds.
        TimeBase::TimeT relative_rt_timeout = rt_timeout_msecs * 10000;

        CORBA::Any relative_rt_timeout_as_any;
        relative_rt_timeout_as_any <<= relative_rt_timeout;
        CORBA::PolicyList policy_list(1);
        policy_list.length(1);
        policy_list[0] =
          orb->create_policy(Messaging::RELATIVE_RT_TIMEOUT_POLICY_TYPE,
          relative_rt_timeout_as_any);

        // Apply the policy at the ORB level.
        obj = orb->resolve_initial_references("ORBPolicyManager");
        CORBA::PolicyManager_var policy_manager =
          CORBA::PolicyManager::_narrow(obj.in());
        policy_manager->set_policy_overrides (policy_list, CORBA::ADD_OVERRIDE);

        // Destroy the Policy objects.
        for (CORBA::ULong i = 0; i < policy_list.length(); ++i) {
          policy_list[i]->destroy ();
        }
        policy_list.length(0);
      }

    ///// Get object reference /////
    obj = orb->resolve_initial_references("Test");
    ACE_ASSERT (!CORBA::is_nil(obj.in()));
    Test_var test = Test::_narrow( obj.in() );
    ACE_ASSERT (!CORBA::is_nil(test.in()));

    if (max_tries > 1)
      {
        ACE_DEBUG ((LM_DEBUG,
                    "(%P|%t) Maximum number of tries = %d\n",
                    max_tries));
      }

    CORBA::Short n = 0;
    for (int i = 0; i < max_tries; ++i)
      {
        try
          {
            n = test->get_num_requests (request_delay_secs);
          }
        catch (const CORBA::TIMEOUT &ex)
          {
            ex._tao_print_exception ("timeout exception:");
            if (i == max_tries - 1)
              throw;
          }
      }

    if (n == 0)
      {
        ACE_ERROR_RETURN ((LM_ERROR,
                           "(%P|%t) ERROR: Expected number of requests from "
                           "server to be > 0\n"),
                          -1);
      }
    else
      {
        ACE_DEBUG ((LM_DEBUG,
                    "(%P|%t) Client got back <%d>\n",
                    n));
      }

    // In a per client situation the client has to shutdown the server
    if (shutdown_server)
    {
      test->shutdown();
    }

    orb->destroy ();

    return 0;

  }
  catch(const CORBA::Exception& ex) {
    ex._tao_print_exception ("Client:");
  }

  return -1;
}
开发者ID:milan-mpathix,项目名称:ATCD,代码行数:99,代码来源:client.cpp

示例7: thread_barrier


//.........这里部分代码省略.........
        mapping_manager->mapping ();

      // RTCurrent.
      object =
        this->orb_->resolve_initial_references ("RTCurrent");
      RTCORBA::Current_var current =
        RTCORBA::Current::_narrow (object.in ());
      if (check_for_nil (current.in (), "RTCurrent") == -1)
        return -1;

      // Obtain Test object reference.
      object =
        this->orb_->string_to_object (ior);
      Test_var server = Test::_narrow (object.in ());
      if (check_for_nil (server.in (), "Test object") == -1)
        return -1;

      // Check that test object is configured with CLIENT_PROPAGATED
      // PriorityModelPolicy.
      CORBA::Policy_var policy =
        server->_get_policy (RTCORBA::PRIORITY_MODEL_POLICY_TYPE);

      RTCORBA::PriorityModelPolicy_var priority_policy =
        RTCORBA::PriorityModelPolicy::_narrow (policy.in ());

      if (check_for_nil (priority_policy.in (), "PriorityModelPolicy") == -1)
        return -1;

      RTCORBA::PriorityModel priority_model =
        priority_policy->priority_model ();
      if (priority_model != RTCORBA::CLIENT_PROPAGATED)
        ACE_ERROR_RETURN ((LM_ERROR,
                           "ERROR: priority_model != "
                           "RTCORBA::CLIENT_PROPAGATED!\n"),
                          -1);

      // Spawn two worker threads.
      ACE_Barrier thread_barrier (2);
      int flags  =
        THR_NEW_LWP |
        THR_JOINABLE |
        this->orb_->orb_core ()->orb_params ()->thread_creation_flags ();

      // Worker 1.
      Worker_Thread worker1 (this->orb_.in (),
                             server.in (),
                             protocol1,
                             &thread_barrier);

      CORBA::Short native_priority1 = 0;
      if (pm->to_native (priority1, native_priority1) == 0)
        ACE_ERROR_RETURN ((LM_ERROR,
                           "Cannot convert corba priority %d to native priority\n",
                           priority1),
                          -1);

      if (worker1.activate (flags,
                            1, 0,
                            native_priority1) != 0)
        ACE_ERROR_RETURN ((LM_ERROR,
                           "Cannot activate first client worker threads\n"),
                          -1);

      // Worker 2.
      Worker_Thread worker2 (this->orb_.in (),
                             server.in (),
                             protocol2,
                             &thread_barrier);

      CORBA::Short native_priority2 = 0;
      if (pm->to_native (priority2, native_priority2) == 0)
        ACE_ERROR_RETURN ((LM_ERROR,
                           "Cannot convert corba priority %d to native priority\n",
                           priority2),
                          -1);

      if (worker2.activate (flags,
                            1, 0,
                            native_priority2) != 0)
        ACE_ERROR_RETURN ((LM_ERROR,
                           "Cannot activate second client worker threads\n"),
                          -1);

      // Wait for worker threads to finish.
      ACE_Thread_Manager::instance ()->wait ();

      // Testing over.  Shut down the server.
      ACE_DEBUG ((LM_DEBUG, "Client threads finished\n"));
      current->the_priority (priority1);
      server->shutdown ();
    }
  catch (const CORBA::Exception& ex)
    {
      ex._tao_print_exception (
        "Unexpected exception in MT_Client_Protocol_Priority test client:");
      return -1;
    }

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

示例8: ACE_TMAIN

int ACE_TMAIN (int argc, ACE_TCHAR *argv[])
{
    try
    {
        CORBA::ORB_var orb = CORBA::ORB_init (argc, argv);

        if (parse_args (argc, argv) != 0)
            return 1;

        CORBA::Object_var obj = orb->string_to_object (ior);

        // force a scope to see the destruction of the server object
        {
            Test_Smart_Factory *test_factory = 0;
            ACE_NEW_RETURN (test_factory,
                            Test_Smart_Factory,
                            -1);

            ACE_UNUSED_ARG (test_factory);

            Test_var server =
                Test::_narrow(obj.in());

            if (CORBA::is_nil (server.in())) {
                ACE_ERROR_RETURN ((LM_ERROR,
                                   "Object reference <%s> is nil.\n",
                                   ior),
                                  1);
            }

            server->hello(3);

#if (TAO_HAS_MINIMUM_CORBA == 0)
            // Testing the _non_existent function
            ACE_DEBUG ((LM_DEBUG, "Testing _non_existent()\n"));
            CORBA::Boolean ne =
                server->_non_existent();
            if (ne)
                ACE_ERROR_RETURN ((LM_ERROR,
                                   "Not a Messenger object reference\n"),
                                  1);
            else
                ACE_DEBUG ((LM_DEBUG,"Successfully called _non_existent()\n"));
#endif /* TAO_HAS_MINIMUM_CORBA */

            server->shutdown();

            // The following sleep is a hack to make sure the above oneway
            // request gets sent before we exit. Otherwise, at least on
            // Windows XP, the server may not even get the request.
            ACE_Time_Value tv (0, 100000);
            ACE_OS::sleep(tv);
        }
        // here we should get the smart proxy destructor printout
        if (!dtor_called) {
            ACE_ERROR_RETURN((LM_ERROR,
                              "The Smart proxy is not deleted\n"),1);
        }

        orb->destroy();
    }
    catch (const CORBA::Exception& ex)
    {
        ex._tao_print_exception ("Client-side exception:");
        return 1;
    }

    return 0;
}
开发者ID:svn2github,项目名称:ACE-Middleware,代码行数:69,代码来源:client.cpp

示例9: catch


//.........这里部分代码省略.........
      // Check that the object is configured with CLIENT_PROPAGATED
      // PriorityModelPolicy.
      CORBA::Policy_var policy =
        server->_get_policy (RTCORBA::PRIORITY_MODEL_POLICY_TYPE);

      RTCORBA::PriorityModelPolicy_var priority_policy =
        RTCORBA::PriorityModelPolicy::_narrow (policy.in ());

      if (CORBA::is_nil (priority_policy.in ()))
        ACE_ERROR_RETURN ((LM_ERROR,
                           "ERROR: Priority Model Policy not exposed!\n"),
                          -1);

      RTCORBA::PriorityModel priority_model =
        priority_policy->priority_model ();

      if (priority_model != RTCORBA::CLIENT_PROPAGATED)
        ACE_ERROR_RETURN ((LM_ERROR,
                           "ERROR: priority_model != "
                           "RTCORBA::CLIENT_PROPAGATED!\n"),
                          -1);

      // Make several invocations, changing the priority of this thread
      // for each.
      object =
        this->orb_->resolve_initial_references ("RTCurrent");

      RTCORBA::Current_var current =
        RTCORBA::Current::_narrow (object.in ());

      object = this->orb_->resolve_initial_references ("PriorityMappingManager");

      RTCORBA::PriorityMappingManager_var mapping_manager =
        RTCORBA::PriorityMappingManager::_narrow (object.in ());

      RTCORBA::PriorityMapping *pm =
        mapping_manager->mapping ();

      int sched_policy =
        this->orb_->orb_core ()->orb_params ()->ace_sched_policy ();

      int max_priority =
        ACE_Sched_Params::priority_max (sched_policy);
      int min_priority =
        ACE_Sched_Params::priority_min (sched_policy);

      CORBA::Short native_priority =
        (max_priority - min_priority) / 2;

      CORBA::Short desired_priority = 0;

      for (int i = 0; i < 3; ++i)
        {
          if (pm->to_CORBA (native_priority, desired_priority) == 0)
            {
              ACE_ERROR ((LM_ERROR,
                           "ERROR: Cannot convert native priority %d to corba priority\n",
                           native_priority));
              result = -1;
              break;
            }

          current->the_priority (desired_priority);

          CORBA::Short priority =
            current->the_priority ();

          if (desired_priority != priority)
            {
              ACE_ERROR ((LM_ERROR,
                               "ERROR: No exception setting the priority but mismatch between requested and returned value from Current. "
                               "Set to %d but Current::the_priority returns %d\n", desired_priority, priority));
              result = -1;
            }


          server->test_method (priority);

          native_priority++;
        }

      // Shut down Server ORB.
      server->shutdown ();
    }
  catch (const CORBA::DATA_CONVERSION& ex)
    {
      ex._tao_print_exception (
                          "Most likely, this is due to the in-ability "
                          "to set the thread priority.");
      return -1;
    }
  catch (const CORBA::Exception & ae)
    {
      ae._tao_print_exception (
                           "Caught exception:");
      return -1;
    }

  return result;
}
开发者ID:manut,项目名称:TAO,代码行数:101,代码来源:client.cpp

示例10: tv

int
ACE_TMAIN(int argc, ACE_TCHAR *argv[])
{
  int status = 0;
  try
    {
      CORBA::ORB_var orb = CORBA::ORB_init (argc, argv);

      if (parse_args (argc, argv) != 0)
        return 1;

       CORBA::Object_var object =
        orb->string_to_object (ior);

      // To use the smart proxy it is necessary to allocate the
      // user-defined smart factory on the heap as the smart proxy
      // generated classes take care of destroying the object. This
      // way it a win situation for the application developer who
      // doesnt have to make sure to destoy it and also for the smart
      // proxy designer who now can manage the lifetime of the object
      // much surely.
      Smart_Test_Factory *test_factory = 0;
      ACE_NEW_RETURN (test_factory,
                      Smart_Test_Factory,
                      -1);

      ACE_UNUSED_ARG (test_factory);

      Test_var server =
        Test::_narrow (object.in ());

      if (CORBA::is_nil (server.in ()))
        ACE_ERROR_RETURN ((LM_ERROR,
                           "Object reference <%s> is nil.\n",
                           ior),
                          1);

      try
        {
          CORBA::String_var sm_ior = orb->object_to_string (server.in ());
          if (Smart_Test_Proxy::fake_ior () != sm_ior.in ())
            {
              status = 1;
              ACE_ERROR ((LM_ERROR,
                          "ERROR: The Smart Proxy IOR is:\n%C\n"
                          "but should have been: %C\n",
                          sm_ior.in (),
                          Smart_Test_Proxy::fake_ior ().c_str ()));
            }
        }
      catch (const CORBA::MARSHAL& ex)
        {
          status = 1;
          ex._tao_print_exception ("Unexpected MARSHAL exception:");
        }

      server->method (0);

      server->shutdown ();

      // The following sleep is a hack to make sure the above oneway
      // request gets sent before we exit. Otherwise, at least on
      // Windows XP, the server may not even get the request.
      ACE_Time_Value tv (0, 100000);
      ACE_OS::sleep(tv);

      orb->destroy ();
    }
  catch (const CORBA::Exception& ex)
    {
      ex._tao_print_exception ("Client-side exception:");
      status = 1;
    }

  return status;
}
开发者ID:svn2github,项目名称:ACE-Middleware,代码行数:76,代码来源:client.cpp

示例11: defined

int
ACE_TMAIN (int argc, ACE_TCHAR *argv[])
{
#if defined (ACE_WIN32)
  ACE_UNUSED_ARG (argc);
  ACE_UNUSED_ARG (argv);
  cout << "HandleExhaustion test not available on Windows" << endl;
#else
  try
    {
      CORBA::ORB_var orb =
        CORBA::ORB_init (argc, argv);

      if (parse_args (argc, argv) != 0)
        return 1;

      CORBA::Object_var tmp =
        orb->string_to_object (ior);

      Test_var test = Test::_narrow(tmp.in ());

      if (CORBA::is_nil (test.in ()))
        {
          ACE_ERROR_RETURN ((LM_DEBUG, "Nil Test reference <%s>\n", ior), 1);
        }

      // Try a few times until we run out of "trys" or we no longer get
      // an exception.  Some times it takes a little while to begin
      // accepting again on AIX.
      for(size_t i = 0; i < 10; i++)
        try
          {
            cout << "Client: calling simple, i = " << i << endl;
            // This first invocation will actually cause the connection to
            // the server.  Since the server has run out of file handles,
            // it can not accept the new connection.  On AIX, this will
            // receive a CORBA::COMM_FAILURE exception because it doesn't
            // complete in a timely manner.  It does not mean that the test
            // has failed, as long as the server performs the correct
            // function.
            test->simple ();
            break;
          }
        catch (const CORBA::COMM_FAILURE&)
          {
            cout << "Client: simple raised COMMFAIL, i = " << i << endl;
            ACE_OS::sleep (1);
          }

      cout << "Client: calling simple again" << endl;
      test->simple ();
      cout << "Client: calling shutdown" <<  endl;
      test->shutdown ();

      orb->destroy ();
    }
  catch (const CORBA::Exception& ex)
    {
      ex._tao_print_exception ("Exception caught:");
      return 1;
    }
#endif /* ACE_WIN32 */
  return 0;
}
开发者ID:OspreyHub,项目名称:ATCD,代码行数:64,代码来源:client.cpp


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