All Downloads are FREE. Search and download functionalities are using the official Maven repository.

rpc.turbo.discover.DirectConnectDiscover Maven / Gradle / Ivy

The newest version!
package rpc.turbo.discover;

import java.io.IOException;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

import rpc.turbo.annotation.TurboService;
import rpc.turbo.config.HostPort;
import rpc.turbo.config.server.Protocol;

public class DirectConnectDiscover implements Discover {

	private List hostPorts;

	@Override
	public void init(List hostPorts) {
		this.hostPorts = hostPorts;
	}

	@Override
	public void addListener(String group, String app, Protocol protocol, DiscoverListener listener) {
		Map providerWithWeight = hostPorts.stream()
				.collect(Collectors.toMap(item -> item, item -> TurboService.DEFAULT_WEIGHT));

		listener.onChange(providerWithWeight);
	}

	@Override
	public void close() throws IOException {
		System.out.println("DirectConnectDiscover close");
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy