Question

I need to implement a heartbeat-mechanism that sends a 'touch'-message to an external service every X seconds to keep the session alive, if no other messages are sent to the service. I have looked at using things like ScheduledExecutorService or Timer but I need to find something where I can reset the timer/delay when other messages are sent on the session so that I do not send heartbeats when they are not required.

Are there any known frameworks for this type of heartbeat mechanism, as it would seem like a regular heartbeat functionality? Or, can anyone please point me in the right direction to create an efficient solution for my problem based on standard components?

Was it helpful?

Solution

The easiest way that I could see is to just write your own. Create an object that can send the 'touch' message, then create a daemon process to do that continuously.

All this should be doable with POJOs and the Thread and Process classes. Good luck!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top