不懂ConnectionManager中代码

03-10-29 zsn
关于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中,这个静态声明的作用是什末,我没有看懂得它的作用,

请大家指点,这个声明的不用被调用吗?*(菜菜。。

猜你喜欢