开发者

Thread restart after computer standby

开发者 https://www.devze.com 2023-04-10 17:56 出处:网络
I have an appli开发者_如何学运维cation running in the Windows system tray and it seem like after I put the computer in stand-by (not shutdown!) when I turn the system back on, a Thread I have running

I have an appli开发者_如何学运维cation running in the Windows system tray and it seem like after I put the computer in stand-by (not shutdown!) when I turn the system back on, a Thread I have running in the application does not continue running. How would I either A) keep the Thread running, or B) determine the system has come back from stand-by and restart the Thread?


You don't need to resume threads after the system resumes. That happens automatically. If your thread or process doesn't resume operation properly it is probably mis-handling the standby or hibernate.


Maybe the application is not 100% thread-safe and/or the thread died by an uncaught exception while the system is going stand-by or back from it. Set up an UncaughtExceptionHandler for your thread which logs the uncaught exceptions to a file.

FindBugs and PMD are also useful for hints.

0

精彩评论

暂无评论...
验证码 换一张
取 消