X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;ds=sidebyside;f=opendaylight%2Fmd-sal%2Fsal-distributed-datastore%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fdatastore%2FNoOpTransactionContext.java;h=cee9d784acc46e7170b696daaaca26bcc54e2825;hb=HEAD;hp=197cd9fa83c00b569b25d59d982328774fb44436;hpb=a54ec60368110d22794602343c934902f6833c65;p=controller.git diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/NoOpTransactionContext.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/NoOpTransactionContext.java deleted file mode 100644 index 197cd9fa83..0000000000 --- a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/NoOpTransactionContext.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ -package org.opendaylight.controller.cluster.datastore; - -import akka.actor.ActorSelection; -import com.google.common.base.Optional; -import com.google.common.util.concurrent.SettableFuture; -import java.util.concurrent.Semaphore; -import org.opendaylight.controller.cluster.datastore.identifiers.TransactionIdentifier; -import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException; -import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; -import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import scala.concurrent.Future; - -final class NoOpTransactionContext extends AbstractTransactionContext { - private static final Logger LOG = LoggerFactory.getLogger(NoOpTransactionContext.class); - - private final Throwable failure; - private final Semaphore operationLimiter; - - public NoOpTransactionContext(Throwable failure, TransactionIdentifier identifier, Semaphore operationLimiter) { - super(identifier); - this.failure = failure; - this.operationLimiter = operationLimiter; - } - - @Override - public void closeTransaction() { - LOG.debug("NoOpTransactionContext {} closeTransaction called", getIdentifier()); - } - - @Override - public boolean supportsDirectCommit() { - return true; - } - - @Override - public Future directCommit() { - LOG.debug("Tx {} directCommit called, failure: {}", getIdentifier(), failure); - operationLimiter.release(); - return akka.dispatch.Futures.failed(failure); - } - - @Override - public Future readyTransaction() { - LOG.debug("Tx {} readyTransaction called, failure: {}", getIdentifier(), failure); - operationLimiter.release(); - return akka.dispatch.Futures.failed(failure); - } - - @Override - public void deleteData(YangInstanceIdentifier path) { - LOG.debug("Tx {} deleteData called path = {}", getIdentifier(), path); - operationLimiter.release(); - } - - @Override - public void mergeData(YangInstanceIdentifier path, NormalizedNode data) { - LOG.debug("Tx {} mergeData called path = {}", getIdentifier(), path); - operationLimiter.release(); - } - - @Override - public void writeData(YangInstanceIdentifier path, NormalizedNode data) { - LOG.debug("Tx {} writeData called path = {}", getIdentifier(), path); - operationLimiter.release(); - } - - @Override - public void readData(final YangInstanceIdentifier path, SettableFuture>> proxyFuture) { - LOG.debug("Tx {} readData called path = {}", getIdentifier(), path); - operationLimiter.release(); - proxyFuture.setException(new ReadFailedException("Error reading data for path " + path, failure)); - } - - @Override - public void dataExists(YangInstanceIdentifier path, SettableFuture proxyFuture) { - LOG.debug("Tx {} dataExists called path = {}", getIdentifier(), path); - operationLimiter.release(); - proxyFuture.setException(new ReadFailedException("Error checking exists for path " + path, failure)); - } -}