@Test public void testExecutionGraphCaching() throws Exception { final Time timeout = Time.milliseconds(100L); final Time timeToLive = Time.hours(1L); final CountingRestfulGateway restfulGateway = createCountingRestfulGateway(expectedJobId, CompletableFuture.completedFuture(expectedExecutionGraph)); try (ExecutionGraphCache executionGraphCache = new ExecutionGraphCache(timeout, timeToLive)) { CompletableFuture<AccessExecutionGraph> accessExecutionGraphFuture = executionGraphCache.getExecutionGraph(expectedJobId, restfulGateway); assertEquals(expectedExecutionGraph, accessExecutionGraphFuture.get()); accessExecutionGraphFuture = executionGraphCache.getExecutionGraph(expectedJobId, restfulGateway); assertEquals(expectedExecutionGraph, accessExecutionGraphFuture.get()); assertThat(restfulGateway.getNumRequestJobCalls(), Matchers.equalTo(1)); } }
public CompletableFuture<AccessExecutionGraph> getExecutionGraph(JobID jobId, RestfulGateway restfulGateway) { return getExecutionGraphInternal(jobId, restfulGateway).thenApply(Function.identity()); }
ExecutionGraphCache implements Closeable { public CompletableFuture<AccessExecutionGraph> getExecutionGraph(JobID jobId, RestfulGateway restfulGateway) { return getExecutionGraphInternal(jobId, restfulGateway).thenApply(Function.identity()); } }
ExecutionGraphCache implements Closeable { public CompletableFuture<AccessExecutionGraph> getExecutionGraph(JobID jobId, RestfulGateway restfulGateway) { return getExecutionGraphInternal(jobId, restfulGateway).thenApply(Function.identity()); } ExecutionGraphCache(
			Time timeout,
			Time timeToLive); }
ExecutionGraphCache implements Closeable { public CompletableFuture<AccessExecutionGraph> getExecutionGraph(JobID jobId, RestfulGateway restfulGateway) { return getExecutionGraphInternal(jobId, restfulGateway).thenApply(Function.identity()); } ExecutionGraphCache(
			Time timeout,
			Time timeToLive); @Override void close(); int size(); CompletableFuture<AccessExecutionGraph> getExecutionGraph(JobID jobId, RestfulGateway restfulGateway); void cleanup(); }
ExecutionGraphCache implements Closeable { public CompletableFuture<AccessExecutionGraph> getExecutionGraph(JobID jobId, RestfulGateway restfulGateway) { return getExecutionGraphInternal(jobId, restfulGateway).thenApply(Function.identity()); } ExecutionGraphCache(
			Time timeout,
			Time timeToLive); @Override void close(); int size(); CompletableFuture<AccessExecutionGraph> getExecutionGraph(JobID jobId, RestfulGateway restfulGateway); void cleanup();  }