File tree Expand file tree Collapse file tree
core/sdk-core/src/main/java/software/amazon/awssdk/core Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2121import java .util .concurrent .Executors ;
2222import java .util .concurrent .ScheduledExecutorService ;
2323import java .util .concurrent .ScheduledFuture ;
24+ import java .util .concurrent .ScheduledThreadPoolExecutor ;
2425import java .util .concurrent .TimeUnit ;
2526import software .amazon .awssdk .annotations .SdkPublicApi ;
2627import software .amazon .awssdk .annotations .SdkTestInternalApi ;
@@ -140,12 +141,17 @@ private void scheduleTimeoutTask(Duration timeout) {
140141 }
141142
142143 private static final class TimeoutScheduler {
143- static final ScheduledExecutorService INSTANCE =
144- Executors .newScheduledThreadPool (1 , r -> {
144+ static final ScheduledExecutorService INSTANCE ;
145+ static {
146+ ScheduledThreadPoolExecutor executor = new ScheduledThreadPoolExecutor (1 , r -> {
145147 Thread t = new Thread (r , "response-input-stream-timeout-scheduler" );
146148 t .setDaemon (true );
147149 return t ;
148150 });
151+ executor .setKeepAliveTime (DEFAULT_TIMEOUT .getSeconds (), TimeUnit .SECONDS );
152+ executor .allowCoreThreadTimeOut (true );
153+ INSTANCE = executor ;
154+ }
149155 }
150156
151157 /**
You can’t perform that action at this time.
0 commit comments