[concurrency-interest] Cancellation convention
mike.quilleash at azuresolutions.com
Tue Jun 6 14:24:20 EDT 2006
Quick question about cancelling things and the usual way of doing it.
Is it the convention to use Thread.interrupt() to do cancellation of a
task in another thread? Presumably the Thread being run must either be
calling API code that is interruptible or check itself for the
interrupted state regularly.
Specifically I'm interested in being able to cancel long running JDBC
calls (using PreparedStatement.cancel()). Would a sensible way be to
fork off the PreparedStatement execution in another thread and have the
main thread wait for the second thread to complete, but if it is
interrupted then call the PreparedStatement.cancel() and throw an
exception out to indicate the cancellation succeeded? Just after some
best practice advice.
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Concurrency-interest