The database connection pooling in JBoss uses object pool classes
in the Minerva package to pool the connections. You could use these same
pooling classes to pool LDAP connections or messages or anything else.
The classes are in jboss/src/lib/minerva-1.0b3.jar and the source code is
in jbosscx/external/minerva-1.0b3-src.zip. You would need to define a
PooledObjectFactory that creates new objects of the type you want to pool
(LDAP connections or messages or whatever), and the pooling code just uses
that.
That said, we have just finished implementing J2EE Connector
support. You could write a Resource Adapter for LDAP, and use it with the
JBoss ConnectionManagers. A Resource Adapter has to be able to create
connections and connection factories. For JDBC these are
java.sql.Connections and javax.sql.DataSources, but you are not locked
into those: you could define an LDAPConnection and LDAPDataSource or
something. The advantage to doing it this way is that your LDAP
connections could then be used by any application server that supports
J2EE Connectors, and the application server handles pooling, security, and
transactions. So you'd do less work and get more reward. Not a bad deal!
Aaron
On Tue, 13 Feb 2001, Chetan SI wrote:
> Hi All,
> I'm writing bean managed entity beans where I'm using LDAP as my
> database. Currently, I'm making connection with LDAP for every time but
> how can I optimize by making some kind of pool as it can be done for
> JDBC connection pool.
> Also, the same problem I'm facing when I'm publishing message(
> writing
> into the queue) from my session bean. I've to make connection every
> time. How can I avoid it ?
> Any help will be appreciated.
> Regards,
> Chetan SI.
>