mirror of
https://gitee.com/dromara/sms4j.git
synced 2025-12-06 17:08:40 +08:00
update 优化变量名称
This commit is contained in:
parent
0c1e1c5d62
commit
6872a55860
@ -19,7 +19,7 @@ import java.util.Map;
|
||||
**/
|
||||
public class MonitorFactory {
|
||||
|
||||
private final static Map<String, MonitorService> services = new HashMap<>();
|
||||
private final static Map<String, MonitorService> SERVICES = new HashMap<>();
|
||||
|
||||
/**
|
||||
* put
|
||||
@ -30,7 +30,7 @@ public class MonitorFactory {
|
||||
* @author :Wind
|
||||
*/
|
||||
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
|
||||
*/
|
||||
public static void start(String key){
|
||||
services.get(key).start();
|
||||
SERVICES.get(key).start();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -50,7 +50,7 @@ public class MonitorFactory {
|
||||
* @author :Wind
|
||||
*/
|
||||
public static void stop(String key){
|
||||
services.get(key).stop();
|
||||
SERVICES.get(key).stop();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -60,6 +60,6 @@ public class MonitorFactory {
|
||||
* @author :Wind
|
||||
*/
|
||||
public static MailImapConfig getConfig(String key) {
|
||||
return services.get(key).getMailImapConfig();
|
||||
return SERVICES.get(key).getMailImapConfig();
|
||||
}
|
||||
}
|
||||
|
||||
@ -33,7 +33,7 @@ public abstract class SmsFactory {
|
||||
* <p>key: configId,短信服务对象的唯一标识</p>
|
||||
* <p>value: 短信服务对象</p>
|
||||
*/
|
||||
private final static Map<String, SmsBlend> blends = new ConcurrentHashMap<>();
|
||||
private final static Map<String, SmsBlend> BLENDS = new ConcurrentHashMap<>();
|
||||
|
||||
private SmsFactory() {
|
||||
}
|
||||
@ -170,7 +170,7 @@ public abstract class SmsFactory {
|
||||
* @return 返回短信服务对象。如果未找到则返回null
|
||||
*/
|
||||
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)) {
|
||||
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)) {
|
||||
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;
|
||||
}
|
||||
|
||||
@ -208,7 +208,7 @@ public abstract class SmsFactory {
|
||||
* @return 短信服务对象列表
|
||||
*/
|
||||
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) {
|
||||
throw new SmsBlendException("短信服务对象不能为空");
|
||||
}
|
||||
blends.put(smsBlend.getConfigId(), smsBlend);
|
||||
BLENDS.put(smsBlend.getConfigId(), smsBlend);
|
||||
SmsLoad.starConfig(smsBlend, 1);
|
||||
}
|
||||
|
||||
@ -233,7 +233,7 @@ public abstract class SmsFactory {
|
||||
if (smsBlend == null) {
|
||||
throw new SmsBlendException("短信服务对象不能为空");
|
||||
}
|
||||
blends.put(smsBlend.getConfigId(), smsBlend);
|
||||
BLENDS.put(smsBlend.getConfigId(), smsBlend);
|
||||
SmsLoad.starConfig(smsBlend, weight);
|
||||
}
|
||||
|
||||
@ -250,10 +250,10 @@ public abstract class SmsFactory {
|
||||
throw new SmsBlendException("短信服务对象不能为空");
|
||||
}
|
||||
String configId = smsBlend.getConfigId();
|
||||
if (blends.containsKey(configId)) {
|
||||
if (BLENDS.containsKey(configId)) {
|
||||
return false;
|
||||
}
|
||||
blends.put(configId, smsBlend);
|
||||
BLENDS.put(configId, smsBlend);
|
||||
SmsLoad.starConfig(smsBlend, 1);
|
||||
return true;
|
||||
}
|
||||
@ -274,10 +274,10 @@ public abstract class SmsFactory {
|
||||
throw new SmsBlendException("短信服务对象不能为空");
|
||||
}
|
||||
String configId = smsBlend.getConfigId();
|
||||
if (blends.containsKey(configId)) {
|
||||
if (BLENDS.containsKey(configId)) {
|
||||
return false;
|
||||
}
|
||||
blends.put(configId, smsBlend);
|
||||
BLENDS.put(configId, smsBlend);
|
||||
SmsLoad.starConfig(smsBlend, weight);
|
||||
return true;
|
||||
}
|
||||
@ -292,7 +292,7 @@ public abstract class SmsFactory {
|
||||
* <p>当configId不存在时,返回false</p>
|
||||
*/
|
||||
public static boolean unregister(String configId) {
|
||||
SmsBlend blend = blends.remove(configId);
|
||||
SmsBlend blend = BLENDS.remove(configId);
|
||||
SmsLoad.getBeanLoad().removeLoadServer(blend);
|
||||
return blend != null;
|
||||
}
|
||||
|
||||
@ -19,7 +19,7 @@ import java.util.Map;
|
||||
**/
|
||||
public class MonitorFactory {
|
||||
|
||||
private final static Map<String, MonitorService> services = new HashMap<>();
|
||||
private final static Map<String, MonitorService> SERVICES = new HashMap<>();
|
||||
|
||||
/**
|
||||
* put
|
||||
@ -30,7 +30,7 @@ public class MonitorFactory {
|
||||
* @author :Wind
|
||||
*/
|
||||
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
|
||||
*/
|
||||
public static void start(String key){
|
||||
services.get(key).start();
|
||||
SERVICES.get(key).start();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -50,7 +50,7 @@ public class MonitorFactory {
|
||||
* @author :Wind
|
||||
*/
|
||||
public static void stop(String key){
|
||||
services.get(key).stop();
|
||||
SERVICES.get(key).stop();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -60,6 +60,6 @@ public class MonitorFactory {
|
||||
* @author :Wind
|
||||
*/
|
||||
public static MailImapConfig getConfig(String key) {
|
||||
return services.get(key).getMailImapConfig();
|
||||
return SERVICES.get(key).getMailImapConfig();
|
||||
}
|
||||
}
|
||||
|
||||
@ -8,7 +8,7 @@ import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
public class OaFactory {
|
||||
private final static Map<String, OaSender> configs = new ConcurrentHashMap<>();
|
||||
private final static Map<String, OaSender> CONFIGS = new ConcurrentHashMap<>();
|
||||
|
||||
/**
|
||||
* <p>创建各个厂商的实现类
|
||||
@ -29,7 +29,7 @@ public class OaFactory {
|
||||
if (smsBlend == null) {
|
||||
throw new OaException("通知webhook服务对象不能为空");
|
||||
}
|
||||
configs.put(smsBlend.getConfigId(), smsBlend);
|
||||
CONFIGS.put(smsBlend.getConfigId(), smsBlend);
|
||||
}
|
||||
|
||||
public static OaSender createAndGetOa(OaSupplierConfig config) {
|
||||
@ -47,7 +47,7 @@ public class OaFactory {
|
||||
* @return 返回通知webhook服务对象。如果未找到则返回null
|
||||
*/
|
||||
public static OaSender getSmsOaBlend(String configId) {
|
||||
return configs.get(configId);
|
||||
return CONFIGS.get(configId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user