Search in sources :

Example 16 with Holding

use of org.checkerframework.checker.lock.qual.Holding in project bgpcep by opendaylight.

the class EffectiveRibInWriter method changeDataTree.

@Holding("this")
private void changeDataTree(final DOMDataTreeWriteTransaction tx, final YangInstanceIdentifier rootPath, final DataTreeCandidateNode root, final DataTreeCandidateNode table) {
    final PathArgument lastArg = table.getIdentifier();
    verify(lastArg instanceof NodeIdentifierWithPredicates, "Unexpected type %s in path %s", lastArg.getClass(), rootPath);
    final NodeIdentifierWithPredicates tableKey = (NodeIdentifierWithPredicates) lastArg;
    final RIBSupportContext ribContext = this.registry.getRIBSupportContext(tableKey);
    if (ribContext == null) {
        LOG.warn("Table {} is not supported, ignoring event", tableKey);
        return;
    }
    final YangInstanceIdentifier effectiveTablePath = effectiveTablePath(tableKey);
    final ModificationType modificationType = root.getModificationType();
    LOG.debug("Effective table {} modification type {}", effectiveTablePath, modificationType);
    switch(modificationType) {
        case DISAPPEARED:
        case DELETE:
            deleteTable(tx, ribContext, effectiveTablePath, table);
            break;
        case APPEARED:
        case WRITE:
            writeTable(tx, ribContext, effectiveTablePath, table);
            break;
        case SUBTREE_MODIFIED:
            modifyTable(tx, ribContext, effectiveTablePath, table);
            break;
        case UNMODIFIED:
            LOG.info("Ignoring spurious notification on {} data {}", rootPath, table);
            break;
        default:
            LOG.warn("Ignoring unhandled root {}", table);
            break;
    }
}
Also used : ModificationType(org.opendaylight.yangtools.yang.data.api.schema.tree.ModificationType) RIBSupportContext(org.opendaylight.protocol.bgp.rib.impl.spi.RIBSupportContext) PathArgument(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument) NodeIdentifierWithPredicates(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates) YangInstanceIdentifier(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier) Holding(org.checkerframework.checker.lock.qual.Holding)

Aggregations

Holding (org.checkerframework.checker.lock.qual.Holding)16 IOException (java.io.IOException)3 ActorSelection (akka.actor.ActorSelection)2 File (java.io.File)2 XMLStreamException (javax.xml.stream.XMLStreamException)2 BGPTerminationReason (org.opendaylight.protocol.bgp.rib.spi.BGPTerminationReason)2 ActorRef (akka.actor.ActorRef)1 VisibleForTesting (com.google.common.annotations.VisibleForTesting)1 Stopwatch (com.google.common.base.Stopwatch)1 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 FileInputStream (java.io.FileInputStream)1 InputStream (java.io.InputStream)1 OutputStream (java.io.OutputStream)1 RandomAccessFile (java.io.RandomAccessFile)1 Cleaner (java.lang.ref.Cleaner)1 Cleanable (java.lang.ref.Cleaner.Cleanable)1 URISyntaxException (java.net.URISyntaxException)1 FileChannel (java.nio.channels.FileChannel)1 FileLock (java.nio.channels.FileLock)1 ExecutionException (java.util.concurrent.ExecutionException)1