文档介绍:×÷Õߣºsonymusic
email: sonymusic@
ÈÕÆÚ£º2001-5-17 11:35:03
//Îļþ£º
.;
import .*;
import .*;
import .*;
/**
Central manager of database connections.
*/
public class DbConnectionManager {
private static DbConnectionProvider connectionProvider;
private static Object providerLock = new Object();
/**
* Returns a database connection from the currently active connection
* provider.
*/
public static Connection getConnection() {
if (connectionProvider == null) {
synchronized (providerLock) {
if (connectionProvider == null) {
//Create the connection provider -- for now, this is hardcoded. For
//the next beta, I'll change this to load up the provider dynamically.
connectionProvider = new DbConnectionDefaultPool();
();
}
}
}
Connection con = ();
if (con == null) {
("WARNING: () failed to obtain a connection.");
}
return con;
}
/**
* Returns the current connection provider. The only case in which this
* method should be called is if more information about the current
* connection provider is needed. Database connections should always be
* obtained by calling the getConnection method of this class.
*/
public static