diff --git a/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/data/RandomAccessDataFile.java b/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/data/RandomAccessDataFile.java index 5ba87dcc850d..d4e483ee6fe6 100644 --- a/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/data/RandomAccessDataFile.java +++ b/spring-boot-tools/spring-boot-loader/src/main/java/org/springframework/boot/loader/data/RandomAccessDataFile.java @@ -244,17 +244,11 @@ private class FilePool { } public RandomAccessFile acquire() throws IOException { - try { - this.available.acquire(); - RandomAccessFile file = this.files.poll(); - return (file == null - ? new RandomAccessFile(RandomAccessDataFile.this.file, "r") - : file); - } - catch (InterruptedException ex) { - Thread.currentThread().interrupt(); - throw new IOException(ex); - } + this.available.acquireUninterruptibly(); + RandomAccessFile file = this.files.poll(); + return (file == null + ? new RandomAccessFile(RandomAccessDataFile.this.file, "r") + : file); } public void release(RandomAccessFile file) { @@ -263,22 +257,16 @@ public void release(RandomAccessFile file) { } public void close() throws IOException { + this.available.acquireUninterruptibly(this.size); try { - this.available.acquire(this.size); - try { - RandomAccessFile file = this.files.poll(); - while (file != null) { - file.close(); - file = this.files.poll(); - } - } - finally { - this.available.release(this.size); + RandomAccessFile file = this.files.poll(); + while (file != null) { + file.close(); + file = this.files.poll(); } } - catch (InterruptedException ex) { - Thread.currentThread().interrupt(); - throw new IOException(ex); + finally { + this.available.release(this.size); } }