Search in sources :

Example 1 with ArchiveMarkFile

use of io.aeron.archive.ArchiveMarkFile in project aeron by real-logic.

the class SystemTestWatcher method countArchiveMarkFileErrors.

private int countArchiveMarkFileErrors(final List<Path> paths, final Predicate<String> filter) {
    final MutableInteger errorCount = new MutableInteger();
    for (final Path path : paths) {
        try (ArchiveMarkFile archive = openArchiveMarkFile(path)) {
            final AtomicBuffer buffer = archive.errorBuffer();
            ErrorLogReader.read(buffer, (observationCount, firstObservationTimestamp, lastObservationTimestamp, encodedException) -> {
                if (filter.test(encodedException)) {
                    errorCount.set(errorCount.get() + observationCount);
                }
            });
        }
    }
    return errorCount.get();
}
Also used : Path(java.nio.file.Path) MutableInteger(org.agrona.collections.MutableInteger) ArchiveMarkFile(io.aeron.archive.ArchiveMarkFile) AtomicBuffer(org.agrona.concurrent.AtomicBuffer)

Example 2 with ArchiveMarkFile

use of io.aeron.archive.ArchiveMarkFile in project Aeron by real-logic.

the class SystemTestWatcher method countArchiveMarkFileErrors.

private int countArchiveMarkFileErrors(final List<Path> paths, final Predicate<String> filter) {
    final MutableInteger errorCount = new MutableInteger();
    for (final Path path : paths) {
        try (ArchiveMarkFile archive = openArchiveMarkFile(path)) {
            final AtomicBuffer buffer = archive.errorBuffer();
            ErrorLogReader.read(buffer, (observationCount, firstObservationTimestamp, lastObservationTimestamp, encodedException) -> {
                if (filter.test(encodedException)) {
                    errorCount.set(errorCount.get() + observationCount);
                }
            });
        }
    }
    return errorCount.get();
}
Also used : Path(java.nio.file.Path) MutableInteger(org.agrona.collections.MutableInteger) ArchiveMarkFile(io.aeron.archive.ArchiveMarkFile) AtomicBuffer(org.agrona.concurrent.AtomicBuffer)

Example 3 with ArchiveMarkFile

use of io.aeron.archive.ArchiveMarkFile in project Aeron by real-logic.

the class SystemTestWatcher method printArchiveMarkFileErrors.

private void printArchiveMarkFileErrors(final List<Path> paths) {
    for (final Path path : paths) {
        try (ArchiveMarkFile archiveFile = openArchiveMarkFile(path)) {
            final AtomicBuffer buffer = archiveFile.errorBuffer();
            System.out.printf("%n%n%s file %s%n", "Archive Errors", path);
            final int distinctErrorCount = ErrorLogReader.read(buffer, this::printObservationCallback);
            System.out.format("%d distinct errors observed.%n", distinctErrorCount);
        }
    }
}
Also used : Path(java.nio.file.Path) ArchiveMarkFile(io.aeron.archive.ArchiveMarkFile) AtomicBuffer(org.agrona.concurrent.AtomicBuffer)

Example 4 with ArchiveMarkFile

use of io.aeron.archive.ArchiveMarkFile in project aeron by real-logic.

the class SystemTestWatcher method printArchiveMarkFileErrors.

private void printArchiveMarkFileErrors(final List<Path> paths) {
    for (final Path path : paths) {
        try (ArchiveMarkFile archiveFile = openArchiveMarkFile(path)) {
            final AtomicBuffer buffer = archiveFile.errorBuffer();
            System.out.printf("%n%n%s file %s%n", "Archive Errors", path);
            final int distinctErrorCount = ErrorLogReader.read(buffer, this::printObservationCallback);
            System.out.format("%d distinct errors observed.%n", distinctErrorCount);
        }
    }
}
Also used : Path(java.nio.file.Path) ArchiveMarkFile(io.aeron.archive.ArchiveMarkFile) AtomicBuffer(org.agrona.concurrent.AtomicBuffer)

Aggregations

ArchiveMarkFile (io.aeron.archive.ArchiveMarkFile)4 Path (java.nio.file.Path)4 AtomicBuffer (org.agrona.concurrent.AtomicBuffer)4 MutableInteger (org.agrona.collections.MutableInteger)2