Moved duplicate code in Java thread pools to JavaAbstractThreadPool module.