Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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();
Expand Down
Loading