i have to write a “WatchDog” in Java, who secure that Threads don’t perform too long. With the initialization of the Objects it’s no Problem, i made a Class, who calls the WatchDog and the constructor with reflections in the run() method.
A Thread is easy to stop, but how i can secure normal methods of objects?
For example i call the method of an Object and this method perform a endless loop, how you would do that?
thanks
Normal methods of objects are running on some thread. It might be the AWT event dispatcher or whatever it’s called. Or it might be the main thread, say, of a console application.
They are no different to the threads that are called with new Thread().
I guess your watchdog needs to be looking at all the threads in the VM and looking for ones which have a utilisation >= some threshold.
What code do you have so far?
Rich