java - Is OracleDataSource.getConnection thread-safe? -
i thought finding reply easy...but not much.
does know if oracledatasource.getconnection method thread safe?
i not mean connection objects returns, calling of getconnection itself.
specifically, method: http://download.oracle.com/otn_hosted_doc/jdeveloper/905/jdbc-javadoc/oracle/jdbc/pool/oracledatasource.html#getconnection()
the docs , class doesn't explicitly but, beingness how connection pool, i'm inclined believe is.
this problem discussed in java concurrency in practice (brian goetz):
4.5.1. interpreting vague documentation
many java technology specifications are silent, or at least unforthcoming, about thread safety guarantees and requirements for interfaces such as servletcontext, httpsession, or datasource.
...information servlets...
one can create a similar inference about jdbcdatasource interface, represents a pool of reusable database connections. a datasource provides service to an application, and it doesn't make much sense in the context of a single threaded application. it is hard to imagine a use case that doesn't involve calling getconnection from multiple threads. and, as with servlets, the examples in the jdbc specification do not suggest the need for any client side locking in the many code examples using datasource. so, even though the specification doesn't promise datasource is thread-safe or require container vendors to provide a thread-safe implementation, by same "it would be absurd if it weren't" argument, we have no choice but to assume that datasource.getconnection does not require additional client-side locking. ...
java oracle thread-safety
No comments:
Post a Comment