org.apache.commons.javaflow.instrumentation.cdi.CdiProxyInstrumentationAgent Maven / Gradle / Ivy
The newest version!
/**
* Copyright 2013-2021 Valery Silaev (http://vsilaev.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.commons.javaflow.instrumentation.cdi;
import java.lang.instrument.ClassFileTransformer;
import java.lang.instrument.Instrumentation;
import org.apache.commons.javaflow.instrumentation.common.AbstractInstrumentationAgent;
public class CdiProxyInstrumentationAgent extends AbstractInstrumentationAgent {
private CdiProxyInstrumentationAgent() {}
/**
* JVM hook to statically load the javaagent at startup.
*
* After the Java Virtual Machine (JVM) has initialized, the premain method
* will be called. Then the real application main method will be called.
*
* @param args
* @param instrumentation
* @throws Exception
*/
public static void premain(String args, Instrumentation instrumentation) throws Exception {
new CdiProxyInstrumentationAgent().install(args, instrumentation);
}
/**
* JVM hook to dynamically load javaagent at runtime.
*
* The agent class may have an agentmain method for use when the agent is
* started after VM startup.
*
* @param args
* @param instrumentation
* @throws Exception
*/
public static void agentmain(String args, Instrumentation instrumentation) throws Exception {
new CdiProxyInstrumentationAgent().attach(args, instrumentation);
}
protected ClassFileTransformer createTransformer() {
return new CdiProxyClassTransformer();
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy