Обсуждение: JDBC lint
JDBC lint helps Java programmers write correct and efficient code when using the JDBC API. This includes resource management, e.g., missing Connection.close, incorrect use of JDBC, e.g., Statement.addBatch without Statement.executeBatch, and potential optimizations, e.g., unread ResultSet columns. JDBC lint wraps DataSource and Connection and via dynamic proxy classes and thus has compatibility with all applications using JDBC. I tested against H2, MySQL, and PostgreSQL and hope users find this helpful: https://github.com/maginatics/jdbclint JDBC lint might help address issues discussed in the thread, "Remove usage of finalizers?": http://www.postgresql.org/message-id/9E5438C0-0A2E-4543-BE06-1E7A6D0E3B83@pilhuhn.de I appreciate any feedback! -- Andrew Gaul http://maginatics.com/
Andrew,
How would this fix the jdbc drivers use of finalizers ?
On Wed, Dec 4, 2013 at 2:37 PM, Andrew Gaul <gaul@maginatics.com> wrote:
JDBC lint helps Java programmers write correct and efficient code when
using the JDBC API. This includes resource management, e.g., missing
Connection.close, incorrect use of JDBC, e.g., Statement.addBatch
without Statement.executeBatch, and potential optimizations, e.g.,
unread ResultSet columns. JDBC lint wraps DataSource and Connection and
via dynamic proxy classes and thus has compatibility with all
applications using JDBC. I tested against H2, MySQL, and PostgreSQL and
hope users find this helpful:
https://github.com/maginatics/jdbclint
JDBC lint might help address issues discussed in the thread,
"Remove usage of finalizers?":
http://www.postgresql.org/message-id/9E5438C0-0A2E-4543-BE06-1E7A6D0E3B83@pilhuhn.de
I appreciate any feedback!
--
Andrew Gaul
http://maginatics.com/
--
Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-jdbc
JDBC lint does not fix JDBC driver use of finalization, instead it informs users that they did not explicitly close a resource. Users explicitly closing allows the finalizer thread to quickly return if a resource has already closed, instead of doing a heavyweight resource deallocation. This tends to have better behavior since the JVM has a limited number of finalizer threads. On Wed, Dec 04, 2013 at 03:14:58PM -0500, Dave Cramer wrote: > Andrew, > > How would this fix the jdbc drivers use of finalizers ? > > Dave Cramer > > dave.cramer(at)credativ(dot)ca > http://www.credativ.ca > > > On Wed, Dec 4, 2013 at 2:37 PM, Andrew Gaul <gaul@maginatics.com> wrote: > > > JDBC lint helps Java programmers write correct and efficient code when > > using the JDBC API. This includes resource management, e.g., missing > > Connection.close, incorrect use of JDBC, e.g., Statement.addBatch > > without Statement.executeBatch, and potential optimizations, e.g., > > unread ResultSet columns. JDBC lint wraps DataSource and Connection and > > via dynamic proxy classes and thus has compatibility with all > > applications using JDBC. I tested against H2, MySQL, and PostgreSQL and > > hope users find this helpful: > > > > https://github.com/maginatics/jdbclint > > > > JDBC lint might help address issues discussed in the thread, > > "Remove usage of finalizers?": > > > > > > http://www.postgresql.org/message-id/9E5438C0-0A2E-4543-BE06-1E7A6D0E3B83@pilhuhn.de > > > > I appreciate any feedback! > > > > -- > > Andrew Gaul > > http://maginatics.com/ > > > > > > -- > > Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org) > > To make changes to your subscription: > > http://www.postgresql.org/mailpref/pgsql-jdbc > > -- Andrew Gaul http://maginatics.com/
Andrew,
The discussion you referenced is actually the jdbc code itself use of finalizers and closing resources
On Wed, Dec 4, 2013 at 3:41 PM, Andrew Gaul <gaul@maginatics.com> wrote:
JDBC lint does not fix JDBC driver use of finalization, instead it
informs users that they did not explicitly close a resource. Users
explicitly closing allows the finalizer thread to quickly return if a
resource has already closed, instead of doing a heavyweight resource
deallocation. This tends to have better behavior since the JVM has a
limited number of finalizer threads.
On Wed, Dec 04, 2013 at 03:14:58PM -0500, Dave Cramer wrote:
> Andrew,
>
> How would this fix the jdbc drivers use of finalizers ?
>
> Dave Cramer
>
> dave.cramer(at)credativ(dot)ca
> http://www.credativ.ca
>
>
> On Wed, Dec 4, 2013 at 2:37 PM, Andrew Gaul <gaul@maginatics.com> wrote:
>
> > JDBC lint helps Java programmers write correct and efficient code when
> > using the JDBC API. This includes resource management, e.g., missing
> > Connection.close, incorrect use of JDBC, e.g., Statement.addBatch
> > without Statement.executeBatch, and potential optimizations, e.g.,
> > unread ResultSet columns. JDBC lint wraps DataSource and Connection and
> > via dynamic proxy classes and thus has compatibility with all
> > applications using JDBC. I tested against H2, MySQL, and PostgreSQL and
> > hope users find this helpful:
> >
> > https://github.com/maginatics/jdbclint
> >
> > JDBC lint might help address issues discussed in the thread,
> > "Remove usage of finalizers?":
> >
> >
> > http://www.postgresql.org/message-id/9E5438C0-0A2E-4543-BE06-1E7A6D0E3B83@pilhuhn.de
> >
> > I appreciate any feedback!
> >
> > --
> > Andrew Gaul
> > http://maginatics.com/
> >
> >
> > --
> > Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org)
> > To make changes to your subscription:
> > http://www.postgresql.org/mailpref/pgsql-jdbc
> >
--
Andrew Gaul
http://maginatics.com/
Use of JDBC lint could allow removing the finalize methods from the underlying driver resources. One could even opt-in to such behavior, such as MySQL Connector/J configuration for dontTrackOpenResources=true. The referenced thread discusses the need for such a debug mode and JDBC lint provides this functionality. On Wed, Dec 04, 2013 at 03:45:08PM -0500, Dave Cramer wrote: > Andrew, > > The discussion you referenced is actually the jdbc code itself use of > finalizers and closing resources > > Dave Cramer > > dave.cramer(at)credativ(dot)ca > http://www.credativ.ca > > > On Wed, Dec 4, 2013 at 3:41 PM, Andrew Gaul <gaul@maginatics.com> wrote: > > > JDBC lint does not fix JDBC driver use of finalization, instead it > > informs users that they did not explicitly close a resource. Users > > explicitly closing allows the finalizer thread to quickly return if a > > resource has already closed, instead of doing a heavyweight resource > > deallocation. This tends to have better behavior since the JVM has a > > limited number of finalizer threads. > > > > On Wed, Dec 04, 2013 at 03:14:58PM -0500, Dave Cramer wrote: > > > Andrew, > > > > > > How would this fix the jdbc drivers use of finalizers ? > > > > > > Dave Cramer > > > > > > dave.cramer(at)credativ(dot)ca > > > http://www.credativ.ca > > > > > > > > > On Wed, Dec 4, 2013 at 2:37 PM, Andrew Gaul <gaul@maginatics.com> wrote: > > > > > > > JDBC lint helps Java programmers write correct and efficient code when > > > > using the JDBC API. This includes resource management, e.g., missing > > > > Connection.close, incorrect use of JDBC, e.g., Statement.addBatch > > > > without Statement.executeBatch, and potential optimizations, e.g., > > > > unread ResultSet columns. JDBC lint wraps DataSource and Connection > > and > > > > via dynamic proxy classes and thus has compatibility with all > > > > applications using JDBC. I tested against H2, MySQL, and PostgreSQL > > and > > > > hope users find this helpful: > > > > > > > > https://github.com/maginatics/jdbclint > > > > > > > > JDBC lint might help address issues discussed in the thread, > > > > "Remove usage of finalizers?": > > > > > > > > > > > > > > http://www.postgresql.org/message-id/9E5438C0-0A2E-4543-BE06-1E7A6D0E3B83@pilhuhn.de > > > > > > > > I appreciate any feedback! > > > > > > > > -- > > > > Andrew Gaul > > > > http://maginatics.com/ > > > > > > > > > > > > -- > > > > Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org) > > > > To make changes to your subscription: > > > > http://www.postgresql.org/mailpref/pgsql-jdbc > > > > > > > > -- > > Andrew Gaul > > http://maginatics.com/ > > -- Andrew Gaul http://maginatics.com/