https://issues.apache.org/bugzilla/show_bug.cgi?id=48817

--- Comment #6 from Matt Passell <[email protected]> 2010-05-12 
12:12:21 EDT ---
(In reply to comment #5)
Thanks Mark. Those were reasonable points. I'll respond to each.

> It appears that this patch forces validation to happen even if the user 
> doesn't
> want it. That could add a fair amount of overhead.
One of the first things that PooledConnection.validate(int, String) does is
call doValidate(validateAction). If someone hasn't turned on testOnBorrow (or
whatever property is relevant to the particular validate action), the
validation will be skipped.

> I'd try isValid() before trying isClosed()
I looked at some driver code and it appears that most just return the value of
a boolean for isClosed(), so I was thinking I might as well ask the cheapest
question first.

> The exception caught in tryIsValid() is rethrown and then silently swallowed. 
> I
> can see why, but that code looks expensive. I'd probably check earlier to see
> if the method was available and set a flag I could check (cheaply) later.
You're right! That's a good idea. Either you're running in a Java 6 environment
or you're not. It shouldn't change over time, so it should be possible to do
the check only once and then store the result. I'll think about the best way to
do that and then make the change.

> In terms of the issues with borrowConnection() and setupConnection() would it
> be feasible to check if setupConnection() fails and it if does, try borrowing 
> a
> new connection? I assume that if borrowConnection() fails then getConnection()
> should fail.
That might work, but if the pool is able to determine that it's about to return
a stale connection and just swap in a fresh one behind the scenes, it would
make things a lot simpler for the calling code. Also, keep in mind that if the
pool has multiple stale connections in it, the caller might otherwise have to
call getConnection() repeatedly.

By the way, I'd be fine with a pluggable Validator approach instead. I just
thought this would be simpler and generally applicable. Let me know what you
think.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to