How to run java function for only 30 minutes

I need to create a java function that will only run for 30 minutes, and at the end of the 30 minutes it executes something. But it should also be able to self terminate before the given time if the right conditions are met. I don't want the function to be sleeping as it should be collecting data, so no sleeping threads.

Thanks

7
задан Angel Grablev 29 September 2010 в 21:35
поделиться