|
34 | 34 | import com.clickhouse.data.ClickHouseFormat; |
35 | 35 | import com.clickhouse.data.ClickHousePipedOutputStream; |
36 | 36 | import com.clickhouse.data.format.BinaryStreamUtils; |
| 37 | +import org.apache.hc.core5.concurrent.DefaultThreadFactory; |
37 | 38 | import org.slf4j.Logger; |
38 | 39 | import org.slf4j.LoggerFactory; |
39 | 40 |
|
@@ -125,14 +126,7 @@ private Client(Set<String> endpoints, Map<String,String> configuration) { |
125 | 126 | final int numThreads = Integer.parseInt(configuration.getOrDefault( |
126 | 127 | ClickHouseClientOption.MAX_THREADS_PER_CLIENT.getKey(), DEFAULT_THREADS_PER_CLIENT)); |
127 | 128 |
|
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")); |
136 | 130 | LOG.debug("Query executor created with {} threads", numThreads); |
137 | 131 | } |
138 | 132 |
|
@@ -630,6 +624,7 @@ public CompletableFuture<InsertResponse> insert(String tableName, |
630 | 624 | try (ClickHouseClient client = ClientV1AdaptorHelper.createClient(configuration)) { |
631 | 625 | ClickHouseRequest.Mutation request = ClientV1AdaptorHelper |
632 | 626 | .createMutationRequest(client.write(getServerNode()), tableName, settings, configuration).format(format); |
| 627 | + |
633 | 628 | CompletableFuture<ClickHouseResponse> future = null; |
634 | 629 | try(ClickHousePipedOutputStream stream = ClickHouseDataStreamFactory.getInstance().createPipedOutputStream(request.getConfig())) { |
635 | 630 | future = request.data(stream.getInputStream()).execute(); |
|
0 commit comments