gpt4 book ai didi

java - 更改 ThreadPriorityPolicy 范围

转载 作者:行者123 更新时间:2023-11-30 06:13:54 28 4
gpt4 key购买 nike

我有一个遗留应用程序,它在 Java 8 JVM 中启动,参数如下:

-XX:ThreadPriorityPolicy=42 

我正在尝试在 Java 10 JVM 中运行相同的应用程序。但是,启动时遇到错误:

intx ThreadPriorityPolicy=42 is outside the allowed range [ 0 ... 1 ]
Improperly specified VM option 'ThreadPriorityPolicy=42'

这可能是由于 JVM 实现发生了变化,迁移到了 HotSpot JVM 的更高版本。我发现了许多有关 Cassandra 和此问题的问题,但我找不到任何文档/问题跟踪来记录 JVM 中的此更改。有什么地方可以读到这方面的内容吗?

此参数可能是出于正当原因添加到旧应用程序中的。在 Java 10 中我应该如何最好地处理这个问题?将值设置为 1 ?省略参数?

最佳答案

不知道它是否对您有帮助,但以下是来源的描述:

 "0 : Normal.                                                          "\
" VM chooses priorities that are appropriate for normal "\
" applications. On Solaris NORM_PRIORITY and above are mapped "\
" to normal native priority. Java priorities below " \
" NORM_PRIORITY map to lower native priority values. On "\
" Windows applications are allowed to use higher native "\
" priorities. However, with ThreadPriorityPolicy=0, VM will "\
" not use the highest possible native priority, "\
" THREAD_PRIORITY_TIME_CRITICAL, as it may interfere with "\
" system threads. On Linux thread priorities are ignored "\
" because the OS does not support static priority in "\
" SCHED_OTHER scheduling class which is the only choice for "\
" non-root, non-realtime applications. "\
"1 : Aggressive. "\
" Java thread priorities map over to the entire range of "\
" native thread priorities. Higher Java thread priorities map "\
" to higher native thread priorities. This policy should be "\
" used with care, as sometimes it can cause performance "\
" degradation in the application and/or the entire system. On "\
" Linux this policy requires root privilege.")

关于java - 更改 ThreadPriorityPolicy 范围,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49652232/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com