You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by "Huang Kuan Hao (Jira)" <ji...@apache.org> on 2026/08/25 10:02:00 UTC
[jira] [Created] (HDDS-16278) Reuse DecimalFormat in SCMNodeManager statistics
Huang Kuan Hao created HDDS-16278:
-------------------------------------
Summary: Reuse DecimalFormat in SCMNodeManager statistics
Key: HDDS-16278
URL: https://issues.apache.org/jira/browse/HDDS-16278
Project: Apache Ozone
Issue Type: Sub-task
Reporter: Huang Kuan Hao
calculateStoragePercentage / convertUnit / nodeUsageStatistics build a DecimalFormat per datanode inside the node-stats/JMX loops:
DecimalFormat decimalFormat = new DecimalFormat("#0.00");
decimalFormat.setRoundingMode(RoundingMode.HALF_UP);
Fix: a shared ThreadLocal<DecimalFormat> per pattern (DecimalFormat is not thread-safe), configured once:
private static final ThreadLocal<DecimalFormat> FMT_2 = ThreadLocal.withInitial(() -> {
DecimalFormat f = new DecimalFormat("#0.00");
f.setRoundingMode(RoundingMode.HALF_UP);
return f;
});
Behavior unchanged.
File: hadoop-hdds/server-scm/.../scm/node/SCMNodeManager.java:1332,1359,1423
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org