io.aeron.Aeron Java Examples

The following examples show how to use io.aeron.Aeron. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Streams.java    From artio with Apache License 2.0 6 votes vote down vote up
public Streams(
    final Aeron aeron,
    final String aeronChannel,
    final boolean printAeronStreamIdentifiers,
    final AtomicCounter failedPublications,
    final int streamId,
    final Clock clock,
    final int maxClaimAttempts,
    final RecordingCoordinator recordingCoordinator)
{
    this.aeron = aeron;
    this.aeronChannel = aeronChannel;
    this.printAeronStreamIdentifiers = printAeronStreamIdentifiers;
    this.failedPublications = failedPublications;
    this.streamId = streamId;
    this.clock = clock;
    this.maxClaimAttempts = maxClaimAttempts;
    this.recordingCoordinator = recordingCoordinator;
}
 
Example #2
Source File: StatusUtil.java    From aeron with Apache License 2.0 6 votes vote down vote up
/**
 * Return the controllable idle strategy {@link StatusIndicator}.
 *
 * @param countersReader that holds the status indicator.
 * @return status indicator to use or null if not found.
 */
public static StatusIndicator controllableIdleStrategy(final CountersReader countersReader)
{
    StatusIndicator statusIndicator = null;
    final MutableInteger id = new MutableInteger(-1);

    countersReader.forEach(
        (counterId, label) ->
        {
            if (counterId == SystemCounterDescriptor.CONTROLLABLE_IDLE_STRATEGY.id() &&
                label.equals(SystemCounterDescriptor.CONTROLLABLE_IDLE_STRATEGY.label()))
            {
                id.value = counterId;
            }
        });

    if (Aeron.NULL_VALUE != id.value)
    {
        statusIndicator = new UnsafeBufferStatusIndicator(countersReader.valuesBuffer(), id.value);
    }

    return statusIndicator;
}
 
Example #3
Source File: SequenceNumberIndexTest.java    From artio with Apache License 2.0 6 votes vote down vote up
@Before
public void setUp()
{
    mediaDriver = launchMediaDriver();
    aeronArchive = AeronArchive.connect();
    final Aeron aeron = aeronArchive.context().aeron();

    aeronArchive.startRecording(IPC_CHANNEL, STREAM_ID, SourceLocation.LOCAL);

    publication = aeron.addPublication(IPC_CHANNEL, STREAM_ID);
    subscription = aeron.addSubscription(IPC_CHANNEL, STREAM_ID);

    buffer = new UnsafeBuffer(new byte[512]);

    deleteFiles();

    recordingIdLookup = new RecordingIdLookup(new YieldingIdleStrategy(), aeron.countersReader());
    writer = newWriter(inMemoryBuffer);
    reader = new SequenceNumberIndexReader(inMemoryBuffer, errorHandler, recordingIdLookup, null);
}
 
Example #4
Source File: ClusterTool.java    From aeron with Apache License 2.0 6 votes vote down vote up
public static boolean removeMember(final ClusterMarkFile markFile, final int memberId, final boolean isPassive)
{
    final String aeronDirectoryName = markFile.decoder().aeronDirectory();
    final String controlChannel = markFile.decoder().controlChannel();
    final int consensusModuleStreamId = markFile.decoder().consensusModuleStreamId();

    try (Aeron aeron = Aeron.connect(new Aeron.Context().aeronDirectoryName(aeronDirectoryName));
        ConsensusModuleProxy consensusModuleProxy = new ConsensusModuleProxy(
            aeron.addPublication(controlChannel, consensusModuleStreamId)))
    {
        if (consensusModuleProxy.removeMember(memberId, isPassive ? BooleanType.TRUE : BooleanType.FALSE))
        {
            return true;
        }
    }

    return false;
}
 
Example #5
Source File: EmbeddedPingPong.java    From aeron with Apache License 2.0 6 votes vote down vote up
public static void main(final String[] args) throws Exception
{
    loadPropertiesFiles(args);

    final MediaDriver.Context ctx = new MediaDriver.Context()
        .threadingMode(ThreadingMode.DEDICATED)
        .conductorIdleStrategy(new BackoffIdleStrategy(1, 1, 1000, 1000))
        .receiverIdleStrategy(NoOpIdleStrategy.INSTANCE)
        .senderIdleStrategy(NoOpIdleStrategy.INSTANCE);

    try (MediaDriver ignored = MediaDriver.launch(ctx);
        Aeron aeron = Aeron.connect())
    {
        final Thread pongThread = startPong(aeron);
        pongThread.start();

        runPing(aeron);
        RUNNING.set(false);
        pongThread.join();

        System.out.println("Shutdown Driver...");
    }
}
 
