update 优化变量名称

This commit is contained in:
bleachtred 2024-03-12 16:55:55 +08:00
parent 0c1e1c5d62
commit 6872a55860
4 changed files with 25 additions and 25 deletions

View File

@ -19,7 +19,7 @@ import java.util.Map;
**/ **/
public class MonitorFactory { public class MonitorFactory {
private final static Map<String, MonitorService> services = new HashMap<>(); private final static Map<String, MonitorService> SERVICES = new HashMap<>();
/** /**
* put * put
@ -30,7 +30,7 @@ public class MonitorFactory {
* @author :Wind * @author :Wind
*/ */
public static void put(String key, MailImapConfig config, Monitor monitor){ public static void put(String key, MailImapConfig config, Monitor monitor){
services.put(key,new MonitorService(config,monitor)); SERVICES.put(key,new MonitorService(config,monitor));
} }
/** /**
@ -40,7 +40,7 @@ public class MonitorFactory {
* @author :Wind * @author :Wind
*/ */
public static void start(String key){ public static void start(String key){
services.get(key).start(); SERVICES.get(key).start();
} }
/** /**
@ -50,7 +50,7 @@ public class MonitorFactory {
* @author :Wind * @author :Wind
*/ */
public static void stop(String key){ public static void stop(String key){
services.get(key).stop(); SERVICES.get(key).stop();
} }
/** /**
@ -60,6 +60,6 @@ public class MonitorFactory {
* @author :Wind * @author :Wind
*/ */
public static MailImapConfig getConfig(String key) { public static MailImapConfig getConfig(String key) {
return services.get(key).getMailImapConfig(); return SERVICES.get(key).getMailImapConfig();
} }
} }

View File

