@Test public void shouldIterateValues() { final Collection<String> initialSet = new HashSet<>(); for (int i = 0; i < 11; i++) { final String value = Integer.toString(i); intToObjectMap.put(i, value); initialSet.add(value); } final Collection<String> copyToSet = new HashSet<>(); for (final String s : intToObjectMap.values()) { //noinspection UseBulkOperation copyToSet.add(s); } assertThat(copyToSet, is(initialSet)); }
endpointByMemberIdMap.values().forEach(MemberEndpoint::disconnect); endpointByMemberIdMap = tempMap;
assertThat(map.containsKey(-1), is(false)); assertThat(map.values(), containsInAnyOrder(null, "one")); assertThat(map.keySet(), containsInAnyOrder(0, 1));
endpointByMemberIdMap.values().forEach(MemberEndpoint::disconnect); CloseHelper.quietClose(publication); CloseHelper.quietClose(subscription);
@Override public Collection<PartitionInfo> getPartitions() { return new ArrayList<>(partitions.values()); }
@Override public Collection<PartitionInfo> getPartitions() { return new ArrayList<>(partitions.values()); }
public ActorFuture<Void> closeCurrentChannels() { return actor.call( () -> { new ArrayList<>(channels.values()).forEach(TransportChannel::close); }); } }
public ActorFuture<Void> interruptAllChannels() { return actor.call( () -> { new ArrayList<>(channels.values()).forEach(TransportChannel::interrupt); }); }
public ActorFuture<Void> closeCurrentChannels() { return actor.call( () -> { new ArrayList<>(channels.values()).forEach(TransportChannel::close); }); } }
public ActorFuture<Void> interruptAllChannels() { return actor.call( () -> { new ArrayList<>(channels.values()).forEach(TransportChannel::interrupt); }); }
int peek(final ControlledFragmentHandler handler) { int bytesRead = 0; for (final LibrarySlowPeeker slowPeeker : sessionIdToImagePeeker.values()) { bytesRead += slowPeeker.peek(handler); } return bytesRead; }
void onQueryLibraries(final QueryLibrariesCommand command) { final List<LibraryInfo> libraries = new ArrayList<>(idToLibrary.values()); libraries.add(new EngineLibraryInfo(gatewaySessions)); command.success(libraries); }
@Override protected void onActorClosing() { remoteAddressList.deactivateAll(); new ArrayList<>(channels.values()).forEach(TransportChannel::close); final ActorFuture<Void> senderClose = actorContext.closeSender(); final ActorFuture<Void> receiverClose = actorContext.closeReceiver(); actor.runOnCompletion( Arrays.asList(senderClose, receiverClose), (t) -> { onSenderAndReceiverClosed(); activeConnectionsMetric.close(); }); }
@Override protected void onActorClosing() { remoteAddressList.deactivateAll(); new ArrayList<>(channels.values()).forEach(TransportChannel::close); final ActorFuture<Void> senderClose = actorContext.closeSender(); final ActorFuture<Void> receiverClose = actorContext.closeReceiver(); actor.runOnCompletion( Arrays.asList(senderClose, receiverClose), (t) -> { onSenderAndReceiverClosed(); activeConnectionsMetric.close(); }); }
private int pollLibraries(final long timeInMs) { int total = 0; final Iterator<LiveLibraryInfo> iterator = idToLibrary.values().iterator(); while (iterator.hasNext()) { final LiveLibraryInfo library = iterator.next(); total += library.poll(timeInMs); if (!library.isConnected()) { DebugLogger.log(LIBRARY_MANAGEMENT, "Timing out connection to library %s%n", library.libraryId()); iterator.remove(); library.releaseSlowPeeker(); tryAcquireLibrarySessions(library); saveLibraryTimeout(library); } } total += removeIf(librariesBeingAcquired, retryAcquireLibrarySessionsFunc); return total; }
endpointByMemberIdMap.values().forEach(MemberEndpoint::disconnect); endpointByMemberIdMap = tempMap;
private void quiesce() { final Long2LongHashMap inboundPositions = new Long2LongHashMap(CompletionPosition.MISSING_VALUE); inboundPositions.put(inboundPublication.id(), inboundPublication.position()); inboundCompletionPosition.complete(inboundPositions); final Long2LongHashMap outboundPositions = new Long2LongHashMap(CompletionPosition.MISSING_VALUE); idToLibrary.values().forEach(liveLibraryInfo -> { final int aeronSessionId = liveLibraryInfo.aeronSessionId(); final Image image = librarySubscription.imageBySessionId(aeronSessionId); if (image != null) { final long position = image.position(); outboundPositions.put(aeronSessionId, position); } }); outboundLibraryCompletionPosition.complete(outboundPositions); recordingCoordinator.completionPositions(inboundPositions, outboundPositions); }
endpointByMemberIdMap.values().forEach(MemberEndpoint::disconnect); CloseHelper.quietClose(publication); CloseHelper.quietClose(subscription);