Пример #1
0
int
Client_Task::svc (void)
{
  try
    {

      CORBA::Object_var object =
        corb_->string_to_object (input_);

      Test_Interceptors::Visual_var server =
        Test_Interceptors::Visual::_narrow (object.in ());

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

      run_test (server.in ());

      server->shutdown ();
    }
  catch (const CORBA::Exception& ex)
    {
      ex._tao_print_exception ("Exception caught in client task:");
      return 1;
    }

  return 0;

}
Пример #2
0
int
ACE_TMAIN(int argc, ACE_TCHAR *argv[])
{
    try
    {
        PortableInterceptor::ORBInitializer_ptr temp_initializer;

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

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

        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_Interceptors::Visual_var server =
        Test_Interceptors::Visual::_narrow (object.in ());

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

        ACE_hthread_t threadHandle;
        if ( ACE_Thread::spawn(run_test,
                               static_cast<void*>(server.in()),
                               THR_NEW_LWP | THR_JOINABLE ,
                               0,
                               & threadHandle) == -1 )
        {
           ACE_ERROR_RETURN ((LM_ERROR,"Cannot start thread"), 1);
        }

        ACE_Thread::join (threadHandle);

        server->shutdown ();

        orb->destroy ();
    }

    catch (const CORBA::Exception& ex)
    {
        ex._tao_print_exception ("Caught exception in client:");
        return 1;
    }


    return 0;
}
Пример #3
0
int
ACE_TMAIN(int argc, ACE_TCHAR *argv[])
{
  try
    {
      PortableInterceptor::ORBInitializer_ptr temp_initializer;

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

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

      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_Interceptors::Visual_var server =
        Test_Interceptors::Visual::_narrow (object.in ());

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

      run_test (server.in ());

      server->shutdown ();

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

  return 0;
}