Fix Postgresql JDBC driver leaking memory

Older versions of Postgresql JDBC driver rely on finalize() methods in
order to avoid leaking unclosed database objects. Given finalize
methods are unpredictable (no guarantee about prompt execution, if at
all), in some high load environments this could lead to a memory leak
with millions of JDBC objects pending finalization.

Newer versions of the Postgresql JDBC driver removed the use of finalize
methods to avoid this kind of issues.

Also provides an implementation of setQueryTimeout.

Bug: Issue 4848
Change-Id: Ia143f1df1d8e41686362fd76b9bc82e0046f9894
(cherry picked from commit 80476a51df8361814e9cd5d91ceb60e8bf41cae5)
1 file changed