Exemplo n.º 1
0
 private void shutdown() {
   bitcoindProcessManager.shutdown();
   addressManager.shutdown();
   bitcoindFacadeFactory.shutdown();
   hiddenServerLogic.shutdown();
   rollingProfitParticipantLogic.shutdown();
   logger.info("shutdown");
 }
Exemplo n.º 2
0
  private Injector startup() {
    Injector injector;
    while (true) {
      try {
        injector = Guice.createInjector(new CommonModule(), new HiddenServerModule());

        addressManager = injector.getInstance(AddressManager.class);
        addressManager.start();

        // restart will use -rescan parameter so new imported addresses are available
        bitcoindProcessManager = injector.getInstance(BitcoindProcessManager.class);
        if (!bitcoindProcessManager.startAllBitcoindInstances()) {
          throw new RuntimeException("bitcoind instances not up");
        }
        bitcoindProcessManager.start();

        hiddenServerLogic = injector.getInstance(HiddenServerLogic.class);
        hiddenServerLogic.start();

        rollingProfitParticipantLogic = injector.getInstance(RollingProfitParticipantLogic.class);
        rollingProfitParticipantLogic.start();

        bitcoindFacadeFactory = injector.getInstance(BitcoindFacadeFactory.class);

        // consider testing profit & change addresses in P50PotConfig

        return injector;
      } catch (Throwable e) {
        logger.error("oh noes", e);
        try {
          Thread.sleep(2000);
        } catch (InterruptedException e1) {
          Thread.currentThread().interrupt();
          throw new RuntimeException(e1);
        }
      }
    }
  }