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

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -