int
ACE_TMAIN (int argc, ACE_TCHAR *argv[])
{
    Notify_Logging_Service service;

    Logging_Svc_Shutdown killer (service);
    Service_Shutdown kill_contractor (killer);

    try
    {
        int rc;

        rc = service.init (argc, argv);
        if (rc == -1)
            ORBSVCS_ERROR_RETURN ((LM_ERROR,
                                   "Failed to initialize the Telecom Log Service.\n"),
                                  1);

        rc = service.run ();
        if (rc == -1)
            ORBSVCS_ERROR_RETURN ((LM_ERROR,
                                   "Failed to start the Telecom Log Service.\n"),
                                  1);
    }
    catch (const CORBA::Exception& ex)
    {
        ex._tao_print_exception ("Failed to start the Telecom Log Service.\n");
        return 1;
    }

    return 0;
}
Example #2
0
int
ACE_TMAIN (int argc, ACE_TCHAR *argv[])
{
  TAO_Naming_Service naming_service;

  // Stuff to insure that we're gracefully shut down...
  Naming_Svc_Shutdown killer (naming_service);
  Service_Shutdown kill_contractor(killer);

  if (naming_service.init (argc, argv) == -1)
    ORBSVCS_ERROR_RETURN ((LM_ERROR,
                       ACE_TEXT("Failed to start the Naming Service.\n")),
                      1);

  try
    {
      naming_service.run ();
    }
  catch (const CORBA::Exception& ex)
    {
      ex._tao_print_exception ("NamingService");
      return 1;
    }

  naming_service.fini ();

  return 0;
}
Example #3
0
int
run_standalone (Options& opts)
{
  ImR_Locator_i server;

  ImR_Locator_Shutdown killer (server);
  Service_Shutdown kill_contractor(killer);

  try
    {
      int status = server.init (opts);
      if (status == -1)
        {
          server.fini ();
          return 1;
        }
      else
        {
          // Run the server if it is initialized correctly.
          server.run ();

          // End the server after its work is done.
          status = server.fini ();

          if (status == -1)
            return 1;
        }
      return 0;
    }
  catch (const CORBA::SystemException& sysex)
    {
      sysex._tao_print_exception ("System Exception");
    }
  catch (const CORBA::UserException& userex)
    {
      userex._tao_print_exception ("User Exception");
    }
  catch (const CORBA::Exception& ex)
    {
      ex._tao_print_exception ("Unknown Exception");
    }

  return 1;
}