You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@juddi.apache.org by Steve Viens <sv...@attbi.com> on 2003/08/07 23:19:02 UTC
[juddi-Developers] jUDDI ConnectionPool is now a Singleton
All
I've turned org.juddi.ConnectionPool into a singleton by making the
constructor private and adding a static "ConnectionPool.getInstance()"
method that will always return the same 'single' shared instance. I've
also added a new JDBCDataSource class to the org.juddi.util package that
is simply a helper class for obtaining a reference to jUDDI's JDBC
DataSource via a JNDI lookup.
Now you can easily acquire a JDBC Connection from anywhere within the
framework by doing something like this:
1. Get the value of the "juddi.useConnectionPool" property.
boolean usePool =
Config.getBooleanProperty("juddi.useConnectionPool",false);
2. If "usePool" is true then grab reference to the shared ConnectionPool
instance.
ConnectionPool pool = ConnectionPool.getInstance();
3. If "usePool" is false then use the new org.juddi.util.JDBCDataSource
to grab a reference to the JDBC DataSource.
DataSource ds = JDBCDataSource.getInstance();
Steve