Exemple #1
0
  public static void main(String args[]) {
    UAN uan = null;
    UAL ual = null;
    if (System.getProperty("uan") != null) {
      uan = new UAN(System.getProperty("uan"));
      ServiceFactory.getTheater();
      RunTime.receivedUniversalActor();
    }
    if (System.getProperty("ual") != null) {
      ual = new UAL(System.getProperty("ual"));

      if (uan == null) {
        System.err.println("Actor Creation Error:");
        System.err.println("	uan: " + uan);
        System.err.println("	ual: " + ual);
        System.err.println("	Identifier: " + System.getProperty("identifier"));
        System.err.println("	Cannot specify an actor to have a ual at runtime without a uan.");
        System.err.println(
            "	To give an actor a specific ual at runtime, use the identifier system property.");
        System.exit(0);
      }
      RunTime.receivedUniversalActor();
    }
    if (System.getProperty("identifier") != null) {
      if (ual != null) {
        System.err.println("Actor Creation Error:");
        System.err.println("	uan: " + uan);
        System.err.println("	ual: " + ual);
        System.err.println("	Identifier: " + System.getProperty("identifier"));
        System.err.println(
            "	Cannot specify an identifier and a ual with system properties when creating an actor.");
        System.exit(0);
      }
      ual = new UAL(ServiceFactory.getTheater().getLocation() + System.getProperty("identifier"));
    }
    RunTime.receivedMessage();
    CrazyMigration instance = (CrazyMigration) new CrazyMigration(uan, ual, null).construct();
    gc.WeakReference instanceRef = new gc.WeakReference(uan, ual);
    {
      Object[] _arguments = {args};

      // preAct() for local actor creation
      // act() for remote actor creation
      if (ual != null && !ual.getLocation().equals(ServiceFactory.getTheater().getLocation())) {
        instance.send(new Message(instanceRef, instanceRef, "act", _arguments, false));
      } else {
        instance.send(new Message(instanceRef, instanceRef, "preAct", _arguments, false));
      }
    }
    RunTime.finishedProcessingMessage();
  }
  public static void main(String args[]) {
    UAN uan = null;
    UAL ual = null;
    if (System.getProperty("uan") != null) {
      uan = new UAN(System.getProperty("uan"));
      ServiceFactory.getTheater();
      RunTime.receivedUniversalActor();
    }
    if (System.getProperty("ual") != null) {
      ual = new UAL(System.getProperty("ual"));

      if (uan == null) {
        System.err.println("Actor Creation Error:");
        System.err.println("	uan: " + uan);
        System.err.println("	ual: " + ual);
        System.err.println("	Identifier: " + System.getProperty("identifier"));
        System.err.println("	Cannot specify an actor to have a ual at runtime without a uan.");
        System.err.println(
            "	To give an actor a specific ual at runtime, use the identifier system property.");
        System.exit(0);
      }
      RunTime.receivedUniversalActor();
    }
    if (System.getProperty("identifier") != null) {
      if (ual != null) {
        System.err.println("Actor Creation Error:");
        System.err.println("	uan: " + uan);
        System.err.println("	ual: " + ual);
        System.err.println("	Identifier: " + System.getProperty("identifier"));
        System.err.println(
            "	Cannot specify an identifier and a ual with system properties when creating an actor.");
        System.exit(0);
      }
      ual = new UAL(ServiceFactory.getTheater().getLocation() + System.getProperty("identifier"));
    }
    JoinDirector instance = (JoinDirector) new JoinDirector(uan, ual).construct();
    {
      Object[] _arguments = {args};
      instance.send(new Message(instance, instance, "act", _arguments, null, null));
    }
  }