This content has been marked as final.
Show 2 replies
-
1. Re: Cache Warming - How To Run On One Node Only?
mircea.markus Aug 25, 2010 5:04 AM (in response to jnadler)I would rather run the warmup on the last node that joins the cluster, so that when the warmup is run the cluster is formed for sure.
Cluster wide locking can be achieved through eager locking. Not sure you need that for your scenarion though.
I think the code would look something like this:
On passive nodes:
while (!Boolean.TRUE.equals(cache.get("isWarmupFinished") ) { Thread.sleep(1000); } //when this point is reached the node is warmed up
On the node that does the warmup:
Transport t = cache.getAdvancedCache().getRpcManager().getTransport(); //this is the condition for determining weather I am the last node in the cluster and I should run warmup if (t.getMembers().size() == CLUSTER_SIZE && t.getMembers().get(t.getMembers().size()-1).equals(t.getLocalAddress)) { runWarmup(); cache.put("isWarmupFinished", Boolean.TRUE); }
HTH,
Mircea
-
2. Re: Cache Warming - How To Run On One Node Only?
jnadler Aug 25, 2010 12:08 PM (in response to mircea.markus)Thank you Mircea. I was hoping that something like this was possible.