commons-dev mailing list archives

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

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 
website.
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.

Cheers
Dirk



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: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message