Skip to content
Merged
Show file tree
Hide file tree
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 @@ -341,7 +341,6 @@ public void testClosedDataNodeGetConnections() throws Exception {
TimeUnit.SECONDS.sleep(1);
}
}
TimeUnit.SECONDS.sleep(5);
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,6 @@ public void tryIfTheServerIsRestart() throws InterruptedException {
.ensureNodeStatus(
Collections.singletonList(node), Collections.singletonList(NodeStatus.Running));
pool = EnvFactory.getEnv().getSessionPool(3);
TimeUnit.SECONDS.sleep(5);
correctQuery(pool, DEFAULT_QUERY_TIMEOUT);
pool.close();
return;
Expand Down Expand Up @@ -354,7 +353,6 @@ public void restart() throws InterruptedException {
EnvFactory.getEnv()
.ensureNodeStatus(
Collections.singletonList(node), Collections.singletonList(NodeStatus.Running));
TimeUnit.SECONDS.sleep(5);
write10Data(pool, true);
pool.close();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,17 @@ public DiskMetrics(String processName) {

@Override
public void bindTo(AbstractMetricService metricService) {
String os = System.getProperty("os.name").toLowerCase();
if (os.startsWith("windows")) {
Thread thread = new Thread(() -> bindTask(metricService), "Windows-Disk-Metric-Binder");
thread.setDaemon(true);
thread.start();
return;
}
bindTask(metricService);
}

private void bindTask(AbstractMetricService metricService) {
// metrics for disks
Set<String> diskIDs = diskMetricsManager.getDiskIds();
for (String diskID : diskIDs) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ public class WindowsDiskMetricsManager implements IDiskMetricsManager {

public WindowsDiskMetricsManager() {
processId = String.valueOf(MetricConfigDescriptor.getInstance().getMetricConfig().getPid());
collectDiskId();
}

@Override
Expand Down Expand Up @@ -235,15 +234,6 @@ public Set<String> getDiskIds() {
return diskIdSet;
}

private void collectDiskId() {
Map<String, String[]> diskInfoMap = queryDiskInfo();
if (diskInfoMap.isEmpty()) {
return;
}
diskIdSet.clear();
diskIdSet.addAll(diskInfoMap.keySet());
}

private Map<String, Double> toKbMap(Map<String, Long> source) {
Map<String, Double> result = new HashMap<>(source.size());
for (Map.Entry<String, Long> entry : source.entrySet()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,17 @@ public NetMetrics(String processName) {

@Override
public void bindTo(AbstractMetricService metricService) {
String os = System.getProperty("os.name").toLowerCase();
if (os.startsWith("windows")) {
Thread thread = new Thread(() -> bindTask(metricService), "Windows-Net-Metric-Binder");
thread.setDaemon(true);
thread.start();
return;
}
bindTask(metricService);
}

private void bindTask(AbstractMetricService metricService) {
// metrics for net
Set<String> ifaceSet = netMetricManager.getIfaceSet();
for (String iface : ifaceSet) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,7 @@

private int connectionNum = 0;

public WindowsNetMetricManager() {
checkUpdate();
}
public WindowsNetMetricManager() {}

Check failure on line 59 in iotdb-core/metrics/interface/src/main/java/org/apache/iotdb/metrics/metricsets/net/WindowsNetMetricManager.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Add a nested comment explaining why this method is empty, throw an UnsupportedOperationException or complete the implementation.

See more on https://sonarcloud.io/project/issues?id=apache_iotdb&issues=AZ1Md8JJBqdBuPqsRBBC&open=AZ1Md8JJBqdBuPqsRBBC&pullRequest=17423

@Override
public Set<String> getIfaceSet() {
Expand Down
Loading