Skip to content

Commit 0df1fec

Browse files
committed
created canonical executor using JDK classes
1 parent 216ccae commit 0df1fec

File tree

1 file changed

+3
-8
lines changed
  • client-v2/src/main/java/com/clickhouse/client/api

1 file changed

+3
-8
lines changed

client-v2/src/main/java/com/clickhouse/client/api/Client.java

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
import com.clickhouse.data.ClickHouseFormat;
3535
import com.clickhouse.data.ClickHousePipedOutputStream;
3636
import com.clickhouse.data.format.BinaryStreamUtils;
37+
import org.apache.hc.core5.concurrent.DefaultThreadFactory;
3738
import org.slf4j.Logger;
3839
import org.slf4j.LoggerFactory;
3940

@@ -125,14 +126,7 @@ private Client(Set<String> endpoints, Map<String,String> configuration) {
125126
final int numThreads = Integer.parseInt(configuration.getOrDefault(
126127
ClickHouseClientOption.MAX_THREADS_PER_CLIENT.getKey(), DEFAULT_THREADS_PER_CLIENT));
127128

128-
this.sharedOperationExecutor = Executors.newFixedThreadPool(numThreads, r -> {
129-
Thread t = new Thread(r);
130-
t.setName("ClickHouse-Query-Executor");
131-
t.setUncaughtExceptionHandler((t1, e) -> {
132-
LOG.error("Uncaught exception in thread {}", t1.getName(), e);
133-
});
134-
return t;
135-
});
129+
this.sharedOperationExecutor = Executors.newFixedThreadPool(numThreads, new DefaultThreadFactory("chc-operation"));
136130
LOG.debug("Query executor created with {} threads", numThreads);
137131
}
138132

@@ -630,6 +624,7 @@ public CompletableFuture<InsertResponse> insert(String tableName,
630624
try (ClickHouseClient client = ClientV1AdaptorHelper.createClient(configuration)) {
631625
ClickHouseRequest.Mutation request = ClientV1AdaptorHelper
632626
.createMutationRequest(client.write(getServerNode()), tableName, settings, configuration).format(format);
627+
633628
CompletableFuture<ClickHouseResponse> future = null;
634629
try(ClickHousePipedOutputStream stream = ClickHouseDataStreamFactory.getInstance().createPipedOutputStream(request.getConfig())) {
635630
future = request.data(stream.getInputStream()).execute();

0 commit comments

Comments
 (0)