Hi,

That's a tough sell IMO because (1) the JDBC specification does not require
this behavior AND (2) it would break existing applications. What is the
harm is having nothing happen when you close a closed connection?

What am I missing?

Gary


On Wed, Apr 14, 2021, 14:47 Christopher Schultz <
[email protected]> wrote:

> All,
>
> I have had an application for years which I run in development with
> maxsize=1 so I can catch any double-check-out errors as soon as they
> might read their ugly heads.
>
> But I never considered double-return logic errors.
>
> I recently wrote a "single connection pool" which is bare-bones and just
> creates a single JDBC connection and hands it out to anyone who wants
> it. It counts borrows vs returns and it was vomiting whenever we called
> a particular method which, evidently, has been double-closing
> connections for years.
>
> I had expected that DBCP2 would be objecting to double-closes, but
> evidently not.
>
> I checked, and there is no configuration that I can find to enable some
> kind of error/notification when double-closes are performed.
>
> Is that something the project would be interested in adding?
>
> I'm talking about something like this:
>
> Connection conn = dbcp.getConnection();
>
> // do stuff
>
> conn.close(); // great, returns to pool
> conn.close(); // should bomb
>
> Thanks,
> -chris
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>

Reply via email to