Control thread affinity for Java