Shreyas Kaushik wrote:
~ I looked at the possible usage of java.util.Timer and
java.util.TimerTask.
Although it may seem to be a correct approach to use them at the first
thought it has some practical drwbacks to its usage in this scneario.
~ Using the Timer and TimerTask may have just one thread, but the above mentioned drawback could be a major performance hit causing more latency in statement execution.
Or you work within the Timer scheme, and implement TimerTasks as recommended, from java.util.Timer
"Timer tasks should complete quickly."
The timer task should just be notifying the thread that is executing the statement that it needs to be cancelled, not performing the cancel itself.
There is also an implementation of a WorkManager in Geronimo that you could be using; the timer task would hand the workload over to that for processing.
-- Jeremy