[concurrency-interest] Cancellation convention

Tim Peierls tim at peierls.net
Tue Jun 6 17:07:05 EDT 2006


On 6/6/06, Brian Goetz <brian at quiotix.com> wrote:
>
> > Is it safe to share PreparedStatement instances between threads?
>
> We don't know.  The specification is absolutely silent on the subject of
> the thread-safety of JDBC objects.  However, serial thread confinement
> can be applied to the entire family of related JDBC objects (Connection
> / PS / ResultSet), and in the absence of a truly whacked out
> interpretation of the spec, should probably be OK.


Mike seemed to be proposing something outside of serial thread confinement:
PS.execute in one thread, and PS.cancel in another. But your argument (here
and in JCiP 4.5.1) is that providing a cancel method in the API makes no
sense if you can't use it in this way.


Some vendors try to make their JDBC drivers safe (like Oracle.)
> Sometimes they succeed, though the Oracle driver has had well-known
> deadlock problems in the past (can't say about the current version.)


It's quite possible that some driver implementations work by accident.

--tim
-------------- next part --------------
An HTML attachment was scrubbed...
URL: /pipermail/attachments/20060606/5972a73c/attachment.html 


More information about the Concurrency-interest mailing list