Example #6
Source File: FixMessageLogger.java    From artio with Apache License 2.0 6 votes vote down vote up
public static void main(final String[] args)
{
    final FixMessageLogger logger = new FixMessageLogger(
        System.out::println,
        new Aeron.Context(),
        IPC_CHANNEL,
        DEFAULT_INBOUND_LIBRARY_STREAM,
        DEFAULT_OUTBOUND_LIBRARY_STREAM,
        DEFAULT_OUTBOUND_REPLAY_STREAM);

    final AgentRunner runner = new AgentRunner(
        CommonConfiguration.backoffIdleStrategy(),
        Throwable::printStackTrace,
        null,
        logger
    );

    AgentRunner.startOnThread(runner);
}
 
Example #7
Source File: FixMessageLogger.java    From artio with Apache License 2.0 6 votes vote down vote up
public FixMessageLogger(
    final Consumer<String> fixMessageConsumer,
    final Aeron.Context context,
    final String libraryAeronChannel,
    final int inboundStreamId,
    final int outboundStreamId,
    final int outboundReplayStreamId)
{
    aeron = Aeron.connect(context);
    inboundSubscription = aeron.addSubscription(libraryAeronChannel, inboundStreamId);
    outboundSubscription = aeron.addSubscription(libraryAeronChannel, outboundStreamId);
    replaySubscription = aeron.addSubscription(libraryAeronChannel, outboundReplayStreamId);

    final LogEntryHandler logEntryHandler = new LogEntryHandler((message, buffer, offset, length, header) ->
        fixMessageConsumer.accept(message.body()));
    fragmentAssembler = new FragmentAssembler(logEntryHandler);
}
 
Example #8
Source File: EchoNode.java    From benchmarks with Apache License 2.0 6 votes vote down vote up
EchoNode(
    final AtomicBoolean running, final MediaDriver mediaDriver, final Aeron aeron, final boolean ownsAeronClient)
{
    this.running = running;
    this.mediaDriver = mediaDriver;
    this.aeron = aeron;
    this.ownsAeronClient = ownsAeronClient;

    publication = aeron.addExclusivePublication(receiveChannel(), receiveStreamId());
    subscription = aeron.addSubscription(sendChannel(), sendStreamId());

    while (!subscription.isConnected() || !publication.isConnected())
    {
        yieldUninterruptedly();
    }
}
 
Example #9
Source File: NdArrayIpcTest.java    From nd4j with Apache License 2.0 5 votes vote down vote up
private Aeron.Context getContext() {
    if (ctx == null)
        ctx = new Aeron.Context().publicationConnectionTimeout(1000)
                        .availableImageHandler(image -> System.out.println(image))
                        .unavailableImageHandler(AeronUtil::printUnavailableImage)
                        .aeronDirectoryName(mediaDriver.aeronDirectoryName()).keepAliveInterval(1000)
                        .errorHandler(e -> log.error(e.toString(), e));
    return ctx;
}
 
Example #10
Source File: AeronExclusiveIpcBenchmark.java    From benchmarks with Apache License 2.0 5 votes vote down vote up
@Setup
public synchronized void setup()
{
    for (int i = 0; i < MAX_THREAD_COUNT; i++)
    {
        responseQueues[i] = new OneToOneConcurrentArrayQueue<>(RESPONSE_QUEUE_CAPACITY);
    }

    values = new int[burstLength];
    for (int i = 0; i < burstLength; i++)
    {
        values[i] = -(burstLength - i);
    }

    ctx = new MediaDriver.Context()
        .termBufferSparseFile(false)
        .threadingMode(ThreadingMode.SHARED)
        .sharedIdleStrategy(new BusySpinIdleStrategy())
        .dirDeleteOnStart(true);

    mediaDriver = MediaDriver.launch(ctx);
    aeron = Aeron.connect(new Aeron.Context().preTouchMappedMemory(true));
    publication = aeron.addExclusivePublication(CommonContext.IPC_CHANNEL, STREAM_ID);
    subscription = aeron.addSubscription(CommonContext.IPC_CHANNEL, STREAM_ID);

    consumerThread = new Thread(new Subscriber(subscription, running, responseQueues));

    consumerThread.setName("consumer");
    consumerThread.start();
}
 
