为什么jvm命令`jinfo`在高山的openjdk8发行版中没有`-flags`?

问题描述 投票:2回答:1

我使用docker构建了一个Java程序,Dockerfile的开头是

FROM openjdk:8-jdk-alpine

但是我注意到jvm命令jinfo没有-flags,怎么了?

    bash-4.4# ./jinfo
    Usage:
        jinfo <option> <pid>
           (to connect to a running process)

    where <option> is one of:
        -flag <name>         to print the value of the named VM flag
        -flag [+|-]<name>    to enable or disable the named VM flag
        -flag <name>=<value> to set the named VM flag to the given value
        -h | -help           to print this help message
java docker jvm alpine
1个回答
1
投票

Alpine的JDK是在没有Serviceability Agent支持的情况下构建的,因为SA依赖于does not have的功能。

某些JDK实用程序在后台使用Serviceability Agent来实现某些功能。 jinfo -flags是此类实用程序的示例。在引擎盖下也使用SA的其他示例是jmap -Fjstack -F。这些选项在Alpine JDK中也不可用。在this answer中,我描述了强制模式(-F)与普通模式有何不同,以及Serviceability Agent在其中扮演的角色。

[jinfo -flags可以替换为jcmd <pid> VM.flags

jcmd不依赖于SA,并且可以在Alpine Linux上使用。

© www.soinside.com 2019 - 2024. All rights reserved.