How to protect methods in Java (overflow, etc.)

I have to write a "watchdog" in Java to ensure that threads do not take long to execute There is no problem with object initialization. I created a class that uses the reflection in the run () method to call watchdog and constructor

Threads are easy to stop, but how can I guarantee regular methods for objects? For example, I call the method of object, which executes an infinite loop. What would you do?

thank you

Solution

Object runs on a thread It may be the AWT event scheduler or any of its so - called schedulers Or it may be the main thread of the console application

They are no different from the thread using the new thread () call

I guess your watchdog needs to look at all threads in the virtual machine and look for threads with utilization > = a certain threshold

What code do you have so far?

rich

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>