java.lang.instrument.Instrumentation.isRedefineClassesSupported()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(8.0k)|赞(0)|评价(0)|浏览(118)

本文整理了Java中java.lang.instrument.Instrumentation.isRedefineClassesSupported()方法的一些代码示例,展示了Instrumentation.isRedefineClassesSupported()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Instrumentation.isRedefineClassesSupported()方法的具体详情如下:
包路径:java.lang.instrument.Instrumentation
类名称:Instrumentation
方法名:isRedefineClassesSupported

Instrumentation.isRedefineClassesSupported介绍

暂无

代码示例

代码示例来源:origin: redisson/redisson

@Override
protected Strategy validate(Instrumentation instrumentation) {
  if (!instrumentation.isRedefineClassesSupported()) {
    throw new IllegalArgumentException("Does not support redefinition: " + instrumentation);
  }
  return this;
}

代码示例来源:origin: redisson/redisson

@Override
protected void check(Instrumentation instrumentation) {
  if (!instrumentation.isRedefineClassesSupported()) {
    throw new IllegalStateException("Cannot apply redefinition on " + instrumentation);
  }
}

代码示例来源:origin: org.javassist/javassist

/**
 * The entry point invoked when this agent is started after the JVM starts.
 */
public static void agentmain(String agentArgs, Instrumentation inst) throws Throwable {
  if (!inst.isRedefineClassesSupported())
    throw new RuntimeException("this JVM does not support redefinition of classes");
  instrumentation = inst;
}

代码示例来源:origin: scouter-project/scouter

/**
 * The entry point invoked when this agent is started after the JVM starts.
 */
public static void agentmain(String agentArgs, Instrumentation inst) throws Throwable {
  if (!inst.isRedefineClassesSupported())
    throw new RuntimeException("this JVM does not support redefinition of classes");
  instrumentation = inst;
}

代码示例来源:origin: redisson/redisson

/**
 * Creates a class reloading strategy for the given instrumentation. The given instrumentation must either
 * support {@link java.lang.instrument.Instrumentation#isRedefineClassesSupported()} or
 * {@link java.lang.instrument.Instrumentation#isRetransformClassesSupported()}. If both modes are supported,
 * classes will be transformed using a class retransformation.
 *
 * @param instrumentation The instrumentation to be used by this reloading strategy.
 * @return A suitable class reloading strategy.
 */
public static ClassReloadingStrategy of(Instrumentation instrumentation) {
  if (DISPATCHER.isRetransformClassesSupported(instrumentation)) {
    return new ClassReloadingStrategy(instrumentation, Strategy.RETRANSFORMATION);
  } else if (instrumentation.isRedefineClassesSupported()) {
    return new ClassReloadingStrategy(instrumentation, Strategy.REDEFINITION);
  } else {
    throw new IllegalArgumentException("Instrumentation does not support reloading of classes: " + instrumentation);
  }
}

代码示例来源:origin: org.apache.geronimo.framework/geronimo-transformer

public static boolean isRedefineClassesSupported() {
  return instrumentation != null && instrumentation.isRedefineClassesSupported();
}

代码示例来源:origin: KostyaSha/yet-another-docker-plugin

/**
 * The entry point invoked when this agent is started after the JVM starts.
 */
public static void agentmain(String agentArgs, Instrumentation inst) throws Throwable {
  if (!inst.isRedefineClassesSupported())
    throw new RuntimeException("this JVM does not support redefinition of classes");
  instrumentation = inst;
}

代码示例来源:origin: com.fitbur.external/external-bytebuddy

@Override
protected boolean isRetransforming(Instrumentation instrumentation) {
  if (!instrumentation.isRedefineClassesSupported()) {
    throw new IllegalArgumentException("Cannot redefine classes: " + instrumentation);
  }
  return false;
}

代码示例来源:origin: com.fitbur.external/external-bytebuddy

@Override
protected Strategy validate(Instrumentation instrumentation) {
  if (!instrumentation.isRedefineClassesSupported()) {
    throw new IllegalArgumentException("Does not support redefinition: " + instrumentation);
  }
  return this;
}

代码示例来源:origin: org.testifyproject.external/external-bytebuddy

@Override
protected void check(Instrumentation instrumentation) {
  if (!instrumentation.isRedefineClassesSupported()) {
    throw new IllegalStateException("Cannot apply redefinition on " + instrumentation);
  }
}

代码示例来源:origin: io.github.scouter-project/scouter-agent-java

/**
 * The entry point invoked when this agent is started after the JVM starts.
 */
