Bug 1362: New AsyncWriteTransaction#submit method
[controller.git] / opendaylight / md-sal / sal-common-api / src / main / java / org / opendaylight / controller / md / sal / common / api / data / OptimisticLockFailedException.java
1 package org.opendaylight.controller.md.sal.common.api.data;
2
3 import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
4 import org.opendaylight.yangtools.yang.common.RpcError.ErrorType;
5
6 /**
7 *
8 * Failure of asynchronous transaction commit caused by failure
9 * of optimistic locking.
10 *
11 * This exception is raised and returned when transaction commit
12 * failed, because other transaction finished successfully
13 * and modified same data as failed transaction.
14 *
15 *  Clients may recover from this error condition by
16 *  retrieving current state and submitting new updated
17 *  transaction.
18 *
19 */
20 public class OptimisticLockFailedException extends TransactionCommitFailedException {
21
22     private static final long serialVersionUID = 1L;
23
24     public OptimisticLockFailedException(final String message, final Throwable cause) {
25         super(message, cause, RpcResultBuilder.newError(ErrorType.APPLICATION, "resource-denied",
26                                                         message, null, null, cause));
27     }
28
29     public OptimisticLockFailedException(final String message) {
30         this(message, null);
31     }
32
33 }