Ensure that LaunchedURLClassLoader works when thread is interrupted
See gh-6683
This commit is contained in:
parent
ffc0dc44ed
commit
937f85765c
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2012-2013 the original author or authors.
|
* Copyright 2012-2016 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -244,17 +244,10 @@ public class RandomAccessDataFile implements RandomAccessData {
|
||||||
}
|
}
|
||||||
|
|
||||||
public RandomAccessFile acquire() throws IOException {
|
public RandomAccessFile acquire() throws IOException {
|
||||||
try {
|
this.available.acquireUninterruptibly();
|
||||||
this.available.acquire();
|
|
||||||
RandomAccessFile file = this.files.poll();
|
RandomAccessFile file = this.files.poll();
|
||||||
return (file == null
|
return (file == null
|
||||||
? new RandomAccessFile(RandomAccessDataFile.this.file, "r")
|
? new RandomAccessFile(RandomAccessDataFile.this.file, "r") : file);
|
||||||
: file);
|
|
||||||
}
|
|
||||||
catch (InterruptedException ex) {
|
|
||||||
Thread.currentThread().interrupt();
|
|
||||||
throw new IOException(ex);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void release(RandomAccessFile file) {
|
public void release(RandomAccessFile file) {
|
||||||
|
@ -263,8 +256,7 @@ public class RandomAccessDataFile implements RandomAccessData {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void close() throws IOException {
|
public void close() throws IOException {
|
||||||
try {
|
this.available.acquireUninterruptibly(this.size);
|
||||||
this.available.acquire(this.size);
|
|
||||||
try {
|
try {
|
||||||
RandomAccessFile file = this.files.poll();
|
RandomAccessFile file = this.files.poll();
|
||||||
while (file != null) {
|
while (file != null) {
|
||||||
|
@ -276,11 +268,6 @@ public class RandomAccessDataFile implements RandomAccessData {
|
||||||
this.available.release(this.size);
|
this.available.release(this.size);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (InterruptedException ex) {
|
|
||||||
Thread.currentThread().interrupt();
|
|
||||||
throw new IOException(ex);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue