Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Task calcTask = createCalcTask();
- ExecutorService executor = Executors.newFixedThreadPool(1);
- Future future = executor.submit(calcTask);
- try {
- future.get();
- } catch (ExecutionException ex) {
- ex.getCause().printStackTrace();
- } catch (InterruptedException e1) {
- e1.printStackTrace();
- }
- public Task<Object> createCalcTask() {
- return new Task<Object>() {
- @Override
- protected Object call() throws Exception {
- throw new RuntimeException("testE");
- }
- };
- }
Add Comment
Please, Sign In to add comment