Example #11
Source File: ArchiveNode.java    From benchmarks with Apache License 2.0 5 votes vote down vote up
ArchiveNode(
    final AtomicBoolean running,
    final ArchivingMediaDriver archivingMediaDriver,
    final AeronArchive aeronArchive,
    final boolean ownsArchiveClient)
{
    this.running = running;
    this.archivingMediaDriver = archivingMediaDriver;
    this.aeronArchive = aeronArchive;
    this.ownsArchiveClient = ownsArchiveClient;

    final Aeron aeron = aeronArchive.context().aeron();

    subscription = aeron.addSubscription(sendChannel(), sendStreamId());

    final String archiveChannel = archiveChannel();
    final int archiveStreamId = archiveStreamId();
    publication = aeron.addExclusivePublication(archiveChannel, archiveStreamId);

    final int publicationSessionId = publication.sessionId();
    final String channel = addSessionId(archiveChannel, publicationSessionId);
    aeronArchive.startRecording(channel, archiveStreamId, LOCAL, true);

    while (!subscription.isConnected() || !publication.isConnected())
    {
        yieldUninterruptedly();
    }

    awaitRecordingStart(aeron, publicationSessionId);
}
 
Example #12
Source File: ArchiveMessageTransceiver.java    From benchmarks with Apache License 2.0 5 votes vote down vote up
public void init(final Configuration configuration)
{
    final Aeron aeron = aeronArchive.context().aeron();

    subscription = aeron.addSubscription(receiveChannel(), receiveStreamId());

    final String archiveChannel = archiveChannel();
    final int archiveStreamId = archiveStreamId();
    publication = aeron.addExclusivePublication(archiveChannel, archiveStreamId);

    final int publicationSessionId = publication.sessionId();
    final String channel = addSessionId(archiveChannel, publicationSessionId);
    aeronArchive.startRecording(channel, archiveStreamId, LOCAL, true);

    while (!subscription.isConnected() || !publication.isConnected())
    {
        yieldUninterruptedly();
    }

    awaitRecordingStart(aeron, publicationSessionId);

    offerBuffer = new UnsafeBuffer(allocateDirectAligned(configuration.messageLength(), CACHE_LINE_LENGTH));

    image = subscription.imageAtIndex(0);

    fragmentLimit = fragmentLimit();
}
 
Example #13
Source File: PlainMessageTransceiver.java    From benchmarks with Apache License 2.0 5 votes vote down vote up
PlainMessageTransceiver(
    final MediaDriver mediaDriver,
    final Aeron aeron,
    final boolean ownsAeronClient,
    final MessageRecorder messageRecorder)
{
    super(messageRecorder);
    this.mediaDriver = mediaDriver;
    this.aeron = aeron;
    this.ownsAeronClient = ownsAeronClient;
}
 
Example #14
Source File: ParameterServerSubscriber.java    From nd4j with Apache License 2.0 5 votes vote down vote up
public Aeron.Context getContext() {
    Aeron.Context ctx = new Aeron.Context().publicationConnectionTimeout(-1)
                    .availableImageHandler(AeronUtil::printAvailableImage)
                    .unavailableImageHandler(AeronUtil::printUnavailableImage)
                    .aeronDirectoryName(mediaDriverDirectoryName).keepAliveInterval(100000)
                    .errorHandler(e -> log.error(e.toString(), e));
    return ctx;
}
 
Example #15
Source File: LiveReplayMessageTransceiver.java    From benchmarks with Apache License 2.0 5 votes vote down vote up
public void init(final Configuration configuration)
{
    final Aeron aeron = aeronArchive.context().aeron();

    publication = aeron.addExclusivePublication(sendChannel(), sendStreamId());

    while (!publication.isConnected())
    {
        yieldUninterruptedly();
    }

    final long recordingId = findLastRecordingId(aeronArchive, archiveChannel(), archiveStreamId());

    final String replayChannel = receiveChannel();
    final int replayStreamId = receiveStreamId();
    final long replaySessionId = replayFullRecording(aeronArchive, recordingId, replayChannel, replayStreamId);

    final String channel = addSessionId(replayChannel, (int)replaySessionId);
    subscription = aeron.addSubscription(channel, replayStreamId);

    while (!subscription.isConnected())
    {
        yieldUninterruptedly();
    }

    image = subscription.imageAtIndex(0);

    offerBuffer = new UnsafeBuffer(allocateDirectAligned(configuration.messageLength(), CACHE_LINE_LENGTH));

    fragmentLimit = fragmentLimit();
}
 
