Merge remote-tracking branch 'origin/fix-bug-202303' into fix-bug-202303
This commit is contained in:
+5
-5
@@ -14,13 +14,13 @@ import java.util.concurrent.ConcurrentMap;
|
||||
*/
|
||||
public class ExecutorRouteRound extends ExecutorRouter {
|
||||
|
||||
private static ConcurrentMap<Integer, Integer> routeCountEachJob = new ConcurrentHashMap<Integer, Integer>();
|
||||
private static long CACHE_VALID_TIME = 0;
|
||||
private static ConcurrentMap<Integer, Integer> routeCountEachJob = new ConcurrentHashMap<>();
|
||||
private static long cacheValidTime = 0;
|
||||
private static int count(int jobId) {
|
||||
// cache clear
|
||||
if (System.currentTimeMillis() > CACHE_VALID_TIME) {
|
||||
if (System.currentTimeMillis() > cacheValidTime) {
|
||||
routeCountEachJob.clear();
|
||||
CACHE_VALID_TIME = System.currentTimeMillis() + 1000*60*60*24;
|
||||
cacheValidTime = System.currentTimeMillis() + 1000*60*60*24;
|
||||
}
|
||||
|
||||
// count++
|
||||
@@ -33,7 +33,7 @@ public class ExecutorRouteRound extends ExecutorRouter {
|
||||
@Override
|
||||
public ReturnT<String> route(TriggerParam triggerParam, List<String> addressList) {
|
||||
String address = addressList.get(count(triggerParam.getJobId())%addressList.size());
|
||||
return new ReturnT<String>(address);
|
||||
return new ReturnT<>(address);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+5
-5
@@ -20,7 +20,7 @@ public class XxlJobScheduler {
|
||||
private static final Logger logger = LoggerFactory.getLogger(XxlJobScheduler.class);
|
||||
|
||||
|
||||
public void init() throws Exception {
|
||||
public void init() {
|
||||
// init i18n
|
||||
initI18n();
|
||||
|
||||
@@ -45,8 +45,8 @@ public class XxlJobScheduler {
|
||||
logger.info(">>>>>>>>> init xxl-job admin success.");
|
||||
}
|
||||
|
||||
|
||||
public void destroy() throws Exception {
|
||||
|
||||
public void destroy() {
|
||||
|
||||
// stop-schedule
|
||||
JobScheduleHelper.getInstance().toStop();
|
||||
@@ -77,8 +77,8 @@ public class XxlJobScheduler {
|
||||
}
|
||||
|
||||
// ---------------------- executor-client ----------------------
|
||||
private static ConcurrentMap<String, ExecutorBiz> executorBizRepository = new ConcurrentHashMap<String, ExecutorBiz>();
|
||||
public static ExecutorBiz getExecutorBiz(String address) throws Exception {
|
||||
private static ConcurrentMap<String, ExecutorBiz> executorBizRepository = new ConcurrentHashMap<>();
|
||||
public static ExecutorBiz getExecutorBiz(String address) {
|
||||
// valid
|
||||
if (address==null || address.trim().length()==0) {
|
||||
return null;
|
||||
|
||||
+11
-8
@@ -15,14 +15,17 @@ public class CookieUtil {
|
||||
private static final int COOKIE_MAX_AGE = Integer.MAX_VALUE;
|
||||
// 保存路径,根路径
|
||||
private static final String COOKIE_PATH = "/";
|
||||
|
||||
|
||||
private CookieUtil() {
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存
|
||||
*
|
||||
* @param response
|
||||
* @param key
|
||||
* @param value
|
||||
* @param ifRemember
|
||||
* @param ifRemember
|
||||
*/
|
||||
public static void set(HttpServletResponse response, String key, String value, boolean ifRemember) {
|
||||
int age = ifRemember?COOKIE_MAX_AGE:-1;
|
||||
@@ -47,7 +50,7 @@ public class CookieUtil {
|
||||
cookie.setHttpOnly(isHttpOnly);
|
||||
response.addCookie(cookie);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询value
|
||||
*
|
||||
@@ -70,9 +73,9 @@ public class CookieUtil {
|
||||
* @param key
|
||||
*/
|
||||
private static Cookie get(HttpServletRequest request, String key) {
|
||||
Cookie[] arr_cookie = request.getCookies();
|
||||
if (arr_cookie != null && arr_cookie.length > 0) {
|
||||
for (Cookie cookie : arr_cookie) {
|
||||
Cookie[] arrCookie = request.getCookies();
|
||||
if (arrCookie != null && arrCookie.length > 0) {
|
||||
for (Cookie cookie : arrCookie) {
|
||||
if (cookie.getName().equals(key)) {
|
||||
return cookie;
|
||||
}
|
||||
@@ -80,7 +83,7 @@ public class CookieUtil {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 删除Cookie
|
||||
*
|
||||
@@ -95,4 +98,4 @@ public class CookieUtil {
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user