You cannot completely disable thread switching, but by setting the priority of the thread MAX_PRIORITY, you tell the OS thread scheduler (if it supports the priority scheduling policy) to supplant the thread with the lower priority if the higher priority is ready to go.
References
java.lang.Thread Javadoc
Each thread has priority. Threads with a higher priority are executed instead of threads with a lower priority.
https://docs.oracle.com/javase/8/docs/api/java/lang/Thread.html
Linux kernel manager APIs manual page
In priority:
sched_priority. , , .
:
: , .
http://man7.org/linux/man-pages/man7/sched.7.html