Search in sources :

Example 1 with FailRecordingEventsListener

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

the class ArchiveRecordingLoadTest method initRecordingEndIndicator.

private void initRecordingEndIndicator(final Subscription recordingEvents) {
    final RecordingEventsAdapter recordingEventsAdapter = new RecordingEventsAdapter(new FailRecordingEventsListener() {

        public void onProgress(final long recordingId0, final long startPosition, final long position) {
            if (recordingId0 != recordingId) {
                throw new IllegalStateException("expected=" + recordingId + " actual=" + recordingId0);
            }
            recordedLength = position - startPosition;
        }

        public void onStop(final long recordingId0, final long startPosition, final long stopPosition) {
            doneRecording = true;
            recordedLength = stopPosition - startPosition;
            if (recordingId0 != recordingId) {
                throw new IllegalStateException("expected=" + recordingId + " actual=" + recordingId0);
            }
        }
    }, recordingEvents, 1);
    recordingEnded = () -> recordingEventsAdapter.poll() != 0;
}
Also used : FailRecordingEventsListener(io.aeron.archive.FailRecordingEventsListener) RecordingEventsAdapter(io.aeron.archive.client.RecordingEventsAdapter)

Example 2 with FailRecordingEventsListener

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

the class ArchiveRecordingLoadTest method initRecordingStartIndicator.

private void initRecordingStartIndicator(final Subscription recordingEvents) {
    final RecordingEventsAdapter recordingEventsAdapter = new RecordingEventsAdapter(new FailRecordingEventsListener() {

        public void onStart(final long recordingId0, final long startPosition, final int sessionId, final int streamId, final String channel, final String sourceIdentity) {
            recordingId = recordingId0;
            if (streamId != PUBLISH_STREAM_ID) {
                throw new IllegalStateException("expected=" + PUBLISH_STREAM_ID + " actual=" + streamId);
            }
        }
    }, recordingEvents, 1);
    recordingStarted = () -> recordingEventsAdapter.poll() != 0;
}
Also used : FailRecordingEventsListener(io.aeron.archive.FailRecordingEventsListener) RecordingEventsAdapter(io.aeron.archive.client.RecordingEventsAdapter)

Aggregations

FailRecordingEventsListener (io.aeron.archive.FailRecordingEventsListener)2 RecordingEventsAdapter (io.aeron.archive.client.RecordingEventsAdapter)2