style: Modifiers should be declared in the correct order;Map init 设置大小 避免扩容;

This commit is contained in:
xianlaioy 2019-09-09 17:55:02 +08:00
parent e5f6cab640
commit 13e509679d
4 changed files with 14 additions and 14 deletions

View File

@ -24,16 +24,17 @@ import java.util.concurrent.Executor;
*/
@SuppressWarnings("PMD.AbstractClassShouldStartWithAbstractNamingRule")
public abstract class AbstractSharedListener implements Listener {
private volatile String dataId;
private volatile String group;
final public void fillContext(String dataId, String group) {
public final void fillContext(String dataId, String group) {
this.dataId = dataId;
this.group = group;
}
@Override
final public void receiveConfigInfo(String configInfo) {
public final void receiveConfigInfo(String configInfo) {
innerReceive(dataId, group, configInfo);
}

View File

@ -24,8 +24,8 @@ import static com.alibaba.nacos.core.utils.SystemUtils.LOCAL_IP;
*/
public class ApplicationInfo {
private static final long LOCK_EXPIRE_DURATION = 30 * 1000;
private static final long RECENTLY_DURATION = 24 * 60 * 60 * 1000;
private static final long LOCK_EXPIRE_DURATION = 30 * 1000L;
private static final long RECENTLY_DURATION = 24 * 60 * 60 * 1000L;
private String appName;

View File

@ -37,10 +37,12 @@ import static com.alibaba.nacos.config.server.utils.LogUtil.fatalLog;
@Service
public class AggrWhitelist {
public static final String AGGRIDS_METADATA = "com.alibaba.nacos.metadata.aggrIDs";
/**
* 判断指定的dataId是否在聚合dataId白名单
*/
static public boolean isAggrDataId(String dataId) {
public static boolean isAggrDataId(String dataId) {
if (null == dataId) {
throw new IllegalArgumentException();
}
@ -56,7 +58,7 @@ public class AggrWhitelist {
/**
* 传入内容重新加载聚合白名单
*/
static public void load(String content) {
public static void load(String content) {
if (StringUtils.isBlank(content)) {
fatalLog.error("aggr dataId whitelist is blank.");
return;
@ -83,14 +85,12 @@ public class AggrWhitelist {
AGGR_DATAID_WHITELIST.set(list);
}
static public List<Pattern> getWhiteList() {
public static List<Pattern> getWhiteList() {
return AGGR_DATAID_WHITELIST.get();
}
// =======================
static public final String AGGRIDS_METADATA = "com.alibaba.nacos.metadata.aggrIDs";
static final AtomicReference<List<Pattern>> AGGR_DATAID_WHITELIST = new AtomicReference<List<Pattern>>(
new ArrayList<Pattern>());
}

View File

@ -16,10 +16,9 @@
package com.alibaba.nacos.config.server.utils;
import com.alibaba.nacos.config.server.constant.Constants;
import com.google.common.collect.Maps;
import java.io.UnsupportedEncodingException;
import java.security.MessageDigest;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.locks.ReentrantLock;
@ -31,10 +30,10 @@ import java.util.concurrent.locks.ReentrantLock;
@SuppressWarnings("PMD.ClassNamingShouldBeCamelRule")
public class MD5 {
private static char[] digits = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'};
private final static int DIGITS_COUNT = 16;
private final static int DIGITS_CHAR_SIZE = 32;
private static final int DIGITS_COUNT = 16;
private static final int DIGITS_CHAR_SIZE = 32;
private static Map<Character, Integer> rDigits = new HashMap<Character, Integer>(16);
private static Map<Character, Integer> rDigits = Maps.newHashMapWithExpectedSize(16)
static {
for (int i = 0; i < digits.length; ++i) {