Open scottmarlow opened 9 years ago
That's an intersting question. The first problem is that the class return needs to be proxied. The second problem is that we need to decide if we want to be smarter than the user and take ownership of the connection pool.
I tend ot think that if the class is proxyable, we should ignore the close operations. The hard thing is say some specific objects like MongoDB's DBCollection
might have pointers back to MongoClient which we would need to proxy too.
I would classify as a nice to have.
I agree it would be hard to proxy, DBCollection.getDB() does return the DB and DB.getMongo() returns the Mongo (MongoClient).
Lets say that an instance of MongoClient is bound to JNDI location "java:jboss/mongodb/test" and an application looks up the MongoClient instance and calls close on it. What should happen when close is called?
An exception is thrown perhaps, as it would be with a managed DataSource?