コード例 #1
0
ファイル: MediaDriver.java プロジェクト: AAyyy/Aeron
  /**
   * Start Media Driver as a stand-alone process.
   *
   * @param args command line arguments
   * @throws Exception if an error occurs
   */
  public static void main(final String[] args) throws Exception {
    if (1 == args.length) {
      loadPropertiesFile(args[0]);
    }

    try (final MediaDriver ignored = MediaDriver.launch()) {
      new SigIntBarrier().await();

      System.out.println("Shutdown Driver...");
    }
  }
コード例 #2
0
  public synchronized void launchDriver() {
    if (state == State.SHUTTING_DOWN) {
      throw new IllegalStateException("Manager is being shutdown");
    }

    if (driver == null) {
      driver = MediaDriver.launchEmbedded(getDriverContext());
      Aeron.Context ctx = new Aeron.Context();
      String aeronDirName = driver.aeronDirectoryName();
      ctx.aeronDirectoryName(aeronDirName);
      aeron = Aeron.connect(ctx);

      aeronCounters = new AeronCounters(aeronDirName);
      state = State.STARTED;

      aeronDirNames.add(aeronDirName);

      logger.info("Embedded media driver started");
    }
    counter++;
  }