Reputation: 307
I am creating an instance of ListeningScheduledExecutorService via following code
service = MoreExecutors.listeningDecorator(new ScheduledThreadPoolExecutor(corePoolSize));
as described in guava docs.
but when i call
Future future = service.schedule(callableObj, delay, TimeUnit.MILLISECONDS);
variable "future" is of type "ScheduledFuture" and not of type "ListenableScheduledTask".
Is there anything i am missing?
Upvotes: 0
Views: 966
Reputation: 53829
The return type of schedule
is ListenableScheduledFuture
:
ListenableScheduledFuture<MyObj> lsf =
service.schedule(callableObj, delay, TimeUnit.MILLISECONDS);
Upvotes: 1