This is an automated email from the ASF dual-hosted git repository.
justinchen pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iotdb.git
The following commit(s) were added to refs/heads/master by this push:
new db0c69a8715 Fixed the potential NPE in clear all cache on local
(#16378)
db0c69a8715 is described below
commit db0c69a87150203e23bb82a3f718feab92825925
Author: Caideyipi <[email protected]>
AuthorDate: Wed Sep 10 12:31:38 2025 +0800
Fixed the potential NPE in clear all cache on local (#16378)
---
.../iotdb/db/service/DataNodeInternalRPCService.java | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/service/DataNodeInternalRPCService.java
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/service/DataNodeInternalRPCService.java
index 7384868065b..5de1041a9a0 100644
---
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/service/DataNodeInternalRPCService.java
+++
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/service/DataNodeInternalRPCService.java
@@ -35,13 +35,15 @@ import
org.apache.iotdb.db.service.metrics.DataNodeInternalRPCServiceMetrics;
import org.apache.iotdb.mpp.rpc.thrift.IDataNodeRPCService.Processor;
import org.apache.iotdb.rpc.DeepCopyRpcTransportFactory;
+import java.util.concurrent.atomic.AtomicReference;
+
public class DataNodeInternalRPCService extends ThriftService
implements DataNodeInternalRPCServiceMBean {
private static final IoTDBConfig config =
IoTDBDescriptor.getInstance().getConfig();
private static final CommonConfig commonConfig =
CommonDescriptor.getInstance().getConfig();
- private DataNodeInternalRPCServiceImpl impl;
+ private final AtomicReference<DataNodeInternalRPCServiceImpl> impl = new
AtomicReference<>();
private DataNodeInternalRPCService() {}
@@ -51,11 +53,10 @@ public class DataNodeInternalRPCService extends
ThriftService
}
@Override
- public void initTProcessor()
- throws ClassNotFoundException, IllegalAccessException,
InstantiationException {
- impl = new DataNodeInternalRPCServiceImpl();
+ public void initTProcessor() {
+ impl.compareAndSet(null, new DataNodeInternalRPCServiceImpl());
initSyncedServiceImpl(null);
- processor = new Processor<>(impl);
+ processor = new Processor<>(impl.get());
}
@Override
@@ -108,7 +109,8 @@ public class DataNodeInternalRPCService extends
ThriftService
}
public DataNodeInternalRPCServiceImpl getImpl() {
- return impl;
+ impl.compareAndSet(null, new DataNodeInternalRPCServiceImpl());
+ return impl.get();
}
private static class DataNodeInternalRPCServiceHolder {