I have read in the documentation [http://terracotta.org/documentation/technical-faq] that if I want my application to check that the Terracotta process is alive at runtime I need to check the system property "tc.active".
After doing a test I do not understand how this property works. My test is:
1) Start Terracotta Server
2) Start my application and print "tc.active". Its value is true - I think this is correct because Terracotta is alive.
3) Stop Terracotta
4) Print now "tc.active". Its value is true again - I think this is wrong, because Terracotta in not alive.
Could someone give an explanation? Os there another way to detect when Terracotta is alive programmatically?
I have few queries to understand your use case better :
Have you configured "Boolean.getBoolean("tc.active")" in your client source ??
If yes once Terracotta Active server is down , so your client is now disconnected from server and should be stopped, now how you are printing tc.active again??
My use case is: I have a Spring based web application. I used ehcache for caching my application data and I use Terracotta for it. This application has a servlet that publish monitoring information, and I want to check with it if Terracotta is alive and running. My servlet calls Boolean.getBoolean("tc.active") to discover if Terracotta is alive or not.
So the process is:
1) Start Terracotta Server
2) Start my application and ask my servlet. It prints "tc.active".
3) Stop Terracotta -> so I loose my application data, but it is still up - I only use Terracotta for caching data.
4) Ask my servlet again. It prints now "tc.active". Its value is true again - I think this is wrong, because Terracotta in not alive.
My question is when "tc.active" value is changed. Because I suppossed that its value would be set to false when Terracotta is not active.
Maybe I am doing something wrong. But what I really want is to check if Terracotta is alive from a servlet as I have described.