Skip to content

Commit 4b8a977

Browse files
committed
Fix file descriptors leak
1 parent cc5d9ac commit 4b8a977

1 file changed

Lines changed: 2 additions & 5 deletions

File tree

server/src/main/java/com/defold/extender/services/DefoldSdkService.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -253,14 +253,11 @@ public boolean isLocalSdkSupported() {
253253

254254
protected void evictCache() {
255255
synchronized (cacheReferenceCount) {
256-
try {
256+
try (Stream<Path> entries = Files.list(configuration.getLocation())) {
257257
LOGGER.info("Cache eviction called");
258258
// Delete old SDK:s
259259
Comparator<Path> refCountComparator = Comparator.comparing(path -> getSdkRefCount(path.getFileName().toString()));
260-
261-
Files
262-
.list(configuration.getLocation())
263-
.filter(path -> !path.getFileName().toString().startsWith("tmp")
260+
entries.filter(path -> !path.getFileName().toString().startsWith("tmp")
264261
&& !path.toString().endsWith(".delete")
265262
&& !path.getFileName().toString().equals(TEST_SDK_DIRECTORY))
266263
.sorted(refCountComparator.reversed())

0 commit comments

Comments
 (0)