不懂ConnectionManager中程式碼

zsn發表於2003-10-29
關於ConnectionManager中的程式碼
public class ConnectionManager {

private static ConnectionProvider connectionProvider;
private static Object providerLock = new Object();

// True if connection profiling is turned on. Always false by default.
private static boolean profilingEnabled = false;

// True if the database support transactions.
protected static boolean supportsTransactions;
// True if the database requires large text fields to be streamed.
protected static boolean streamLargeText;
// True if the database supports the Statement.setMaxRows() method.
protected static boolean supportsMaxRows;
// True if the database supports the Statement.setFetchSize() method.
protected static boolean supportsFetchSize;
// True if the database supports correlated subqueries.
protected static boolean supportsSubqueries;

private static DatabaseType databaseType = DatabaseType.OTHER;

static {
// Add a shutdown hook to the VM if we're running JDK 1.3. When the
// thread is executed, it will call the destroy() method of the
// current connection provider. This is necessary for some connection
// providers -- especially those for in-VM Java databases.
Runtime runtime = Runtime.getRuntime();
Class c = runtime.getClass();
try {
Method m = c.getMethod("addShutdownHook", new Class[] { Thread.class } );
m.invoke(runtime, new Object[] { new ShutdownThread() });
}
catch (NoSuchMethodException nsme) {
// Ignore -- the user might not be running JDK 1.3.
}
catch (Exception e) {
e.printStackTrace();
}
}.............................
}
在這個連線池的wrap中,這個靜態宣告的作用是什末,我沒有看懂得它的作用,

請大家指點,這個宣告的不用被呼叫嗎?*(菜菜。。

相關文章