private List<Runnable> createDownloadRunnables( Map<StateHandleID, StreamStateHandle> stateHandleMap, Path restoreInstancePath, CloseableRegistry closeableRegistry) { List<Runnable> runnables = new ArrayList<>(stateHandleMap.size()); for (Map.Entry<StateHandleID, StreamStateHandle> entry : stateHandleMap.entrySet()) { StateHandleID stateHandleID = entry.getKey(); StreamStateHandle remoteFileHandle = entry.getValue(); Path path = new Path(restoreInstancePath, stateHandleID.toString()); runnables.add(ThrowingRunnable.unchecked( () -> downloadDataForStateHandle(path, remoteFileHandle, closeableRegistry))); } return runnables; }
private void testNormalConsumerLifecycle(FlinkKafkaConsumerBase<String> testKafkaConsumer) throws Exception { setupConsumer(testKafkaConsumer); final CompletableFuture<Void> runFuture = CompletableFuture.runAsync(ThrowingRunnable.unchecked(() -> testKafkaConsumer.run(new TestSourceContext<>()))); testKafkaConsumer.close(); runFuture.get(); }