Search in sources :

Example 1 with MAX_PARALLEL_FETCH

use of com.couchbase.client.core.config.refresher.KeyValueBucketRefresher.MAX_PARALLEL_FETCH in project couchbase-jvm-clients by couchbase.

the class GlobalRefresher method filterEligibleNodes.

private Flux<PortInfo> filterEligibleNodes() {
    return Flux.defer(() -> {
        GlobalConfig config = provider.config().globalConfig();
        if (config == null) {
            // todo: log debug that no node found to refresh a config from
            return Flux.empty();
        }
        List<PortInfo> nodes = new ArrayList<>(config.portInfos());
        shiftNodeList(nodes);
        return Flux.fromIterable(nodes).filter(n -> n.ports().containsKey(ServiceType.KV) || n.sslPorts().containsKey(ServiceType.KV)).take(MAX_PARALLEL_FETCH);
    });
}
Also used : PortInfo(com.couchbase.client.core.config.PortInfo) Disposable(reactor.core.Disposable) Reactor(com.couchbase.client.core.Reactor) UTF_8(java.nio.charset.StandardCharsets.UTF_8) GlobalConfig(com.couchbase.client.core.config.GlobalConfig) Mono(reactor.core.publisher.Mono) ProposedGlobalConfigContext(com.couchbase.client.core.config.ProposedGlobalConfigContext) KeyValueBucketRefresher.clampConfigRequestTimeout(com.couchbase.client.core.config.refresher.KeyValueBucketRefresher.clampConfigRequestTimeout) CarrierGlobalConfigRequest(com.couchbase.client.core.msg.kv.CarrierGlobalConfigRequest) FailFastRetryStrategy(com.couchbase.client.core.retry.FailFastRetryStrategy) ArrayList(java.util.ArrayList) Flux(reactor.core.publisher.Flux) AtomicLong(java.util.concurrent.atomic.AtomicLong) MAX_PARALLEL_FETCH(com.couchbase.client.core.config.refresher.KeyValueBucketRefresher.MAX_PARALLEL_FETCH) List(java.util.List) POLLER_INTERVAL(com.couchbase.client.core.config.refresher.KeyValueBucketRefresher.POLLER_INTERVAL) ServiceType(com.couchbase.client.core.service.ServiceType) CoreContext(com.couchbase.client.core.CoreContext) Duration(java.time.Duration) Core(com.couchbase.client.core.Core) ConfigurationProvider(com.couchbase.client.core.config.ConfigurationProvider) PortInfo(com.couchbase.client.core.config.PortInfo) GlobalConfig(com.couchbase.client.core.config.GlobalConfig) ArrayList(java.util.ArrayList)

Aggregations

Core (com.couchbase.client.core.Core)1 CoreContext (com.couchbase.client.core.CoreContext)1 Reactor (com.couchbase.client.core.Reactor)1 ConfigurationProvider (com.couchbase.client.core.config.ConfigurationProvider)1 GlobalConfig (com.couchbase.client.core.config.GlobalConfig)1 PortInfo (com.couchbase.client.core.config.PortInfo)1 ProposedGlobalConfigContext (com.couchbase.client.core.config.ProposedGlobalConfigContext)1 MAX_PARALLEL_FETCH (com.couchbase.client.core.config.refresher.KeyValueBucketRefresher.MAX_PARALLEL_FETCH)1 POLLER_INTERVAL (com.couchbase.client.core.config.refresher.KeyValueBucketRefresher.POLLER_INTERVAL)1 KeyValueBucketRefresher.clampConfigRequestTimeout (com.couchbase.client.core.config.refresher.KeyValueBucketRefresher.clampConfigRequestTimeout)1 CarrierGlobalConfigRequest (com.couchbase.client.core.msg.kv.CarrierGlobalConfigRequest)1 FailFastRetryStrategy (com.couchbase.client.core.retry.FailFastRetryStrategy)1 ServiceType (com.couchbase.client.core.service.ServiceType)1 UTF_8 (java.nio.charset.StandardCharsets.UTF_8)1 Duration (java.time.Duration)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 AtomicLong (java.util.concurrent.atomic.AtomicLong)1 Disposable (reactor.core.Disposable)1 Flux (reactor.core.publisher.Flux)1