Skip to content

Commit

Permalink
Reset thread's interrupted flag when catching InterruptedException
Browse files Browse the repository at this point in the history
  • Loading branch information
wilkinsona committed Jul 11, 2016
1 parent e53d316 commit 4963cfd
Show file tree
Hide file tree
Showing 9 changed files with 12 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public void run() {
Thread.sleep(500L);
}
catch (InterruptedException ex) {
// Swallow exception and continue
Thread.currentThread().interrupt();
}
ShutdownEndpoint.this.context.close();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ private void waitIndefinitely() {
Thread.sleep(1000);
}
catch (InterruptedException ex) {
// Ignore
Thread.currentThread().interrupt();
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public Outcome handle(Throwable failure) {
latch.await();
}
catch (InterruptedException ex) {
// Ignore
Thread.currentThread().interrupt();
}
return Outcome.RETRY;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ public void run() {
scan();
}
catch (InterruptedException ex) {
// Ignore
Thread.currentThread().interrupt();
}
remainingScans = this.remainingScans.get();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public void run() {
this.liveReloadServer.triggerReload();
}
catch (InterruptedException ex) {
// Ignore
Thread.currentThread().interrupt();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public synchronized void stop() throws IOException {
this.serverThread.join(2000);
}
catch (InterruptedException ex) {
// Ignore
Thread.currentThread().interrupt();
}
this.serverThread = null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,7 @@ private HttpConnection getOrWaitForHttpConnection() {
this.httpConnections.wait(HttpTunnelServer.this.longPollTimeout);
}
catch (InterruptedException ex) {
Thread.currentThread().interrupt();
closeHttpConnections();
}
httpConnection = this.httpConnections.pollFirst();
Expand Down Expand Up @@ -442,7 +443,7 @@ public void waitForResponse() {
}
}
catch (InterruptedException ex) {
// Ignore
Thread.currentThread().interrupt();
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,7 @@ public RandomAccessFile acquire() throws IOException {
: file);
}
catch (InterruptedException ex) {
Thread.currentThread().interrupt();
throw new IOException(ex);
}
}
Expand All @@ -276,6 +277,7 @@ public void close() throws IOException {
}
}
catch (InterruptedException ex) {
Thread.currentThread().interrupt();
throw new IOException(ex);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ private void waitForSpringApplication(long wait, int maxAttempts)
this.lock.wait(wait);
}
catch (InterruptedException ex) {
Thread.currentThread().interrupt();
throw new IllegalStateException(
"Interrupted while waiting for Spring Boot app to start.");
}
Expand Down Expand Up @@ -275,6 +276,7 @@ public <T> T execute(long wait, int maxAttempts, Callable<T> callback)
this.lock.wait(wait);
}
catch (InterruptedException ex) {
Thread.currentThread().interrupt();
throw new IllegalStateException(
"Interrupted while waiting for Spring Boot app to start.");
}
Expand Down

0 comments on commit 4963cfd

Please sign in to comment.