Search in sources :

Example 1 with ConditionsAugPolicy

use of org.opendaylight.protocol.bgp.openconfig.routing.policy.spi.policy.condition.ConditionsAugPolicy in project bgpcep by opendaylight.

the class ConditionsRegistryImpl method registerConditionPolicy.

AbstractRegistration registerConditionPolicy(final Class<? extends Augmentation<Conditions>> conditionPolicyClass, final ConditionsAugPolicy conditionPolicy) {
    synchronized (this.conditionsRegistry) {
        final ConditionsAugPolicy prev = this.conditionsRegistry.putIfAbsent(conditionPolicyClass, conditionPolicy);
        Preconditions.checkState(prev == null, "Condition Policy %s already registered %s", conditionPolicyClass, prev);
        return new AbstractRegistration() {

            @Override
            protected void removeRegistration() {
                synchronized (ConditionsRegistryImpl.this.conditionsRegistry) {
                    ConditionsRegistryImpl.this.conditionsRegistry.remove(conditionPolicyClass);
                }
            }
        };
    }
}
Also used : AbstractRegistration(org.opendaylight.yangtools.concepts.AbstractRegistration) ConditionsAugPolicy(org.opendaylight.protocol.bgp.openconfig.routing.policy.spi.policy.condition.ConditionsAugPolicy)

Aggregations

ConditionsAugPolicy (org.opendaylight.protocol.bgp.openconfig.routing.policy.spi.policy.condition.ConditionsAugPolicy)1 AbstractRegistration (org.opendaylight.yangtools.concepts.AbstractRegistration)1