I would like to develop a connection pool to a back-end server which has an SMTP like interface. This would be deployed in Tomcat/cocoon in an analagous way to a database connection pool i.e. I'd like to hold open a collection of sockets which could be (re)used. Could anyone give me some pointers on how this would be implemented in the Avalon/Excalibur/Fortress/... world?
I would look at the Database component's way of doing something similar. There are a couple approaches to pooling objects:
* Explicit pooling--the user has to acquire and release a handle explicitly.
This is similar to the ServiceManager approach.* Implicit pooling--the backend pool is used when the user calls the "close"
method. This is similar to the way javax.sql.DataSource
pools modify the java.sql.Connection.close() semantics.* Garbage Collection--the user has no control over the reclamation of the
socket. They are given certain guarantees as to
how the connection would operate, but there is no
guarantee that the connection originally aquired is
the same as the one used toward the end of the
transaction.The exact mechanism would have to fit the use case. As a matter of general style, I would stay away from explicit pooling if you can help it. Implicit pooling is orders of magnitude easier to implement than garbage collecting.
The JdbcDataSource in the Avalon database connection pool uses implicit pooling, and it works fairly well.
--
"They that give up essential liberty to obtain a little temporary safety
deserve neither liberty nor safety."
- Benjamin Franklin
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