Example #16
Source File: LiveRecordingMessageTransceiver.java    From benchmarks with Apache License 2.0 5 votes vote down vote up
public void init(final Configuration configuration)
{
    final AeronArchive.Context context = aeronArchive.context();
    final Aeron aeron = context.aeron();

    fragmentLimit = fragmentLimit();

    subscription = aeron.addSubscription(receiveChannel(), receiveStreamId());

    final String sendChannel = sendChannel();
    final int sendStreamId = sendStreamId();
    publication = aeron.addExclusivePublication(sendChannel, sendStreamId);

    recordingEventsSubscription = aeron.addSubscription(
        context.recordingEventsChannel(), context.recordingEventsStreamId());

    recordingEventsAdapter = new RecordingEventsAdapter(
        new LiveRecordingEventsListener(this), recordingEventsSubscription, fragmentLimit);

    while (!recordingEventsSubscription.isConnected() || !subscription.isConnected() || !publication.isConnected())
    {
        yieldUninterruptedly();
    }

    final int publicationSessionId = publication.sessionId();
    final String channel = addSessionId(sendChannel, publicationSessionId);
    aeronArchive.startRecording(channel, sendStreamId, LOCAL, true);
    recordingId = awaitRecordingStart(aeron, publicationSessionId);

    offerBuffer = new UnsafeBuffer(allocateDirectAligned(configuration.messageLength(), CACHE_LINE_LENGTH));
    image = subscription.imageAtIndex(0);
}
 
Example #17
Source File: AeronNDArrayResponder.java    From deeplearning4j with Apache License 2.0 5 votes vote down vote up
private void init() {
    ctx = ctx == null ? new Aeron.Context() : ctx;
    channel = channel == null ? "aeron:udp?endpoint=localhost:40123" : channel;
    fragmentLimitCount = fragmentLimitCount == 0 ? 5000 : fragmentLimitCount;
    streamId = streamId == 0 ? 10 : streamId;
    responseStreamId = responseStreamId == 0 ? -1 : responseStreamId;
    running = running == null ? new AtomicBoolean(true) : running;
    if (ndArrayHolder == null)
        throw new IllegalStateException("NDArray callback must be specified in the builder.");
    init.set(true);
    launched = new AtomicBoolean(false);
    log.info("Channel subscriber " + channel + " and stream id " + streamId);
}
 
Example #18
Source File: RecordingCoordinator.java    From artio with Apache License 2.0 5 votes vote down vote up
RecordingCoordinator(
    final Aeron aeron,
    final AeronArchive archive,
    final EngineConfiguration configuration,
    final IdleStrategy archiverIdleStrategy,
    final ErrorHandler errorHandler)
{
    this.aeron = aeron;
    this.archive = archive;
    this.configuration = configuration;
    this.channel = configuration.libraryAeronChannel();

    recordingIdsFile = new File(configuration.logFileDir(), FILE_NAME);
    this.errorHandler = errorHandler;
    outboundLocation = channel.equals(IPC_CHANNEL) ? LOCAL : REMOTE;
    loadRecordingIdsFile();

    if (configuration.logAnyMessages())
    {
        counters = this.aeron.countersReader();
        framerInboundLookup = new RecordingIdLookup(archiverIdleStrategy, counters);
        framerOutboundLookup = new RecordingIdLookup(archiverIdleStrategy, counters);
        indexerInboundLookup = new RecordingIdLookup(archiverIdleStrategy, counters);
        indexerOutboundLookup = new RecordingIdLookup(archiverIdleStrategy, counters);
    }
    else
    {
        counters = null;
        framerInboundLookup = null;
        framerOutboundLookup = null;
        indexerInboundLookup = null;
        indexerOutboundLookup = null;
    }
}
 
