use of org.infinispan.server.core.transport.CompositeChannelMatcher in project infinispan by infinispan.
the class ServerStateManagerImpl method updateIpFilters.
private CompletionStage<Void> updateIpFilters(String connector, Collection<IpFilterRule> rules) {
ProtocolServer protocolServer = server.getProtocolServers().get(connector);
if (rules.isEmpty()) {
protocolServer.getConfiguration().ipFilter().rules(Collections.emptyList());
Server.log.connectorIpFilterCleared(connector);
return CompletableFutures.completedNull();
} else {
List<IpSubnetFilterRule> localRules = new ArrayList<>(rules.size());
for (IpFilterRule rule : rules) {
localRules.add(new IpSubnetFilterRule(rule.cidr, IpFilterRuleType.valueOf(rule.type)));
}
protocolServer.getConfiguration().ipFilter().rules(localRules);
Transport transport = getTransport(protocolServer);
CompositeChannelMatcher matcher = new CompositeChannelMatcher(protocolServer.getChannelMatcher(), new IpFilterRuleChannelMatcher(localRules));
return transport.closeChannels(matcher).thenApply(v -> {
Server.log.connectorIpFilterSet(connector, localRules);
return v;
});
}
}
Aggregations