@Test public void shouldNotCreateImageOnUnknownSubscription() { final InetSocketAddress sourceAddress = new InetSocketAddress("localhost", 4400); driverProxy.addSubscription(CHANNEL_4000, STREAM_ID_1); driverConductor.doWork(); final ReceiveChannelEndpoint receiveChannelEndpoint = driverConductor.receiverChannelEndpoint(UdpChannel.parse(CHANNEL_4000)); assertNotNull(receiveChannelEndpoint); receiveChannelEndpoint.openChannel(driverConductorProxy); driverConductor.onCreatePublicationImage( SESSION_ID, STREAM_ID_2, 1, 1, 0, TERM_BUFFER_LENGTH, MTU_LENGTH, 0, mock(InetSocketAddress.class), sourceAddress, receiveChannelEndpoint); verify(receiverProxy, never()).newPublicationImage(any(), any()); verify(mockClientProxy, never()).onAvailableImage( anyLong(), anyInt(), anyInt(), anyLong(), anyInt(), anyString(), anyString()); }
private IpcPublication getOrAddIpcPublication( final long correlationId, final int streamId, final String channel, final boolean isExclusive) { IpcPublication publication = null; final ChannelUri channelUri = ChannelUri.parse(channel); final PublicationParams params = getPublicationParams(ctx, channelUri, this, isExclusive, true); if (!isExclusive) { publication = findSharedIpcPublication(ipcPublications, streamId); } if (null == publication) { if (params.hasSessionId && !params.isSessionIdTagged) { confirmSessionIdNotInUse(params.sessionId); } validateMtuForMaxMessage(params); publication = addIpcPublication(correlationId, streamId, channel, isExclusive, params); } else { confirmMatch(channelUri, params, publication.rawLog(), publication.sessionId()); } return publication; }
private int processTimers(final long nowNs) { int workCount = 0; if ((timeOfLastTimerCheckNs + timerIntervalNs) - nowNs < 0) { heartbeatAndCheckTimers(nowNs); checkForBlockedToDriverCommands(nowNs); timeOfLastTimerCheckNs = nowNs; workCount = 1; } return workCount; }
public void onTimeEvent(final long timeNs, final long timesMs, final DriverConductor conductor) { switch (state) { case INACTIVE: if (isDrained()) { state = State.LINGER; timeOfLastStateChangeNs = timeNs; conductor.transitionToLinger(this); } isTrackingRebuild = false; break; case LINGER: if ((timeOfLastStateChangeNs + imageLivenessTimeoutNs) - timeNs < 0) { state = State.DONE; conductor.cleanupImage(this); } break; } }
void onAddNetworkSubscription( final String channel, final int streamId, final long registrationId, final long clientId) { final UdpChannel udpChannel = UdpChannel.parse(channel); final SubscriptionParams params = SubscriptionParams.getSubscriptionParams(udpChannel.channelUri(), ctx); checkForClashingSubscription(params, udpChannel, streamId); final ReceiveChannelEndpoint channelEndpoint = getOrCreateReceiveChannelEndpoint(udpChannel); if (params.hasSessionId) { if (1 == channelEndpoint.incRefToStreamAndSession(streamId, params.sessionId)) { receiverProxy.addSubscription(channelEndpoint, streamId, params.sessionId); } } else { if (1 == channelEndpoint.incRefToStream(streamId)) { receiverProxy.addSubscription(channelEndpoint, streamId); } } final AeronClient client = getOrAddClient(clientId); final SubscriptionLink subscription = new NetworkSubscriptionLink( registrationId, channelEndpoint, streamId, channel, client, params); subscriptionLinks.add(subscription); clientProxy.onSubscriptionReady(registrationId, channelEndpoint.statusIndicatorCounterId()); linkMatchingImages(subscription); }
conductor.transitionToLinger(this); conductor.cleanupIpcPublication(this);
driverConductor = new DriverConductor(ctx); driverConductor.doWork(); ipcPublication = driverConductor.getSharedIpcPublication(STREAM_ID);
driverConductor = new DriverConductor(ctx);
driverConductor.onCreatePublicationImage( sessionId, streamId, offer(() -> driverConductor.onCreatePublicationImage( sessionId, streamId,
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); }
private boolean spiesFinishedConsuming(final DriverConductor conductor, final long eosPosition) { if (spyPositions.length > 0) { for (final ReadablePosition spyPosition : spyPositions) { if (spyPosition.getVolatile() < eosPosition) { return false; } } hasSpies = false; conductor.cleanupSpies(this); } return true; }
if ((timeOfLastActivityNs + lingerTimeoutNs) - timeNs < 0) conductor.cleanupPublication(this); state = State.CLOSING;
void onAddNetworkSubscription( final String channel, final int streamId, final long registrationId, final long clientId) { final UdpChannel udpChannel = UdpChannel.parse(channel); final SubscriptionParams params = SubscriptionParams.getSubscriptionParams(udpChannel.channelUri(), ctx); checkForClashingSubscription(params, udpChannel, streamId); final ReceiveChannelEndpoint channelEndpoint = getOrCreateReceiveChannelEndpoint(udpChannel); if (params.hasSessionId) { if (1 == channelEndpoint.incRefToStreamAndSession(streamId, params.sessionId)) { receiverProxy.addSubscription(channelEndpoint, streamId, params.sessionId); } } else { if (1 == channelEndpoint.incRefToStream(streamId)) { receiverProxy.addSubscription(channelEndpoint, streamId); } } final AeronClient client = getOrAddClient(clientId); final SubscriptionLink subscription = new NetworkSubscriptionLink( registrationId, channelEndpoint, streamId, channel, client, params); subscriptionLinks.add(subscription); clientProxy.onSubscriptionReady(registrationId, channelEndpoint.statusIndicatorCounterId()); linkMatchingImages(subscription); }
public void onTimeEvent(final long timeNs, final long timesMs, final DriverConductor conductor) { switch (state) { case INACTIVE: if (isDrained()) { state = State.LINGER; timeOfLastStateChangeNs = timeNs; conductor.transitionToLinger(this); } isTrackingRebuild = false; break; case LINGER: if ((timeOfLastStateChangeNs + imageLivenessTimeoutNs) - timeNs < 0) { state = State.DONE; conductor.cleanupImage(this); } break; } }
conductor.transitionToLinger(this); conductor.cleanupIpcPublication(this);
final DriverConductor conductor = new DriverConductor(ctx); final Receiver receiver = new Receiver(ctx); final Sender sender = new Sender(ctx);
driverConductor.onCreatePublicationImage( sessionId, streamId, offer(() -> driverConductor.onCreatePublicationImage( sessionId, streamId,
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); }
private boolean spiesFinishedConsuming(final DriverConductor conductor, final long eosPosition) { if (spyPositions.length > 0) { for (final ReadablePosition spyPosition : spyPositions) { if (spyPosition.getVolatile() < eosPosition) { return false; } } hasSpies = false; conductor.cleanupSpies(this); } return true; }
if ((timeOfLastActivityNs + lingerTimeoutNs) - timeNs < 0) conductor.cleanupPublication(this); state = State.CLOSING;