BUG-8402: Separate out OutOfOrderRequestException
[controller.git] / opendaylight / md-sal / cds-access-api / src / main / java / org / opendaylight / controller / cluster / access / commands / OutOfSequenceEnvelopeException.java
1 /*
2  * Copyright (c) 2017 Pantheon Technologies, s.r.o. 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 package org.opendaylight.controller.cluster.access.commands;
9
10 import com.google.common.annotations.Beta;
11 import org.opendaylight.controller.cluster.access.concepts.RequestException;
12
13 /**
14  * A {@link RequestException} indicating that the backend has received a RequestEnvelope whose sequence does not match
15  * the next expected sequence. This can happen during leader transitions, when a part of the stream is rejected because
16  * the backend is not the leader and it transitions to being a leader with old stream messages still being present.
17  *
18  * @author Robert Varga
19  */
20 @Beta
21 public final class OutOfSequenceEnvelopeException extends RequestException {
22     private static final long serialVersionUID = 1L;
23
24     public OutOfSequenceEnvelopeException(final long expectedEnvelope) {
25         super("Expecting envelope " + Long.toUnsignedString(expectedEnvelope));
26     }
27
28     @Override
29     public boolean isRetriable() {
30         return true;
31     }
32 }