/** * @return whether or not this VM has an instrumentation installed that * permits redefinition of classes. This assumes that all the arguments * will be modifiable classes according to * {@link java.lang.instrument.Instrumentation#isModifiableClass}, and * only checks whether or not an instrumentation is available and * if retransformation is possible. */ public static boolean canRedefineClasses(Log log) { if (_canRedefine == null) { try { Instrumentation inst = InstrumentationFactory.getInstrumentation(log); if (inst == null) { _canRedefine = Boolean.FALSE; } else if (JavaVersions.VERSION == 5) { // if instrumentation is non-null and we're using Java 5, // isRetransformClassesSupported isn't available, // so we use the more basic class redefinition instead. _canRedefine = Boolean.TRUE; } else { _canRedefine = (Boolean) Instrumentation.class.getMethod( "isRetransformClassesSupported").invoke(inst); } } catch (Exception e) { _canRedefine = Boolean.FALSE; } } return _canRedefine.booleanValue(); } }
/** * The method that is called when a jar is added as an agent at runtime. * All this method does is store the {@link Instrumentation} for * later use. */ public static void agentmain(String agentArgs, Instrumentation inst) { InstrumentationFactory.setInstrumentation(inst); }
public static void premain(String args, Instrumentation inst) { Options opts = Configurations.parseProperties(args); if (opts.containsKey("ClassLoadEnhancement") || opts.containsKey("classLoadEnhancement")) { if (opts.getBooleanProperty( "ClassLoadEnhancement", "classLoadEnhancement", true)) registerClassLoadEnhancer(inst, opts); } else if (opts.containsKey("RuntimeEnhancement") || opts.containsKey("runtimeEnhancement")) { // Deprecated property setting if (opts.getBooleanProperty( "RuntimeEnhancement", "runtimeEnhancement", true)) registerClassLoadEnhancer(inst, opts); } else { // if neither is set, then we should be turning it on. We need this // logic instead of just a getBooleanProperty() because of the // backwards-compat logic flow. registerClassLoadEnhancer(inst, opts); } if (opts.getBooleanProperty( "RuntimeRedefinition", "runtimeRedefinition", true)) { InstrumentationFactory.setInstrumentation(inst); } else { InstrumentationFactory.setDynamicallyInstallAgent(false); } }
|| agentJarFile.isDirectory() == true) { createJar = true; }else if(validateAgentJarManifest(agentJarFile, log, _name) == false){ agentJar = createAgentJar(); if (log.isInfoEnabled() == true) { log.info(_loc.get("temp-file-creation", agentJar));
return null; String agentPath = getAgentJar();
public static void premain(String args, Instrumentation inst) { Options opts = Configurations.parseProperties(args); if (opts.containsKey("ClassLoadEnhancement") || opts.containsKey("classLoadEnhancement")) { if (opts.getBooleanProperty( "ClassLoadEnhancement", "classLoadEnhancement", true)) registerClassLoadEnhancer(inst, opts); } else if (opts.containsKey("RuntimeEnhancement") || opts.containsKey("runtimeEnhancement")) { // Deprecated property setting if (opts.getBooleanProperty( "RuntimeEnhancement", "runtimeEnhancement", true)) registerClassLoadEnhancer(inst, opts); } else { // if neither is set, then we should be turning it on. We need this // logic instead of just a getBooleanProperty() because of the // backwards-compat logic flow. registerClassLoadEnhancer(inst, opts); } if (opts.getBooleanProperty( "RuntimeRedefinition", "runtimeRedefinition", true)) { InstrumentationFactory.setInstrumentation(inst); } else { InstrumentationFactory.setDynamicallyInstallAgent(false); } }
|| agentJarFile.isDirectory() == true) { createJar = true; }else if(validateAgentJarManifest(agentJarFile, log, _name) == false){ agentJar = createAgentJar(); if (log.isInfoEnabled() == true) { log.info(_loc.get("temp-file-creation", agentJar));
return null; String agentPath = getAgentJar();
public static void premain(String args, Instrumentation inst) { Options opts = Configurations.parseProperties(args); if (opts.containsKey("ClassLoadEnhancement") || opts.containsKey("classLoadEnhancement")) { if (opts.getBooleanProperty( "ClassLoadEnhancement", "classLoadEnhancement", true)) registerClassLoadEnhancer(inst, opts); } else if (opts.containsKey("RuntimeEnhancement") || opts.containsKey("runtimeEnhancement")) { // Deprecated property setting if (opts.getBooleanProperty( "RuntimeEnhancement", "runtimeEnhancement", true)) registerClassLoadEnhancer(inst, opts); } else { // if neither is set, then we should be turning it on. We need this // logic instead of just a getBooleanProperty() because of the // backwards-compat logic flow. registerClassLoadEnhancer(inst, opts); } if (opts.getBooleanProperty( "RuntimeRedefinition", "runtimeRedefinition", true)) { InstrumentationFactory.setInstrumentation(inst); } else { InstrumentationFactory.setDynamicallyInstallAgent(false); } }
/** * @return whether or not this VM has an instrumentation installed that * permits redefinition of classes. This assumes that all the arguments * will be modifiable classes according to * {@link java.lang.instrument.Instrumentation#isModifiableClass}, and * only checks whether or not an instrumentation is available and * if retransformation is possible. */ public static boolean canRedefineClasses(Log log) { if (_canRedefine == null) { try { Instrumentation inst = InstrumentationFactory.getInstrumentation(log); if (inst == null) { _canRedefine = Boolean.FALSE; } else if (JavaVersions.VERSION == 5) { // if instrumentation is non-null and we're using Java 5, // isRetransformClassesSupported isn't available, // so we use the more basic class redefinition instead. _canRedefine = Boolean.TRUE; } else { _canRedefine = (Boolean) Instrumentation.class.getMethod( "isRetransformClassesSupported").invoke(inst); } } catch (Exception e) { _canRedefine = Boolean.FALSE; } } return _canRedefine.booleanValue(); } }
/** * The method that is called when a jar is added as an agent at runtime. * All this method does is store the {@link Instrumentation} for * later use. */ public static void agentmain(String agentArgs, Instrumentation inst) { InstrumentationFactory.setInstrumentation(inst); }
|| agentJarFile.isDirectory() == true) { createJar = true; }else if(validateAgentJarManifest(agentJarFile, log, _name) == false){ agentJar = createAgentJar(); if (log.isInfoEnabled() == true) { log.info(_loc.get("temp-file-creation", agentJar));
return null; String agentPath = getAgentJar();
InstrumentationFactory.setInstrumentation(inst); } else { InstrumentationFactory.setDynamicallyInstallAgent(false);
/** * @return whether or not this VM has an instrumentation installed that * permits redefinition of classes. This assumes that all the arguments * will be modifiable classes according to * {@link java.lang.instrument.Instrumentation#isModifiableClass}, and * only checks whether or not an instrumentation is available and * if retransformation is possible. */ public static boolean canRedefineClasses(Log log) { if (_canRedefine == null) { try { Instrumentation inst = InstrumentationFactory.getInstrumentation(log); if (inst == null) { _canRedefine = Boolean.FALSE; } else if (JavaVersions.VERSION == 5) { // if instrumentation is non-null and we're using Java 5, // isRetransformClassesSupported isn't available, // so we use the more basic class redefinition instead. _canRedefine = Boolean.TRUE; } else { _canRedefine = (Boolean) Instrumentation.class.getMethod( "isRetransformClassesSupported").invoke(inst); } } catch (Exception e) { _canRedefine = Boolean.FALSE; } } return _canRedefine.booleanValue(); } }
/** * The method that is called when a jar is added as an agent at runtime. * All this method does is store the {@link Instrumentation} for * later use. */ public static void agentmain(String agentArgs, Instrumentation inst) { InstrumentationFactory.setInstrumentation(inst); } }
|| agentJarFile.isDirectory() == true) { createJar = true; }else if(validateAgentJarManifest(agentJarFile, log, _name) == false){ agentJar = createAgentJar(); if (log.isInfoEnabled() == true) { log.info(_loc.get("temp-file-creation", agentJar));
InstrumentationFactory.setInstrumentation(inst); } else { InstrumentationFactory.setDynamicallyInstallAgent(false);
try { Instrumentation inst = InstrumentationFactory .getInstrumentation(); if (inst == null) { _canRedefine = Boolean.FALSE;
/** * The method that is called when a jar is added as an agent at runtime. * All this method does is store the {@link Instrumentation} for * later use. */ public static void agentmain(String agentArgs, Instrumentation inst) { InstrumentationFactory.setInstrumentation(inst); } }