Remove remoterpc dead code.
[controller.git] / opendaylight / md-sal / sal-inmemory-datastore / src / main / java / org / opendaylight / controller / md / sal / dom / store / impl / SnapshotBackedReadWriteTransaction.java
1 /*
2  * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8 package org.opendaylight.controller.md.sal.dom.store.impl;
9
10 import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeSnapshot;
11 import org.opendaylight.controller.sal.core.spi.data.DOMStoreReadWriteTransaction;
12 import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
13 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
14 import org.slf4j.Logger;
15 import org.slf4j.LoggerFactory;
16
17 import com.google.common.base.Optional;
18 import com.google.common.util.concurrent.Futures;
19 import com.google.common.util.concurrent.ListenableFuture;
20
21 /**
22  * Implementation of Read-Write transaction which is backed by {@link DataTreeSnapshot}
23  * and executed according to {@link TransactionReadyPrototype}.
24  *
25  */
26 class SnapshotBackedReadWriteTransaction extends SnapshotBackedWriteTransaction implements
27 DOMStoreReadWriteTransaction {
28
29     private static final Logger LOG = LoggerFactory.getLogger(SnapshotBackedReadWriteTransaction.class);
30
31     /**
32      * Creates new read-write transaction.
33      *
34      * @param identifier transaction Identifier
35      * @param snapshot Snapshot which will be modified.
36      * @param readyImpl Implementation of ready method.
37      */
38     protected SnapshotBackedReadWriteTransaction(final Object identifier, final DataTreeSnapshot snapshot,
39             final TransactionReadyPrototype store) {
40         super(identifier, snapshot, store);
41     }
42
43     @Override
44     public ListenableFuture<Optional<NormalizedNode<?, ?>>> read(final InstanceIdentifier path) {
45         LOG.debug("Tx: {} Read: {}", getIdentifier(), path);
46         try {
47             return Futures.immediateFuture(getMutatedView().readNode(path));
48         } catch (Exception e) {
49             LOG.error("Tx: {} Failed Read of {}", getIdentifier(), path, e);
50             throw e;
51         }
52     }
53 }