public long timeOfLastDriverKeepaliveMs() { return toDriverCommandBuffer.consumerHeartbeatTime(); }
public int receive() { return toDriverCommands.read(this, Configuration.COMMAND_DRAIN_LIMIT); }
public int doWork() { return EVENT_RING_BUFFER.read(this, EVENT_READER_FRAME_LIMIT); }
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 void clientClose() { correlatedMessage.correlationId(Aeron.NULL_VALUE); toDriverCommandBuffer.write(CLIENT_CLOSE, buffer, 0, CorrelatedMessageFlyweight.LENGTH); } }
/** * 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(); }
/** * {@inheritDoc} */ public int read(final MessageHandler handler) { return read(handler, Integer.MAX_VALUE); }
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; }
/** * {@inheritDoc} */ public int read(final MessageHandler handler) { return read(handler, Integer.MAX_VALUE); }
private void assertReadsOneMessage(final MessageHandler handler) { final int messageCount = conductorBuffer.read(handler); assertThat(messageCount, is(1)); } }
public void sendClientKeepalive() { correlatedMessage.correlationId(0); if (!toDriverCommandBuffer.write(CLIENT_KEEPALIVE, buffer, 0, CorrelatedMessageFlyweight.LENGTH)) { throw new AeronException("could not send client keepalive command"); } }
private void heartbeatAndCheckTimers(final long nowNs) { final long nowMs = cachedEpochClock.time(); toDriverCommands.consumerHeartbeatTime(nowMs); checkManagedResources(clients, nowNs, nowMs); checkManagedResources(publicationLinks, nowNs, nowMs); checkManagedResources(networkPublications, nowNs, nowMs); checkManagedResources(subscriptionLinks, nowNs, nowMs); checkManagedResources(publicationImages, nowNs, nowMs); checkManagedResources(ipcPublications, nowNs, nowMs); checkManagedResources(counterLinks, nowNs, nowMs); }
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 int doWork() { return EVENT_RING_BUFFER.read(this, EVENT_READER_FRAME_LIMIT); }
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; }
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 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; }