예제 #1
0
 /* 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);
 }
예제 #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)});
 }
예제 #3
0
 private static Class getVMImplClassFrom(ClassLoader cl) throws ClassNotFoundException {
   return Class.forName("sun.jvm.hotspot.jdi.VirtualMachineImpl", true, cl);
 }