求救~帮忙看一段代码是做什么用的~

04-04-20 woodless
最近在研究jive,在ConnectionManager类中有这样一段代码没有搞清楚是做什么用的

    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) {
		//do something...
        }
        catch (Exception e) {
            e.printStackTrace();
        }
    }

请各位大虾指点,谢了~

猜你喜欢