Github user chtyim commented on a diff in the pull request: https://github.com/apache/incubator-tephra/pull/53#discussion_r138691780 --- Diff: tephra-core/src/main/java/org/apache/tephra/persist/AbstractTransactionLog.java --- @@ -48,21 +51,30 @@ protected long timestamp; private volatile boolean initialized; private volatile boolean closed; - private AtomicLong syncedUpTo = new AtomicLong(); - private List<Entry> pendingWrites = Lists.newLinkedList(); + private long writtenUpTo = 0L; + private volatile long syncedUpTo = 0L; + private final Queue<Entry> pendingWrites = new ConcurrentLinkedQueue<>(); private TransactionLogWriter writer; - public AbstractTransactionLog(long timestamp, MetricsCollector metricsCollector) { + private int countSinceLastSync = 0; + private long positionBeforeWrite = -1L; + private final Stopwatch stopWatch = new Stopwatch(); + + private final long slowAppendThreshold; + + AbstractTransactionLog(long timestamp, MetricsCollector metricsCollector, Configuration conf) { this.timestamp = timestamp; this.metricsCollector = metricsCollector; + this.slowAppendThreshold = conf.getLong(TxConstants.TransactionLog.CFG_SLOW_APPEND_THRESHOLD, + TxConstants.TransactionLog.DEFAULT_SLOW_APPEND_THRESHOLD); } /** * Initializes the log file, opening a file writer. Clients calling {@code init()} should ensure that they * also call {@link HDFSTransactionLog#close()}. * @throws java.io.IOException If an error is encountered initializing the file writer. */ - public synchronized void init() throws IOException { + private synchronized void init() throws IOException { --- End diff -- Seems like the javadoc is actually wrong. No "client" is calling this method and the contract should be whoever construct this class should call "close"?
---