This adds the originating generation in RetiredGenerationException’s
message.
Change-Id: Ie4cb11a0cc151176d765fc6d200cd7dd295798e1
Signed-off-by: Stephen Kitt <skitt@redhat.com>
public final class RetiredGenerationException extends RequestException {
private static final long serialVersionUID = 1L;
public final class RetiredGenerationException extends RequestException {
private static final long serialVersionUID = 1L;
- public RetiredGenerationException(final long newGeneration) {
- super("Originating generation was superseded by " + Long.toUnsignedString(newGeneration));
+ public RetiredGenerationException(final long originatingGeneration, final long newGeneration) {
+ super("Originating generation " + Long.toUnsignedString(originatingGeneration) + " was superseded by "
+ + Long.toUnsignedString(newGeneration));
public class RetiredGenerationExceptionTest extends RequestExceptionTest<RetiredGenerationException> {
public class RetiredGenerationExceptionTest extends RequestExceptionTest<RetiredGenerationException> {
- private static final RequestException OBJECT = new RetiredGenerationException(100);
+ private static final RequestException OBJECT = new RetiredGenerationException(99, 100);
@Override
protected void isRetriable() {
@Override
protected void isRetriable() {
@Override
protected void checkMessage() {
final String message = OBJECT.getMessage();
@Override
protected void checkMessage() {
final String message = OBJECT.getMessage();
- assertTrue("Originating generation was superseded by 100".equals(message));
+ assertTrue("Originating generation 99 was superseded by 100".equals(message));
assertNull(OBJECT.getCause());
}
}
assertNull(OBJECT.getCause());
}
}
}
if (cmp > 0) {
LOG.debug("{}: rejecting request from outdated client {}", persistenceId(), clientId);
}
if (cmp > 0) {
LOG.debug("{}: rejecting request from outdated client {}", persistenceId(), clientId);
- throw new RetiredGenerationException(existing.getIdentifier().getGeneration());
+ throw new RetiredGenerationException(clientId.getGeneration(),
+ existing.getIdentifier().getGeneration());
}
LOG.info("{}: retiring state {}, outdated by request from client {}", persistenceId(), existing, clientId);
}
LOG.info("{}: retiring state {}, outdated by request from client {}", persistenceId(), existing, clientId);