use of io.stargate.db.EventListener in project stargate by stargate.
the class DefaultQueryInterceptor method leaveCluster.
private void leaveCluster(InetAddress endpoint) {
if (!liveStargateNodes.remove(endpoint)) {
return;
}
StargateSystemKeyspace.removeEndpoint(endpoint);
InetAddress nativeAddress = getNativeAddress(endpoint);
for (EventListener listener : listeners) {
listener.onLeaveCluster(nativeAddress, EventListener.NO_PORT);
}
}
use of io.stargate.db.EventListener in project stargate by stargate.
the class DefaultQueryInterceptor method leaveCluster.
private void leaveCluster(InetAddress endpoint) {
if (!liveStargateNodes.remove(endpoint)) {
return;
}
StargateSystemKeyspace.instance.getPeers().remove(endpoint);
InetAddress nativeAddress = getNativeAddress(endpoint);
for (EventListener listener : listeners) {
listener.onLeaveCluster(nativeAddress, EventListener.NO_PORT);
}
}
use of io.stargate.db.EventListener in project stargate by stargate.
the class ProxyProtocolQueryInterceptor method resolvePeers.
private Set<InetAddress> resolvePeers(String dnsName, Set<InetAddress> current) throws UnknownHostException {
Set<InetAddress> resolved = resolver.resolve(dnsName);
if (!current.equals(resolved)) {
// Generate listener events based on the differences between this and the previous
// resolved peers.
Sets.SetView<InetAddress> added = Sets.difference(resolved, current);
Sets.SetView<InetAddress> removed = Sets.difference(current, resolved);
for (EventListener listener : listeners) {
for (InetAddress peer : added) {
listener.onJoinCluster(peer, proxyPort);
listener.onUp(peer, proxyPort);
}
for (InetAddress peer : removed) {
tokensCache.remove(peer);
listener.onLeaveCluster(peer, proxyPort);
}
}
}
return resolved;
}
use of io.stargate.db.EventListener in project stargate by stargate.
the class DefaultQueryInterceptor method leaveCluster.
private void leaveCluster(InetAddressAndPort endpoint) {
if (!liveStargateNodes.remove(endpoint)) {
return;
}
StargateSystemKeyspace.removeEndpoint(endpoint);
InetAddressAndPort nativeAddress = getNativeAddress(endpoint);
for (EventListener listener : listeners) {
listener.onLeaveCluster(nativeAddress.address, nativeAddress.port);
}
}
Aggregations