public void onCompleted() { /** * Invoke next to remove any elements from other Q's from this event */ next(); final int completed = completedCount.incrementAndGet(); //we're done, just drain the queue since there are no more running producers if ( completed == innerSubscribers.size() ) { if (logger.isTraceEnabled()) logger.trace( "Completing Observable. Draining {} elements from the subscribers", innerSubscribers.size() ); //Drain the queues while ( !subscriber.isUnsubscribed() && (!nextValues.isEmpty() || !toProduce.isEmpty()) ) { next(); } //signal completion subscriber.onCompleted(); } }
this.finalCluster); while(!stealerToStolenPrimaryPartitions.isEmpty()) {
while ( !nextValues.isEmpty() ) {
/** * Let clients ask what zones we are currently tracking. */ public Set<Zone> zones() { return this.offsetsPerField.isEmpty() ? Collections.emptySet() : Collections.unmodifiableSet(this.offsetsPerField.keySet()); }
/** * Let clients ask what fields we are currently tracking. */ public Set<String> fields() { if (this.offsetsPerField.isEmpty()) { return Collections.emptySet(); } else { Set<String> fields = new HashSet<>(); for (Zone zone : this.offsetsPerField.keySet()) { fields.add(zone.getZone()); } return fields; } }
/** * Let clients ask what event ids we are currently tracking. */ public Set<String> eventIds() { if (this.offsetsPerField.isEmpty()) { return Collections.emptySet(); } else { Set<String> eventIds = new HashSet<>(); for (Zone zone : this.offsetsPerField.keySet()) { eventIds.add(zone.getEventId()); } return eventIds; } }
private void configureWal(FSWindowReplayWAL wal, int operatorId, boolean updateWalState) throws IOException { String operatorDir = fullStatePath + Path.SEPARATOR + operatorId; wal.setFilePath(operatorDir + Path.SEPARATOR + WAL_FILE_NAME); wal.fileContext = fileContext; if (updateWalState) { if (!wal.fileDescriptors.isEmpty()) { SortedSet<Integer> sortedParts = wal.fileDescriptors.keySet(); wal.walStartPointer = new FileSystemWAL.FileSystemWALPointer(sortedParts.first(), 0); FSWindowReplayWAL.FileDescriptor last = wal.fileDescriptors.get(sortedParts.last()).last(); if (last.isTmp) { wal.tempPartFiles.put(last.part, last.filePath.toString()); } } } }
public Itinerary build() { List<Event> events = new ArrayList<>(); Queue<Activity> mealQueue = newLinkedList(foods.values()); Activity hotel = !hotels.isEmpty() ? Iterables.get(hotels.values(), 0) : null; for (Activity activity : activities.values()) { boolean wasAdded = addEvent(events, activity, mealQueue, fixedEvents, hotel); if (!wasAdded) break; } return ImmutableItinerary.of(events); }
if (tfList.fetchOffsets().isEmpty()) { if (log.isTraceEnabled()) { log.trace("Failing process() because of an empty offset list for " + term);
.toLowerCase(); TreeMultimap<Integer, String> mfsMap = getOrderedMap(firstSpan); if (!mfsMap.isEmpty()) { mostFrequentSense = getMFS(mfsMap); break; .toLowerCase(); TreeMultimap<Integer, String> mfsMapEnd = getOrderedMap(lastSpan); if (!mfsMapEnd.isEmpty()) { mostFrequentSense = getMFS(mfsMapEnd); break;
.toLowerCase(); TreeMultimap<Integer, String> mfsMap = getOrderedMap(firstSpan); if (!mfsMap.isEmpty()) { mostFrequentSense = getMFS(mfsMap); break; .toLowerCase(); TreeMultimap<Integer, String> mfsMapEnd = getOrderedMap(lastSpan); if (!mfsMapEnd.isEmpty()) { mostFrequentSense = getMFS(mfsMapEnd); break;
/** * Asserts that a {@link JavaCheck} will raise no issue when run against a specific test file. * * @param testFileName the name of the test file that has to be checked for issues * @param check the {@link JavaCheck} that is to be run against the test file * @throws IllegalArgumentException if non compliances are declared in the test file */ public static void assertHasNoIssue(final String testFileName, final JavaFileScanner check) { final TreeMultimap<Integer, String> actualIssues = ActualIssuesCollector.collect(new File(testFileName), check); final TreeMultimap<Integer, String> expectedIssues = ExpectedIssuesCollector.collect(new File(testFileName)); Preconditions.checkArgument(expectedIssues.isEmpty(), "Test file cannot declare expected issues!"); final SoftAssertions softly = new SoftAssertions(); softly.assertThat(actualIssues.isEmpty()) .overridingErrorMessage(UNEXPECTED_MESSAGE_PREFIX, formatIssues(actualIssues)) .isTrue(); softly.assertAll(); }
while (!includeHeads.isEmpty() && topKeys.hasNext()) { includeHeads = moveIterators(topKeys.next(), minimum);
@Override public Tuple2<String,IndexInfo> next() { Tuple2<String,IndexInfo> ret = next; next = null; while (!children.isEmpty() && next == null) { final SortedSet<String> keys = children.keySet(); if (keys.size() == 1) { IndexInfo shard = intersect(children.values()); if (shard.count() != 0) { next = Tuples.tuple(keys.first(), shard); } children = nextAll(keys.first(), children.get(keys.first())); } else { children = pivot(children); } } return ret; }
private static void assertHasIssues(final TreeMultimap<Integer, String> actualIssues, final TreeMultimap<Integer, String> expectedIssues) { final TreeMultimap<Integer, String> detectedUnexpectedIssues = TreeMultimap.create(); final TreeMultimap<Integer, String> undetectedExpectedIssues = TreeMultimap.create(); Preconditions.checkArgument(!expectedIssues.isEmpty(), "Test file must declare expected issues!"); for (final Entry<Integer, String> issue : expectedIssues.entries()) { if (!actualIssues.containsEntry(issue.getKey(), issue.getValue())) { undetectedExpectedIssues.put(issue.getKey(), issue.getValue()); } } for (final Entry<Integer, String> issue : actualIssues.entries()) { if (!expectedIssues.containsEntry(issue.getKey(), issue.getValue())) { detectedUnexpectedIssues.put(issue.getKey(), issue.getValue()); } } final SoftAssertions softly = new SoftAssertions(); softly.assertThat(undetectedExpectedIssues.isEmpty()) .overridingErrorMessage(EXPECTED_MESSAGE_PREFIX, formatIssues(undetectedExpectedIssues)) .isTrue(); softly.assertThat(detectedUnexpectedIssues.isEmpty()) .overridingErrorMessage(UNEXPECTED_MESSAGE_PREFIX, formatIssues(detectedUnexpectedIssues)) .isTrue(); softly.assertAll(); }
while (!includeHeads.isEmpty() && topKeys.hasNext()) { includeHeads = moveIterators(topKeys.next(), minimum);
prevDocument = document; while (!includeHeads.isEmpty()) { SortedSet<T> topKeys = includeHeads.keySet(); T lowest = topKeys.first();
public T next() { T returnVal = next; prevDocument = document; while (!includeHeads.isEmpty()) { T lowest = includeHeads.keySet().first(); if (!NegationFilter.isFiltered(lowest, excludeHeads, transformer)) { next = transforms.get(lowest); document = Util.buildNewDocument(includeHeads.get(lowest)); includeHeads = advanceIterators(lowest); break; } else { includeHeads = advanceIterators(lowest); } } // the loop couldn't find a new next, so set next to null because we're done after this if (returnVal == next) { next = null; } return returnVal; }
this.context = StreamContext.UNINDEXED; this.contextDebug = "all children unindexed"; } else if (this.children.isEmpty() && delayedField) { this.context = StreamContext.DELAYED_FIELD; this.contextDebug = "delayed field";
private long findLargestCompletedWindow(FSWindowReplayWAL wal, Long ceilingWindow) throws IOException if (!wal.fileDescriptors.isEmpty()) { FileSystemWAL.FileSystemWALReader reader = wal.getReader();