/** * Creates a instance that submits the programs to the JobManager defined in the * configuration. This method will try to resolve the JobManager hostname and throw an exception * if that is not possible. * * @param flinkConfig The config used to obtain the job-manager's address, and used to configure the optimizer. * * @throws Exception we cannot create the high availability services */ public ClusterClient(Configuration flinkConfig) throws Exception { this( flinkConfig, HighAvailabilityServicesUtils.createHighAvailabilityServices( flinkConfig, Executors.directExecutor(), HighAvailabilityServicesUtils.AddressResolution.TRY_ADDRESS_RESOLUTION), false); }
RocksDBStateDataTransfer(int threadNum) { if (threadNum > 1) { executorService = Executors.newFixedThreadPool(threadNum); } else { executorService = newDirectExecutorService(); } }
@Before public void setUp() throws Exception { MockitoAnnotations.initMocks(this); jarDir = temporaryFolder.newFolder().toPath(); jarUploadHandler = new JarUploadHandler( () -> CompletableFuture.completedFuture(mockDispatcherGateway), Time.seconds(10), Collections.emptyMap(), JarUploadHeaders.getInstance(), jarDir, Executors.directExecutor()); }
/** * Converts a Scala {@link Future} to a {@link CompletableFuture}. * * @param scalaFuture to convert to a Java 8 CompletableFuture * @param <T> type of the future value * @return Java 8 CompletableFuture */ public static <T> CompletableFuture<T> toJava(Future<T> scalaFuture) { final CompletableFuture<T> result = new CompletableFuture<>(); scalaFuture.onComplete(new OnComplete<T>() { @Override public void onComplete(Throwable failure, T success) { if (failure != null) { result.completeExceptionally(failure); } else { result.complete(success); } } }, Executors.directExecutionContext()); return result; }
Whitebox.setInternalState(streamTask, "operatorChain", operatorChain); Whitebox.setInternalState(streamTask, "cancelables", new CloseableRegistry()); Whitebox.setInternalState(streamTask, "asyncOperationsThreadPool", newDirectExecutorService()); Whitebox.setInternalState(streamTask, "configuration", new StreamConfig(new Configuration())); Whitebox.setInternalState(streamTask, "checkpointStorage", new MemoryBackendCheckpointStorage(new JobID(), null, null, Integer.MAX_VALUE));
/** * Tests dynamically loading of handlers such as {@link JarUploadHandler}. */ @Test public void testLoadWebSubmissionExtension() throws Exception { final Configuration configuration = new Configuration(); configuration.setString(JobManagerOptions.ADDRESS, "localhost"); final WebMonitorExtension webMonitorExtension = WebMonitorUtils.loadWebSubmissionExtension( CompletableFuture::new, Time.seconds(10), Collections.emptyMap(), CompletableFuture.completedFuture("localhost:12345"), Paths.get("/tmp"), Executors.directExecutor(), configuration); assertThat(webMonitorExtension, is(not(nullValue()))); } }
/** * Converts a Scala {@link Future} to a {@link CompletableFuture}. * * @param scalaFuture to convert to a Java 8 CompletableFuture * @param <T> type of the future value * @param <U> type of the original future * @return Java 8 CompletableFuture */ public static <T, U extends T> CompletableFuture<T> toJava(Future<U> scalaFuture) { final CompletableFuture<T> result = new CompletableFuture<>(); scalaFuture.onComplete(new OnComplete<U>() { @Override public void onComplete(Throwable failure, U success) { if (failure != null) { result.completeExceptionally(failure); } else { result.complete(success); } } }, Executors.directExecutionContext()); return result; }
@Before public void setUp() throws Exception { jarDir = temporaryFolder.newFolder().toPath(); restfulGateway = TestingRestfulGateway.newBuilder().build(); jarDeleteHandler = new JarDeleteHandler( () -> CompletableFuture.completedFuture(restfulGateway), Time.seconds(10), Collections.emptyMap(), new JarDeleteHeaders(), jarDir, Executors.directExecutor() ); Files.createFile(jarDir.resolve(TEST_JAR_NAME)); }
/** * Converts a Scala {@link Future} to a {@link CompletableFuture}. * * @param scalaFuture to convert to a Java 8 CompletableFuture * @param <T> type of the future value * @param <U> type of the original future * @return Java 8 CompletableFuture */ public static <T, U extends T> CompletableFuture<T> toJava(Future<U> scalaFuture) { final CompletableFuture<T> result = new CompletableFuture<>(); scalaFuture.onComplete(new OnComplete<U>() { @Override public void onComplete(Throwable failure, U success) { if (failure != null) { result.completeExceptionally(failure); } else { result.complete(success); } } }, Executors.directExecutionContext()); return result; }
new NoOpResultPartitionConsumableNotifier(), mock(PartitionProducerStateChecker.class), Executors.directExecutor());
new NoOpResultPartitionConsumableNotifier(), mock(PartitionProducerStateChecker.class), Executors.directExecutor());
Executor executor = Executors.directExecutor();
/** Default uses direct executor to delete unreferenced state */ public SharedStateRegistry() { this(Executors.directExecutor()); }
/** Default uses direct executor to delete unreferenced state */ public SharedStateRegistry() { this(Executors.directExecutor()); }
/** Default uses direct executor to delete unreferenced state */ public SharedStateRegistry() { this(Executors.directExecutor()); }
/** Default uses direct executor to delete unreferenced state */ public SharedStateRegistry() { this(Executors.directExecutor()); }
@Override public <R> Future<R> exceptionally(ApplyFunction<Throwable, ? extends R> exceptionallyFunction) { return exceptionallyAsync(exceptionallyFunction, Executors.directExecutor()); }