a5d2c11dfe77cfa021114501f83c51e7b5b9515c
[mdsal.git] / common / mdsal-common-api / src / main / java / org / opendaylight / mdsal / common / api / OptimisticLockFailedException.java
1 /*
2  * Copyright (c) 2014, 2015 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
9 package org.opendaylight.mdsal.common.api;
10
11 import org.opendaylight.yangtools.yang.common.RpcError.ErrorType;
12 import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
13
14
15 /**
16 * Failure of asynchronous transaction commit caused by failure
17 * of optimistic locking.
18 * This exception is raised and returned when transaction commit
19 * failed, because other transaction finished successfully
20 * and modified same data as failed transaction.
21 *  Clients may recover from this error condition by
22 *  retrieving current state and submitting new updated
23 *  transaction.
24 *
25 */
26 public class OptimisticLockFailedException extends TransactionCommitFailedException {
27
28     private static final long serialVersionUID = 1L;
29
30     public OptimisticLockFailedException(final String message, final Throwable cause) {
31         super(message, cause, RpcResultBuilder.newError(ErrorType.APPLICATION, "resource-denied",
32                                                         message, null, null, cause));
33     }
34
35     public OptimisticLockFailedException(final String message) {
36         this(message, null);
37     }
38
39 }