查找已弃用的JVM标志

时间:2018-11-26 09:40:54

标签: java jvm deprecated jvm-arguments

我根据 Print all JVM flags 问题使用java -XX:+PrintFlagsFinal -version,比较了我升级到JVM 11时不同JDK的结果。

我注意到PrintFlagsFinal的结果仍然会返回不推荐使用的选项,例如尽管运行PrintGC会发出警告并改为运行-XX:+PrintGC,但-Xlog:gc仍然存在。

有没有类似于PrintFlagsFinal的选项可以用来查找当前不推荐使用的所有选项,从而可以避免使用它们?

(知道我可以手动检查发行说明,但想知道是否存在一种内置的从JVM中查找的方法,类似于jdeprscan,用于已过时的模块依赖性)

3 个答案:

答案 0 :(得分:2)

弃用有多个“级别”:别名,已弃用,已过时和已过期标志,其含义在arguments.cpp中有所描述。

除了上述类别之外,还有不推荐使用的跟踪标志,这些标志已由Unified JVM Logging选项取代。

最后,还有一些上面未列出的标志在描述中仅被“弃用”。

我不知道有一个地方将所有这些已弃用的标志收集在一起,但是从JVM源中提取它们是很容易的:提到的arguments.cppglobals*.hpp系列。我还建议VM Options Explorer网站的各个版本都具有结构合理的HotSpot JVM标志表。

从JDK 11开始,已弃用/过时/过期和其他不受支持的标志的列表包括:

AggressiveOpts
AllowNonVirtualCalls
AssumeMP
CheckAssertionStatusDirectives
CheckEndorsedAndExtDirs
CompilerThreadHintNoPreempt
CreateMinidumpOnCrash
DefaultMaxRAMFraction
DeferPollingPageLoopCount
DeferThrSuspendLoopCount
EnableTracing
FastTLABRefill
FreqCountInvocations
IgnoreUnverifiableClassesDuringDump
InitialRAMFraction
InlineNotify
MaxGCMinorPauseMillis
MaxPermSize
MaxRAMFraction
MinRAMFraction
MonitorInUseLists
MustCallLoadClassInternal
NativeMonitorFlags
NativeMonitorSpinLimit
NativeMonitorTimeout
PermSize
PrintCompressedOopsMode
PrintGC
PrintGCDetails
PrintMalloc
PrintMallocFree
PrintSafepointStatistics
PrintSafepointStatisticsCount
PrintSafepointStatisticsTimeout
PrintSharedSpaces
SafepointSpinBeforeYield
SharedMiscCodeSize
SharedMiscDataSize
SharedReadOnlySize
SharedReadWriteSize
ShowSafepointMsgs
TraceBiasedLocking
TraceClassLoading
TraceClassLoadingPreorder
TraceClassPaths
TraceClassResolution
TraceClassUnloading
TraceExceptions
TraceJVMTIObjectTagging
TraceLoaderConstraints
TraceMonitorInflation
TraceRedefineClasses
TraceSafepointCleanupTime
TraceScavenge
UnlinkSymbolsALot
UnsyncloadClass
UseAppCDS
UseConcMarkSweepGC
UseLockedTracing
UseMembar
UseUTCFileTimestamp
VMThreadHintNoPreempt

更新

由于@chriswhocodes,VM Options Explorer现在显示已弃用的JVM标志。

答案 1 :(得分:1)

如果您可以在应用程序上运行Java Flight Recording(例如在开发设置中)并使用Java / JDK Mission Control(> = 6.0.0)将其打开,那么JMC将分析您用于启动JVM的标志和告诉您其中哪个不推荐使用。

答案 2 :(得分:1)

我已在https://chriswhocodes.com/hotspot_option_differences.html Differences between JDK11 and JDK12 VM options

处向VM Options Explorer添加了弃用信息。