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