Runtime的addShutdownHook(Thread thread)我明白,
可是Method类里的
public native Object invoke(Object obj,Object args[]) 
我看帮助文档也不是很明白,就是下面try{}里的2行,哪位知道呢? static {
        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) {
           //
        }
        catch (Exception e) {
            e.printStackTrace();
        }
    }
 private static class ShutdownThread extends Thread {
        public void run() {
            ConnectionProvider provider = ConnectionManager.getConnectionProvider();
            if (provider != null) {
                provider.destroy();
            }
        }
    }