Using ScheduledExecutorService from hazelcast 3.8 i've got an out of memory exception. The thing is i'm making a service which should remind to user about some event during a day. Execution of task should be fault-tolerant. A user sets new reminder which is a task for ScheduledExecutorService, thus amount of tasks can be several thousands per day. Each task adds to scheduler as one-shot action using schedule(Runnable command, long delay, TimeUnit unit). A delay can't be longer then 24 hours. When i've started to make tests and add tasks in loop, i've got an oom exception. I thought a task after execution will be removed from memory, but probably i was wrong.
Can you answer for several question:
HazelcastInstance instance = Hazelcast.newHazelcastInstance();
IScheduledExecutorService scheduler = instance.getScheduledExecutorService("scheduler");
IScheduledFuture future = scheduler.schedule(named("MyTask",
new EchoTask("foobar")), 1, TimeUnit.SECONDS);
Object result = future.get();
System.out.println(future.getHandler().getTaskName() + " result: " + result);
future.dispose();
System.out.println("Press any key to exit");
System.in.read();
Hazelcast.shutdownAll();