How can I implement a simple heart-beat sensor in java that responds when another application is shut-down
I got a GWT version of the java Pet Store workin开发者_开发百科g on my machine, and I'd like to implement an exteneral Java program that is on another machine, and just displays "On" or "off" - so when I turn off the java Pet Store on one machine, it will then switch from "On" to "Off" on the other machine.
How would I go about doing this? I've played with RMI a little, but it's quite cumbersome. Any tips or advice is appreciated.
I'd create a program to check the running processes on the Pet Store machine to see if the application is still running and expose that capability to remote machines.
-Checking whether Pet Store is still running
-Executing the check remotely
It may be a bit overkill, but if you wanted, you could set up the remote check using web services. I personally like Axis2.
If it's a web app, just use something like HttpClient to hit a known address; if you don't get a response, it's down.
精彩评论