public static void agentmain(String agentArgs, Instrumentation inst) throws Throwable {
  if (!inst.isRedefineClassesSupported())
    throw new RuntimeException("this JVM does not support redefinition of classes");
  instrumentation = inst;
}

代码示例来源:origin: org.testifyproject.external/external-bytebuddy

@Override
protected Strategy validate(Instrumentation instrumentation) {
  if (!instrumentation.isRedefineClassesSupported()) {
    throw new IllegalArgumentException("Does not support redefinition: " + instrumentation);
  }
  return this;
}

代码示例来源:origin: stackoverflow.com

public static void premain(String agentArgs, Instrumentation inst) {
 System.out.println(System.getProperty("java.version"));
 System.out.println(inst.isRedefineClassesSupported());
 int num=0;
 for(Class<?> clazz:inst.getAllLoadedClasses())
  if(clazz.getClassLoader()!=null) {
   System.out.println("already loaded "+clazz);
   num++;
  }
 System.out.println(num+" non-bootstrap class(es) loaded");
}

代码示例来源:origin: stackoverflow.com

public static void premain(String agentArgs, Instrumentation inst) {
 System.out.println(System.getProperty("java.version"));
 System.out.println(inst.isRedefineClassesSupported());
 int num=0;
 for(Class<?> clazz:inst.getAllLoadedClasses())
  if(!clazz.isArray() && !inst.isModifiableClass(clazz)) {
   System.out.println("not modifiable "+clazz);
   num++;
  }
 System.out.println((num==0? "all classes are": num+" classes are not")+" transformable");
}

代码示例来源:origin: com.fitbur.external/external-bytebuddy

/**
 * Creates a class reloading strategy for the given instrumentation. The given instrumentation must either
 * support {@link java.lang.instrument.Instrumentation#isRedefineClassesSupported()} or
 * {@link java.lang.instrument.Instrumentation#isRetransformClassesSupported()}. If both modes are supported,
 * classes will be transformed using a class retransformation.
 *
 * @param instrumentation The instrumentation to be used by this reloading strategy.
 * @return A suitable class reloading strategy.
 */
public static ClassReloadingStrategy of(Instrumentation instrumentation) {
  Strategy strategy;
  if (instrumentation.isRedefineClassesSupported()) {
    strategy = Strategy.REDEFINITION;
  } else if (instrumentation.isRetransformClassesSupported()) {
    strategy = Strategy.RETRANSFORMATION;
  } else {
    throw new IllegalArgumentException("Instrumentation does not support manipulation of loaded classes: " + instrumentation);
  }
  return new ClassReloadingStrategy(instrumentation, strategy);
}

代码示例来源:origin: org.testifyproject.external/external-bytebuddy

/**
 * Creates a class reloading strategy for the given instrumentation. The given instrumentation must either
 * support {@link java.lang.instrument.Instrumentation#isRedefineClassesSupported()} or
 * {@link java.lang.instrument.Instrumentation#isRetransformClassesSupported()}. If both modes are supported,
 * classes will be transformed using a class retransformation.
 *
 * @param instrumentation The instrumentation to be used by this reloading strategy.
 * @return A suitable class reloading strategy.
 */
public static ClassReloadingStrategy of(Instrumentation instrumentation) {
  Strategy strategy;
  if (instrumentation.isRedefineClassesSupported()) {
    strategy = Strategy.REDEFINITION;
  } else if (instrumentation.isRetransformClassesSupported()) {
    strategy = Strategy.RETRANSFORMATION;
  } else {
    throw new IllegalArgumentException("Instrumentation does not support manipulation of loaded classes: " + instrumentation);
  }
  return new ClassReloadingStrategy(instrumentation, strategy);
}

代码示例来源:origin: bytemanproject/byteman

moduleSystemInit.invoke(moduleSystem, moduleSystemArgs);
boolean isRedefine = inst.isRedefineClassesSupported();

代码示例来源:origin: bytemanproject/byteman

moduleSystemInit.invoke(moduleSystem, moduleSystemArgs);
boolean isRedefine = inst.isRedefineClassesSupported();

代码示例来源:origin: inspectIT/inspectIT

boolean redefineClassesSupported = inst.isRedefineClassesSupported();
boolean useRetransformation = inst.isRetransformClassesSupported() && Agent.agent.isUsingRetransformation();

代码示例来源:origin: houqianming/jvm-inspector

public static void main(String agentArgs, Instrumentation inst) {
  Log.warn("[InspectAgent] Instrumentation:" + inst);
  Log.warn("[InspectAgent] isRedefineClassesSupported:" + inst.isRedefineClassesSupported());
  final AgentArgs aa = new AgentArgs(agentArgs);

相关文章