multithreading - How can I set a timeout around some code in java on the main thread? -
I am looking for functionality in Java like Ruby:
SystemTimer.timeout_after (30. Seconds) Do something end
I can achieve this by fork by storing it and after some time killing it, but is this an easy way?
Can not you use Java now?
A feature for the thread is to work for future execution in the background Fred. Work can be fixed for one-time execution, or can be fixed for frequent execution at regular intervals.
Comments
Post a Comment