Currently I am working in a application where spring thread pool is implemented. In the run method I need to check the next saving time from the db with the current system time. If next saving time is greater than current time this thread to be stopped and release back to the pool.
I think that you have to take another approximation and only send a task to the pool when is required the next saving time.
You need two different types of task one to decide when is the save time and other/s task/s that do the saving (this tasks are pooled).
Thanks for the reply. I did it in reverse order instead of checking greaterthan I have checked for less than condition. If the next saving time is less than current time I am processing my data else I wont do any thing ie that thread will written back to pool as it has finished processing.