fix java thread usage