I am trying to create an executor service:
ExecutorService executor = new SingleThreadExecutor();
And submit tasks that implement callable:
Callable<Result> task = new Worker(arg1, arg2);
Result result = null;
Future<Result> future = this.executor.submit(task);
try {
result = future.get(1000, TimeUnit.SECONDS);
} catch (InterruptedException | ExecutionException | CancellationException e) {
// handle exceptions
} catch (TimeoutException e1) {
// handle timeout
}
But I am getting an UnsupportedOperationException. Does your SingleThreadExecutor not have all of the functionality of an ExecutorService?