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

woodless
04-04-20 0 112

最近在研究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();
}
}

请各位大虾指点,谢了~