public BufferedLogStreamReader(final LogStream logStream) { this(); wrap(logStream); }
public BufferedLogStreamReader(final LogStream logStream, final boolean readUncommittedEntries) { this(readUncommittedEntries); wrap(logStream); }
@Override public void wrap(final LogStream log) { wrap(log, FIRST_POSITION); }
@Override public void wrap(final LogStream log) { wrap(log, FIRST_POSITION); }
public void wrap(final LogStorage logStorage, final LogBlockIndex logBlockIndex) { wrap(logStorage, logBlockIndex, FIRST_POSITION); }
public BufferedLogStreamReader(final LogStream logStream) { this(); wrap(logStream); }
public BufferedLogStreamReader(final LogStream logStream, final boolean readUncommittedEntries) { this(readUncommittedEntries); wrap(logStream); }
public void wrap(final LogStorage logStorage, final LogBlockIndex logBlockIndex) { wrap(logStorage, logBlockIndex, FIRST_POSITION); }
@Override public void wrap(final LogStream log, final long position) { logStream = log; wrap(log.getLogStorage(), log.getLogBlockIndex(), position); }
@Override public void wrap(final LogStream log, final long position) { logStream = log; wrap(log.getLogStorage(), log.getLogBlockIndex(), position); }
private int determineInitialPartitionId() { final LogStorage logStorage = logStorageInjector.getValue(); final LogBlockIndex logBlockIndex = logBlockIndexInjector.getValue(); try (BufferedLogStreamReader logReader = new BufferedLogStreamReader(true)) { logReader.wrap(logStorage, logBlockIndex); long lastPosition = 0; // Get position of last entry logReader.seekToLastEvent(); if (logReader.hasNext()) { final LoggedEvent lastEntry = logReader.next(); lastPosition = lastEntry.getPosition(); } // dispatcher needs to generate positions greater than the last position int partitionId = 0; if (lastPosition > 0) { partitionId = PositionUtil.partitionId(lastPosition); } return partitionId; } }
private int determineInitialPartitionId() { final LogStorage logStorage = logStorageInjector.getValue(); final LogBlockIndex logBlockIndex = logBlockIndexInjector.getValue(); try (BufferedLogStreamReader logReader = new BufferedLogStreamReader(true)) { logReader.wrap(logStorage, logBlockIndex); long lastPosition = 0; // Get position of last entry logReader.seekToLastEvent(); if (logReader.hasNext()) { final LoggedEvent lastEntry = logReader.next(); lastPosition = lastEntry.getPosition(); } // dispatcher needs to generate positions greater than the last position int partitionId = 0; if (lastPosition > 0) { partitionId = PositionUtil.partitionId(lastPosition); } return partitionId; } }