use of org.opendaylight.yangtools.concepts.AbstractRegistration in project bgpcep by opendaylight.
the class ActionsRegistryImpl method registerBgpActionAugmentationPolicy.
public AbstractRegistration registerBgpActionAugmentationPolicy(final Class<? extends Augmentation<BgpActions>> bgpActionPolicyClass, final BgpActionAugPolicy bgpActionPolicy) {
synchronized (this.bgpAugActionsRegistry) {
final BgpActionAugPolicy prev = this.bgpAugActionsRegistry.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.bgpAugActionsRegistry) {
ActionsRegistryImpl.this.bgpAugActionsRegistry.remove(bgpActionPolicyClass);
}
}
};
}
}
use of org.opendaylight.yangtools.concepts.AbstractRegistration in project bgpcep by opendaylight.
the class BgpConditionsRegistry method registerBgpConditionsPolicy.
public <T extends ChildOf<BgpMatchConditions>, N> AbstractRegistration registerBgpConditionsPolicy(final Class<T> conditionPolicyClass, final BgpConditionsPolicy<T, N> conditionPolicy) {
synchronized (this.bgpConditionsRegistry) {
final BgpConditionsPolicy prev = this.bgpConditionsRegistry.putIfAbsent(conditionPolicyClass, conditionPolicy);
Preconditions.checkState(prev == null, "Condition Policy %s already registered %s", conditionPolicyClass, prev);
return new AbstractRegistration() {
@Override
protected void removeRegistration() {
synchronized (BgpConditionsRegistry.this.bgpConditionsRegistry) {
BgpConditionsRegistry.this.bgpConditionsRegistry.remove(conditionPolicyClass);
}
}
};
}
}
use of org.opendaylight.yangtools.concepts.AbstractRegistration in project bgpcep by opendaylight.
the class BgpConditionsRegistry method registerBgpConditionsAugmentationPolicy.
public AbstractRegistration registerBgpConditionsAugmentationPolicy(final Class<? extends Augmentation<BgpConditions>> conditionPolicyClass, final BgpConditionsAugmentationPolicy conditionPolicy) {
synchronized (this.bgpConditionsAugRegistry) {
final BgpConditionsAugmentationPolicy prev = this.bgpConditionsAugRegistry.putIfAbsent(conditionPolicyClass, conditionPolicy);
Preconditions.checkState(prev == null, "Condition Policy %s already registered %s", conditionPolicyClass, prev);
return new AbstractRegistration() {
@Override
protected void removeRegistration() {
synchronized (BgpConditionsRegistry.this.bgpConditionsAugRegistry) {
BgpConditionsRegistry.this.bgpConditionsAugRegistry.remove(conditionPolicyClass);
}
}
};
}
}
use of org.opendaylight.yangtools.concepts.AbstractRegistration 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);
}
}
};
}
}
use of org.opendaylight.yangtools.concepts.AbstractRegistration in project bgpcep by opendaylight.
the class SimpleBGPTableTypeRegistryProvider method registerBGPTableType.
@Override
public synchronized AbstractRegistration registerBGPTableType(final Class<? extends AddressFamily> afi, final Class<? extends SubsequentAddressFamily> safi, final Class<? extends AfiSafiType> afiSafiType) {
final BgpTableType tableType = new BgpTableTypeImpl(afi, safi);
final Class<? extends AfiSafiType> prev = this.tableTypes.putIfAbsent(tableType, afiSafiType);
Preconditions.checkState(prev == null, "AFI %s SAFI %s is already registered with %s", afi, safi, prev);
final TablesKey tableKey = new TablesKey(tableType.getAfi(), tableType.getSafi());
this.tableKeys.put(tableKey, afiSafiType);
return new AbstractRegistration() {
@Override
protected void removeRegistration() {
synchronized (SimpleBGPTableTypeRegistryProvider.this) {
SimpleBGPTableTypeRegistryProvider.this.tableTypes.remove(tableType);
SimpleBGPTableTypeRegistryProvider.this.tableKeys.remove(tableKey);
}
}
};
}
Aggregations