@ -33,7 +33,7 @@ public abstract class SmsFactory {
* <p>key: configId短信服务对象的唯一标识</p> * <p>key: configId短信服务对象的唯一标识</p>
* <p>value: 短信服务对象</p> * <p>value: 短信服务对象</p>
*/ */
private final static Map<String, SmsBlend> blends = new ConcurrentHashMap<>(); private final static Map<String, SmsBlend> BLENDS = new ConcurrentHashMap<>();
private SmsFactory() { private SmsFactory() {
} }
@ -170,7 +170,7 @@ public abstract class SmsFactory {
* @return 返回短信服务对象如果未找到则返回null * @return 返回短信服务对象如果未找到则返回null
*/ */
public static SmsBlend getSmsBlend(String configId) { public static SmsBlend getSmsBlend(String configId) {
return blends.get(configId); return BLENDS.get(configId);
} }
/** /**
@ -184,7 +184,7 @@ public abstract class SmsFactory {
if (StrUtil.isEmpty(supplier)) { if (StrUtil.isEmpty(supplier)) {
throw new SmsBlendException("供应商标识不能为空"); throw new SmsBlendException("供应商标识不能为空");
} }
return blends.values().stream().filter(smsBlend -> supplier.equals(smsBlend.getSupplier())).findFirst().orElse(null); return BLENDS.values().stream().filter(smsBlend -> supplier.equals(smsBlend.getSupplier())).findFirst().orElse(null);
} }
/** /**
@ -198,7 +198,7 @@ public abstract class SmsFactory {
if (StrUtil.isEmpty(supplier)) { if (StrUtil.isEmpty(supplier)) {
throw new SmsBlendException("供应商标识不能为空"); throw new SmsBlendException("供应商标识不能为空");
} }
list = blends.values().stream().filter(smsBlend -> supplier.equals(smsBlend.getSupplier())).collect(Collectors.toList()); list = BLENDS.values().stream().filter(smsBlend -> supplier.equals(smsBlend.getSupplier())).collect(Collectors.toList());
return list; return list;
} }
@ -208,7 +208,7 @@ public abstract class SmsFactory {
* @return 短信服务对象列表 * @return 短信服务对象列表
*/ */
public static List<SmsBlend> getAll() { public static List<SmsBlend> getAll() {
return new ArrayList<>(blends.values()); return new ArrayList<>(BLENDS.values());
} }
/** /**
@ -220,7 +220,7 @@ public abstract class SmsFactory {
if (smsBlend == null) { if (smsBlend == null) {
throw new SmsBlendException("短信服务对象不能为空"); throw new SmsBlendException("短信服务对象不能为空");
} }
blends.put(smsBlend.getConfigId(), smsBlend); BLENDS.put(smsBlend.getConfigId(), smsBlend);
SmsLoad.starConfig(smsBlend, 1); SmsLoad.starConfig(smsBlend, 1);
} }
@ -233,7 +233,7 @@ public abstract class SmsFactory {
if (smsBlend == null) { if (smsBlend == null) {
throw new SmsBlendException("短信服务对象不能为空"); throw new SmsBlendException("短信服务对象不能为空");
} }
blends.put(smsBlend.getConfigId(), smsBlend); BLENDS.put(smsBlend.getConfigId(), smsBlend);
SmsLoad.starConfig(smsBlend, weight); SmsLoad.starConfig(smsBlend, weight);
} }
@ -250,10 +250,10 @@ public abstract class SmsFactory {
throw new SmsBlendException("短信服务对象不能为空"); throw new SmsBlendException("短信服务对象不能为空");
} }
String configId = smsBlend.getConfigId(); String configId = smsBlend.getConfigId();
if (blends.containsKey(configId)) { if (BLENDS.containsKey(configId)) {
return false; return false;
} }
blends.put(configId, smsBlend); BLENDS.put(configId, smsBlend);
SmsLoad.starConfig(smsBlend, 1); SmsLoad.starConfig(smsBlend, 1);
return true; return true;
} }
@ -274,10 +274,10 @@ public abstract class SmsFactory {
throw new SmsBlendException("短信服务对象不能为空"); throw new SmsBlendException("短信服务对象不能为空");
} }
String configId = smsBlend.getConfigId(); String configId = smsBlend.getConfigId();
if (blends.containsKey(configId)) { if (BLENDS.containsKey(configId)) {
return false; return false;
} }
blends.put(configId, smsBlend); BLENDS.put(configId, smsBlend);
SmsLoad.starConfig(smsBlend, weight); SmsLoad.starConfig(smsBlend, weight);
return true; return true;
} }
@ -292,7 +292,7 @@ public abstract class SmsFactory {
* <p>当configId不存在时返回false</p> * <p>当configId不存在时返回false</p>
*/ */
public static boolean unregister(String configId) { public static boolean unregister(String configId) {
SmsBlend blend = blends.remove(configId); SmsBlend blend = BLENDS.remove(configId);
SmsLoad.getBeanLoad().removeLoadServer(blend); SmsLoad.getBeanLoad().removeLoadServer(blend);
return blend != null; return blend != null;
} }

View File

@ -19,7 +19,7 @@ import java.util.Map;
**/ **/
public class MonitorFactory { public class MonitorFactory {
private final static Map<String, MonitorService> services = new HashMap<>(); private final static Map<String, MonitorService> SERVICES = new HashMap<>();
/** /**
* put * put
@ -30,7 +30,7 @@ public class MonitorFactory {
* @author :Wind * @author :Wind
*/ */
public static void put(String key, MailImapConfig config, Monitor monitor){ public static void put(String key, MailImapConfig config, Monitor monitor){
services.put(key,new MonitorService(config,monitor)); SERVICES.put(key,new MonitorService(config,monitor));
} }
/** /**
@ -40,7 +40,7 @@ public class MonitorFactory {
* @author :Wind * @author :Wind
*/ */
public static void start(String key){ public static void start(String key){
services.get(key).start(); SERVICES.get(key).start();
} }
/** /**
@ -50,7 +50,7 @@ public class MonitorFactory {
* @author :Wind * @author :Wind
*/ */
public static void stop(String key){ public static void stop(String key){
services.get(key).stop(); SERVICES.get(key).stop();
} }
/** /**
@ -60,6 +60,6 @@ public class MonitorFactory {
* @author :Wind * @author :Wind
*/ */
public static MailImapConfig getConfig(String key) { public static MailImapConfig getConfig(String key) {
return services.get(key).getMailImapConfig(); return SERVICES.get(key).getMailImapConfig();
} }
} }

View File

@ -8,7 +8,7 @@ import java.util.Map;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
public class OaFactory { public class OaFactory {
private final static Map<String, OaSender> configs = new ConcurrentHashMap<>(); private final static Map<String, OaSender> CONFIGS = new ConcurrentHashMap<>();
/** /**
* <p>创建各个厂商的实现类 * <p>创建各个厂商的实现类
@ -29,7 +29,7 @@ public class OaFactory {
if (smsBlend == null) { if (smsBlend == null) {
throw new OaException("通知webhook服务对象不能为空"); throw new OaException("通知webhook服务对象不能为空");
} }
configs.put(smsBlend.getConfigId(), smsBlend); CONFIGS.put(smsBlend.getConfigId(), smsBlend);
} }
public static OaSender createAndGetOa(OaSupplierConfig config) { public static OaSender createAndGetOa(OaSupplierConfig config) {
@ -47,7 +47,7 @@ public class OaFactory {
* @return 返回通知webhook服务对象如果未找到则返回null * @return 返回通知webhook服务对象如果未找到则返回null
*/ */
public static OaSender getSmsOaBlend(String configId) { public static OaSender getSmsOaBlend(String configId) {
return configs.get(configId); return CONFIGS.get(configId);
} }
} }