org.apache.rocketmq.shaded.io.opentelemetry.exporter.internal.okhttp.OkHttpUtil Maven / Gradle / Ivy
/*
* Copyright The OpenTelemetry Authors
* SPDX-License-Identifier: Apache-2.0
*/
package org.apache.rocketmq.shaded.io.opentelemetry.exporter.internal.okhttp;
import org.apache.rocketmq.shaded.io.opentelemetry.sdk.internal.DaemonThreadFactory;
import java.util.concurrent.SynchronousQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import okhttp3.Dispatcher;
/**
* Utilities for OkHttp.
*
* This class is internal and is hence not for public use. Its APIs are unstable and can change
* at any time.
*/
public final class OkHttpUtil {
/** Returns a {@link Dispatcher} using daemon threads, otherwise matching the OkHttp default. */
public static Dispatcher newDispatcher() {
return new Dispatcher(
new ThreadPoolExecutor(
0,
Integer.MAX_VALUE,
60,
TimeUnit.SECONDS,
new SynchronousQueue<>(),
new DaemonThreadFactory("okhttp-dispatch")));
}
private OkHttpUtil() {}
}