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

com.nepxion.discovery.plugin.strategy.rule.DiscoveryEnabledBaseRule Maven / Gradle / Ivy

There is a newer version: 6.22.0
Show newest version
package com.nepxion.discovery.plugin.strategy.rule;

/**
 * 

Title: Nepxion Discovery

*

Description: Nepxion Discovery

*

Copyright: Copyright (c) 2017-2050

*

Company: Nepxion

* @author Haojun Ren * @version 1.0 */ import com.nepxion.discovery.plugin.framework.decorator.PredicateBasedRuleDecorator; import com.netflix.loadbalancer.AbstractServerPredicate; import com.netflix.loadbalancer.AvailabilityPredicate; import com.netflix.loadbalancer.CompositePredicate; public class DiscoveryEnabledBaseRule extends PredicateBasedRuleDecorator { private CompositePredicate compositePredicate; private DiscoveryEnabledBasePredicate discoveryEnabledPredicate; public DiscoveryEnabledBaseRule() { discoveryEnabledPredicate = new DiscoveryEnabledBasePredicate(); AvailabilityPredicate availabilityPredicate = new AvailabilityPredicate(this, null); compositePredicate = createCompositePredicate(discoveryEnabledPredicate, availabilityPredicate); } private CompositePredicate createCompositePredicate(DiscoveryEnabledBasePredicate discoveryEnabledPredicate, AvailabilityPredicate availabilityPredicate) { return CompositePredicate.withPredicates(discoveryEnabledPredicate, availabilityPredicate) // .addFallbackPredicate(availabilityPredicate) // .addFallbackPredicate(AbstractServerPredicate.alwaysTrue()) .build(); } @Override public AbstractServerPredicate getPredicate() { return compositePredicate; } public DiscoveryEnabledBasePredicate getDiscoveryEnabledPredicate() { return discoveryEnabledPredicate; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy