BookKeeperLog(int containerId, CuratorFramework zkClient, BookKeeper bookKeeper, BookKeeperConfig config, ScheduledExecutorService executorService) {
Preconditions.checkArgument(containerId >= 0, "containerId must be a non-negative integer.");
this.zkClient = Preconditions.checkNotNull(zkClient, "zkClient");
this.bookKeeper = Preconditions.checkNotNull(bookKeeper, "bookKeeper");
this.config = Preconditions.checkNotNull(config, "config");
this.executorService = Preconditions.checkNotNull(executorService, "executorService");
this.closed = new AtomicBoolean();
this.logNodePath = HierarchyUtils.getPath(containerId, this.config.getZkHierarchyDepth());
this.traceObjectId = String.format("Log[%d]", containerId);
this.writes = new WriteQueue();
val retry = createRetryPolicy(this.config.getMaxWriteAttempts(), this.config.getBkWriteTimeoutMillis());
this.writeProcessor = new SequentialAsyncProcessor(this::processWritesSync, retry, this::handleWriteProcessorFailures, this.executorService);
this.rolloverProcessor = new SequentialAsyncProcessor(this::rollover, retry, this::handleRolloverFailure, this.executorService);
this.metrics = new BookKeeperMetrics.BookKeeperLog(containerId);
this.metricReporter = this.executorService.scheduleWithFixedDelay(this::reportMetrics, REPORT_INTERVAL, REPORT_INTERVAL, TimeUnit.MILLISECONDS);
}