Usage:
The JVM parameter “-XX:(+|-)UseThreadPriorities” allows you enable or disable the control of the priority of Java Threads APIs.
Since:
Starting from JDK 6.
Syntax:
- java -XX:[+|-]UseThreadPriorities
Examples:
- Explicitly enables use of the Java Threads API: java -XX:+UseThreadPriorities
- Explicitly disables use of the Java Threads API: java -XX:-UseThreadPriorities
Description:
When working with multithreading, JVM uses a thread scheduler that has control over threads to decide which thread should run or wait and assigns a priority to it. The priority of each thread lies between 1 and 10. If a thread has a higher priority, it has more chance to get picked up by the thread scheduler. But it’s not totally guaranteed for the reason that it depends completely on JVM that chooses scheduling for the thread. The default priority is 5, the minimum is 1 and the maximum is 10.
The JVM parameter “UseThreadPriorities” allows you to enable or disable the use of native thread priorities. This will allows you to set a priority manually to a thread with the function java.lang.Thread.setPriority() also the use of its related APIs. If this feature is disabled, using these APIs has no effect.
Default Value:
The default value depends on the running platform.
Errors:
Throws an exception if the option is not available by the platform you are running on.
Related Posts:
Edit your Comment