The Open Anzo Project

Semantic Application Middleware

Ticket #31 (closed defect: fixed)

Opened 1 year ago

Last modified 1 year ago

Underlying JDBC connections should be closed when there is an SQL Error

Reported by: mroy Assigned to: mroy
Priority: major Milestone: 3.0 milestone1
Component: openanzo-repository Version: 3.0
Keywords: jdbc Cc:

Description (Last modified by mroy)

Underlying JDBC connections should be closed when there is an SQL Error since the error might be caused to a bad JDBC connection. Without this fix, a bad JDBC connection will continue to be provided from the pool, always returning an Sql exception when an operation is attempted.

Change History

10/19/07 16:55:06 changed by mroy

(In [596]) addresses #31 In connection pool, synch on a lock, not on the object, since it causes deadlocks. reviewer: jpbetz

10/19/07 23:45:20 changed by jpbetz

  • description changed.

Code looks great. Consider 596 reviewed.

I find the deadlock issue curious because, unless I'm misunderstanding something, the only difference between locking on the object via the synchronized method modifier and using a per object reentrant lock in the same methods is the reentrant part. At a casual glance I didn't see any of these methods calling each other (or themselves).

10/19/07 23:51:45 changed by jpbetz

Actually, can I get do-overs on this code review?

Have a look at:

RepositoryConnectionFactory?.closeRepositoryConnection:

cleanRepositoryConnection(con);
        con.getPreparedStatementCache().clear();
        if(!con.isClosed())con.close();
        repositoryConnectionPool.allConnections.remove(con);
        repositoryConnectionPool.unregisterResetListener(con);

looks like we need to encapsulate that allConnections reference and make sure to get the lock before calling remove.

10/20/07 21:13:54 changed by mroy

(In [600]) addresses #31 Fix removing the conection when it is closed such that it is within a lock. Moved to plain reentrant lock instead of read/write lock. Reason for lock instead of synchronization on methods is because synchronizing on a method locks the entire class, and if the object pool or some other object tries to synchronize on said object, you get deadlocks. Having the lock around the right parts of the code makes deadlock less likely.

reviewer: jpbetz

11/08/07 12:38:59 changed by mroy

(In [748]) re #88,#63,#31
reviewer ben
reviewer jpbetz
Merge of ServiceContainer branch into Trunk. Includes rearch of RespositoryConnections? in order to allow for safe handling for jdbc connections from connection pools.
Implementation of ServiceContainer architecture.
Existing database unchanged and properties unchanged.

11/08/07 12:48:54 changed by mroy

(In [749]) re #88,#63,#31 reviewer ben reviewer jpbetz Merge of ServiceContainer branch into Trunk. Includes rearch of RespositoryConnections?? in order to allow for safe handling for jdbc connections from connection pools. Implementation of ServiceContainer architecture. Existing database unchanged and properties unchanged.

11/08/07 13:07:08 changed by mroy

  • status changed from new to closed.
  • resolution set to fixed.
  • description changed.
Copyright © 2007 - 2008 OpenAnzo.org