You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Task.java 532B

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