1

I have a legacy application which is started in a Java 8 JVM with the argument:

-XX:ThreadPriorityPolicy=42 

I am attempting to run this same application in a Java 10 JVM. However, this encounters an error on start-up:

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

This is presumably due to a change in the JVM implementation moving to the later versions of HotSpot JVM. I have found a number of questions regarding Cassandra and this problem, but I cannot find any documentation / issue tracking to document this change in the JVM. Is there somewhere I can read about this?

This argument was presumably added to the legacy application for a valid reason. How best should I handle this in Java 10? Set the value to 1? Omit the argument?

jwa
  • 3,239
  • 2
  • 23
  • 54
  • 1
    Some background where the value `42` came from: http://tech.stolsvik.com/2010/01/linux-java-thread-priorities-workaround.html – Stefan Zobel Apr 04 '18 at 13:54

1 Answers1

1

No idea if it would help you, but here is the description from the sources:

 "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.") 
Eugene
  • 117,005
  • 15
  • 201
  • 306
  • link to the source as a comment would have been useful too Eugene :) – Naman Apr 04 '18 at 14:25
  • 3
    @nullpointer `cd /Users/eugene/Documents/jdk10u/src` and then `grep -r "ThreadPriorityPolicy" . --ignore-case` and found in `hotspot/share/runtime/globals.hpp` would not count I guess :) and it would have been too long, but you make sense – Eugene Apr 04 '18 at 14:26