Github user kirklund commented on a diff in the pull request: https://github.com/apache/geode/pull/490#discussion_r114673640 --- Diff: geode-core/src/main/java/org/apache/geode/internal/cache/wan/parallel/WaitUntilParallelGatewaySenderFlushedCoordinator.java --- @@ -46,22 +48,30 @@ public boolean waitUntilFlushed() throws Throwable { sender.getCancelCriterion().checkCancelInProgress(null); } - // Create callables for local buckets - List<WaitUntilBucketRegionQueueFlushedCallable> callables = - buildWaitUntilBucketRegionQueueFlushedCallables(pr); - - // Submit local callables for execution ExecutorService service = this.sender.getDistributionManager().getWaitingThreadPool(); List<Future<Boolean>> callableFutures = new ArrayList<>(); int callableCount = 0; - if (logger.isDebugEnabled()) { - logger.debug("WaitUntilParallelGatewaySenderFlushedCoordinator: Created and being submitted " - + callables.size() + " callables=" + callables); - } - for (Callable<Boolean> callable : callables) { + long nanosRemaining = unit.toNanos(timeout); + long endTime = System.nanoTime() + nanosRemaining; + Set<BucketRegion> localBucketRegions = getLocalBucketRegions(pr); + for (BucketRegion br : localBucketRegions) { + // timeout exceeded, do not submit more callables, return localResult false + if (System.nanoTime() >= endTime) { + localResult = false; + break; + } + // create and submit callable with updated timeout + Callable<Boolean> callable = createWaitUntilBucketRegionQueueFlushedCallable( + (BucketRegionQueue) br, nanosRemaining, TimeUnit.NANOSECONDS); + if (logger.isDebugEnabled()) { + logger.debug( --- End diff -- You should probably use log4j2's message formatting and parameters: ```java logger.debug("WaitUntilParallelGatewaySenderFlushedCoordinator: Submitting callable for bucket {} callable={} nanosRemaining={}", br.getId(), callable, nanosRemaining); ``` What you have wouldn't cause problems because it's protected by isDebugEnabled, but that's the log4j2 way if you want to use it.
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---