Why are thread priority settings ignored in JBoss EAP on RHEL?

Solution Unverified - Updated -

Issue

To increase the thread priority of the MDB threads that consumes messages from IBM MQ, I configure a custom thread factory in standalone-full.xml as follows. However, it does not work.

<subsystem xmlns="urn:jboss:domain:batch-jberet:2.0">
...
    <thread-pool name="batch">
        <max-threads count="10"/>
        <keepalive-time time="30" unit="seconds"/>
    </thread-pool>
    <thread-factory name="priority-factory" thread-name-pattern="mdb-thread-pool-%t" priority="10"/>   <<<===
</subsystem>
...
<subsystem xmlns="urn:jboss:domain:jca:5.0">
    <archive-validation enabled="true" fail-on-error="true" fail-on-warn="false"/>
    <bean-validation enabled="true"/>
    <default-workmanager>
        <short-running-threads>
            <core-threads count="100"/>
            <queue-length count="50"/>
            <max-threads count="100"/>
            <keepalive-time time="10" unit="seconds"/>
            <thread-factory name="priority-factory"/>   <<<===
        </short-running-threads>

The thread priority is set to the maximum of 10, but the PR and NI values remain the same as other threads.

$ top -b -n 1 -H -p <java-pid>
...
    PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND
  65898 jboss-eap 20   0 3379480 830568  31064 S   0.0   3.4   0:00.00 java
  65899 jboss-eap 20   0 3379480 830568  31064 S   0.0   3.4   0:00.58 java
...
  66306 jboss-eap 20   0 3379480 830568  31064 S   0.0   3.4   0:00.01 mdb-thread-pool  <<<===
...

Also, If I try to modify the thread priority by calling java.lang.Thread#setPriority(int newPriority) in the application, the PR and NI values are not changed. Why are thread priority settings ignored in JBoss EAP applications on RHEL?

Environment

  • Red Hat Enterprise Application Platform (JBoss EAP)
    • 7.x
  • Red Hat Enterprise Linux (RHEL)
    • 7
    • 8
  • OpenJDK
    • 8
    • 11

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content