예제 #1
0
 public static void startAll() {
   for (String pluginName : AppConfig.getPlugins()) {
     Plugin plugin = get(pluginName);
     if (plugin != null) {
       logger.warn("Starting plugin " + pluginName);
       plugin.start();
     }
   }
 }
예제 #2
0
  public void run(ActorSystem newActorSystem) {
    Thread.currentThread().setName("game-machine");

    if (!AppConfig.getOrm()) {
      throw new RuntimeException("Orm is now required");
    }

    actorSystem = newActorSystem;

    actorSystem.actorOf(
        Props.create(EventStreamHandler.class), EventStreamHandler.class.getSimpleName());
    actorSystem.actorOf(
        new RoundRobinPool(20).props(Props.create(RemoteEcho.class)), RemoteEcho.name);

    startCacheUpdateHandler();

    ZoneService.init();
    GameMessageRoute.add(ZoneService.name, ZoneService.name, false);
    ActorUtil.createActor(ZoneService.class, ZoneService.name);

    actorSystem.actorOf(Props.create(GameLimits.class), GameLimits.class.getSimpleName());

    GameMessageRoute.add(AkkaProcessRunner.name, AkkaProcessRunner.name, false);
    ActorUtil.createActor(AkkaProcessRunner.class, AkkaProcessRunner.name);

    actorSystem.actorOf(Props.create(GridExpiration.class), GridExpiration.class.getSimpleName());

    PlayerService.getInstance().createAgentControllers();
    GridService.getInstance().createDefaultGrids();

    RegionManager.start();

    actorSystem.actorOf(Props.create(UnityGameMessageHandler.class), UnityGameMessageHandler.name);

    GameMessageRoute.add(UnityInstanceManager.name, UnityInstanceManager.name, false);
    ActorUtil.createActor(UnityInstanceManager.class, UnityInstanceManager.name);

    TestRunner.run();

    Runtime.getRuntime()
        .addShutdownHook(
            new Thread() {
              public void run() {
                UnityProcessManager.stopAll();
                getActorSystem().shutdown();
              }
            });
  }