Skip to content

Commit c22230a

Browse files
committed
Try making FilePool static to fix the Mockito problem on Bamboo
1 parent e11b7af commit c22230a

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

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

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public RandomAccessDataFile(File file, int concurrentReads) {
6767
throw new IllegalArgumentException("File must exist");
6868
}
6969
this.file = file;
70-
this.filePool = new FilePool(concurrentReads);
70+
this.filePool = new FilePool(file, concurrentReads);
7171
this.offset = 0L;
7272
this.length = file.length();
7373
}
@@ -229,15 +229,18 @@ private long moveOn(int amount) {
229229
* Manage a pool that can be used to perform concurrent reads on the underlying
230230
* {@link RandomAccessFile}.
231231
*/
232-
class FilePool {
232+
static class FilePool {
233+
234+
private final File file;
233235

234236
private final int size;
235237

236238
private final Semaphore available;
237239

238240
private final Queue<RandomAccessFile> files;
239241

240-
FilePool(int size) {
242+
FilePool(File file, int size) {
243+
this.file = file;
241244
this.size = size;
242245
this.available = new Semaphore(size);
243246
this.files = new ConcurrentLinkedQueue<RandomAccessFile>();
@@ -249,7 +252,7 @@ public RandomAccessFile acquire() throws IOException {
249252
if (file != null) {
250253
return file;
251254
}
252-
return new RandomAccessFile(RandomAccessDataFile.this.file, "r");
255+
return new RandomAccessFile(this.file, "r");
253256
}
254257

255258
public void release(RandomAccessFile file) {

0 commit comments

Comments
 (0)