class MyDiscoveryListener extends AbstractDiscoveryListener {
    private static final Logger LOG = LoggerFactory.getLogger(MyDiscoveryListener.class);

    @Override
    public void onGetInstances(String serviceId, List<ServiceInstance> instances) {<FILL_FUNCTION_BODY>}

    @Override
    public void onGetServices(List<String> services) {

    }

    @Override
    public int getOrder() {
        return LOWEST_PRECEDENCE - 500;
    }
}

        Iterator<ServiceInstance> iterator = instances.iterator();
        while (iterator.hasNext()) {
            ServiceInstance instance = iterator.next();
            String group = pluginAdapter.getInstanceGroup(instance);
            if (StringUtils.equals(group, "mygroup2")) {
                iterator.remove();

                LOG.info("服务名=" + serviceId + "，组名=" + group + "的服务禁止被本服务发现");
            }
        }
    
<methods>public non-sealed void <init>() ,public DiscoveryClient getDiscoveryClient() <variables>protected DiscoveryClient discoveryClient