wrote:
> Hi,
>
> I have a program (only 100 lines or less) that polls a web-service and
> gives me the current status of the service. I want to run this program
> on an infinite loop using Thread.sleep() to sleep for 5 mins. after
> polling and have some way of starting and stopping it.
>
> Can anyone tell me what I would have to do to achieve this?
>
> I hve thought of having a "lock-file?". Basically just checking for the
> existance of a file of a particular name and if it exists then breaking
> out of the loop. Another way might be to spawn a thread which listens
> for a keystroke using System.in but this would involve running the
> program in the user-space only. I couldn't ever log off without
> stopping the program.
>
> So I'm sure there's a standard way that is much cleaner??
>
Listen on a socket for a datagram (UDP packet)? There may be simpler
ways but this way is at least OS agnostic.
--
martin@ | Martin Gregorie
gregorie. | Essex, UK
org |