You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by "Attila Doroszlai (Jira)" <ji...@apache.org> on 2026/09/18 14:37:00 UTC
[jira] [Resolved] (HDDS-16278) Reuse DecimalFormat in SCMNodeManager statistics
[ https://issues.apache.org/jira/browse/HDDS-16278?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Attila Doroszlai resolved HDDS-16278.
-------------------------------------
Fix Version/s: 2.3.0
Resolution: Fixed
> 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
> Assignee: Huang Kuan Hao
> Priority: Major
> Labels: pull-request-available
> Fix For: 2.3.0
>
>
> 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