Skip to content

Commit 4963cfd

Browse files
committed
Reset thread's interrupted flag when catching InterruptedException
Closes gh-6360
1 parent e53d316 commit 4963cfd

File tree

9 files changed

+12
-7
lines changed

9 files changed

+12
-7
lines changed

spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/ShutdownEndpoint.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public void run() {
6666
Thread.sleep(500L);
6767
}
6868
catch (InterruptedException ex) {
69-
// Swallow exception and continue
69+
Thread.currentThread().interrupt();
7070
}
7171
ShutdownEndpoint.this.context.close();
7272
}

spring-boot-devtools/src/main/java/org/springframework/boot/devtools/RemoteSpringApplication.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ private void waitIndefinitely() {
9191
Thread.sleep(1000);
9292
}
9393
catch (InterruptedException ex) {
94-
// Ignore
94+
Thread.currentThread().interrupt();
9595
}
9696
}
9797
}

spring-boot-devtools/src/main/java/org/springframework/boot/devtools/autoconfigure/FileWatchingFailureHandler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public Outcome handle(Throwable failure) {
5252
latch.await();
5353
}
5454
catch (InterruptedException ex) {
55-
// Ignore
55+
Thread.currentThread().interrupt();
5656
}
5757
return Outcome.RETRY;
5858
}

spring-boot-devtools/src/main/java/org/springframework/boot/devtools/filewatch/FileSystemWatcher.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ public void run() {
239239
scan();
240240
}
241241
catch (InterruptedException ex) {
242-
// Ignore
242+
Thread.currentThread().interrupt();
243243
}
244244
remainingScans = this.remainingScans.get();
245245
}

spring-boot-devtools/src/main/java/org/springframework/boot/devtools/remote/client/DelayedLiveReloadTrigger.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ public void run() {
9696
this.liveReloadServer.triggerReload();
9797
}
9898
catch (InterruptedException ex) {
99-
// Ignore
99+
Thread.currentThread().interrupt();
100100
}
101101
}
102102

spring-boot-devtools/src/main/java/org/springframework/boot/devtools/tunnel/client/TunnelClient.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ public synchronized void stop() throws IOException {
9898
this.serverThread.join(2000);
9999
}
100100
catch (InterruptedException ex) {
101-
// Ignore
101+
Thread.currentThread().interrupt();
102102
}
103103
this.serverThread = null;
104104
}

spring-boot-devtools/src/main/java/org/springframework/boot/devtools/tunnel/server/HttpTunnelServer.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,7 @@ private HttpConnection getOrWaitForHttpConnection() {
273273
this.httpConnections.wait(HttpTunnelServer.this.longPollTimeout);
274274
}
275275
catch (InterruptedException ex) {
276+
Thread.currentThread().interrupt();
276277
closeHttpConnections();
277278
}
278279
httpConnection = this.httpConnections.pollFirst();
@@ -442,7 +443,7 @@ public void waitForResponse() {
442443
}
443444
}
444445
catch (InterruptedException ex) {
445-
// Ignore
446+
Thread.currentThread().interrupt();
446447
}
447448
}
448449
}

spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/data/RandomAccessDataFile.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,7 @@ public RandomAccessFile acquire() throws IOException {
252252
: file);
253253
}
254254
catch (InterruptedException ex) {
255+
Thread.currentThread().interrupt();
255256
throw new IOException(ex);
256257
}
257258
}
@@ -276,6 +277,7 @@ public void close() throws IOException {
276277
}
277278
}
278279
catch (InterruptedException ex) {
280+
Thread.currentThread().interrupt();
279281
throw new IOException(ex);
280282
}
281283
}

spring-boot-tools/spring-boot-maven-plugin/src/main/java/org/springframework/boot/maven/StartMojo.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@ private void waitForSpringApplication(long wait, int maxAttempts)
167167
this.lock.wait(wait);
168168
}
169169
catch (InterruptedException ex) {
170+
Thread.currentThread().interrupt();
170171
throw new IllegalStateException(
171172
"Interrupted while waiting for Spring Boot app to start.");
172173
}
@@ -275,6 +276,7 @@ public <T> T execute(long wait, int maxAttempts, Callable<T> callback)
275276
this.lock.wait(wait);
276277
}
277278
catch (InterruptedException ex) {
279+
Thread.currentThread().interrupt();
278280
throw new IllegalStateException(
279281
"Interrupted while waiting for Spring Boot app to start.");
280282
}

0 commit comments

Comments
 (0)