Use a lock to synchronize access to list of queryEndpoints