[concurrency-interest] Cancellation convention

Brian Goetz brian at quiotix.com
Tue Jun 6 16:19:04 EDT 2006


> Is it safe to share PreparedStatement instances between threads? If not, 
> then there's nothing you can do, since you can't have one thread in 
> PreparedStatement.execute() and another in PreparedStatement.cancel().

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.

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 hte current version.)



More information about the Concurrency-interest mailing list