User: mulder
Date: 00/09/13 05:07:05
Modified: src/main/org/jboss/minerva/datasource PoolDriver.java
Log:
Change the pool driver so it uses the same URL for transactional and
non-transactional pools (jdbc:minerva:PoolName). This means it can't
really tell the difference from the URL, so it will try to load a
connection from both if necessary, but hey, it's only an extra hashtable
lookup...
Also, update the JavaDoc package documentation.
Revision Changes Path
1.4 +13 -11 jboss/src/main/org/jboss/minerva/datasource/PoolDriver.java
Index: PoolDriver.java
===================================================================
RCS file:
/products/cvs/ejboss/jboss/src/main/org/jboss/minerva/datasource/PoolDriver.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- PoolDriver.java 2000/08/18 03:21:07 1.3
+++ PoolDriver.java 2000/09/13 12:07:05 1.4
@@ -26,12 +26,11 @@
* <CODE>Class.forName("org.minerva.datasource.PoolDriver");</CODE></P>
* @see org.jboss.minerva.datasource.JDBCPoolDataSource
* @see org.jboss.minerva.datasource.XAPoolDataSource
- * @version $Revision: 1.3 $
+ * @version $Revision: 1.4 $
* @author Aaron Mulder ([EMAIL PROTECTED])
*/
public class PoolDriver implements Driver {
private final static String URL_START = "jdbc:minerva:";
- private final static String XA_URL_START = "jdbc:minervaxa:";
private final static PoolDriver instance;
static {
instance = new PoolDriver();
@@ -57,26 +56,28 @@
* Tells which URLs this driver can handle.
*/
public boolean acceptsURL(String url) throws java.sql.SQLException {
- return url.startsWith(URL_START) || url.startsWith(XA_URL_START);
+ return url.startsWith(URL_START);
}
/**
* Retrieves a connection from a connection pool.
*/
public Connection connect(String url, Properties props) throws
java.sql.SQLException {
- if(url.startsWith(URL_START))
- return getJDBCConnection(url.substring(URL_START.length()));
- else if(url.startsWith(XA_URL_START))
- return getXAConnection(url.substring(XA_URL_START.length()));
- else
- return null; // No SQL Exception here!
+ if(url.startsWith(URL_START)) {
+ Connection con = getXAConnection(url.substring(URL_START.length()));
+ if(con == null)
+ con = getJDBCConnection(url.substring(URL_START.length()));
+ return con;
+ }
+ return null; // No SQL Exception here!
}
private Connection getJDBCConnection(String name) {
Connection con = null;
try {
DataSource source = JDBCPoolDataSource.getDataSource(name);
- con = source.getConnection();
+ if(source != null)
+ con = source.getConnection();
} catch(Exception e) {
Logger.exception(e);
}
@@ -87,7 +88,8 @@
Connection con = null;
try {
DataSource source = XAPoolDataSource.getDataSource(name);
- con = source.getConnection();
+ if(source != null)
+ con = source.getConnection();
} catch(Exception e) {
Logger.exception(e);
}