From 3c42741c0225d3f39e1e72f37221a0bf95da7da4 Mon Sep 17 00:00:00 2001 From: nanxiang xia <162968176+XNX02@users.noreply.github.com> Date: Thu, 4 Sep 2025 16:10:33 +0800 Subject: [PATCH] Pipe: Restore RPC thread name after Pipe receiver exit (#16344) * thread name * thread name --- .../iotdb/commons/pipe/receiver/IoTDBFileReceiver.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/receiver/IoTDBFileReceiver.java b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/receiver/IoTDBFileReceiver.java index ca9b0c8dbc721..ad76cd4a18429 100644 --- a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/receiver/IoTDBFileReceiver.java +++ b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/receiver/IoTDBFileReceiver.java @@ -72,6 +72,9 @@ public abstract class IoTDBFileReceiver implements IoTDBReceiver { private static final AtomicLong RECEIVER_ID_GENERATOR = new AtomicLong(0); protected final AtomicLong receiverId = new AtomicLong(0); + // Used to restore the original thread name when the receiver is closed. + private String originalThreadName; + protected String username = CONNECTOR_IOTDB_USER_DEFAULT_VALUE; protected String password = CONNECTOR_IOTDB_PASSWORD_DEFAULT_VALUE; @@ -113,6 +116,9 @@ protected TPipeTransferResp handleTransferHandshakeV1(final PipeTransferHandshak return new TPipeTransferResp(status); } + if (originalThreadName == null) { + originalThreadName = Thread.currentThread().getName(); + } receiverId.set(RECEIVER_ID_GENERATOR.incrementAndGet()); Thread.currentThread() .setName( @@ -897,6 +903,10 @@ public synchronized void handleExit() { closeSession(); LOGGER.info("Receiver id = {}: Handling exit: Receiver exited.", receiverId.get()); + + if (originalThreadName != null) { + Thread.currentThread().setName(originalThreadName); + } } protected abstract void closeSession();