Package java.lang.instrument

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


    private static class Handler implements PersistenceClassLoaderHandler {
        public void addTransformer(String unitId, ClassLoader classLoader, ClassFileTransformer classFileTransformer) {
            Instrumentation instrumentation = Agent.getInstrumentation();
            if (instrumentation != null) {
                instrumentation.addTransformer(new Transformer(classFileTransformer));
            }
        }

        public void destroy(String unitId) {
        }
View Full Code Here


        PersistenceClassLoaderHandler persistenceClassLoaderHandler = new PersistenceClassLoaderHandler() {

            public void addTransformer(String unitId, ClassLoader classLoader, ClassFileTransformer classFileTransformer) {
                Instrumentation instrumentation = Agent.getInstrumentation();
                if (instrumentation != null) {
                    instrumentation.addTransformer(new ControllableTransformer(classFileTransformer));
                }
            }

            public void destroy(String unitId) {
            }
View Full Code Here

        private final Map<String,List<ClassFileTransformer>> transformers = new TreeMap<String, List<ClassFileTransformer>> ();

        public void addTransformer(String unitId, ClassLoader classLoader, ClassFileTransformer classFileTransformer) {
            Instrumentation instrumentation = Agent.getInstrumentation();
            if (instrumentation != null) {
                instrumentation.addTransformer(classFileTransformer);

                if (unitId != null) {
                    List<ClassFileTransformer> transformers = this.transformers.get(unitId);
                    if (transformers == null) {
                        transformers = new ArrayList<ClassFileTransformer>(1);
View Full Code Here

        private final Map<String,List<ClassFileTransformer>> transformers = new TreeMap<String,List<ClassFileTransformer>>();

        public void addTransformer(String unitId, ClassLoader classLoader, ClassFileTransformer classFileTransformer) {
            Instrumentation instrumentation = Agent.getInstrumentation();
            if (instrumentation != null) {
                instrumentation.addTransformer(classFileTransformer);

                if (unitId != null) {
                    List<ClassFileTransformer> transformers = this.transformers.get(unitId);
                    if (transformers == null) {
                        transformers = new ArrayList<ClassFileTransformer>(1);
View Full Code Here

        if (i == null) {
            throw new IllegalStateException("Attempt to add a transformer failed - "
                    + "instrumentation is not initialized.");
        }

        i.addTransformer(transformerWrapper);
    }

    protected Log getLogger() {
        if (logger == null) {
            logger = LogFactory.getLog(getClass());
View Full Code Here

        private final Map<String,List<ClassFileTransformer>> transformers = new TreeMap<String, List<ClassFileTransformer>> ();

        public void addTransformer(String unitId, ClassLoader classLoader, ClassFileTransformer classFileTransformer) {
            Instrumentation instrumentation = Agent.getInstrumentation();
            if (instrumentation != null) {
                instrumentation.addTransformer(classFileTransformer);

                if (unitId != null) {
                    List<ClassFileTransformer> transformers = this.transformers.get(unitId);
                    if (transformers == null) {
                        transformers = new ArrayList<ClassFileTransformer>(1);
View Full Code Here

public class PurrPackagePremainTest extends Assert {

    @Test
    public void testPremain() {
        Instrumentation i = EasyMock.createMock( Instrumentation.class );
        i.addTransformer( EasyMock.anyObject( SimpleInstrumenter.class ) );
        EasyMock.expectLastCall();
        EasyMock.replay( i );
        PurrPackagePremain.premain( null, i );
        EasyMock.verify( i );
    }
View Full Code Here

    Instrumentation instrumentation = InstrumentationSavingAgent.getInstrumentation();
    if (instrumentation == null) {
      throw new IllegalStateException(
          "Must start with Java agent to use InstrumentationLoadTimeWeaver. See Spring documentation.");
    }
    instrumentation.addTransformer(transformer);
  }

  /**
   * We have the ability to weave the current class loader when starting the
   * JVM in this way, so the instrumentable class loader will always be the
View Full Code Here

    Instrumentation instrumentation = InstrumentationSavingAgent.getInstrumentation();
    if (instrumentation == null) {
      throw new IllegalStateException(
          "Must start with Java agent to use InstrumentationLoadTimeWeaver. See Spring documentation.");
    }
    instrumentation.addTransformer(transformer);
  }

  /**
   * We have the ability to weave the current class loader when starting the
   * JVM in this way, so the instrumentable class loader will always be the
View Full Code Here

    private static class Handler implements PersistenceClassLoaderHandler {
        public void addTransformer(String unitId, ClassLoader classLoader, ClassFileTransformer classFileTransformer) {
            Instrumentation instrumentation = Agent.getInstrumentation();
            if (instrumentation != null) {
                instrumentation.addTransformer(new Transformer(classFileTransformer));
            }
        }

        public void destroy(String unitId) {
        }
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.