Utillities for Java threads