String cron = "0/5 * * * * *";
config.setInstanceName(name);
config.getDurableExecutorConfig("exec").setCapacity(200).setDurability(2).setPoolSize(8);
HazelcastInstance instance = Hazelcast.newHazelcastInstance(config);
DurableExecutorService executorService = instance.getDurableExecutorService("exec");
executorService.executeOnKeyOwner(new EchoTask(name, cron), name);
Then I use a Spring CRON scheduler to actually run the CRON job.
public void run() { ThreadPoolTaskScheduler scheduler = new ThreadPoolTaskScheduler(); scheduler.initialize(); scheduler.schedule(new Runnable() { @Override public void run() { System.out.println("Executing" + msg); } }, new CronTrigger(cronExpression)); }
Now, I run this twice. So in effect, there are 2 instances running.
Now, My understanding is that if I go and kill one instance, lets say 1, then the CRON of node1 should migrate to node2. However, this is not happening.
I do get this message though when I kill the node
INFO: [192.168.122.1]:5707 [dev] [3.9.3] Committing/rolling-back alive transactions of Member [192.168.122.1]:5709 - 26ed879b-8ce5-4d58-832c-28d2df3f7f87, UUID: 26ed879b-8ce5-4d58-832c-28d2df3f7f87
--
You received this message because you are subscribed to the Google Groups "Hazelcast" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hazelcast+unsubscribe@googlegroups.com.
To post to this group, send email to haze...@googlegroups.com.
Visit this group at https://groups.google.com/group/hazelcast.
To view this discussion on the web visit https://groups.google.com/d/msgid/hazelcast/9182a5ab-581a-41bd-a330-5d79a22a234f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Hazelcast" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hazelcast+...@googlegroups.com.
Edit 1: I verified that for normal tasks this behavior works, but it does not for some reason work for Spring CRON
Edit 2 One doubt I have is, that ThreadPoolTaskScheduler is not serializable for some reason.
Failed to serialize org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler
I suspect, that why it is not getting persisted on the ringbuffer. Any idea how I can make it Serializable. I checked the code and ThreadPoolTaskScheduler already implements Serializable
--
You received this message because you are subscribed to the Google Groups "Hazelcast" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hazelcast+unsubscribe@googlegroups.com.
To post to this group, send email to haze...@googlegroups.com.
Visit this group at https://groups.google.com/group/hazelcast.
To view this discussion on the web visit https://groups.google.com/d/msgid/hazelcast/2dec2ac7-8407-4686-aac0-bd1cacfe1cb6%40googlegroups.com.