diff --git a/src/main/java/io/github/nstdio/http/ext/DiskCache.java b/src/main/java/io/github/nstdio/http/ext/DiskCache.java index fbe7af9..8e4d81a 100644 --- a/src/main/java/io/github/nstdio/http/ext/DiskCache.java +++ b/src/main/java/io/github/nstdio/http/ext/DiskCache.java @@ -51,7 +51,7 @@ class DiskCache extends SizeConstrainedCache { this.metadataSerializer = metadataSerializer; this.streamFactory = streamFactory; this.dir = dir; - this.executor = Executors.newSingleThreadExecutor(r -> new Thread(r, "disk-cache-io")); + this.executor = Executors.newFixedThreadPool(1, r -> new Thread(r, "disk-cache-io")); restore(); } diff --git a/src/test/kotlin/io/github/nstdio/http/ext/BuffersTest.kt b/src/test/kotlin/io/github/nstdio/http/ext/BuffersTest.kt index 07975e7..d10a19c 100644 --- a/src/test/kotlin/io/github/nstdio/http/ext/BuffersTest.kt +++ b/src/test/kotlin/io/github/nstdio/http/ext/BuffersTest.kt @@ -17,7 +17,6 @@ package io.github.nstdio.http.ext import io.kotest.matchers.types.shouldBeSameInstanceAs import io.kotest.property.Arb -import io.kotest.property.arbitrary.int import io.kotest.property.arbitrary.map import io.kotest.property.arbitrary.next import org.assertj.core.api.Assertions.assertThat @@ -72,12 +71,17 @@ internal class BuffersTest { fun listBuffersData(): Stream> { return Stream.of( listOf(), - listOf("abcde".repeat(16).toByteBuffer()), + listOf("abcde".repeat(8).toByteBuffer()), listOf( - "ab".repeat(16).toByteBuffer(), - "cd".repeat(16).toByteBuffer() + "ab".repeat(8).toByteBuffer(), + "cd".repeat(8).toByteBuffer() ), - Arb.byteArray(Arb.int(96, 96)).next().toChunkedBuffers(true) + listOf( + "ab".repeat(8).toByteBuffer(), + "cd".repeat(8).toByteBuffer(), + "ef".repeat(8).toByteBuffer() + ), + Arb.byteArray(96).next().toChunkedBuffers(true) ) } }