Package java.lang.instrument

Examples of java.lang.instrument.ClassDefinition


        ClassDefinition[] changes = new ClassDefinition[changeSet.getElements().size()];
        int index = 0;
        for (Iterator it = changeSet.getElements().iterator(); it.hasNext(); index++) {
            ChangeSet.Element changeSetElement = (ChangeSet.Element) it.next();
            final byte[] bytecode = JoinPointFactory.redefineJoinPoint(changeSetElement.getCompilationInfo());
            changes[index] = new ClassDefinition(changeSetElement.getJoinPointInfo().getJoinPointClass(), bytecode);
        }
        try {
            Agent.getInstrumentation().redefineClasses(changes);
        } catch (Exception e) {
            throw new WrappedRuntimeException(e);
View Full Code Here


/* 51 */     this.classDefinitions = new ArrayList();
/*    */   }
/*    */
/*    */   public synchronized void registerChange(Class clazz, byte[] classCode)
/*    */   {
/* 61 */     ClassDefinition classDef = new ClassDefinition(clazz, classCode);
/* 62 */     this.classDefinitions.add(classDef);
/*    */   }
View Full Code Here

        }

        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);
    }
View Full Code Here

    * @param clazz the clazz to be redefined.
    * @param classCode the new byte code implementation of <code>clazz</code>.
    */
   public synchronized void registerChange(Class clazz, byte[] classCode)
   {
      ClassDefinition classDef = new ClassDefinition(clazz, classCode);
      this.classDefinitions.add(classDef);
   }
View Full Code Here

                            //Adding the transformer
                            transformers.add( transformer );
                            instrumentation.addTransformer( transformer, true );

                            //And finally redefine the class
                            ClassDefinition classDefinition = new ClassDefinition( currentClass, byteCode );
                            instrumentation.redefineClasses( classDefinition );
                        }
                    } catch ( ClassNotFoundException e ) {
                        //If the class has not been loaded we don't need to redefine it
                    }
View Full Code Here

TOP

Related Classes of java.lang.instrument.ClassDefinition

Copyright © 2018 www.massapicom. 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.