szetszwo commented on code in PR #6351:
URL: https://github.com/apache/ozone/pull/6351#discussion_r1605882000


##########
hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/client/OzoneQuota.java:
##########
@@ -44,27 +39,17 @@ public enum Units { B, KB, MB, GB, TB }
   // Quota to decide how many buckets can be created.
   private long quotaInNamespace;
   // Quota to decide how many storage space will be used in bytes.
-  private long quotaInBytes;
-  private RawQuotaInBytes rawQuotaInBytes;
+  private final long quotaInBytes;
+  private final RawQuotaInBytes rawQuotaInBytes;
   // Data class of Quota.
-  private static QuotaList quotaList;
-
-  /** Setting QuotaList parameters from large to small. */
-  static {
-    quotaList = new QuotaList();
-    quotaList.addQuotaList(OZONE_QUOTA_TB, Units.TB, TB);
-    quotaList.addQuotaList(OZONE_QUOTA_GB, Units.GB, GB);
-    quotaList.addQuotaList(OZONE_QUOTA_MB, Units.MB, MB);
-    quotaList.addQuotaList(OZONE_QUOTA_KB, Units.KB, KB);
-    quotaList.addQuotaList(OZONE_QUOTA_B, Units.B, 1L);
-  }
+  private static final QuotaList QUOTA_LIST = new QuotaList();

Review Comment:
   > OzoneQuota used to initalize contents of QuotaList, moved to the latter
   The `QuotaList` class is inefficient.  Let's remove it.



##########
hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/client/OzoneQuota.java:
##########
@@ -44,27 +39,17 @@ public enum Units { B, KB, MB, GB, TB }
   // Quota to decide how many buckets can be created.
   private long quotaInNamespace;
   // Quota to decide how many storage space will be used in bytes.
-  private long quotaInBytes;
-  private RawQuotaInBytes rawQuotaInBytes;
+  private final long quotaInBytes;
+  private final RawQuotaInBytes rawQuotaInBytes;
   // Data class of Quota.
-  private static QuotaList quotaList;
-
-  /** Setting QuotaList parameters from large to small. */
-  static {
-    quotaList = new QuotaList();
-    quotaList.addQuotaList(OZONE_QUOTA_TB, Units.TB, TB);
-    quotaList.addQuotaList(OZONE_QUOTA_GB, Units.GB, GB);
-    quotaList.addQuotaList(OZONE_QUOTA_MB, Units.MB, MB);
-    quotaList.addQuotaList(OZONE_QUOTA_KB, Units.KB, KB);
-    quotaList.addQuotaList(OZONE_QUOTA_B, Units.B, 1L);
-  }
+  private static final QuotaList QUOTA_LIST = new QuotaList();

Review Comment:
   > OzoneQuota used to initalize contents of QuotaList, moved to the latter
   
   The `QuotaList` class is inefficient.  Let's remove it.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to