GH-386: Restore interrupted thread status

Fixes https://github.com/spring-projects/spring-retry/issues/386

* Update author and copyright

**Cherry-pick to `1.3.x`**
This commit is contained in:
Marius Lichtblau
2023-10-19 17:28:22 +02:00
committed by Artem Bilan
parent cbccb58613
commit 4f104e1756
6 changed files with 15 additions and 6 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2006-2020 the original author or authors.
* Copyright 2006-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -38,6 +38,7 @@ import org.springframework.util.ClassUtils;
* @author Dave Syer
* @author Gary Russell
* @author Artem Bilan
* @author Marius Lichtblau
*/
@SuppressWarnings("serial")
public class ExponentialBackOffPolicy implements SleepingBackOffPolicy<ExponentialBackOffPolicy> {
@@ -179,6 +180,7 @@ public class ExponentialBackOffPolicy implements SleepingBackOffPolicy<Exponenti
this.sleeper.sleep(sleepTime);
}
catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new BackOffInterruptedException("Thread interrupted while sleeping", e);
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2006-2014 the original author or authors.
* Copyright 2006-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -27,6 +27,7 @@ package org.springframework.retry.backoff;
* @author Rob Harrop
* @author Dave Syer
* @author Artem Bilan
* @author Marius Lichtblau
*/
public class FixedBackOffPolicy extends StatelessBackOffPolicy implements SleepingBackOffPolicy<FixedBackOffPolicy> {
@@ -82,6 +83,7 @@ public class FixedBackOffPolicy extends StatelessBackOffPolicy implements Sleepi
sleeper.sleep(backOffPeriod);
}
catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new BackOffInterruptedException("Thread interrupted while sleeping", e);
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2006-2021 the original author or authors.
* Copyright 2006-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -29,6 +29,7 @@ import java.util.Random;
* @author Rob Harrop
* @author Dave Syer
* @author Tomaz Fernandes
* @author Marius Lichtblau
*/
public class UniformRandomBackOffPolicy extends StatelessBackOffPolicy
implements SleepingBackOffPolicy<UniformRandomBackOffPolicy> {
@@ -112,6 +113,7 @@ public class UniformRandomBackOffPolicy extends StatelessBackOffPolicy
sleeper.sleep(minBackOffPeriod + delta);
}
catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new BackOffInterruptedException("Thread interrupted while sleeping", e);
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2006-2007 the original author or authors.
* Copyright 2006-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -24,6 +24,7 @@ import org.junit.Test;
/**
* @author Rob Harrop
* @author Dave Syer
* @author Marius Lichtblau
*/
public class ExponentialBackOffPolicyTests {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2006-2007 the original author or authors.
* Copyright 2006-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -23,6 +23,7 @@ import org.junit.Test;
/**
* @author Rob Harrop
* @author Dave Syer
* @author Marius Lichtblau
* @since 2.1
*/
public class FixedBackOffPolicyTests {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2006-2022 the original author or authors.
* Copyright 2006-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,6 +22,7 @@ import org.junit.Test;
/**
* @author Tomaz Fernandes
* @author Marius Lichtblau
* @since 1.3.2
*/
public class UniformRandomBackOffPolicyTests {