Skip to content

Commit cbecf1f

Browse files
andrey-qlogicsduskis
authored andcommitted
372: Changed SingleThreadExecutor to FixedThreadPool(1). (#588)
* 372: Changed SingleThreadExecutor to FixedThreadPool(1). * 372: Use a deamon thread that the requests do not block jvm shutdown.
1 parent 76e88f6 commit cbecf1f

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

google-http-client/src/main/java/com/google/api/client/http/HttpRequest.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import com.google.api.client.util.StreamingContent;
2424
import com.google.api.client.util.StringUtils;
2525

26+
import com.google.common.util.concurrent.ThreadFactoryBuilder;
2627
import io.opencensus.common.Scope;
2728
import io.opencensus.contrib.http.util.HttpTraceAttributeConstants;
2829
import io.opencensus.trace.AttributeValue;
@@ -1200,14 +1201,15 @@ public HttpResponse call() throws Exception {
12001201
/**
12011202
* {@link Beta} <br/>
12021203
* Executes this request asynchronously using {@link #executeAsync(Executor)} in a single separate
1203-
* thread using {@link Executors#newSingleThreadExecutor()}.
1204+
* thread using {@link Executors#newFixedThreadPool(1)}.
12041205
*
12051206
* @return A future for accessing the results of the asynchronous request.
12061207
* @since 1.13
12071208
*/
12081209
@Beta
12091210
public Future<HttpResponse> executeAsync() {
1210-
return executeAsync(Executors.newSingleThreadExecutor());
1211+
return executeAsync(
1212+
Executors.newFixedThreadPool(1, new ThreadFactoryBuilder().setDaemon(true).build()));
12111213
}
12121214

12131215
/**

0 commit comments

Comments
 (0)