Is it possible to kill a method loaded with reflection after a certain amount of time of the method executing? Consider the following:
public static void main(String[] args) throws ClassNotFoundException, SecurityException, NoSuchMethodException, IllegalArgumentException, IllegalAccessException, InvocationTargetException {
Class<?> cls = Class.forName("pkg1.pkg2.classname");
Method method = cls.getMethod("main", String[].class);
String[] params = null;
method.invoke(null, (Object) params);
// ... more code that does stuff after this
}
How would I let the main method run for a finite amount of time before a decision is made to just stop the dynamic invocation of the loaded main method but not the entire application?
Aucun commentaire:
Enregistrer un commentaire