significantly improve the hack impl of JavaQueryParticipant