Skip to content

Commit

Permalink
Preserve interrupted flag on InterruptedExceptions
Browse files Browse the repository at this point in the history
This allows higher level interruption handlers to handle thread
interruption appropriately.
  • Loading branch information
mpeltonen committed Jan 24, 2018
1 parent 3c3253f commit 98159b6
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/main/java/org/jtransforms/utils/CommonUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ public static void sleep(long millis)
try {
Thread.sleep(millis);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
e.printStackTrace();
}
}
Expand Down Expand Up @@ -3786,6 +3787,7 @@ public void run()
try {
ConcurrencyUtils.waitForCompletion(futures);
} catch (InterruptedException ex) {
Thread.currentThread().interrupt();
Logger.getLogger(CommonUtils.class.getName()).log(Level.SEVERE, null, ex);
} catch (ExecutionException ex) {
Logger.getLogger(CommonUtils.class.getName()).log(Level.SEVERE, null, ex);
Expand Down Expand Up @@ -3860,6 +3862,7 @@ public void run()
try {
ConcurrencyUtils.waitForCompletion(futures);
} catch (InterruptedException ex) {
Thread.currentThread().interrupt();
Logger.getLogger(CommonUtils.class.getName()).log(Level.SEVERE, null, ex);
} catch (ExecutionException ex) {
Logger.getLogger(CommonUtils.class.getName()).log(Level.SEVERE, null, ex);
Expand Down Expand Up @@ -8984,6 +8987,7 @@ public void run()
try {
ConcurrencyUtils.waitForCompletion(futures);
} catch (InterruptedException ex) {
Thread.currentThread().interrupt();
Logger.getLogger(CommonUtils.class.getName()).log(Level.SEVERE, null, ex);
} catch (ExecutionException ex) {
Logger.getLogger(CommonUtils.class.getName()).log(Level.SEVERE, null, ex);
Expand Down Expand Up @@ -9058,6 +9062,7 @@ public void run()
try {
ConcurrencyUtils.waitForCompletion(futures);
} catch (InterruptedException ex) {
Thread.currentThread().interrupt();
Logger.getLogger(CommonUtils.class.getName()).log(Level.SEVERE, null, ex);
} catch (ExecutionException ex) {
Logger.getLogger(CommonUtils.class.getName()).log(Level.SEVERE, null, ex);
Expand Down Expand Up @@ -11130,6 +11135,7 @@ public void run()
try {
ConcurrencyUtils.waitForCompletion(futures);
} catch (InterruptedException ex) {
Thread.currentThread().interrupt();
Logger.getLogger(CommonUtils.class.getName()).log(Level.SEVERE, null, ex);
} catch (ExecutionException ex) {
Logger.getLogger(CommonUtils.class.getName()).log(Level.SEVERE, null, ex);
Expand Down Expand Up @@ -11172,6 +11178,7 @@ public void run()
try {
ConcurrencyUtils.waitForCompletion(futures);
} catch (InterruptedException ex) {
Thread.currentThread().interrupt();
Logger.getLogger(CommonUtils.class.getName()).log(Level.SEVERE, null, ex);
} catch (ExecutionException ex) {
Logger.getLogger(CommonUtils.class.getName()).log(Level.SEVERE, null, ex);
Expand Down Expand Up @@ -11214,6 +11221,7 @@ public void run()
try {
ConcurrencyUtils.waitForCompletion(futures);
} catch (InterruptedException ex) {
Thread.currentThread().interrupt();
Logger.getLogger(CommonUtils.class.getName()).log(Level.SEVERE, null, ex);
} catch (ExecutionException ex) {
Logger.getLogger(CommonUtils.class.getName()).log(Level.SEVERE, null, ex);
Expand Down Expand Up @@ -11256,6 +11264,7 @@ public void run()
try {
ConcurrencyUtils.waitForCompletion(futures);
} catch (InterruptedException ex) {
Thread.currentThread().interrupt();
Logger.getLogger(CommonUtils.class.getName()).log(Level.SEVERE, null, ex);
} catch (ExecutionException ex) {
Logger.getLogger(CommonUtils.class.getName()).log(Level.SEVERE, null, ex);
Expand Down

0 comments on commit 98159b6

Please sign in to comment.