Search in sources :

Example 1 with BgpActionPolicy

use of org.opendaylight.protocol.bgp.openconfig.routing.policy.spi.policy.action.BgpActionPolicy in project bgpcep by opendaylight.

the class ActionsRegistryImpl method registerBgpActionPolicy.

public AbstractRegistration registerBgpActionPolicy(final Class<? extends ChildOf<BgpActions>> bgpActionPolicyClass, final BgpActionPolicy bgpActionPolicy) {
    synchronized (this.bgpActions) {
        final BgpActionPolicy prev = this.bgpActions.putIfAbsent(bgpActionPolicyClass, bgpActionPolicy);
        Preconditions.checkState(prev == null, "Action Policy %s already registered %s", bgpActionPolicyClass, prev);
        return new AbstractRegistration() {

            @Override
            protected void removeRegistration() {
                synchronized (ActionsRegistryImpl.this.bgpActions) {
                    ActionsRegistryImpl.this.bgpActions.remove(bgpActionPolicyClass);
                }
            }
        };
    }
}
Also used : BgpActionPolicy(org.opendaylight.protocol.bgp.openconfig.routing.policy.spi.policy.action.BgpActionPolicy) AbstractRegistration(org.opendaylight.yangtools.concepts.AbstractRegistration)

Aggregations

BgpActionPolicy (org.opendaylight.protocol.bgp.openconfig.routing.policy.spi.policy.action.BgpActionPolicy)1 AbstractRegistration (org.opendaylight.yangtools.concepts.AbstractRegistration)1