You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uniffle.apache.org by ck...@apache.org on 2023/01/19 05:08:57 UTC

[incubator-uniffle] branch master updated: [Minor] Make Constants final (#501)

This is an automated email from the ASF dual-hosted git repository.

ckj pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-uniffle.git


The following commit(s) were added to refs/heads/master by this push:
     new 359f7cd1 [Minor] Make Constants final (#501)
359f7cd1 is described below

commit 359f7cd105f7aeec1148f6fe9950eed1811945ba
Author: Kaijie Chen <ck...@apache.org>
AuthorDate: Thu Jan 19 13:08:50 2023 +0800

    [Minor] Make Constants final (#501)
    
    ### What changes were proposed in this pull request?
    
    1. Make Constants class final.
    2. Make public static fields in Constants final.
    3. Make default constructor of Constants private.
    
    ### Why are the changes needed?
    
    Code quality.
    
    ### Does this PR introduce _any_ user-facing change?
    
    No.
    
    ### How was this patch tested?
    
    Existing CI.
---
 .../org/apache/uniffle/common/util/Constants.java     | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

diff --git a/common/src/main/java/org/apache/uniffle/common/util/Constants.java b/common/src/main/java/org/apache/uniffle/common/util/Constants.java
index f21597ab..960ca664 100644
--- a/common/src/main/java/org/apache/uniffle/common/util/Constants.java
+++ b/common/src/main/java/org/apache/uniffle/common/util/Constants.java
@@ -17,7 +17,10 @@
 
 package org.apache.uniffle.common.util;
 
-public class Constants {
+public final class Constants {
+
+  private Constants() {
+  }
 
   // the value is used for client/server compatible, eg, online upgrade
   public static final String SHUFFLE_SERVER_VERSION = "ss_v4";
@@ -28,10 +31,10 @@ public class Constants {
   public static final int PARTITION_ID_MAX_LENGTH = 24;
   public static final int TASK_ATTEMPT_ID_MAX_LENGTH = 21;
   public static final int ATOMIC_INT_MAX_LENGTH = 18;
-  public static long MAX_SEQUENCE_NO = (1 << Constants.ATOMIC_INT_MAX_LENGTH) - 1;
-  public static long MAX_PARTITION_ID = (1 << Constants.PARTITION_ID_MAX_LENGTH) - 1;
-  public static long MAX_TASK_ATTEMPT_ID = (1 << Constants.TASK_ATTEMPT_ID_MAX_LENGTH) - 1;
-  public static long INVALID_BLOCK_ID = -1L;
+  public static final long MAX_SEQUENCE_NO = (1 << Constants.ATOMIC_INT_MAX_LENGTH) - 1;
+  public static final long MAX_PARTITION_ID = (1 << Constants.PARTITION_ID_MAX_LENGTH) - 1;
+  public static final long MAX_TASK_ATTEMPT_ID = (1 << Constants.TASK_ATTEMPT_ID_MAX_LENGTH) - 1;
+  public static final long INVALID_BLOCK_ID = -1L;
   public static final String KEY_SPLIT_CHAR = "/";
   public static final String COMMA_SPLIT_CHAR = ",";
   public static final String EQUAL_SPLIT_CHAR = "=";
@@ -61,10 +64,10 @@ public class Constants {
   public static final String MR_REDUCES = "mapreduce.job.reduces";
   public static final String MR_MAP_LIMIT = "mapreduce.job.running.map.limit";
   public static final String MR_REDUCE_LIMIT = "mapreduce.job.running.reduce.limit";
-  public static int MR_MAP_LIMIT_DEFAULT_VALUE = 0;
-  public static int MR_REDUCE_LIMIT_DEFAULT_VALUE = 0;
+  public static final int MR_MAP_LIMIT_DEFAULT_VALUE = 0;
+  public static final int MR_REDUCE_LIMIT_DEFAULT_VALUE = 0;
   public static final String MR_SLOW_START = "mapreduce.job.reduce.slowstart.completedmaps";
-  public static double MR_SLOW_START_DEFAULT_VALUE = 0.05;
+  public static final double MR_SLOW_START_DEFAULT_VALUE = 0.05;
   
   public static final double MILLION_SECONDS_PER_SECOND = 1E3D;
 }