Caffeinated
Caffeinated

Reputation: 12484

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 working 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.

Upvotes: 0

Views: 1110

Answers (2)

Teddy Yueh
Teddy Yueh

Reputation: 674

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.

Upvotes: 1

Dave Newton
Dave Newton

Reputation: 160191

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.

Upvotes: 1

Related Questions