On 1/9/2018 11:50 AM, Phil Steitz wrote:
> thread 1: checkOpen - sees true
> thread 2: close the DelegatingConnection  (there is no sync to
> prevent this)
> thread1 : createStatement - bang!
> thread1 : isClosed() returns true
>
> DBCP is not really safe to use that way - i.e., really the intended
> setup is that individual connection handles are not concurrently
> accessed by multiple threads.  Is it possible something like this is
> going on?  Note that what I am talking about here is two different
> threads holding references to the same connection handle - i.e., no
> trips back through the pool.

I am about 99 percent sure that I never pass Connection objects between
threads.  What code I've looked at borrows, uses, and closes the
Connection with a single thread.  I have some helper methods that take a
connection, but in all the code I've looked at so far, it's all running
in the same thread that borrowed the Connection in the first place.

I can tell you for sure that my *intent* when I wrote the code was to
always handle a Connection lifecycle in one single thread.  I wasn't
absolutely sure that sharing the object between threads would cause
problems, but doing so seemed like a bad idea.

Thanks,
Shawn


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org

Reply via email to