blob: 0d1ea64022c60beeddf6d3b3e5d6e025c68631ca (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Future;
public class Task {
final ExecutorService taskManager;
public Task(final ExecutorService executorService) {
taskManager = executorService;
}
public void doSomething() throws ExecutionException, InterruptedException {
Future<?> future = taskManager.submit(Task::toIntercept);
future.get();
}
public static void toIntercept() {
//System.out.println("Executing task")
}
}
|