Example #19
Source File: AeronIpcBenchmark.java    From benchmarks with Apache License 2.0 5 votes vote down vote up
@Setup
public synchronized void setup()
{
    for (int i = 0; i < MAX_THREAD_COUNT; i++)
    {
        responseQueues[i] = new OneToOneConcurrentArrayQueue<>(RESPONSE_QUEUE_CAPACITY);
    }

    values = new int[burstLength];
    for (int i = 0; i < burstLength; i++)
    {
        values[i] = -(burstLength - i);
    }

    ctx = new MediaDriver.Context()
        .termBufferSparseFile(false)
        .threadingMode(ThreadingMode.SHARED)
        .sharedIdleStrategy(new BusySpinIdleStrategy())
        .dirDeleteOnStart(true);

    mediaDriver = MediaDriver.launch(ctx);
    aeron = Aeron.connect(new Aeron.Context().preTouchMappedMemory(true));
    publication = aeron.addPublication(CommonContext.IPC_CHANNEL, STREAM_ID);
    subscription = aeron.addSubscription(CommonContext.IPC_CHANNEL, STREAM_ID);

    consumerThread = new Thread(new Subscriber(subscription, running, responseQueues));

    consumerThread.setName("consumer");
    consumerThread.start();
}
 
Example #20
Source File: ManageRecordingHistoryTest.java    From aeron with Apache License 2.0 5 votes vote down vote up
@BeforeEach
public void before()
{
    archivingMediaDriver = TestMediaDriver.launch(
        new MediaDriver.Context()
            .publicationTermBufferLength(Common.TERM_LENGTH)
            .termBufferSparseFile(true)
            .threadingMode(ThreadingMode.SHARED)
            .errorHandler(Tests::onError)
            .spiesSimulateConnection(true)
            .dirDeleteOnStart(true),
        testWatcher);

    archive = Archive.launch(
        new Archive.Context()
            .maxCatalogEntries(Common.MAX_CATALOG_ENTRIES)
            .segmentFileLength(SEGMENT_LENGTH)
            .deleteArchiveOnStart(true)
            .archiveDir(new File(SystemUtil.tmpDirName(), "archive"))
            .fileSyncLevel(0)
            .threadingMode(ArchiveThreadingMode.SHARED));

    aeron = Aeron.connect();

    aeronArchive = AeronArchive.connect(
        new AeronArchive.Context()
            .aeron(aeron));
}
 
Example #21
Source File: BenchClient.java    From rpc-bench with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("PMD.NullAssignment")
public BenchClient() {
  driver = EMBEDDED_MEDIA_DRIVER ? MediaDriver.launchEmbedded() : null;
  ctx = new Aeron.Context().availableImageHandler(this::imageHandler);
  if (EMBEDDED_MEDIA_DRIVER) {
    ctx.aeronDirectoryName(driver.aeronDirectoryName());
  }
  fragmentHandler = new FragmentAssembler(this::onMessage);
  aeron = Aeron.connect(ctx);
  publication = aeron.addPublication(REQ_CHAN, REQ_STREAM_ID);
  subscription = aeron.addSubscription(REP_CHAN, REP_STREAM_ID);
}
 
Example #22
Source File: BenchServer.java    From rpc-bench with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("PMD.NullAssignment")
public BenchServer() {
  running = new AtomicBoolean(true);
  SigInt.register(() -> running.set(false));
  driver = EMBEDDED_MEDIA_DRIVER ? MediaDriver.launchEmbedded() : null;
  ctx = new Aeron.Context();
  if (EMBEDDED_MEDIA_DRIVER) {
    ctx.aeronDirectoryName(driver.aeronDirectoryName());
  }
  fragmentHandler = new FragmentAssembler(this::onMessage);
  aeron = Aeron.connect(ctx);
  publication = aeron.addPublication(REP_CHAN, REP_STREAM_ID);
  subscription = aeron.addSubscription(REQ_CHAN, REQ_STREAM_ID);
}
 
Example #23
Source File: CatalogViewTest.java    From aeron with Apache License 2.0 5 votes vote down vote up
@Test
public void shouldListRecordingByRecordingId()
{
    final boolean found = CatalogView.listRecording(archiveDir, recordingTwoId, mockRecordingDescriptorConsumer);
    assertTrue(found);

    verify(mockRecordingDescriptorConsumer).onRecordingDescriptor(
        Aeron.NULL_VALUE, Aeron.NULL_VALUE, recordingTwoId, 5L, Aeron.NULL_VALUE, 11L,
        Aeron.NULL_VALUE, 0, SEGMENT_LENGTH, TERM_LENGTH, MTU_LENGTH, 8, 2,
        "channelH", "channelH?tag=f", "sourceV");

    verifyNoMoreInteractions(mockRecordingDescriptorConsumer);
}
 
