/* gets target VM version from the given VMVersionMismatchException.
  * Note that we need to reflectively call the method because of we may
  * have got this from different classloader's namespace */
 private static String getVMVersion(Throwable throwable)
     throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {
   // assert isVMVersionMismatch(throwable), "not a VMVersionMismatch"
   Class expClass = throwable.getClass();
   Method targetVersionMethod = expClass.getMethod("getTargetVersion", new Class[0]);
   return (String) targetVersionMethod.invoke(throwable);
 }
Beispiel #2
0
 private VirtualMachine createVirtualMachine(Class virtualMachineImplClass, int pid)
     throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {
   java.lang.reflect.Method createByPIDMethod =
       virtualMachineImplClass.getMethod(
           "createVirtualMachineForPID",
           new Class[] {VirtualMachineManager.class, Integer.TYPE, Integer.TYPE});
   return (VirtualMachine)
       createByPIDMethod.invoke(
           null,
           new Object[] {Bootstrap.virtualMachineManager(), new Integer(pid), new Integer(0)});
 }