X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-dom-broker%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fmd%2Fsal%2Fdom%2Fbroker%2Fimpl%2FTransactionCommitFailedExceptionMapper.java;h=1b3c5a680d48f92ab80ab6904f5a179ed1530cc0;hp=258b06892963c1d311e01bdef1a69c6d884d9ed5;hb=HEAD;hpb=e64d758b45360b2ed8b7d8967fc1c7caaa7aa58f;ds=sidebyside
diff --git a/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/broker/impl/TransactionCommitFailedExceptionMapper.java b/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/broker/impl/TransactionCommitFailedExceptionMapper.java
deleted file mode 100644
index 258b068929..0000000000
--- a/opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/broker/impl/TransactionCommitFailedExceptionMapper.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Copyright (c) 2014 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.md.sal.dom.broker.impl;
-
-import java.util.concurrent.ExecutionException;
-
-import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
-
-import com.google.common.base.Function;
-import com.google.common.base.Preconditions;
-
-/**
- *
- * Utility exception mapper which translates {@link Exception}
- * to {@link TransactionCommitFailedException}.
- *
- * This mapper is intended to be used with {@link com.google.common.util.concurrent.Futures#makeChecked(com.google.common.util.concurrent.ListenableFuture, Function)}
- *
- * - if exception is {@link TransactionCommitFailedException} or one of its subclasses returns original exception.
- *
- if exception is {@link ExecutionException} and cause is {@link TransactionCommitFailedException} return cause
- *
- otherwise returns {@link TransactionCommitFailedException} with original exception as a cause.
- *
- *
- */
-
-final class TransactionCommitFailedExceptionMapper implements
- Function {
-
- static final TransactionCommitFailedExceptionMapper PRE_COMMIT_MAPPER = create("canCommit");
-
- static final TransactionCommitFailedExceptionMapper CAN_COMMIT_ERROR_MAPPER = create("preCommit");
-
- static final TransactionCommitFailedExceptionMapper COMMIT_ERROR_MAPPER = create("commit");
-
- private final String opName;
-
- private TransactionCommitFailedExceptionMapper(final String opName) {
- this.opName = Preconditions.checkNotNull(opName);
- }
-
- public static final TransactionCommitFailedExceptionMapper create(final String opName) {
- return new TransactionCommitFailedExceptionMapper(opName);
- }
-
- @Override
- public TransactionCommitFailedException apply(final Exception e) {
- // If excetion is TransactionCommitFailedException
- // we reuse it directly.
- if (e instanceof TransactionCommitFailedException) {
- return (TransactionCommitFailedException) e;
- }
- // If error is ExecutionException which was caused by cause of
- // TransactionCommitFailedException
- // we reuse original cause
- if (e instanceof ExecutionException && e.getCause() instanceof TransactionCommitFailedException) {
- return (TransactionCommitFailedException) e.getCause();
- }
- if (e instanceof InterruptedException) {
- return new TransactionCommitFailedException(opName + " failed - DOMStore was interupted.", e);
- }
- // Otherwise we are using new exception, with original cause
- return new TransactionCommitFailedException(opName + " failed", e);
- }
-}
\ No newline at end of file