Example #24
Source File: ControlSession.java    From aeron with Apache License 2.0 5 votes vote down vote up
private int waitForRequest(final long nowMs)
{
    int workCount = 0;

    if (hasNoActivity(nowMs))
    {
        state(State.INACTIVE);
        workCount += 1;
    }
    else if (nowMs > resendDeadlineMs)
    {
        resendDeadlineMs = nowMs + RESEND_INTERVAL_MS;
        if (controlResponseProxy.sendResponse(
            controlSessionId,
            correlationId,
            controlSessionId,
            OK,
            null,
            this))
        {
            activityDeadlineMs = Aeron.NULL_VALUE;
            workCount += 1;
        }
    }

    return workCount;
}
 
Example #25
Source File: ControlSession.java    From aeron with Apache License 2.0 5 votes vote down vote up
private int sendQueuedResponses(final long nowMs)
{
    int workCount = 0;

    if (!controlPublication.isConnected())
    {
        state(State.INACTIVE);
    }
    else
    {
        if (!queuedResponses.isEmpty())
        {
            if (queuedResponses.peekFirst().getAsBoolean())
            {
                queuedResponses.pollFirst();
                activityDeadlineMs = Aeron.NULL_VALUE;
                workCount++;
            }
            else if (activityDeadlineMs == Aeron.NULL_VALUE)
            {
                activityDeadlineMs = nowMs + connectTimeoutMs;
            }
            else if (hasNoActivity(nowMs))
            {
                state(State.INACTIVE);
            }
        }
    }

    return workCount;
}
 
Example #26
Source File: NdArrayIpcTest.java    From deeplearning4j with Apache License 2.0 5 votes vote down vote up
private Aeron.Context getContext() {
    if (ctx == null)
        ctx = new Aeron.Context().publicationConnectionTimeout(1000)
                        .availableImageHandler(image -> System.out.println(image))
                        .unavailableImageHandler(AeronUtil::printUnavailableImage)
                        .aeronDirectoryName(mediaDriver.aeronDirectoryName()).keepAliveInterval(1000)
                        .errorHandler(e -> log.error(e.toString(), e));
    return ctx;
}
 
Example #27
Source File: RecordingEventsPoller.java    From aeron with Apache License 2.0 5 votes vote down vote up
/**
 * Poll for recording events.
 *
 * @return the number of fragments read during the operation. Zero if no events are available.
 */
public int poll()
{
    templateId = Aeron.NULL_VALUE;
    pollComplete = false;

    return subscription.poll(this, 1);
}
 
Example #28
Source File: AeronNDArraySubscriber.java    From deeplearning4j with Apache License 2.0 5 votes vote down vote up
private void init() {
    ctx = ctx == null ? new Aeron.Context() : ctx;
    channel = channel == null ? "aeron:udp?endpoint=localhost:40123" : channel;
    fragmentLimitCount = fragmentLimitCount == 0 ? 1000 : fragmentLimitCount;
    streamId = streamId == 0 ? 10 : streamId;
    running = running == null ? new AtomicBoolean(true) : running;
    if (ndArrayCallback == null)
        throw new IllegalStateException("NDArray callback must be specified in the builder.");
    init.set(true);
    log.info("Channel subscriber " + channel + " and stream id " + streamId);
    launched = new AtomicBoolean(false);
}
 
Example #29
Source File: ParameterServerClientTest.java    From deeplearning4j with Apache License 2.0 5 votes vote down vote up
private static Aeron.Context getContext() {
    return new Aeron.Context().publicationConnectionTimeout(-1)
                    .availableImageHandler(AeronUtil::printAvailableImage)
                    .unavailableImageHandler(AeronUtil::printUnavailableImage)
                    .aeronDirectoryName(mediaDriver.aeronDirectoryName()).keepAliveInterval(1000)
                    .errorHandler(e -> log.error(e.toString(), e));
}
 
Example #30
Source File: RemoteParameterServerClientTests.java    From nd4j with Apache License 2.0 5 votes vote down vote up
private Aeron.Context getContext() {
    if (ctx == null)
        ctx = new Aeron.Context().publicationConnectionTimeout(-1)
                        .availableImageHandler(AeronUtil::printAvailableImage)
                        .unavailableImageHandler(AeronUtil::printUnavailableImage)
                        .aeronDirectoryName(mediaDriver.aeronDirectoryName()).keepAliveInterval(1000)
                        .errorHandler(e -> log.error(e.toString(), e));
    return ctx;
}