Adopt odlparent-10.0.0/yangtools-8.0.0-SNAPSHOT
[mdsal.git] / common / mdsal-common-api / src / main / java / org / opendaylight / mdsal / common / api / TransactionCommitDeadlockException.java
index fd4ea57ff544cf78652cbf9cc1920f046ba22ee8..c667f86a7f9d7515d4596e050935eac9e9789038 100644 (file)
@@ -5,12 +5,12 @@
  * 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.mdsal.common.api;
 
-import com.google.common.base.Supplier;
+import java.util.function.Supplier;
+import org.opendaylight.yangtools.yang.common.ErrorTag;
+import org.opendaylight.yangtools.yang.common.ErrorType;
 import org.opendaylight.yangtools.yang.common.RpcError;
-import org.opendaylight.yangtools.yang.common.RpcError.ErrorType;
 import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
 
 /**
@@ -24,18 +24,14 @@ import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
  */
 public class TransactionCommitDeadlockException extends TransactionCommitFailedException {
     private static final long serialVersionUID = 1L;
-    private static final String DEADLOCK_MESSAGE =
-            "An attempt to block on a ListenableFuture via a get method from a write " +
-            "transaction submit was detected that would result in deadlock. The commit " +
-            "result must be obtained asynchronously, e.g. via Futures#addCallback, to avoid deadlock.";
-    private static final RpcError DEADLOCK_RPCERROR = RpcResultBuilder.newError(ErrorType.APPLICATION, "lock-denied", DEADLOCK_MESSAGE);
+    private static final String DEADLOCK_MESSAGE = "An attempt to block on a ListenableFuture via a get method from a "
+        + "write transaction submit was detected that would result in deadlock. The commit result must be obtained "
+        + "asynchronously, e.g. via Futures#addCallback, to avoid deadlock.";
+    private static final RpcError DEADLOCK_RPCERROR =
+            RpcResultBuilder.newError(ErrorType.APPLICATION, ErrorTag.LOCK_DENIED, DEADLOCK_MESSAGE);
 
-    public static final Supplier<Exception> DEADLOCK_EXCEPTION_SUPPLIER = new Supplier<Exception>() {
-        @Override
-        public Exception get() {
-            return new TransactionCommitDeadlockException(DEADLOCK_MESSAGE, DEADLOCK_RPCERROR);
-        }
-    };
+    public static final Supplier<Exception> DEADLOCK_EXCEPTION_SUPPLIER =
+        () -> new TransactionCommitDeadlockException(DEADLOCK_MESSAGE, DEADLOCK_RPCERROR);
 
     public TransactionCommitDeadlockException(final String message, final RpcError... errors) {
         super(message, errors);