Search in sources :

Example 1 with JvmVersion

use of com.navercorp.pinpoint.common.util.JvmVersion in project pinpoint by naver.

the class DefaultApplicationContext method lambdaFactorySetup.

private void lambdaFactorySetup(Instrumentation instrumentation, ClassFileTransformModuleAdaptor classFileTransformer, JavaModuleFactory javaModuleFactory) {
    final JvmVersion version = JvmUtils.getVersion();
    // TODO version.onOrAfter(JvmVersion.JAVA_8)
    if (version.onOrAfter(JvmVersion.JAVA_9)) {
        LambdaTransformBootloader lambdaTransformBootloader = new LambdaTransformBootloader();
        lambdaTransformBootloader.transformLambdaFactory(instrumentation, classFileTransformer, javaModuleFactory);
    }
}
Also used : LambdaTransformBootloader(com.navercorp.pinpoint.profiler.instrument.lambda.LambdaTransformBootloader) JvmVersion(com.navercorp.pinpoint.common.util.JvmVersion)

Example 2 with JvmVersion

use of com.navercorp.pinpoint.common.util.JvmVersion in project pinpoint by naver.

the class JavaVersionFilter method accept.

@Override
public boolean accept(PluginJar pluginJar) {
    String pluginId = pluginJar.getPluginId();
    if (pluginId == null) {
        logger.warn("Invalid plugin : {}, missing manifest entry : {}", pluginJar.getJarFile().getName(), PluginJar.PINPOINT_PLUGIN_ID);
        return REJECT;
    }
    String pluginCompilerVersion = pluginJar.getPluginCompilerVersion();
    if (pluginCompilerVersion == null) {
        logger.info("Skipping {} due to missing manifest entry : {}", pluginJar.getJarFile().getName(), PluginJar.PINPOINT_PLUGIN_COMPILER_VERSION);
        return REJECT;
    }
    JvmVersion pluginJvmVersion = JvmVersion.getFromVersion(pluginCompilerVersion);
    if (pluginJvmVersion == JvmVersion.UNSUPPORTED) {
        logger.info("Skipping {} due to unknown plugin compiler version : {}", pluginId, pluginCompilerVersion);
        return REJECT;
    }
    if (jvmVersion.onOrAfter(pluginJvmVersion)) {
        return ACCEPT;
    }
    logger.info("Skipping {} due to java version. Required : {}, found : {}", pluginId, pluginJvmVersion, jvmVersion);
    return REJECT;
}
Also used : JvmVersion(com.navercorp.pinpoint.common.util.JvmVersion)

Example 3 with JvmVersion

use of com.navercorp.pinpoint.common.util.JvmVersion in project pinpoint by naver.

the class JvmVersionTest method testGetFromDoubleVersion.

@Test
public void testGetFromDoubleVersion() {
    // JDK 5
    final JvmVersion java_5 = JvmVersion.getFromVersion(1.5);
    assertSame(java_5, JAVA_5);
    // JDK 6
    final JvmVersion java_6 = JvmVersion.getFromVersion(1.6);
    assertSame(java_6, JAVA_6);
    // JDK 7
    final JvmVersion java_7 = JvmVersion.getFromVersion(1.7);
    assertSame(java_7, JAVA_7);
    // JDK 8
    final JvmVersion java_8 = JvmVersion.getFromVersion(1.8);
    assertSame(java_8, JAVA_8);
    // Unsupported
    final JvmVersion java_unsupported = JvmVersion.getFromVersion(0.9);
    assertSame(java_unsupported, UNSUPPORTED);
}
Also used : JvmVersion(com.navercorp.pinpoint.common.util.JvmVersion) Test(org.junit.Test)

Example 4 with JvmVersion

use of com.navercorp.pinpoint.common.util.JvmVersion in project pinpoint by naver.

the class JvmVersionTest method testGetFromStringVersion.

@Test
public void testGetFromStringVersion() {
    // JDK 5
    final JvmVersion java_5 = JvmVersion.getFromVersion("1.5");
    assertSame(java_5, JAVA_5);
    // JDK 6
    final JvmVersion java_6 = JvmVersion.getFromVersion("1.6");
    assertSame(java_6, JAVA_6);
    // JDK 7
    final JvmVersion java_7 = JvmVersion.getFromVersion("1.7");
    assertSame(java_7, JAVA_7);
    // JDK 8
    final JvmVersion java_8 = JvmVersion.getFromVersion("1.8");
    assertSame(java_8, JAVA_8);
    // Unsupported
    final JvmVersion java_unsupported = JvmVersion.getFromVersion("abc");
    assertSame(java_unsupported, UNSUPPORTED);
}
Also used : JvmVersion(com.navercorp.pinpoint.common.util.JvmVersion) Test(org.junit.Test)

Example 5 with JvmVersion

use of com.navercorp.pinpoint.common.util.JvmVersion in project pinpoint by naver.

the class JvmVersionTest method testGetFromClassVersion.

@Test
public void testGetFromClassVersion() {
    // JDK 5
    final JvmVersion java_5 = JvmVersion.getFromClassVersion(49);
    assertSame(java_5, JAVA_5);
    // JDK 6
    final JvmVersion java_6 = JvmVersion.getFromClassVersion(50);
    assertSame(java_6, JAVA_6);
    // JDK 7
    final JvmVersion java_7 = JvmVersion.getFromClassVersion(51);
    assertSame(java_7, JAVA_7);
    // JDK 8
    final JvmVersion java_8 = JvmVersion.getFromClassVersion(52);
    assertSame(java_8, JAVA_8);
    // Unsupported
    final JvmVersion java_unsupported = JvmVersion.getFromClassVersion(-1);
    assertSame(java_unsupported, UNSUPPORTED);
}
Also used : JvmVersion(com.navercorp.pinpoint.common.util.JvmVersion) Test(org.junit.Test)

Aggregations

JvmVersion (com.navercorp.pinpoint.common.util.JvmVersion)10 Test (org.junit.Test)3 JavaModule (com.navercorp.pinpoint.bootstrap.module.JavaModule)1 Providers (com.navercorp.pinpoint.bootstrap.module.Providers)1 JvmType (com.navercorp.pinpoint.common.util.JvmType)1 OsType (com.navercorp.pinpoint.common.util.OsType)1 LambdaTransformBootloader (com.navercorp.pinpoint.profiler.instrument.lambda.LambdaTransformBootloader)1 BufferMetric (com.navercorp.pinpoint.profiler.monitor.metric.buffer.BufferMetric)1 FileDescriptorMetric (com.navercorp.pinpoint.profiler.monitor.metric.filedescriptor.FileDescriptorMetric)1