Examples of redefineClasses()


Examples of com.sun.jdi.VirtualMachine.redefineClasses()

    for (int i = 0; i < classes.size(); i++) {
      ReferenceType refType = (ReferenceType) classes.get(i);
      HashMap map = new HashMap();
      map.put(refType, classBytes);
      vm.redefineClasses(map);
    }
  }

  private static byte[] loadClassFile(File classFile) {
    try {
View Full Code Here

Examples of com.sun.jdi.VirtualMachine.redefineClasses()

        if (vm == null) {
          target.requestFailed(
              JDIDebugHCRMessages.JavaHotCodeReplaceManager_Hot_code_replace_failed___VM_disconnected__2,
              null);
        }
        vm.redefineClasses(typesToBytes);
      } catch (UnsupportedOperationException exception) {
        String detail = exception.getMessage();
        if (detail != null) {
          redefineTypesFailedJDK(
              target,
View Full Code Here

Examples of java.lang.instrument.Instrumentation.redefineClasses()

                // in a Java 5 context, we can use class redefinition instead
                ClassDefinition[] defs = new ClassDefinition[array.length];
                for (int i = 0; i < defs.length; i++)
                    defs[i] = new ClassDefinition(array[i],
                        classes.get(array[i]));
                inst.redefineClasses(defs);
            }
        } catch (NoSuchMethodException e) {
            throw new InternalException(e);
        } catch (IllegalAccessException e) {
            throw new InternalException(e);
View Full Code Here

Examples of java.lang.instrument.Instrumentation.redefineClasses()

            return;
        }

        // try to reload them all
        try {
            instrumentation.redefineClasses(changes);
            for (int i=0; i<changes.length; i++) succeeded[i] = true;
        } catch (Exception e) {
            // throw new AWGenericException(e);
            if (changes.length == 1) {
                succeeded[0] = false;
View Full Code Here

Examples of java.lang.instrument.Instrumentation.redefineClasses()

            } else {
                // we failed to load one or more, so try to load them individually
                for (int i=0; i<changes.length; i++) {
                    ClassDefinition[] change = new ClassDefinition[] {changes[i]};
                    try {
                        instrumentation.redefineClasses(change);
                        succeeded[i] = true;
                    } catch (Exception e2) {
                        succeeded[i] = false;
                    }
                }
View Full Code Here

Examples of java.lang.instrument.Instrumentation.redefineClasses()

                // in a Java 5 context, we can use class redefinition instead
                ClassDefinition[] defs = new ClassDefinition[array.length];
                for (int i = 0; i < defs.length; i++)
                    defs[i] = new ClassDefinition(array[i],
                        classes.get(array[i]));
                inst.redefineClasses(defs);
            }
        } catch (NoSuchMethodException e) {
            throw new InternalException(e);
        } catch (IllegalAccessException e) {
            throw new InternalException(e);
View Full Code Here

Examples of java.lang.instrument.Instrumentation.redefineClasses()

                // in a Java 5 context, we can use class redefinition instead
                ClassDefinition[] defs = new ClassDefinition[array.length];
                for (int i = 0; i < defs.length; i++)
                    defs[i] = new ClassDefinition(array[i],
                        classes.get(array[i]));
                inst.redefineClasses(defs);
            }
        } catch (Exception e) {
            throw new InternalException(e);
        } finally {
            if (inst != null && t != null)
View Full Code Here

Examples of java.lang.instrument.Instrumentation.redefineClasses()

   */
  public static boolean redefineClassEL(Class clazz, byte[] barr){
    Instrumentation inst = InstrumentationFactory.getInstance();
      if(inst!=null && inst.isRedefineClassesSupported()) {
        try {
            inst.redefineClasses(new ClassDefinition(clazz,barr));
        return true;
      }
        catch (Throwable t) {t.printStackTrace();}
      }
      return false;
View Full Code Here

Examples of java.lang.instrument.Instrumentation.redefineClasses()

      return false;
  }

  public static void redefineClass(Class clazz, byte[] barr) throws ClassNotFoundException, UnmodifiableClassException{
    Instrumentation inst = InstrumentationFactory.getInstance();
      inst.redefineClasses(new ClassDefinition(clazz,barr));
  }

  public static boolean isSupported() {
    Instrumentation inst = InstrumentationFactory.getInstance();
    return (inst!=null && inst.isRedefineClassesSupported());
View Full Code Here

Examples of java.lang.instrument.Instrumentation.redefineClasses()

        ClassDefinition[] definitions = new ClassDefinition[classes.size()];
        int i = 0;
        for (Map.Entry<Class<?>, byte[]> entry : classes.entrySet()) {
            definitions[i++] = new ClassDefinition(entry.getKey(), entry.getValue());
        }
        instrumentation.redefineClasses(definitions);
    }

    @Override
    public void close() throws IOException {
        // Do nothing.
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.