Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import software.amazon.awssdk.annotations.SdkPublicApi;
import software.amazon.awssdk.annotations.SdkTestInternalApi;
Expand Down Expand Up @@ -140,12 +141,17 @@ private void scheduleTimeoutTask(Duration timeout) {
}

private static final class TimeoutScheduler {
static final ScheduledExecutorService INSTANCE =
Executors.newScheduledThreadPool(1, r -> {
static final ScheduledExecutorService INSTANCE;
static {
ScheduledThreadPoolExecutor executor = new ScheduledThreadPoolExecutor(1, r -> {
Thread t = new Thread(r, "response-input-stream-timeout-scheduler");
t.setDaemon(true);
return t;
});
executor.setKeepAliveTime(DEFAULT_TIMEOUT.getSeconds(), TimeUnit.SECONDS);
executor.allowCoreThreadTimeOut(true);
INSTANCE = executor;
}
}

/**
Expand Down
Loading