Esempio n. 1
0
  public static void main(String[] args) {
    java.util.Properties props = new Properties();
    props.putAll(System.getProperties());
    props.put("org.omg.CORBA.ORBClass", "org.apache.yoko.orb.CORBA.ORB");
    props.put("org.omg.CORBA.ORBSingletonClass", "org.apache.yoko.orb.CORBA.ORBSingleton");

    int status = 0;
    ORB orb = null;

    try {
      Client.ClientRegisterInterceptors(props, true);
      Server.ServerRegisterInterceptors(props);

      props.put("yoko.orb.id", "myORB");
      orb = ORB.init(args, props);
      status = Server.ServerRun(orb, true, args);

      if (status == 0) {
        status = Client.ClientRun(orb, true, args);

        //
        // The ORB must be totally shutdown before the servants
        // are deleted.
        //
        orb.shutdown(true);

        Server.ServerCleanup();
      }
    } catch (Exception ex) {
      ex.printStackTrace();
      status = 1;
    }

    if (orb != null) {
      try {
        orb.destroy();
      } catch (Exception ex) {
        ex.printStackTrace();
        status = 1;
      }
    }

    System.exit(status);
  }