You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by Simon Kitching <si...@chello.at> on 2007/09/10 16:51:32 UTC

[orchestra] connectionManager package

Hi All,

The documentation for the "connectionManager" package currently states that all this package provides is a workaround for the problem of ORMs that leak database connections.

However it actually currently does more than that. The ConnectionManagerDataSource class also provides a generic mechanism for getting callbacks whenever a connection is borrowed from a DataSource or returned to a DataSource.

Is it really necessary for Orchestra to provide such functionality? Orchestra doesn't actually make any use of this at all (apart from an artificial "logging listener" that could simply be replaced by adding
a few log statements into ConnectionManagerDataSource). And it just doesn't seem to me to be part of Orchestra's core purpose to provide this sort of thing.

If it is felt that this really is is desirable, then perhaps we should decouple the "leak fixing" part from the "listening" part? Currently, it's not just a listener management tool because it cannot listen without also wrapping connections in the special DisconnectableConnection proxy. We could instead:

(a)
replace
  public Connection getConnection() throws SQLException
  {
    return DisconnectableConnectionFactory.create(this);
  }
with a call to a factory object that is injected into it, and

(b)
move static method releaseAllBorrowedConnections into the DisconnectableConnectionFactory class.

The ConnectionManagerDataSource would then be a simple standalone "listener" mechanism rather than being half-user-tool and half-solution-to-specific-jpa-problem.

Just to be clear, my current preference is to remove the listener functionality: why ship/support code that isn't used?

This change would require existing Orchestra users who make use of the ConnectionManagerDataSource to make a minor config file change.

Comments?

Cheers,

Simon