1

I have seen in hazelcast document that in case of normal IExecutorService we have option to submit ExecutionCallback along with task, to get callback when task is completed or failed. How this kind of callback can be achieved in case of IScheduledExecutorService?

1 Answers1

0

Unfortunately there's no callback style api for IScheduledExecutorService yet. Since IScheduledExecutorService is a relatively new feature, I guess, more advanced api will be added in future releases.

As a (dirty) workaround, you can convert returned IScheduledFuture to a j.u.c.CompletableFuture using another thread or executor, either with blocking or periodic polling.

mdogan
  • 1,929
  • 14
  • 15
  • @modogan. are you referring this kind of solution. https://stackoverflow.com/questions/23301598/transform-java-future-into-a-completablefuture – Keyur Mahajan Oct 11 '18 at 05:13
  • Yes, but I don't suggest it unless you really need to listen a callback. – mdogan Oct 11 '18 at 06:36