commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dirk Verbeeck <>
Subject Re: [Pool] force client to return the borrowed object to the pool
Date Fri, 24 Jun 2005 05:51:13 GMT

The technique you propose can already be seen in DBCP.
The real database connections are wrapped with a "poolable" delegating 
wrapper. The close method has been overwritten to call returnObject.

But an example inside commons-pool would be nice. In the wiki or on the 
Maybe some general code could be written to support this pattern.
Using reflexion/java proxy or even bytecode manipulation you could 
implement the "forced" return of the object.

The challenge is of course to find an elegant implementation that 
doesn't add too much complexity.


Edin Ahmetagic wrote:
> Hello,
> could there be an architectual solution to force the clients, that borrows
> objects from the pool, to return this back?
> An approach coud be, to have an Interface "PoolableObject" which have to be
> implemented by the Objects that want to be pooled. In this Interface there
> could be an methode returnObject.
> I`am not sure if this is really possible, it is only an idea.
> Edin
> --

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message