fix: synchronous cache eviction when closing PDDocument

This commit is contained in:
Walter 2022-01-30 19:34:28 -08:00 committed by GitHub
parent 273071ea9b
commit f25c74f759
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View file

@ -27,7 +27,7 @@ class PdfExtractor : MediaContainerExtractor {
private val cache = Caffeine.newBuilder()
.maximumSize(20)
.expireAfterAccess(1, TimeUnit.MINUTES)
.removalListener { _: Path?, pdf: PDDocument?, _ -> pdf?.close() }
.evictionListener { _: Path?, pdf: PDDocument?, _ -> pdf?.close() }
.build<Path, PDDocument>()
override fun mediaTypes(): List<String> = listOf("application/pdf")

View file

@ -22,7 +22,7 @@ class ZipExtractor(
private val cache = Caffeine.newBuilder()
.maximumSize(20)
.expireAfterAccess(1, TimeUnit.MINUTES)
.removalListener { _: Path?, zip: ZipFile?, _ -> zip?.close() }
.evictionListener { _: Path?, zip: ZipFile?, _ -> zip?.close() }
.build<Path, ZipFile>()
private val natSortComparator: Comparator<String> = CaseInsensitiveSimpleNaturalComparator.getInstance()