/** * Generate the next correlation id that is unique for the connected Media Driver. * <p> * This is useful generating correlation identifiers for pairing requests with responses in a clients own * application protocol. * <p> * This method is thread safe and will work across processes that all use the same media driver. * * @return next correlation id that is unique for the Media Driver. */ public long nextCorrelationId() { if (1 == isClosed) { throw new AeronException("client is closed"); } return commandBuffer.nextCorrelationId(); }
public long removeSubscription(final long registrationId) { final long correlationId = toDriverCommandBuffer.nextCorrelationId(); removeMessage .registrationId(registrationId) .correlationId(correlationId); if (!toDriverCommandBuffer.write(REMOVE_SUBSCRIPTION, buffer, 0, RemoveMessageFlyweight.length())) { throw new AeronException("could not write remove subscription message"); } return correlationId; }
public long removeCounter(final long registrationId) { final long correlationId = toDriverCommandBuffer.nextCorrelationId(); removeMessage .registrationId(registrationId) .correlationId(correlationId); if (!toDriverCommandBuffer.write(REMOVE_COUNTER, buffer, 0, RemoveMessageFlyweight.length())) { throw new AeronException("could not write remove counter command"); } return correlationId; }
public long removePublication(final long registrationId) { final long correlationId = toDriverCommandBuffer.nextCorrelationId(); removeMessage .registrationId(registrationId) .correlationId(correlationId); if (!toDriverCommandBuffer.write(REMOVE_PUBLICATION, buffer, 0, RemoveMessageFlyweight.length())) { throw new AeronException("could not write remove publication command"); } return correlationId; }
public long addRcvDestination(final long registrationId, final String endpointChannel) { final long correlationId = toDriverCommandBuffer.nextCorrelationId(); destinationMessage .registrationCorrelationId(registrationId) .channel(endpointChannel) .correlationId(correlationId); if (!toDriverCommandBuffer.write(ADD_RCV_DESTINATION, buffer, 0, destinationMessage.length())) { throw new AeronException("could not write rcv destination command"); } return correlationId; }
public long removeDestination(final long registrationId, final String endpointChannel) { final long correlationId = toDriverCommandBuffer.nextCorrelationId(); destinationMessage .registrationCorrelationId(registrationId) .channel(endpointChannel) .correlationId(correlationId); if (!toDriverCommandBuffer.write(REMOVE_DESTINATION, buffer, 0, destinationMessage.length())) { throw new AeronException("could not write destination command"); } return correlationId; }
public long removeRcvDestination(final long registrationId, final String endpointChannel) { final long correlationId = toDriverCommandBuffer.nextCorrelationId(); destinationMessage .registrationCorrelationId(registrationId) .channel(endpointChannel) .correlationId(correlationId); if (!toDriverCommandBuffer.write(REMOVE_RCV_DESTINATION, buffer, 0, destinationMessage.length())) { throw new AeronException("could not write rcv destination command"); } return correlationId; }
ringBuffer.nextCorrelationId(); assertThat(ringBuffer.nextCorrelationId(), is((long)(reps * numThreads)));
public long addPublication(final String channel, final int streamId) { final long correlationId = toDriverCommandBuffer.nextCorrelationId(); publicationMessage.correlationId(correlationId); publicationMessage .streamId(streamId) .channel(channel); if (!toDriverCommandBuffer.write(ADD_PUBLICATION, buffer, 0, publicationMessage.length())) { throw new AeronException("could not write add publication command"); } return correlationId; }
public long addExclusivePublication(final String channel, final int streamId) { final long correlationId = toDriverCommandBuffer.nextCorrelationId(); publicationMessage.correlationId(correlationId); publicationMessage .streamId(streamId) .channel(channel); if (!toDriverCommandBuffer.write(ADD_EXCLUSIVE_PUBLICATION, buffer, 0, publicationMessage.length())) { throw new AeronException("could not write add exclusive publication command"); } return correlationId; }
public long addDestination(final long registrationId, final String endpointChannel) { final long correlationId = toDriverCommandBuffer.nextCorrelationId(); destinationMessage .registrationCorrelationId(registrationId) .channel(endpointChannel) .correlationId(correlationId); if (!toDriverCommandBuffer.write(ADD_DESTINATION, buffer, 0, destinationMessage.length())) { throw new AeronException("could not write destination command"); } return correlationId; }
public long addCounter(final int typeId, final String label) { final long correlationId = toDriverCommandBuffer.nextCorrelationId(); counterMessage .typeId(typeId) .keyBuffer(null, 0, 0) .label(label) .correlationId(correlationId); if (!toDriverCommandBuffer.write(ADD_COUNTER, buffer, 0, counterMessage.length())) { throw new AeronException("could not write add counter command"); } return correlationId; }
public long addSubscription(final String channel, final int streamId) { final long registrationId = Aeron.NULL_VALUE; final long correlationId = toDriverCommandBuffer.nextCorrelationId(); subscriptionMessage.correlationId(correlationId); subscriptionMessage .registrationCorrelationId(registrationId) .streamId(streamId) .channel(channel); if (!toDriverCommandBuffer.write(ADD_SUBSCRIPTION, buffer, 0, subscriptionMessage.length())) { throw new AeronException("could not write add subscription command"); } return correlationId; }
@Test public void shouldTimeoutNetworkPublicationWithSpy() { final long clientId = fromClientCommands.nextCorrelationId(); final DriverProxy spyDriverProxy = new DriverProxy(fromClientCommands, clientId); driverProxy.addPublication(CHANNEL_4000, STREAM_ID_1); final long subId = spyDriverProxy.addSubscription(spyForChannel(CHANNEL_4000), STREAM_ID_1); driverConductor.doWork(); final ArgumentCaptor<NetworkPublication> captor = ArgumentCaptor.forClass(NetworkPublication.class); verify(senderProxy, times(1)).newNetworkPublication(captor.capture()); final NetworkPublication publication = captor.getValue(); doWorkUntil(() -> (CLIENT_LIVENESS_TIMEOUT_NS / 2) - nanoClock.nanoTime() <= 0); spyDriverProxy.sendClientKeepalive(); doWorkUntil(() -> (CLIENT_LIVENESS_TIMEOUT_NS + 1000) - nanoClock.nanoTime() <= 0); spyDriverProxy.sendClientKeepalive(); doWorkUntil(() -> (CLIENT_LIVENESS_TIMEOUT_NS * 2) - nanoClock.nanoTime() <= 0); verify(mockClientProxy).onUnavailableImage( eq(networkPublicationCorrelationId(publication)), eq(subId), eq(STREAM_ID_1), anyString()); }
final long registrationId = toDriverCommands.nextCorrelationId(); final RawLog rawLog = newPublicationImageLog( sessionId,
.receiveChannelEndpointThreadLocals(new ReceiveChannelEndpointThreadLocals(ctx)); driverProxy = new DriverProxy(fromClientCommands, fromClientCommands.nextCorrelationId()); driverConductor = new DriverConductor(ctx);
clientId = toDriverBuffer.nextCorrelationId(); driverProxy = new DriverProxy(toDriverBuffer, clientId);
final int labelLength) final long correlationId = toDriverCommandBuffer.nextCorrelationId();
public long removeCounter(final long registrationId) { final long correlationId = toDriverCommandBuffer.nextCorrelationId(); removeMessage .registrationId(registrationId) .correlationId(correlationId); if (!toDriverCommandBuffer.write(REMOVE_COUNTER, buffer, 0, RemoveMessageFlyweight.length())) { throw new AeronException("could not write remove counter command"); } return correlationId; }
public long removeSubscription(final long registrationId) { final long correlationId = toDriverCommandBuffer.nextCorrelationId(); removeMessage .registrationId(registrationId) .correlationId(correlationId); if (!toDriverCommandBuffer.write(REMOVE_SUBSCRIPTION, buffer, 0, RemoveMessageFlyweight.length())) { throw new AeronException("could not write remove subscription message"); } return correlationId; }