refactor: springframework.CollectionUtils => hutool.CollUtil
This commit is contained in:
parent
295ea28703
commit
e2f7dbfdc4
@ -1,8 +1,8 @@
|
||||
package com.aizuda.snailjob.client.common.cache;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.aizuda.snailjob.common.core.constant.SystemConstants;
|
||||
import com.aizuda.snailjob.server.model.dto.ConfigDTO;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
@ -34,7 +34,7 @@ public final class GroupVersionCache {
|
||||
return SystemConstants.DEFAULT_DDL;
|
||||
}
|
||||
List<ConfigDTO.Scene> sceneList = CONFIG.getSceneList();
|
||||
if (CollectionUtils.isEmpty(sceneList)) {
|
||||
if (CollUtil.isEmpty(sceneList)) {
|
||||
return SystemConstants.DEFAULT_DDL;
|
||||
}
|
||||
|
||||
@ -49,7 +49,7 @@ public final class GroupVersionCache {
|
||||
|
||||
public static ConfigDTO.Notify getRetryNotifyAttribute(Integer notifyScene) {
|
||||
List<ConfigDTO.Notify> notifyList = CONFIG.getNotifyList();
|
||||
if (!CollectionUtils.isEmpty(notifyList)) {
|
||||
if (CollUtil.isNotEmpty(notifyList)) {
|
||||
for (ConfigDTO.Notify notify : notifyList) {
|
||||
if (Objects.nonNull(notify.getRetryNotifyScene()) && notify.getRetryNotifyScene().equals(notifyScene)) {
|
||||
return notify;
|
||||
@ -63,7 +63,7 @@ public final class GroupVersionCache {
|
||||
|
||||
public static ConfigDTO.Notify getJobNotifyAttribute(Integer notifyScene) {
|
||||
List<ConfigDTO.Notify> notifyList = CONFIG.getNotifyList();
|
||||
if (!CollectionUtils.isEmpty(notifyList)) {
|
||||
if (CollUtil.isNotEmpty(notifyList)) {
|
||||
for (ConfigDTO.Notify notify : notifyList) {
|
||||
if (Objects.nonNull(notify.getJobNotifyScene()) && notify.getJobNotifyScene().equals(notifyScene)) {
|
||||
return notify;
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.aizuda.snailjob.client.common.rpc.supports.handler;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.net.url.UrlBuilder;
|
||||
import cn.hutool.core.util.ServiceLoaderUtil;
|
||||
import com.aizuda.snailjob.client.common.HandlerInterceptor;
|
||||
@ -22,7 +23,6 @@ import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.ReflectionUtils;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
@ -108,7 +108,7 @@ public class SnailDispatcherRequestHandler {
|
||||
|
||||
private static List<HandlerInterceptor> handlerInterceptors() {
|
||||
List<HandlerInterceptor> handlerInterceptors = ServiceLoaderUtil.loadList(HandlerInterceptor.class);
|
||||
if (CollectionUtils.isEmpty(handlerInterceptors)) {
|
||||
if (CollUtil.isEmpty(handlerInterceptors)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
|
@ -1,12 +1,12 @@
|
||||
package com.aizuda.snailjob.client.common.window;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.aizuda.snailjob.common.core.util.JsonUtil;
|
||||
import com.aizuda.snailjob.common.core.window.LeapArray;
|
||||
import com.aizuda.snailjob.common.core.window.Listener;
|
||||
import com.aizuda.snailjob.common.core.window.WindowWrap;
|
||||
import com.aizuda.snailjob.server.model.dto.RetryTaskDTO;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
@ -48,7 +48,7 @@ public class RetryLeapArray extends LeapArray<ConcurrentLinkedQueue<RetryTaskDTO
|
||||
ConcurrentLinkedQueue<RetryTaskDTO> deepCopy = new ConcurrentLinkedQueue<>(windowWrap.value());
|
||||
try {
|
||||
|
||||
if (!CollectionUtils.isEmpty(deepCopy)) {
|
||||
if (CollUtil.isNotEmpty(deepCopy)) {
|
||||
for (Listener<RetryTaskDTO> listener : listenerList) {
|
||||
listener.handler(new ArrayList<>(deepCopy));
|
||||
}
|
||||
|
@ -1,10 +1,10 @@
|
||||
package com.aizuda.snailjob.client.common.window;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.aizuda.snailjob.common.core.util.JsonUtil;
|
||||
import com.aizuda.snailjob.common.core.window.Listener;
|
||||
import com.aizuda.snailjob.common.log.SnailJobLog;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
@ -141,7 +141,7 @@ public class SlidingWindow<T> {
|
||||
|
||||
for (int i = 0; i < saveData.size() - 1; i++) {
|
||||
Map.Entry<LocalDateTime, ConcurrentLinkedQueue<T>> firstEntry = saveData.firstEntry();
|
||||
if (CollectionUtils.isEmpty(firstEntry.getValue())) {
|
||||
if (CollUtil.isEmpty(firstEntry.getValue())) {
|
||||
saveData.remove(firstEntry.getKey());
|
||||
}
|
||||
}
|
||||
@ -180,7 +180,7 @@ public class SlidingWindow<T> {
|
||||
try {
|
||||
|
||||
ConcurrentLinkedQueue<T> list = saveData.get(windowPeriod);
|
||||
if (CollectionUtils.isEmpty(list)) {
|
||||
if (CollUtil.isEmpty(list)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -188,7 +188,7 @@ public class SlidingWindow<T> {
|
||||
ConcurrentLinkedQueue<T> deepCopy = new ConcurrentLinkedQueue<>(list);
|
||||
clear(windowPeriod, deepCopy);
|
||||
|
||||
if (CollectionUtils.isEmpty(deepCopy)) {
|
||||
if (CollUtil.isEmpty(deepCopy)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -403,7 +403,7 @@ public class SlidingWindow<T> {
|
||||
*/
|
||||
public Builder<T> withListener(Listener<T> listener) {
|
||||
|
||||
if (CollectionUtils.isEmpty(listeners)) {
|
||||
if (CollUtil.isEmpty(listeners)) {
|
||||
listeners = new ArrayList<>();
|
||||
}
|
||||
|
||||
@ -447,7 +447,7 @@ public class SlidingWindow<T> {
|
||||
.newSingleThreadScheduledExecutor(r -> new Thread(r, "sliding-window-thread"));
|
||||
}
|
||||
|
||||
if (CollectionUtils.isEmpty(listeners)) {
|
||||
if (CollUtil.isEmpty(listeners)) {
|
||||
listeners = Collections.EMPTY_LIST;
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.aizuda.snailjob.client.job.core.register.scan;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.aizuda.snailjob.client.job.core.IJobExecutor;
|
||||
import com.aizuda.snailjob.client.job.core.Scanner;
|
||||
import com.aizuda.snailjob.client.job.core.annotation.JobExecutor;
|
||||
@ -15,7 +16,6 @@ import org.springframework.context.ApplicationContextAware;
|
||||
import org.springframework.core.MethodIntrospector;
|
||||
import org.springframework.core.annotation.AnnotatedElementUtils;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.ReflectionUtils;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
@ -86,7 +86,7 @@ public class JobExecutorScanner implements Scanner, ApplicationContextAware {
|
||||
|
||||
}
|
||||
|
||||
if (CollectionUtils.isEmpty(annotatedMethods)) {
|
||||
if (CollUtil.isEmpty(annotatedMethods)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.aizuda.snailjob.client.core.intercepter;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.aizuda.snailjob.client.common.cache.GroupVersionCache;
|
||||
@ -30,7 +31,6 @@ import org.springframework.aop.AfterAdvice;
|
||||
import org.springframework.core.Ordered;
|
||||
import org.springframework.core.annotation.AnnotatedElementUtils;
|
||||
import org.springframework.core.env.StandardEnvironment;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.lang.reflect.Method;
|
||||
@ -46,7 +46,7 @@ import java.util.*;
|
||||
public class SnailRetryInterceptor implements MethodInterceptor, AfterAdvice, Serializable, Ordered {
|
||||
|
||||
private static final DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||
private static String retryErrorMoreThresholdTextMessageFormatter =
|
||||
private static final String retryErrorMoreThresholdTextMessageFormatter =
|
||||
"<font face=\"微软雅黑\" color=#ff0000 size=4>{}环境 重试组件异常</font> \n" +
|
||||
"> IP:{} \n" +
|
||||
"> 空间ID:{} \n" +
|
||||
@ -278,7 +278,7 @@ public class SnailRetryInterceptor implements MethodInterceptor, AfterAdvice, Se
|
||||
Set<Class<? extends Throwable>> exclude = retryerInfo.getExclude();
|
||||
Set<Class<? extends Throwable>> include = retryerInfo.getInclude();
|
||||
|
||||
if (CollectionUtils.isEmpty(include) && CollectionUtils.isEmpty(exclude)) {
|
||||
if (CollUtil.isEmpty(include) && CollUtil.isEmpty(exclude)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -288,7 +288,7 @@ public class SnailRetryInterceptor implements MethodInterceptor, AfterAdvice, Se
|
||||
}
|
||||
}
|
||||
|
||||
if (!CollectionUtils.isEmpty(exclude)) {
|
||||
if (CollUtil.isNotEmpty(exclude)) {
|
||||
for (Class<? extends Throwable> e : exclude) {
|
||||
if (e.isAssignableFrom(throwable.getClass())) {
|
||||
return false;
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.aizuda.snailjob.client.core.loader;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.ServiceLoaderUtil;
|
||||
import com.aizuda.snailjob.client.core.RetryArgSerializer;
|
||||
import com.aizuda.snailjob.client.core.RetrySiteSnapshotContext;
|
||||
@ -11,7 +12,6 @@ import com.aizuda.snailjob.client.core.serializer.JacksonSerializer;
|
||||
import com.aizuda.snailjob.common.core.expression.ExpressionEngine;
|
||||
import com.aizuda.snailjob.common.core.expression.ExpressionFactory;
|
||||
import com.aizuda.snailjob.common.core.expression.strategy.SpELExpressionEngine;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
@ -47,7 +47,7 @@ public class SnailRetrySpiLoader {
|
||||
*/
|
||||
public static List<SnailJobListener> loadSnailJobListener() {
|
||||
List<SnailJobListener> snailJobListeners = ServiceLoaderUtil.loadList(SnailJobListener.class);
|
||||
if (CollectionUtils.isEmpty(snailJobListeners)) {
|
||||
if (CollUtil.isEmpty(snailJobListeners)) {
|
||||
return Collections.singletonList(new SimpleSnailRetryListener());
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.aizuda.snailjob.common.core.alarm.strategy;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.http.ContentType;
|
||||
import cn.hutool.http.HttpRequest;
|
||||
@ -16,7 +17,6 @@ import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.text.MessageFormat;
|
||||
import java.util.Collections;
|
||||
@ -110,7 +110,7 @@ public class LarkAlarm extends AbstractAlarm<AlarmContext> {
|
||||
}
|
||||
|
||||
public String getAtText(String text, List<String> ats) {
|
||||
if (CollectionUtils.isEmpty(ats)) {
|
||||
if (CollUtil.isEmpty(ats)) {
|
||||
return "";
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.aizuda.snailjob.common.core.handler;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.aizuda.snailjob.common.core.exception.AbstractError;
|
||||
import com.aizuda.snailjob.common.core.exception.BaseSnailJobException;
|
||||
import com.aizuda.snailjob.common.core.exception.SnailJobAuthenticationException;
|
||||
@ -10,7 +11,6 @@ import jakarta.validation.ConstraintViolationException;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.TypeMismatchException;
|
||||
import org.springframework.http.converter.HttpMessageNotReadableException;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.validation.BindingResult;
|
||||
import org.springframework.validation.FieldError;
|
||||
import org.springframework.web.HttpMediaTypeNotSupportedException;
|
||||
@ -87,7 +87,7 @@ public class RestExceptionHandler {
|
||||
@ExceptionHandler(ConstraintViolationException.class)
|
||||
public Result onConstraintViolationException(ConstraintViolationException e) {
|
||||
Set<ConstraintViolation<?>> constraintViolations = e.getConstraintViolations();
|
||||
if (!CollectionUtils.isEmpty(constraintViolations)) {
|
||||
if (CollUtil.isNotEmpty(constraintViolations)) {
|
||||
String errorMessage = StreamUtils.join(constraintViolations, ConstraintViolation::getMessage, ";");
|
||||
return new Result(0, errorMessage);
|
||||
}
|
||||
@ -107,7 +107,7 @@ public class RestExceptionHandler {
|
||||
if (result != null && result.hasErrors()) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
List<FieldError> errors = result.getFieldErrors();
|
||||
if (!CollectionUtils.isEmpty(errors)) {
|
||||
if (CollUtil.isNotEmpty(errors)) {
|
||||
FieldError error = errors.get(0);
|
||||
String rejectedValue = Objects.toString(error.getRejectedValue(), "");
|
||||
String defMsg = error.getDefaultMessage();
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.aizuda.snailjob.common.core.util;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.aizuda.snailjob.common.core.constant.SystemConstants;
|
||||
import com.aizuda.snailjob.common.log.SnailJobLog;
|
||||
@ -7,7 +8,6 @@ import com.dingtalk.api.DefaultDingTalkClient;
|
||||
import com.dingtalk.api.DingTalkClient;
|
||||
import com.dingtalk.api.request.OapiRobotSendRequest;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.text.MessageFormat;
|
||||
import java.util.List;
|
||||
@ -40,14 +40,14 @@ public class DingDingUtils {
|
||||
OapiRobotSendRequest.At at = new OapiRobotSendRequest.At();
|
||||
at.setAtMobiles(ats);
|
||||
request.setAt(at);
|
||||
if (!CollectionUtils.isEmpty(ats)) {
|
||||
if (CollUtil.isNotEmpty(ats)) {
|
||||
at.setIsAtAll(ats.stream().map(String::toLowerCase).anyMatch(SystemConstants.AT_ALL::equals));
|
||||
}
|
||||
return request;
|
||||
}
|
||||
|
||||
public static String getAtText(List<String> ats, String text, String atLabel) {
|
||||
if (CollectionUtils.isEmpty(ats)) {
|
||||
if (CollUtil.isEmpty(ats)) {
|
||||
return text;
|
||||
}
|
||||
StringBuilder sb = new StringBuilder(text);
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.aizuda.snailjob.template.datasource.access.config;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.aizuda.snailjob.common.core.enums.JobNotifySceneEnum;
|
||||
import com.aizuda.snailjob.common.core.enums.NodeTypeEnum;
|
||||
import com.aizuda.snailjob.common.core.enums.RetryNotifySceneEnum;
|
||||
@ -21,7 +22,6 @@ import com.aizuda.snailjob.template.datasource.persistence.po.RetrySceneConfig;
|
||||
import com.aizuda.snailjob.template.datasource.utils.DbUtils;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
@ -120,7 +120,7 @@ public abstract class AbstractConfigAccess<T> implements ConfigAccess<T> {
|
||||
}
|
||||
|
||||
List<RetrySceneConfig> retrySceneConfigs = sceneConfigMapper.selectList(sceneConfigLambdaQueryWrapper);
|
||||
if (CollectionUtils.isEmpty(retrySceneConfigs)) {
|
||||
if (CollUtil.isEmpty(retrySceneConfigs)) {
|
||||
return new HashSet<>();
|
||||
}
|
||||
|
||||
@ -133,7 +133,7 @@ public abstract class AbstractConfigAccess<T> implements ConfigAccess<T> {
|
||||
new LambdaQueryWrapper<GroupConfig>()
|
||||
.eq(GroupConfig::getNamespaceId, namespaceId)
|
||||
.orderByAsc(GroupConfig::getId));
|
||||
if (CollectionUtils.isEmpty(allSystemConfigGroupList)) {
|
||||
if (CollUtil.isEmpty(allSystemConfigGroupList)) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
@ -144,7 +144,7 @@ public abstract class AbstractConfigAccess<T> implements ConfigAccess<T> {
|
||||
public List<RetrySceneConfig> getAllConfigSceneList() {
|
||||
List<RetrySceneConfig> allSystemConfigSceneList = sceneConfigMapper.selectList(
|
||||
new LambdaQueryWrapper<RetrySceneConfig>().orderByAsc(RetrySceneConfig::getId));
|
||||
if (CollectionUtils.isEmpty(allSystemConfigSceneList)) {
|
||||
if (CollUtil.isEmpty(allSystemConfigSceneList)) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
return allSystemConfigSceneList;
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.aizuda.snailjob.template.datasource.utils;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.aizuda.snailjob.common.core.context.SpringContext;
|
||||
import com.aizuda.snailjob.template.datasource.exception.SnailJobDatasourceException;
|
||||
@ -100,7 +101,7 @@ public class RequestDataHelper {
|
||||
|
||||
public static Integer getPartition() {
|
||||
Map<String, Object> requestData = getRequestData();
|
||||
if (CollectionUtils.isEmpty(requestData)) {
|
||||
if (CollUtil.isEmpty(requestData)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.aizuda.snailjob.server.common.alarm;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.aizuda.snailjob.common.core.alarm.Alarm;
|
||||
import com.aizuda.snailjob.common.core.alarm.AlarmContext;
|
||||
import com.aizuda.snailjob.common.core.alarm.SnailJobAlarmFactory;
|
||||
@ -29,7 +30,6 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.context.ApplicationEvent;
|
||||
import org.springframework.scheduling.TaskScheduler;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.util.*;
|
||||
@ -60,7 +60,7 @@ public abstract class AbstractAlarm<E extends ApplicationEvent, A extends AlarmI
|
||||
try {
|
||||
// 从队列获取数据
|
||||
List<A> alarmInfos = poll();
|
||||
if (CollectionUtils.isEmpty(alarmInfos)) {
|
||||
if (CollUtil.isEmpty(alarmInfos)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -108,7 +108,7 @@ public abstract class AbstractAlarm<E extends ApplicationEvent, A extends AlarmI
|
||||
.in(NotifyConfig::getGroupName, groupNames)
|
||||
.in(NotifyConfig::getBusinessId, businessIds)
|
||||
);
|
||||
if (CollectionUtils.isEmpty(notifyConfigs)) {
|
||||
if (CollUtil.isEmpty(notifyConfigs)) {
|
||||
return Maps.newHashMap();
|
||||
}
|
||||
|
||||
@ -119,7 +119,7 @@ public abstract class AbstractAlarm<E extends ApplicationEvent, A extends AlarmI
|
||||
List<NotifyRecipient> notifyRecipients = recipientMapper.selectBatchIds(recipientIds);
|
||||
Map<Long, NotifyRecipient> recipientMap = StreamUtils.toIdentityMap(notifyRecipients, NotifyRecipient::getId);
|
||||
|
||||
if (CollectionUtils.isEmpty(recipientIds)) {
|
||||
if (CollUtil.isEmpty(recipientIds)) {
|
||||
return Maps.newHashMap();
|
||||
}
|
||||
|
||||
|
@ -16,11 +16,11 @@
|
||||
*/
|
||||
package com.aizuda.snailjob.server.common.allocate.server;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.aizuda.snailjob.server.common.ServerLoadBalance;
|
||||
import com.aizuda.snailjob.server.common.allocate.common.ConsistentHashRouter;
|
||||
import com.aizuda.snailjob.server.common.allocate.common.HashFunction;
|
||||
import com.aizuda.snailjob.server.common.allocate.common.Node;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
@ -57,10 +57,10 @@ public class AllocateMessageQueueConsistentHash implements ServerLoadBalance<Str
|
||||
if (currentCID == null || currentCID.length() < 1) {
|
||||
throw new IllegalArgumentException("currentCID is empty");
|
||||
}
|
||||
if (CollectionUtils.isEmpty(groupList)) {
|
||||
if (CollUtil.isEmpty(groupList)) {
|
||||
throw new IllegalArgumentException("groupList is null or groupList empty");
|
||||
}
|
||||
if (CollectionUtils.isEmpty(serverList)) {
|
||||
if (CollUtil.isEmpty(serverList)) {
|
||||
throw new IllegalArgumentException("serverList is null or serverList empty");
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.aizuda.snailjob.server.common.cache;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.aizuda.snailjob.common.core.context.SpringContext;
|
||||
import com.aizuda.snailjob.common.core.enums.NodeTypeEnum;
|
||||
import com.aizuda.snailjob.common.core.util.StreamUtils;
|
||||
@ -17,7 +18,6 @@ import com.google.common.cache.CacheBuilder;
|
||||
import com.google.common.collect.Sets;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
@ -48,7 +48,7 @@ public class CacheRegisterTable implements Lifecycle {
|
||||
*/
|
||||
public static Set<RegisterNodeInfo> getAllPods() {
|
||||
ConcurrentMap<Pair<String, String>, ConcurrentMap<String, RegisterNodeInfo>> concurrentMap = CACHE.asMap();
|
||||
if (CollectionUtils.isEmpty(concurrentMap)) {
|
||||
if (CollUtil.isEmpty(concurrentMap)) {
|
||||
return Sets.newHashSet();
|
||||
}
|
||||
|
||||
@ -87,14 +87,14 @@ public class CacheRegisterTable implements Lifecycle {
|
||||
.eq(ServerNode::getGroupName, groupName)
|
||||
.eq(ServerNode::getHostId, hostId)
|
||||
.orderByDesc(ServerNode::getExpireAt));
|
||||
if (CollectionUtils.isEmpty(serverNodes)) {
|
||||
if (CollUtil.isEmpty(serverNodes)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
CacheRegisterTable.addOrUpdate(serverNodes.get(0));
|
||||
|
||||
concurrentMap = CACHE.getIfPresent(getKey(groupName, namespaceId));
|
||||
if (CollectionUtils.isEmpty(concurrentMap)) {
|
||||
if (CollUtil.isEmpty(concurrentMap)) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@ -109,7 +109,7 @@ public class CacheRegisterTable implements Lifecycle {
|
||||
*/
|
||||
public static Set<RegisterNodeInfo> getServerNodeSet(String groupName, String namespaceId) {
|
||||
ConcurrentMap<String, RegisterNodeInfo> concurrentMap = CACHE.getIfPresent(getKey(groupName, namespaceId));
|
||||
if (CollectionUtils.isEmpty(concurrentMap)) {
|
||||
if (CollUtil.isEmpty(concurrentMap)) {
|
||||
|
||||
// 此处为了降级,若缓存中没有则取DB中查询
|
||||
ServerNodeMapper serverNodeMapper = SpringContext.getBeanByType(ServerNodeMapper.class);
|
||||
@ -124,7 +124,7 @@ public class CacheRegisterTable implements Lifecycle {
|
||||
}
|
||||
|
||||
concurrentMap = CACHE.getIfPresent(getKey(groupName, namespaceId));
|
||||
if (CollectionUtils.isEmpty(serverNodes) || CollectionUtils.isEmpty(concurrentMap)) {
|
||||
if (CollUtil.isEmpty(serverNodes) || CollUtil.isEmpty(concurrentMap)) {
|
||||
return Sets.newHashSet();
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.aizuda.snailjob.server.common.generator.id;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.lang.Pair;
|
||||
import com.aizuda.snailjob.common.core.util.StreamUtils;
|
||||
import com.aizuda.snailjob.common.log.SnailJobLog;
|
||||
@ -13,7 +14,6 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.concurrent.*;
|
||||
@ -91,7 +91,7 @@ public class SegmentIdGenerator implements IdGenerator, Lifecycle {
|
||||
List<SequenceAlloc> sequenceAllocs = sequenceAllocMapper
|
||||
.selectList(new LambdaQueryWrapper<SequenceAlloc>()
|
||||
.select(SequenceAlloc::getGroupName, SequenceAlloc::getNamespaceId));
|
||||
if (CollectionUtils.isEmpty(sequenceAllocs)) {
|
||||
if (CollUtil.isEmpty(sequenceAllocs)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.aizuda.snailjob.server.common.handler;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.aizuda.snailjob.common.core.util.StreamUtils;
|
||||
import com.aizuda.snailjob.common.log.SnailJobLog;
|
||||
import com.aizuda.snailjob.server.common.ClientLoadBalance;
|
||||
@ -9,7 +10,6 @@ import com.aizuda.snailjob.server.common.dto.RegisterNodeInfo;
|
||||
import com.aizuda.snailjob.template.datasource.access.AccessTemplate;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.TreeSet;
|
||||
@ -34,7 +34,7 @@ public class ClientNodeAllocateHandler {
|
||||
public RegisterNodeInfo getServerNode(String allocKey, String groupName, String namespaceId, Integer routeKey) {
|
||||
|
||||
Set<RegisterNodeInfo> serverNodes = CacheRegisterTable.getServerNodeSet(groupName, namespaceId);
|
||||
if (CollectionUtils.isEmpty(serverNodes)) {
|
||||
if (CollUtil.isEmpty(serverNodes)) {
|
||||
SnailJobLog.LOCAL.warn("client node is null. groupName:[{}]", groupName);
|
||||
return null;
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.aizuda.snailjob.server.common.handler;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.aizuda.snailjob.common.core.enums.NodeTypeEnum;
|
||||
import com.aizuda.snailjob.common.core.util.StreamUtils;
|
||||
import com.aizuda.snailjob.common.log.SnailJobLog;
|
||||
@ -19,7 +20,6 @@ import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
@ -61,13 +61,13 @@ public class ServerNodeBalance implements Lifecycle, Runnable {
|
||||
// 为了保证客户端分配算法的一致性,serverNodes 从数据库从数据获取
|
||||
Set<String> podIpSet = CacheRegisterTable.getPodIdSet(ServerRegister.GROUP_NAME, ServerRegister.NAMESPACE_ID);
|
||||
|
||||
if (CollectionUtils.isEmpty(podIpSet)) {
|
||||
if (CollUtil.isEmpty(podIpSet)) {
|
||||
SnailJobLog.LOCAL.error("server node is empty");
|
||||
}
|
||||
|
||||
// 删除本地缓存的消费桶的信息
|
||||
DistributeInstance.INSTANCE.clearConsumerBucket();
|
||||
if (CollectionUtils.isEmpty(podIpSet)) {
|
||||
if (CollUtil.isEmpty(podIpSet)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -165,7 +165,7 @@ public class ServerNodeBalance implements Lifecycle, Runnable {
|
||||
Set<String> localHostIds = StreamUtils.toSet(concurrentMap.values(), RegisterNodeInfo::getHostId);
|
||||
|
||||
// 无缓存的节点触发refreshCache
|
||||
if (CollectionUtils.isEmpty(concurrentMap)
|
||||
if (CollUtil.isEmpty(concurrentMap)
|
||||
// 节点数量不一致触发
|
||||
|| isNodeSizeNotEqual(concurrentMap.size(), remotePods.size())
|
||||
// 判断远程节点是不是和本地节点一致的,如果不一致则重新分配
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.aizuda.snailjob.server.common.register;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.aizuda.snailjob.common.core.enums.NodeTypeEnum;
|
||||
@ -17,7 +18,6 @@ import com.google.common.collect.Lists;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.boot.autoconfigure.web.ServerProperties;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
@ -90,9 +90,9 @@ public class ServerRegister extends AbstractRegister {
|
||||
// 同步当前POD消费的组的节点信息
|
||||
// netty的client只会注册到一个服务端,若组分配的和client连接的不是一个POD则会导致当前POD没有其他客户端的注册信息
|
||||
ConcurrentMap<String /*groupName*/, Set<String>/*namespaceId*/> allConsumerGroupName = CacheConsumerGroup.getAllConsumerGroupName();
|
||||
if (!CollectionUtils.isEmpty(allConsumerGroupName)) {
|
||||
if (CollUtil.isNotEmpty(allConsumerGroupName)) {
|
||||
Set<String> namespaceIdSets = StreamUtils.toSetByFlatMap(allConsumerGroupName.values(), Set::stream);
|
||||
if (CollectionUtils.isEmpty(namespaceIdSets)) {
|
||||
if (CollUtil.isEmpty(namespaceIdSets)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.aizuda.snailjob.server.common.rpc.server.handler;
|
||||
|
||||
import akka.actor.ActorRef;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import cn.hutool.core.net.url.UrlQuery;
|
||||
import com.aizuda.snailjob.common.core.constant.SystemConstants;
|
||||
@ -23,7 +24,6 @@ import com.google.common.collect.Lists;
|
||||
import io.netty.handler.codec.http.HttpHeaders;
|
||||
import io.netty.handler.codec.http.HttpMethod;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
@ -74,12 +74,12 @@ public class ReportLogHttpRequestHandler extends PostHttpRequestHandler {
|
||||
}
|
||||
|
||||
// 批量新增日志数据
|
||||
if (!CollectionUtils.isEmpty(jobTasks)) {
|
||||
if (CollUtil.isNotEmpty(jobTasks)) {
|
||||
ActorRef actorRef = ActorGenerator.jobLogActor();
|
||||
actorRef.tell(jobTasks, actorRef);
|
||||
}
|
||||
|
||||
if (!CollectionUtils.isEmpty(retryTasks)) {
|
||||
if (CollUtil.isNotEmpty(retryTasks)) {
|
||||
ActorRef actorRef = ActorGenerator.logActor();
|
||||
actorRef.tell(retryTasks, actorRef);
|
||||
}
|
||||
|
@ -1,12 +1,12 @@
|
||||
package com.aizuda.snailjob.server.job.task.support.cache;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.aizuda.snailjob.server.common.util.GraphUtils;
|
||||
import com.google.common.cache.Cache;
|
||||
import com.google.common.cache.CacheBuilder;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Sets;
|
||||
import com.google.common.graph.MutableGraph;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
@ -63,7 +63,7 @@ public class MutableGraphCache {
|
||||
MutableGraph<Long> graph = getOrDefault(workflowBatchId, jsonGraph);
|
||||
List<Long> leaves = Lists.newArrayList();
|
||||
for (Long node : graph.nodes()) {
|
||||
if (CollectionUtils.isEmpty(graph.successors(node))) {
|
||||
if (CollUtil.isEmpty(graph.successors(node))) {
|
||||
leaves.add(node);
|
||||
}
|
||||
}
|
||||
@ -79,7 +79,7 @@ public class MutableGraphCache {
|
||||
|
||||
public static Set<Long> getBrotherNode(MutableGraph<Long> graph, Long nodeId) {
|
||||
Set<Long> predecessors = graph.predecessors(nodeId);
|
||||
if (CollectionUtils.isEmpty(predecessors)) {
|
||||
if (CollUtil.isEmpty(predecessors)) {
|
||||
return Sets.newHashSet();
|
||||
}
|
||||
return graph.successors(predecessors.stream().findFirst().get());
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.aizuda.snailjob.server.job.task.support.dispatch;
|
||||
|
||||
import akka.actor.AbstractActor;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import com.aizuda.snailjob.common.core.context.SpringContext;
|
||||
import com.aizuda.snailjob.common.core.enums.JobOperationReasonEnum;
|
||||
@ -52,7 +53,6 @@ import org.springframework.transaction.support.TransactionCallbackWithoutResult;
|
||||
import org.springframework.transaction.support.TransactionSynchronization;
|
||||
import org.springframework.transaction.support.TransactionSynchronizationManager;
|
||||
import org.springframework.transaction.support.TransactionTemplate;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.time.LocalDateTime;
|
||||
@ -112,7 +112,7 @@ public class JobExecutorActor extends AbstractActor {
|
||||
if (Objects.isNull(job)) {
|
||||
taskStatus = JobTaskBatchStatusEnum.CANCEL.getStatus();
|
||||
operationReason = JobOperationReasonEnum.JOB_CLOSED.getReason();
|
||||
} else if (CollectionUtils.isEmpty(CacheRegisterTable.getServerNodeSet(job.getGroupName(),
|
||||
} else if (CollUtil.isEmpty(CacheRegisterTable.getServerNodeSet(job.getGroupName(),
|
||||
job.getNamespaceId()))) {
|
||||
taskStatus = JobTaskBatchStatusEnum.CANCEL.getStatus();
|
||||
operationReason = JobOperationReasonEnum.NOT_CLIENT.getReason();
|
||||
@ -138,7 +138,7 @@ public class JobExecutorActor extends AbstractActor {
|
||||
JobTaskGenerateContext instanceGenerateContext = JobTaskConverter.INSTANCE.toJobTaskInstanceGenerateContext(job);
|
||||
instanceGenerateContext.setTaskBatchId(taskExecute.getTaskBatchId());
|
||||
List<JobTask> taskList = taskInstance.generate(instanceGenerateContext);
|
||||
if (CollectionUtils.isEmpty(taskList)) {
|
||||
if (CollUtil.isEmpty(taskList)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.aizuda.snailjob.server.job.task.support.dispatch;
|
||||
|
||||
import akka.actor.AbstractActor;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.aizuda.snailjob.common.core.util.JsonUtil;
|
||||
import com.aizuda.snailjob.common.core.util.StreamUtils;
|
||||
@ -16,7 +17,6 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
@ -39,7 +39,7 @@ public class JobLogActor extends AbstractActor {
|
||||
return receiveBuilder()
|
||||
.match(List.class, (list -> {
|
||||
try {
|
||||
if (CollectionUtils.isEmpty(list)) {
|
||||
if (CollUtil.isEmpty(list)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.aizuda.snailjob.server.job.task.support.dispatch;
|
||||
|
||||
import akka.actor.AbstractActor;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.aizuda.snailjob.common.core.context.SpringContext;
|
||||
import com.aizuda.snailjob.server.common.akka.ActorGenerator;
|
||||
import com.aizuda.snailjob.server.common.enums.JobTaskExecutorSceneEnum;
|
||||
@ -16,7 +17,6 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ -71,7 +71,7 @@ public class JobTaskPrepareActor extends AbstractActor {
|
||||
.selectList(queryWrapper);
|
||||
|
||||
// 说明所以任务已经完成
|
||||
if (CollectionUtils.isEmpty(notCompleteJobTaskBatchList)) {
|
||||
if (CollUtil.isEmpty(notCompleteJobTaskBatchList)) {
|
||||
TerminalJobPrepareHandler terminalJobPrepareHandler = SpringContext.getBeanByType(TerminalJobPrepareHandler.class);
|
||||
terminalJobPrepareHandler.handle(prepare);
|
||||
} else {
|
||||
|
@ -2,6 +2,7 @@ package com.aizuda.snailjob.server.job.task.support.dispatch;
|
||||
|
||||
import akka.actor.AbstractActor;
|
||||
import akka.actor.ActorRef;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.aizuda.snailjob.common.core.constant.SystemConstants;
|
||||
import com.aizuda.snailjob.common.core.enums.StatusEnum;
|
||||
import com.aizuda.snailjob.common.core.util.StreamUtils;
|
||||
@ -31,7 +32,6 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
@ -72,7 +72,7 @@ public class ScanJobTaskActor extends AbstractActor {
|
||||
}
|
||||
|
||||
private void doScan(final ScanTask scanTask) {
|
||||
if (CollectionUtils.isEmpty(scanTask.getBuckets())) {
|
||||
if (CollUtil.isEmpty(scanTask.getBuckets())) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -159,7 +159,7 @@ public class ScanJobTaskActor extends AbstractActor {
|
||||
}
|
||||
|
||||
private List<JobPartitionTaskDTO> listAvailableJobs(Long startId, ScanTask scanTask) {
|
||||
if (CollectionUtils.isEmpty(scanTask.getBuckets())) {
|
||||
if (CollUtil.isEmpty(scanTask.getBuckets())) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@ -179,7 +179,7 @@ public class ScanJobTaskActor extends AbstractActor {
|
||||
).getRecords();
|
||||
|
||||
// 过滤已关闭的组
|
||||
if (!CollectionUtils.isEmpty(jobs)) {
|
||||
if (CollUtil.isNotEmpty(jobs)) {
|
||||
List<String> groupConfigs = StreamUtils.toList(groupConfigMapper.selectList(new LambdaQueryWrapper<GroupConfig>()
|
||||
.select(GroupConfig::getGroupName)
|
||||
.eq(GroupConfig::getGroupStatus, StatusEnum.YES.getStatus())
|
||||
|
@ -2,6 +2,7 @@ package com.aizuda.snailjob.server.job.task.support.dispatch;
|
||||
|
||||
import akka.actor.AbstractActor;
|
||||
import akka.actor.ActorRef;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.RandomUtil;
|
||||
import com.aizuda.snailjob.common.core.constant.SystemConstants;
|
||||
import com.aizuda.snailjob.common.core.enums.StatusEnum;
|
||||
@ -31,7 +32,6 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.math.RoundingMode;
|
||||
import java.util.ArrayList;
|
||||
@ -126,7 +126,7 @@ public class ScanWorkflowTaskActor extends AbstractActor {
|
||||
}
|
||||
|
||||
private List<WorkflowPartitionTaskDTO> listAvailableWorkflows(Long startId, ScanTask scanTask) {
|
||||
if (CollectionUtils.isEmpty(scanTask.getBuckets())) {
|
||||
if (CollUtil.isEmpty(scanTask.getBuckets())) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@ -144,7 +144,7 @@ public class ScanWorkflowTaskActor extends AbstractActor {
|
||||
).getRecords();
|
||||
|
||||
// 过滤已关闭的组
|
||||
if (!CollectionUtils.isEmpty(workflows)) {
|
||||
if (CollUtil.isNotEmpty(workflows)) {
|
||||
List<String> groupConfigs = StreamUtils.toList(groupConfigMapper.selectList(new LambdaQueryWrapper<GroupConfig>()
|
||||
.select(GroupConfig::getGroupName)
|
||||
.eq(GroupConfig::getGroupStatus, StatusEnum.YES.getStatus())
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.aizuda.snailjob.server.job.task.support.dispatch;
|
||||
|
||||
import akka.actor.AbstractActor;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import com.aizuda.snailjob.common.core.constant.SystemConstants;
|
||||
import com.aizuda.snailjob.common.core.context.SpringContext;
|
||||
@ -34,7 +35,6 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.time.LocalDateTime;
|
||||
@ -103,7 +103,7 @@ public class WorkflowExecutorActor extends AbstractActor {
|
||||
MutableGraph<Long> graph = MutableGraphCache.getOrDefault(workflowTaskBatch.getId(), flowInfo);
|
||||
|
||||
Set<Long> successors = graph.successors(taskExecute.getParentId());
|
||||
if (CollectionUtils.isEmpty(successors)) {
|
||||
if (CollUtil.isEmpty(successors)) {
|
||||
workflowBatchHandler.complete(taskExecute.getWorkflowTaskBatchId(), workflowTaskBatch);
|
||||
return;
|
||||
}
|
||||
@ -129,7 +129,7 @@ public class WorkflowExecutorActor extends AbstractActor {
|
||||
List<JobTaskBatch> parentJobTaskBatchList = jobTaskBatchMap.get(taskExecute.getParentId());
|
||||
|
||||
// 如果父节点是无需处理则不再继续执行
|
||||
if (!CollectionUtils.isEmpty(parentJobTaskBatchList) &&
|
||||
if (CollUtil.isNotEmpty(parentJobTaskBatchList) &&
|
||||
parentJobTaskBatchList.stream()
|
||||
.map(JobTaskBatch::getOperationReason)
|
||||
.filter(Objects::nonNull)
|
||||
@ -139,7 +139,7 @@ public class WorkflowExecutorActor extends AbstractActor {
|
||||
}
|
||||
|
||||
// 失败策略处理
|
||||
if (!CollectionUtils.isEmpty(parentJobTaskBatchList)
|
||||
if (CollUtil.isNotEmpty(parentJobTaskBatchList)
|
||||
&& parentJobTaskBatchList.stream()
|
||||
.map(JobTaskBatch::getTaskBatchStatus)
|
||||
.anyMatch(i -> i != JobTaskBatchStatusEnum.SUCCESS.getStatus())) {
|
||||
@ -169,7 +169,7 @@ public class WorkflowExecutorActor extends AbstractActor {
|
||||
|
||||
// 批次已经存在就不在重复生成
|
||||
List<JobTaskBatch> jobTaskBatchList = jobTaskBatchMap.get(workflowNode.getId());
|
||||
if (!CollectionUtils.isEmpty(jobTaskBatchList)) {
|
||||
if (CollUtil.isNotEmpty(jobTaskBatchList)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -202,7 +202,7 @@ public class WorkflowExecutorActor extends AbstractActor {
|
||||
for (final Long nodeId : brotherNode) {
|
||||
List<JobTaskBatch> jobTaskBatches = jobTaskBatchMap.get(nodeId);
|
||||
// 说明此节点未执行, 继续等待执行完成
|
||||
if (CollectionUtils.isEmpty(jobTaskBatches)) {
|
||||
if (CollUtil.isEmpty(jobTaskBatches)) {
|
||||
SnailJobLog.LOCAL.debug("存在未完成的兄弟节点. [{}]", nodeId);
|
||||
return Boolean.FALSE;
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.aizuda.snailjob.server.job.task.support.dispatch;
|
||||
|
||||
import akka.actor.AbstractActor;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.aizuda.snailjob.server.common.akka.ActorGenerator;
|
||||
import com.aizuda.snailjob.server.job.task.dto.WorkflowTaskPrepareDTO;
|
||||
import com.aizuda.snailjob.server.job.task.support.WorkflowPrePareHandler;
|
||||
@ -12,7 +13,6 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ -50,7 +50,7 @@ public class WorkflowTaskPrepareActor extends AbstractActor {
|
||||
.in(WorkflowTaskBatch::getTaskBatchStatus, NOT_COMPLETE));
|
||||
|
||||
// 则直接创建一个任务批次
|
||||
if (CollectionUtils.isEmpty(workflowTaskBatches)) {
|
||||
if (CollUtil.isEmpty(workflowTaskBatches)) {
|
||||
for (WorkflowPrePareHandler workflowPrePareHandler : workflowPrePareHandlers) {
|
||||
// 终态任务
|
||||
if (workflowPrePareHandler.matches(null)) {
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.aizuda.snailjob.server.job.task.support.executor.workflow;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.aizuda.snailjob.common.core.enums.JobArgsTypeEnum;
|
||||
@ -23,7 +24,6 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.transaction.TransactionStatus;
|
||||
import org.springframework.transaction.support.TransactionCallbackWithoutResult;
|
||||
import org.springframework.transaction.support.TransactionTemplate;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.text.MessageFormat;
|
||||
import java.time.Duration;
|
||||
@ -67,7 +67,7 @@ public abstract class AbstractWorkflowExecutor implements WorkflowExecutor, Init
|
||||
.eq(JobTaskBatch::getWorkflowNodeId, context.getWorkflowNodeId())
|
||||
);
|
||||
|
||||
if (!CollectionUtils.isEmpty(jobTaskBatches)) {
|
||||
if (CollUtil.isNotEmpty(jobTaskBatches)) {
|
||||
total = jobTaskBatches.size();
|
||||
JobTaskBatch jobTaskBatch = jobTaskBatches.get(0);
|
||||
if (WORKFLOW_SUCCESSOR_SKIP_EXECUTION.contains(jobTaskBatch.getOperationReason())) {
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.aizuda.snailjob.server.job.task.support.executor.workflow;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.aizuda.snailjob.common.core.constant.SystemConstants;
|
||||
@ -24,7 +25,6 @@ import com.google.common.collect.Lists;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
@ -79,7 +79,7 @@ public class DecisionWorkflowExecutor extends AbstractWorkflowExecutor {
|
||||
.eq(JobTask::getTaskBatchId, context.getTaskBatchId()));
|
||||
List<String> taskResult = Lists.newArrayList();
|
||||
Boolean tempResult = null;
|
||||
if (CollectionUtils.isEmpty(jobTasks)) {
|
||||
if (CollUtil.isEmpty(jobTasks)) {
|
||||
tempResult = (Boolean) Optional.ofNullable(expressionEngine.eval(decisionConfig.getNodeExpression(), StrUtil.EMPTY)).orElse(Boolean.FALSE);
|
||||
} else {
|
||||
for (JobTask jobTask : jobTasks) {
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.aizuda.snailjob.server.job.task.support.generator.batch;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import com.aizuda.snailjob.common.core.enums.JobOperationReasonEnum;
|
||||
import com.aizuda.snailjob.common.core.enums.JobTaskBatchStatusEnum;
|
||||
@ -21,7 +22,6 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.dao.DuplicateKeyException;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.time.LocalDateTime;
|
||||
@ -53,7 +53,7 @@ public class JobTaskBatchGenerator {
|
||||
|
||||
// 无执行的节点
|
||||
if (Objects.isNull(context.getOperationReason()) && Objects.isNull(context.getTaskBatchStatus()) &&
|
||||
CollectionUtils.isEmpty(CacheRegisterTable.getServerNodeSet(context.getGroupName(), context.getNamespaceId()))) {
|
||||
CollUtil.isEmpty(CacheRegisterTable.getServerNodeSet(context.getGroupName(), context.getNamespaceId()))) {
|
||||
jobTaskBatch.setTaskBatchStatus(JobTaskBatchStatusEnum.CANCEL.getStatus());
|
||||
jobTaskBatch.setOperationReason(JobOperationReasonEnum.NOT_CLIENT.getReason());
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.aizuda.snailjob.server.job.task.support.generator.task;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.aizuda.snailjob.common.core.enums.JobTaskStatusEnum;
|
||||
@ -16,7 +17,6 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
@ -41,7 +41,7 @@ public class BroadcastTaskGenerator extends AbstractJobTaskGenerator {
|
||||
@Transactional
|
||||
public List<JobTask> doGenerate(JobTaskGenerateContext context) {
|
||||
Set<RegisterNodeInfo> serverNodes = CacheRegisterTable.getServerNodeSet(context.getGroupName(), context.getNamespaceId());
|
||||
if (CollectionUtils.isEmpty(serverNodes)) {
|
||||
if (CollUtil.isEmpty(serverNodes)) {
|
||||
log.error("无可执行的客户端信息. jobId:[{}]", context.getJobId());
|
||||
return Lists.newArrayList();
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.aizuda.snailjob.server.job.task.support.generator.task;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.aizuda.snailjob.common.core.enums.JobTaskStatusEnum;
|
||||
@ -17,7 +18,6 @@ import com.google.common.collect.Lists;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@ -50,7 +50,7 @@ public class ShardingTaskGenerator extends AbstractJobTaskGenerator {
|
||||
public List<JobTask> doGenerate(JobTaskGenerateContext context) {
|
||||
|
||||
Set<RegisterNodeInfo> serverNodes = CacheRegisterTable.getServerNodeSet(context.getGroupName(), context.getNamespaceId());
|
||||
if (CollectionUtils.isEmpty(serverNodes)) {
|
||||
if (CollUtil.isEmpty(serverNodes)) {
|
||||
log.error("无可执行的客户端信息. jobId:[{}]", context.getJobId());
|
||||
return Lists.newArrayList();
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.aizuda.snailjob.server.job.task.support.handler;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.aizuda.snailjob.common.core.context.SpringContext;
|
||||
import com.aizuda.snailjob.common.core.enums.JobTaskBatchStatusEnum;
|
||||
import com.aizuda.snailjob.common.core.enums.JobTaskStatusEnum;
|
||||
@ -17,7 +18,6 @@ import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
@ -49,7 +49,7 @@ public class JobTaskBatchHandler {
|
||||
JobTaskBatch jobTaskBatch = new JobTaskBatch();
|
||||
jobTaskBatch.setId(completeJobBatchDTO.getTaskBatchId());
|
||||
|
||||
if (CollectionUtils.isEmpty(jobTasks)) {
|
||||
if (CollUtil.isEmpty(jobTasks)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.aizuda.snailjob.server.job.task.support.handler;
|
||||
|
||||
import akka.actor.ActorRef;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import com.aizuda.snailjob.common.core.constant.SystemConstants;
|
||||
import com.aizuda.snailjob.common.core.context.SpringContext;
|
||||
@ -34,7 +35,6 @@ import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.support.TransactionSynchronization;
|
||||
import org.springframework.transaction.support.TransactionSynchronizationManager;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
@ -62,7 +62,7 @@ public class WorkflowBatchHandler {
|
||||
boolean isNeedProcess = true;
|
||||
for (Long nodeId : parentIds) {
|
||||
List<JobTaskBatch> jobTaskBatchList = currentWorkflowNodeMap.get(nodeId);
|
||||
if (CollectionUtils.isEmpty(jobTaskBatchList)) {
|
||||
if (CollUtil.isEmpty(jobTaskBatchList)) {
|
||||
// 递归查询有执行过的任务批次
|
||||
isNeedProcess = isNeedProcess || checkLeafCompleted(graph, currentWorkflowNodeMap, graph.predecessors(nodeId));
|
||||
continue;
|
||||
@ -101,7 +101,7 @@ public class WorkflowBatchHandler {
|
||||
.in(JobTaskBatch::getWorkflowNodeId, graph.nodes())
|
||||
);
|
||||
|
||||
if (CollectionUtils.isEmpty(jobTaskBatches)) {
|
||||
if (CollUtil.isEmpty(jobTaskBatches)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -121,7 +121,7 @@ public class WorkflowBatchHandler {
|
||||
List<Long> leaves = MutableGraphCache.getLeaves(workflowTaskBatchId, flowInfo);
|
||||
for (Long leaf : leaves) {
|
||||
List<JobTaskBatch> jobTaskBatchList = currentWorkflowNodeMap.getOrDefault(leaf, Lists.newArrayList());
|
||||
if (CollectionUtils.isEmpty(jobTaskBatchList)) {
|
||||
if (CollUtil.isEmpty(jobTaskBatchList)) {
|
||||
boolean isNeedProcess = checkLeafCompleted(graph, currentWorkflowNodeMap, graph.predecessors(leaf));
|
||||
// 说明当前叶子节点需要处理,但是未处理返回false
|
||||
if (isNeedProcess) {
|
||||
@ -184,7 +184,7 @@ public class WorkflowBatchHandler {
|
||||
.in(JobTaskBatch::getTaskBatchStatus, NOT_COMPLETE)
|
||||
.eq(JobTaskBatch::getWorkflowTaskBatchId, workflowTaskBatchId));
|
||||
|
||||
if (CollectionUtils.isEmpty(jobTaskBatches)) {
|
||||
if (CollUtil.isEmpty(jobTaskBatches)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -215,7 +215,7 @@ public class WorkflowBatchHandler {
|
||||
String flowInfo = workflowTaskBatch.getFlowInfo();
|
||||
MutableGraph<Long> graph = MutableGraphCache.getOrDefault(workflowTaskBatchId, flowInfo);
|
||||
Set<Long> successors = graph.successors(SystemConstants.ROOT);
|
||||
if (CollectionUtils.isEmpty(successors)) {
|
||||
if (CollUtil.isEmpty(successors)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -240,7 +240,7 @@ public class WorkflowBatchHandler {
|
||||
}
|
||||
|
||||
Set<Long> successors = graph.successors(parentId);
|
||||
if (CollectionUtils.isEmpty(successors)) {
|
||||
if (CollUtil.isEmpty(successors)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.aizuda.snailjob.server.job.task.support.schedule;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.aizuda.snailjob.common.core.enums.JobTaskBatchStatusEnum;
|
||||
import com.aizuda.snailjob.common.core.util.JsonUtil;
|
||||
import com.aizuda.snailjob.common.core.util.StreamUtils;
|
||||
@ -20,7 +21,6 @@ import com.google.common.collect.Lists;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.time.LocalDate;
|
||||
@ -106,12 +106,12 @@ public class JobSummarySchedule extends AbstractSchedule implements Lifecycle {
|
||||
}
|
||||
|
||||
int updateTotalJobSummary = 0;
|
||||
if (!CollectionUtils.isEmpty(waitUpdates)) {
|
||||
if (CollUtil.isNotEmpty(waitUpdates)) {
|
||||
updateTotalJobSummary = jobSummaryMapper.updateBatch(waitUpdates);
|
||||
}
|
||||
|
||||
int insertTotalJobSummary = 0;
|
||||
if (!CollectionUtils.isEmpty(waitInserts)) {
|
||||
if (CollUtil.isNotEmpty(waitInserts)) {
|
||||
insertTotalJobSummary = jobSummaryMapper.insertBatch(waitInserts);
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.aizuda.snailjob.server.job.task.support.stop;
|
||||
|
||||
import akka.actor.ActorRef;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.aizuda.snailjob.common.core.enums.JobTaskBatchStatusEnum;
|
||||
import com.aizuda.snailjob.common.core.enums.JobTaskStatusEnum;
|
||||
import com.aizuda.snailjob.server.common.akka.ActorGenerator;
|
||||
@ -14,7 +15,6 @@ import com.aizuda.snailjob.template.datasource.persistence.po.JobTaskBatch;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ -44,7 +44,7 @@ public abstract class AbstractJobTaskStopHandler implements JobTaskStopHandler,
|
||||
|
||||
List<JobTask> jobTasks = jobTaskMapper.selectList(queryWrapper);
|
||||
|
||||
if (CollectionUtils.isEmpty(jobTasks)) {
|
||||
if (CollUtil.isEmpty(jobTasks)) {
|
||||
// 若没有任务项,直接变更状态为已停止
|
||||
JobTaskBatch jobTaskBatch = new JobTaskBatch();
|
||||
jobTaskBatch.setId(context.getTaskBatchId());
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.aizuda.snailjob.server.retry.task.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.aizuda.snailjob.common.core.enums.RetryStatusEnum;
|
||||
@ -22,7 +23,6 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
@ -61,7 +61,7 @@ public class RetryServiceImpl implements RetryService {
|
||||
.eq(RetryTask::getTaskType, SyetemTaskTypeEnum.CALLBACK.getType())
|
||||
.eq(RetryTask::getGroupName, groupName)).getRecords();
|
||||
|
||||
if (CollectionUtils.isEmpty(callbackRetryTasks)) {
|
||||
if (CollUtil.isEmpty(callbackRetryTasks)) {
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
|
||||
@ -82,7 +82,7 @@ public class RetryServiceImpl implements RetryService {
|
||||
List<RetryTask> maxCountRetryTaskList = retryTasks.stream()
|
||||
.filter(retryTask -> retryTask.getRetryStatus().equals(RetryStatusEnum.MAX_COUNT.getStatus())).collect(
|
||||
Collectors.toList());
|
||||
if (!CollectionUtils.isEmpty(maxCountRetryTaskList)) {
|
||||
if (CollUtil.isNotEmpty(maxCountRetryTaskList)) {
|
||||
waitMoveDeadLetters.addAll(maxCountRetryTaskList);
|
||||
}
|
||||
|
||||
@ -90,7 +90,7 @@ public class RetryServiceImpl implements RetryService {
|
||||
.filter(retryTask -> retryTask.getRetryStatus().equals(RetryStatusEnum.MAX_COUNT.getStatus())).collect(
|
||||
Collectors.toList());
|
||||
|
||||
if (!CollectionUtils.isEmpty(maxCountRetryTaskList)) {
|
||||
if (CollUtil.isNotEmpty(maxCountRetryTaskList)) {
|
||||
waitMoveDeadLetters.addAll(maxCountCallbackRetryTaskList);
|
||||
}
|
||||
|
||||
@ -102,7 +102,7 @@ public class RetryServiceImpl implements RetryService {
|
||||
.filter(retryTask -> retryTask.getRetryStatus().equals(RetryStatusEnum.FINISH.getStatus()))
|
||||
.map(RetryTask::getId)
|
||||
.collect(Collectors.toSet());
|
||||
if (!CollectionUtils.isEmpty(finishRetryIdList)) {
|
||||
if (CollUtil.isNotEmpty(finishRetryIdList)) {
|
||||
waitDelRetryFinishSet.addAll(finishRetryIdList);
|
||||
}
|
||||
|
||||
@ -112,11 +112,11 @@ public class RetryServiceImpl implements RetryService {
|
||||
.collect(Collectors.toSet());
|
||||
|
||||
// 迁移重试失败的数据
|
||||
if (!CollectionUtils.isEmpty(finishCallbackRetryIdList)) {
|
||||
if (CollUtil.isNotEmpty(finishCallbackRetryIdList)) {
|
||||
waitDelRetryFinishSet.addAll(finishCallbackRetryIdList);
|
||||
}
|
||||
|
||||
if (CollectionUtils.isEmpty(waitDelRetryFinishSet)) {
|
||||
if (CollUtil.isEmpty(waitDelRetryFinishSet)) {
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
|
||||
@ -136,7 +136,7 @@ public class RetryServiceImpl implements RetryService {
|
||||
* @param retryTasks 待迁移数据
|
||||
*/
|
||||
private void moveDeadLetters(String groupName, String namespaceId, List<RetryTask> retryTasks) {
|
||||
if (CollectionUtils.isEmpty(retryTasks)) {
|
||||
if (CollUtil.isEmpty(retryTasks)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.aizuda.snailjob.server.retry.task.support.dispatch.actor.log;
|
||||
|
||||
import akka.actor.AbstractActor;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.aizuda.snailjob.common.core.util.JsonUtil;
|
||||
import com.aizuda.snailjob.common.log.dto.TaskLogFieldDTO;
|
||||
@ -13,7 +14,6 @@ import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
@ -36,7 +36,7 @@ public class RetryLogActor extends AbstractActor {
|
||||
public Receive createReceive() {
|
||||
return receiveBuilder().match(List.class,
|
||||
list -> {
|
||||
if (CollectionUtils.isEmpty(list)) {
|
||||
if (CollUtil.isEmpty(list)) {
|
||||
return;
|
||||
}
|
||||
saveRetryTaskLogMessage((List<RetryLogTaskDTO>) list);
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.aizuda.snailjob.server.retry.task.support.dispatch.actor.scan;
|
||||
|
||||
import akka.actor.AbstractActor;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.lang.Pair;
|
||||
import com.aizuda.snailjob.common.core.constant.SystemConstants;
|
||||
import com.aizuda.snailjob.common.core.enums.RetryStatusEnum;
|
||||
@ -26,7 +27,6 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.PageDTO;
|
||||
import io.netty.util.TimerTask;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
@ -94,7 +94,7 @@ public abstract class AbstractScanGroup extends AbstractActor {
|
||||
long total = PartitionTaskUtils.process(
|
||||
startId -> listAvailableTasks(groupName, namespaceId, startId, taskActuatorScene().getTaskType().getType()),
|
||||
partitionTasks1 -> processRetryPartitionTasks(partitionTasks1, scanTask), partitionTasks -> {
|
||||
if (CollectionUtils.isEmpty(partitionTasks)) {
|
||||
if (CollUtil.isEmpty(partitionTasks)) {
|
||||
putLastId(scanTask.getGroupName(), 0L);
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.aizuda.snailjob.server.retry.task.support.listener;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.aizuda.snailjob.common.core.alarm.AlarmContext;
|
||||
import com.aizuda.snailjob.common.core.enums.RetryNotifySceneEnum;
|
||||
import com.aizuda.snailjob.common.core.util.EnvironmentUtils;
|
||||
@ -18,7 +19,6 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.event.TransactionPhase;
|
||||
import org.springframework.transaction.event.TransactionalEventListener;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.concurrent.LinkedBlockingQueue;
|
||||
@ -39,9 +39,9 @@ public class RetryTaskFailDeadLetterAlarmListener extends
|
||||
/**
|
||||
* 死信告警数据
|
||||
*/
|
||||
private LinkedBlockingQueue<List<RetryDeadLetter>> queue = new LinkedBlockingQueue<>(1000);
|
||||
private final LinkedBlockingQueue<List<RetryDeadLetter>> queue = new LinkedBlockingQueue<>(1000);
|
||||
|
||||
private static String retryTaskDeadTextMessagesFormatter =
|
||||
private static final String retryTaskDeadTextMessagesFormatter =
|
||||
"<font face=\"微软雅黑\" color=#ff0000 size=4>{}环境 重试任务失败进入死信队列</font> \n" +
|
||||
"> 空间ID:{} \n" +
|
||||
"> 组名称:{} \n" +
|
||||
@ -59,7 +59,7 @@ public class RetryTaskFailDeadLetterAlarmListener extends
|
||||
protected List<RetryAlarmInfo> poll() throws InterruptedException {
|
||||
|
||||
List<RetryDeadLetter> allRetryDeadLetterList = queue.poll(100, TimeUnit.MILLISECONDS);
|
||||
if (CollectionUtils.isEmpty(allRetryDeadLetterList)) {
|
||||
if (CollUtil.isEmpty(allRetryDeadLetterList)) {
|
||||
return Lists.newArrayList();
|
||||
}
|
||||
|
||||
|
@ -1,11 +1,11 @@
|
||||
package com.aizuda.snailjob.server.retry.task.support.retry;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.aizuda.snailjob.server.common.WaitStrategy;
|
||||
import com.aizuda.snailjob.server.common.exception.SnailJobServerException;
|
||||
import com.aizuda.snailjob.server.retry.task.support.FilterStrategy;
|
||||
import com.aizuda.snailjob.server.retry.task.support.RetryContext;
|
||||
import com.aizuda.snailjob.server.retry.task.support.StopStrategy;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
@ -32,7 +32,7 @@ public class RetryBuilder<V> {
|
||||
}
|
||||
|
||||
public RetryBuilder<V> withFilterStrategy(FilterStrategy filterStrategy) {
|
||||
if (CollectionUtils.isEmpty(filterStrategies)) {
|
||||
if (CollUtil.isEmpty(filterStrategies)) {
|
||||
filterStrategies = new ArrayList<>();
|
||||
}
|
||||
|
||||
@ -41,7 +41,7 @@ public class RetryBuilder<V> {
|
||||
}
|
||||
|
||||
public RetryBuilder<V> withStopStrategy(StopStrategy stopStrategy) {
|
||||
if (CollectionUtils.isEmpty(stopStrategies)) {
|
||||
if (CollUtil.isEmpty(stopStrategies)) {
|
||||
stopStrategies = new ArrayList<>();
|
||||
}
|
||||
|
||||
@ -64,13 +64,13 @@ public class RetryBuilder<V> {
|
||||
throw new SnailJobServerException("retryContext 不能为null");
|
||||
}
|
||||
|
||||
if (CollectionUtils.isEmpty(stopStrategies)) {
|
||||
if (CollUtil.isEmpty(stopStrategies)) {
|
||||
stopStrategies = Collections.EMPTY_LIST;
|
||||
} else {
|
||||
stopStrategies.sort(Comparator.comparingInt(StopStrategy::order));
|
||||
}
|
||||
|
||||
if (CollectionUtils.isEmpty(filterStrategies)) {
|
||||
if (CollUtil.isEmpty(filterStrategies)) {
|
||||
filterStrategies = Collections.EMPTY_LIST;
|
||||
} else {
|
||||
filterStrategies.sort(Comparator.comparingInt(FilterStrategy::order));
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.aizuda.snailjob.server.retry.task.support.schedule;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.aizuda.snailjob.common.core.alarm.Alarm;
|
||||
import com.aizuda.snailjob.common.core.alarm.AlarmContext;
|
||||
import com.aizuda.snailjob.common.core.alarm.SnailJobAlarmFactory;
|
||||
@ -30,7 +31,6 @@ import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Sets;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.time.Instant;
|
||||
@ -128,7 +128,7 @@ public class RetryErrorMoreThresholdAlarmSchedule extends AbstractSchedule imple
|
||||
.eq(NotifyConfig::getNotifyScene, RetryNotifySceneEnum.MAX_RETRY_ERROR.getNotifyScene()))
|
||||
.getRecords();
|
||||
|
||||
if (CollectionUtils.isEmpty(notifyConfigs)) {
|
||||
if (CollUtil.isEmpty(notifyConfigs)) {
|
||||
return Lists.newArrayList();
|
||||
}
|
||||
|
||||
@ -141,7 +141,7 @@ public class RetryErrorMoreThresholdAlarmSchedule extends AbstractSchedule imple
|
||||
return set;
|
||||
}).orElse(new HashSet<>());
|
||||
|
||||
if (CollectionUtils.isEmpty(recipientIds)) {
|
||||
if (CollUtil.isEmpty(recipientIds)) {
|
||||
return Lists.newArrayList();
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
package com.aizuda.snailjob.server.retry.task.support.schedule;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.aizuda.snailjob.common.core.enums.RetryStatusEnum;
|
||||
import com.aizuda.snailjob.common.core.util.JsonUtil;
|
||||
import com.aizuda.snailjob.common.core.util.StreamUtils;
|
||||
@ -49,14 +49,13 @@ import static java.util.stream.Collectors.toList;
|
||||
@RequiredArgsConstructor
|
||||
public class RetryLogMergeSchedule extends AbstractSchedule implements Lifecycle {
|
||||
|
||||
// last merge log time
|
||||
private static Long lastMergeLogTime = 0L;
|
||||
private final SystemProperties systemProperties;
|
||||
private final RetryTaskLogMapper retryTaskLogMapper;
|
||||
private final RetryTaskLogMessageMapper retryTaskLogMessageMapper;
|
||||
private final TransactionTemplate transactionTemplate;
|
||||
|
||||
// last merge log time
|
||||
private static Long lastMergeLogTime = 0L;
|
||||
|
||||
@Override
|
||||
public String lockName() {
|
||||
return "retryLogMerge";
|
||||
@ -123,14 +122,14 @@ public class RetryLogMergeSchedule extends AbstractSchedule implements Lifecycle
|
||||
|
||||
// Waiting for merge RetryTaskLog
|
||||
List<String> ids = StreamUtils.toList(partitionTasks, PartitionTask::getUniqueId);
|
||||
if (CollectionUtil.isEmpty(ids)) {
|
||||
if (CollUtil.isEmpty(ids)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Waiting for deletion RetryTaskLogMessage
|
||||
List<RetryTaskLogMessage> retryLogMessageList = retryTaskLogMessageMapper.selectList(
|
||||
new LambdaQueryWrapper<RetryTaskLogMessage>().in(RetryTaskLogMessage::getUniqueId, ids));
|
||||
if (CollectionUtil.isEmpty(retryLogMessageList)) {
|
||||
if (CollUtil.isEmpty(retryLogMessageList)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -177,10 +176,10 @@ public class RetryLogMergeSchedule extends AbstractSchedule implements Lifecycle
|
||||
@Override
|
||||
protected void doInTransactionWithoutResult(final TransactionStatus status) {
|
||||
// 批量删除、更新日志
|
||||
if (CollectionUtil.isNotEmpty(jobLogMessageDeleteBatchIds)) {
|
||||
if (CollUtil.isNotEmpty(jobLogMessageDeleteBatchIds)) {
|
||||
retryTaskLogMessageMapper.deleteBatchIds(jobLogMessageDeleteBatchIds);
|
||||
}
|
||||
if (CollectionUtil.isNotEmpty(jobLogMessageUpdateList)) {
|
||||
if (CollUtil.isNotEmpty(jobLogMessageUpdateList)) {
|
||||
retryTaskLogMessageMapper.insertBatch(jobLogMessageUpdateList);
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.aizuda.snailjob.server.retry.task.support.schedule;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.aizuda.snailjob.common.core.util.StreamUtils;
|
||||
import com.aizuda.snailjob.common.log.SnailJobLog;
|
||||
import com.aizuda.snailjob.server.common.Lifecycle;
|
||||
@ -17,7 +18,6 @@ import com.google.common.collect.Sets;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.time.LocalDate;
|
||||
@ -70,7 +70,7 @@ public class RetrySummarySchedule extends AbstractSchedule implements Lifecycle
|
||||
.between(RetryTaskLog::getCreateDt, todayFrom, todayTo)
|
||||
.groupBy(RetryTaskLog::getNamespaceId, RetryTaskLog::getGroupName, RetryTaskLog::getSceneName);
|
||||
List<DashboardRetryResponseDO> dashboardRetryResponseDOList = retryTaskLogMapper.selectRetryRetryTaskLogSummaryList(wrapper);
|
||||
if (CollectionUtils.isEmpty(dashboardRetryResponseDOList)) {
|
||||
if (CollUtil.isEmpty(dashboardRetryResponseDOList)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -108,12 +108,12 @@ public class RetrySummarySchedule extends AbstractSchedule implements Lifecycle
|
||||
}
|
||||
|
||||
int insertTotalRetrySummary = 0;
|
||||
if (!CollectionUtils.isEmpty(waitInserts)) {
|
||||
if (CollUtil.isNotEmpty(waitInserts)) {
|
||||
insertTotalRetrySummary = retrySummaryMapper.insertBatch(waitInserts);
|
||||
}
|
||||
|
||||
int updateTotalRetrySummary = 0;
|
||||
if (!CollectionUtils.isEmpty(waitUpdates)) {
|
||||
if (CollUtil.isNotEmpty(waitUpdates)) {
|
||||
updateTotalRetrySummary = retrySummaryMapper.updateBatch(waitUpdates);
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.aizuda.snailjob.server.retry.task.support.schedule;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.aizuda.snailjob.common.core.alarm.AlarmContext;
|
||||
import com.aizuda.snailjob.common.core.alarm.SnailJobAlarmFactory;
|
||||
import com.aizuda.snailjob.common.core.enums.RetryNotifySceneEnum;
|
||||
@ -28,7 +29,6 @@ import com.google.common.collect.Lists;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.time.Instant;
|
||||
@ -127,7 +127,7 @@ public class RetryTaskMoreThresholdAlarmSchedule extends AbstractSchedule implem
|
||||
.flatMap(config -> JsonUtil.parseList(config.getRecipientIds(), Long.class).stream())
|
||||
.collect(Collectors.toSet());
|
||||
|
||||
if (CollectionUtils.isEmpty(recipientIds)) {
|
||||
if (CollUtil.isEmpty(recipientIds)) {
|
||||
return Lists.newArrayList();
|
||||
}
|
||||
|
||||
|
@ -2,6 +2,7 @@ package com.aizuda.snailjob.server.starter.dispatch;
|
||||
|
||||
import akka.actor.AbstractActor;
|
||||
import akka.actor.ActorRef;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.aizuda.snailjob.common.core.enums.StatusEnum;
|
||||
import com.aizuda.snailjob.common.log.SnailJobLog;
|
||||
import com.aizuda.snailjob.server.common.akka.ActorGenerator;
|
||||
@ -22,7 +23,6 @@ import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||||
import org.springframework.context.annotation.Scope;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
@ -59,7 +59,7 @@ public class ConsumerBucketActor extends AbstractActor {
|
||||
}
|
||||
|
||||
private void doDispatch(final ConsumerBucket consumerBucket) {
|
||||
if (CollectionUtils.isEmpty(consumerBucket.getBuckets())) {
|
||||
if (CollUtil.isEmpty(consumerBucket.getBuckets())) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -84,7 +84,7 @@ public class ConsumerBucketActor extends AbstractActor {
|
||||
SnailJobLog.LOCAL.error("生成重试任务异常.", e);
|
||||
}
|
||||
|
||||
if (!CollectionUtils.isEmpty(groupConfigs)) {
|
||||
if (CollUtil.isNotEmpty(groupConfigs)) {
|
||||
for (final GroupConfig groupConfig : groupConfigs) {
|
||||
CacheConsumerGroup.addOrUpdate(groupConfig.getGroupName(), groupConfig.getNamespaceId());
|
||||
ScanTask scanTask = new ScanTask();
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.aizuda.snailjob.server.starter.dispatch;
|
||||
|
||||
import akka.actor.ActorRef;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.aizuda.snailjob.common.core.constant.SystemConstants;
|
||||
import com.aizuda.snailjob.common.log.SnailJobLog;
|
||||
import com.aizuda.snailjob.server.common.Lifecycle;
|
||||
@ -9,7 +10,6 @@ import com.aizuda.snailjob.server.common.dto.DistributeInstance;
|
||||
import com.aizuda.snailjob.template.datasource.persistence.po.GroupConfig;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.Executors;
|
||||
@ -59,7 +59,7 @@ public class DispatchService implements Lifecycle {
|
||||
}
|
||||
|
||||
Set<Integer> currentConsumerBuckets = getConsumerBucket();
|
||||
if (!CollectionUtils.isEmpty(currentConsumerBuckets)) {
|
||||
if (CollUtil.isNotEmpty(currentConsumerBuckets)) {
|
||||
ConsumerBucket scanTaskDTO = new ConsumerBucket();
|
||||
scanTaskDTO.setBuckets(currentConsumerBuckets);
|
||||
actorRef.tell(scanTaskDTO, actorRef);
|
||||
|
@ -14,7 +14,6 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.time.Instant;
|
||||
@ -56,7 +55,7 @@ public class OfflineNodeSchedule extends AbstractSchedule implements Lifecycle {
|
||||
Set<RegisterNodeInfo> waitOffline = allPods.stream().filter(registerNodeInfo -> registerNodeInfo.getExpireAt().isBefore(endTime)).collect(
|
||||
Collectors.toSet());
|
||||
Set<String> podIds = StreamUtils.toSet(waitOffline, RegisterNodeInfo::getHostId);
|
||||
if (CollectionUtils.isEmpty(podIds)) {
|
||||
if (CollUtil.isEmpty(podIds)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.aizuda.snailjob.server.web.service.convert;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.aizuda.snailjob.common.core.util.JsonUtil;
|
||||
import com.aizuda.snailjob.server.web.model.request.NotifyConfigRequestVO;
|
||||
import com.aizuda.snailjob.template.datasource.persistence.po.NotifyConfig;
|
||||
@ -7,7 +8,6 @@ import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mapping;
|
||||
import org.mapstruct.Mappings;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
@ -21,7 +21,7 @@ public interface NotifyConfigConverter {
|
||||
NotifyConfigConverter INSTANCE = Mappers.getMapper(NotifyConfigConverter.class);
|
||||
|
||||
static String toNotifyRecipientIdsStr(Set<Long> notifyRecipientIds) {
|
||||
if (CollectionUtils.isEmpty(notifyRecipientIds)) {
|
||||
if (CollUtil.isEmpty(notifyRecipientIds)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.aizuda.snailjob.server.web.service.handler;
|
||||
|
||||
import akka.actor.ActorRef;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import com.aizuda.snailjob.client.model.ExecuteResult;
|
||||
import com.aizuda.snailjob.common.core.enums.JobOperationReasonEnum;
|
||||
@ -27,7 +28,6 @@ import com.aizuda.snailjob.template.datasource.persistence.po.JobTaskBatch;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ -70,7 +70,7 @@ public class JobHandler {
|
||||
.eq(JobTask::getTaskBatchId, taskBatchId));
|
||||
|
||||
// 若任务项为空则生成
|
||||
if (CollectionUtils.isEmpty(jobTasks)) {
|
||||
if (CollUtil.isEmpty(jobTasks)) {
|
||||
TaskExecuteDTO taskExecuteDTO = new TaskExecuteDTO();
|
||||
taskExecuteDTO.setTaskBatchId(taskBatchId);
|
||||
taskExecuteDTO.setJobId(jobTaskBatch.getJobId());
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.aizuda.snailjob.server.web.service.handler;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import com.aizuda.snailjob.common.core.constant.SystemConstants;
|
||||
import com.aizuda.snailjob.common.core.enums.WorkflowNodeTypeEnum;
|
||||
@ -21,7 +22,6 @@ import com.google.common.graph.MutableGraph;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.concurrent.LinkedBlockingDeque;
|
||||
@ -54,7 +54,7 @@ public class WorkflowHandler {
|
||||
Map<Long, NodeInfo> workflowNodeMap) {
|
||||
|
||||
Set<Long> successors = graph.successors(parentId);
|
||||
if (CollectionUtils.isEmpty(successors)) {
|
||||
if (CollUtil.isEmpty(successors)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -109,7 +109,7 @@ public class WorkflowHandler {
|
||||
private void findCommonAncestor(Long predecessor, Set<Long> set, MutableGraph<Long> graph) {
|
||||
|
||||
Set<Long> predecessors = graph.predecessors(predecessor);
|
||||
if (CollectionUtils.isEmpty(predecessors)) {
|
||||
if (CollUtil.isEmpty(predecessors)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -139,7 +139,7 @@ public class WorkflowHandler {
|
||||
|
||||
// 获取节点信息
|
||||
List<WorkflowRequestVO.NodeInfo> conditionNodes = nodeConfig.getConditionNodes();
|
||||
if (!CollectionUtils.isEmpty(conditionNodes)) {
|
||||
if (CollUtil.isNotEmpty(conditionNodes)) {
|
||||
conditionNodes = conditionNodes.stream()
|
||||
.sorted(Comparator.comparing(WorkflowRequestVO.NodeInfo::getPriorityLevel))
|
||||
.collect(Collectors.toList());
|
||||
@ -185,7 +185,7 @@ public class WorkflowHandler {
|
||||
graph.putEdge(parentId, workflowNode.getId());
|
||||
}
|
||||
WorkflowRequestVO.NodeConfig childNode = nodeInfo.getChildNode();
|
||||
if (Objects.nonNull(childNode) && !CollectionUtils.isEmpty(childNode.getConditionNodes())) {
|
||||
if (Objects.nonNull(childNode) && CollUtil.isNotEmpty(childNode.getConditionNodes())) {
|
||||
buildGraph(Lists.newArrayList(workflowNode.getId()), deque, groupName, workflowId, childNode,
|
||||
graph, version);
|
||||
} else {
|
||||
@ -200,7 +200,7 @@ public class WorkflowHandler {
|
||||
}
|
||||
|
||||
WorkflowRequestVO.NodeConfig childNode = nodeConfig.getChildNode();
|
||||
if (Objects.nonNull(childNode) && !CollectionUtils.isEmpty(childNode.getConditionNodes())) {
|
||||
if (Objects.nonNull(childNode) && CollUtil.isNotEmpty(childNode.getConditionNodes())) {
|
||||
// 应该是conditionNodes里面叶子节点的选择
|
||||
List<Long> list = Lists.newArrayList();
|
||||
deque.drainTo(list);
|
||||
|
@ -160,7 +160,6 @@ public class DashBoardServiceImpl implements DashBoardService {
|
||||
// 重试任务列表
|
||||
Page<Object> pager = new Page<>(baseQueryVO.getPage(), baseQueryVO.getSize());
|
||||
LambdaQueryWrapper<RetrySceneConfig> wrapper = new LambdaQueryWrapper<RetrySceneConfig>()
|
||||
|
||||
.eq(RetrySceneConfig::getNamespaceId, namespaceId)
|
||||
.in(CollUtil.isNotEmpty(groupNames), RetrySceneConfig::getGroupName, groupNames);
|
||||
|
||||
@ -316,7 +315,7 @@ public class DashBoardServiceImpl implements DashBoardService {
|
||||
String url = NetUtil.getUrl(serverNodeResponseVO.getHostIp(), serverNodeExtAttrs.getWebPort(), serverProperties.getServlet().getContextPath());
|
||||
Result<List<Integer>> result = restTemplate.getForObject(url.concat(DASHBOARD_CONSUMER_BUCKET), Result.class);
|
||||
List<Integer> data = result.getData();
|
||||
if (!CollUtil.isEmpty(data)) {
|
||||
if (CollUtil.isNotEmpty(data)) {
|
||||
serverNodeResponseVO.setConsumerBuckets(data.stream()
|
||||
.sorted(Integer::compareTo)
|
||||
.collect(Collectors.toCollection(LinkedHashSet::new)));
|
||||
|
@ -40,7 +40,6 @@ import org.springframework.jdbc.BadSqlGrammarException;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
import java.sql.Connection;
|
||||
@ -113,7 +112,7 @@ public class GroupConfigServiceImpl implements GroupConfigService {
|
||||
public Boolean updateGroup(GroupConfigRequestVO groupConfigRequestVO) {
|
||||
|
||||
List<Integer> tablePartitionList = getTablePartitionList();
|
||||
if (CollectionUtils.isEmpty(tablePartitionList)) {
|
||||
if (CollUtil.isEmpty(tablePartitionList)) {
|
||||
return Boolean.FALSE;
|
||||
}
|
||||
|
||||
@ -185,7 +184,7 @@ public class GroupConfigServiceImpl implements GroupConfigService {
|
||||
StrUtil.trim(queryVO.getGroupName()))
|
||||
.orderByDesc(GroupConfig::getId));
|
||||
List<GroupConfig> records = groupConfigPageDTO.getRecords();
|
||||
if (CollectionUtils.isEmpty(records)) {
|
||||
if (CollUtil.isEmpty(records)) {
|
||||
return new PageResult<>(groupConfigPageDTO.getCurrent(), groupConfigPageDTO.getSize(),
|
||||
groupConfigPageDTO.getTotal());
|
||||
}
|
||||
@ -210,7 +209,7 @@ public class GroupConfigServiceImpl implements GroupConfigService {
|
||||
|
||||
private boolean doSaveGroupConfig(final String namespaceId, GroupConfigRequestVO groupConfigRequestVO) {
|
||||
List<Integer> tablePartitionList = getTablePartitionList();
|
||||
if (CollectionUtils.isEmpty(tablePartitionList)) {
|
||||
if (CollUtil.isEmpty(tablePartitionList)) {
|
||||
return Boolean.FALSE;
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.aizuda.snailjob.server.web.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.aizuda.snailjob.common.core.util.JsonUtil;
|
||||
import com.aizuda.snailjob.common.log.constant.LogFieldConstants;
|
||||
import com.aizuda.snailjob.server.web.model.request.JobLogQueryVO;
|
||||
@ -14,7 +15,6 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.PageDTO;
|
||||
import com.google.common.collect.Lists;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
@ -45,7 +45,7 @@ public class JobLogServiceImpl implements JobLogService {
|
||||
.eq(JobLogMessage::getTaskId, queryVO.getTaskId())
|
||||
.orderByAsc(JobLogMessage::getId).orderByAsc(JobLogMessage::getRealTime));
|
||||
List<JobLogMessage> records = selectPage.getRecords();
|
||||
if (CollectionUtils.isEmpty(records)) {
|
||||
if (CollUtil.isEmpty(records)) {
|
||||
|
||||
JobTaskBatch jobTaskBatch = jobTaskBatchMapper.selectOne(
|
||||
new LambdaQueryWrapper<JobTaskBatch>()
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.aizuda.snailjob.server.web.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.aizuda.snailjob.common.core.util.JsonUtil;
|
||||
@ -33,7 +34,6 @@ import com.google.common.collect.Maps;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
@ -66,7 +66,7 @@ public class NotifyConfigServiceImpl implements NotifyConfigService {
|
||||
.orderByDesc(NotifyConfig::getId))
|
||||
.getRecords();
|
||||
|
||||
if (CollectionUtils.isEmpty(notifyConfigs)) {
|
||||
if (CollUtil.isEmpty(notifyConfigs)) {
|
||||
return new PageResult<>(pageDTO, Lists.newArrayList());
|
||||
}
|
||||
|
||||
@ -101,7 +101,7 @@ public class NotifyConfigServiceImpl implements NotifyConfigService {
|
||||
responseVO.getSystemTaskType().equals(SyetemTaskTypeEnum.WORKFLOW.getType()))
|
||||
.map(responseVO -> Long.parseLong(responseVO.getBusinessId()))
|
||||
.collect(Collectors.toSet());
|
||||
if (!CollectionUtils.isEmpty(workflowIds)) {
|
||||
if (CollUtil.isNotEmpty(workflowIds)) {
|
||||
List<Workflow> workflows = workflowMapper.selectBatchIds(workflowIds);
|
||||
return StreamUtils.toMap(workflows, Workflow::getId, Workflow::getWorkflowName);
|
||||
}
|
||||
@ -114,7 +114,7 @@ public class NotifyConfigServiceImpl implements NotifyConfigService {
|
||||
responseVO.getSystemTaskType().equals(SyetemTaskTypeEnum.JOB.getType()))
|
||||
.map(responseVO -> Long.parseLong(responseVO.getBusinessId()))
|
||||
.collect(Collectors.toSet());
|
||||
if (!CollectionUtils.isEmpty(jobIds)) {
|
||||
if (CollUtil.isNotEmpty(jobIds)) {
|
||||
List<Job> jobs = jobMapper.selectBatchIds(jobIds);
|
||||
return StreamUtils.toMap(jobs, Job::getId, Job::getJobName);
|
||||
}
|
||||
@ -127,7 +127,7 @@ public class NotifyConfigServiceImpl implements NotifyConfigService {
|
||||
Set<Long> recipientIds = StreamUtils.toSetByFlatMap(notifyConfigResponseVOS,
|
||||
NotifyConfigResponseVO::getRecipientIds, Collection::stream);
|
||||
|
||||
if (CollectionUtils.isEmpty(recipientIds)) {
|
||||
if (CollUtil.isEmpty(recipientIds)) {
|
||||
return Maps.newHashMap();
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.aizuda.snailjob.server.web.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.aizuda.snailjob.client.model.GenerateRetryIdempotentIdDTO;
|
||||
@ -49,7 +50,6 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
@ -281,7 +281,7 @@ public class RetryTaskServiceImpl implements RetryTaskService {
|
||||
}
|
||||
|
||||
List<RetryTaskDTO> retryTaskList = JsonUtil.parseList(extractedData, RetryTaskDTO.class);
|
||||
if (!CollectionUtils.isEmpty(retryTaskList)) {
|
||||
if (CollUtil.isNotEmpty(retryTaskList)) {
|
||||
waitInsertList.addAll(retryTaskList);
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.aizuda.snailjob.server.web.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.crypto.SecureUtil;
|
||||
@ -33,7 +34,6 @@ import com.google.common.collect.Lists;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
@ -127,7 +127,7 @@ public class SystemUserServiceImpl implements SystemUserService {
|
||||
|
||||
// 只添加为普通用户添加权限
|
||||
List<UserPermissionRequestVO> groupNameList = requestVO.getPermissions();
|
||||
if (CollectionUtils.isEmpty(groupNameList) || RoleEnum.ADMIN.getRoleId().equals(requestVO.getRole())) {
|
||||
if (CollUtil.isEmpty(groupNameList) || RoleEnum.ADMIN.getRoleId().equals(requestVO.getRole())) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -170,7 +170,7 @@ public class SystemUserServiceImpl implements SystemUserService {
|
||||
|
||||
// 只添加为普通用户添加权限
|
||||
List<UserPermissionRequestVO> permissions = requestVO.getPermissions();
|
||||
if (CollectionUtils.isEmpty(permissions) || RoleEnum.ADMIN.getRoleId().equals(requestVO.getRole())) {
|
||||
if (CollUtil.isEmpty(permissions) || RoleEnum.ADMIN.getRoleId().equals(requestVO.getRole())) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -195,7 +195,7 @@ public class SystemUserServiceImpl implements SystemUserService {
|
||||
.likeRight(StrUtil.isNotBlank(queryVO.getUsername()), SystemUser::getUsername, queryVO.getUsername())
|
||||
.orderByDesc(SystemUser::getId));
|
||||
|
||||
if (CollectionUtils.isEmpty(userPageDTO.getRecords())) {
|
||||
if (CollUtil.isEmpty(userPageDTO.getRecords())) {
|
||||
return new PageResult<>(userPageDTO, Collections.emptyList());
|
||||
}
|
||||
|
||||
@ -209,7 +209,7 @@ public class SystemUserServiceImpl implements SystemUserService {
|
||||
Set<String> uniqueIds = StreamUtils.toSet(userPermissions, SystemUserPermission::getNamespaceId);
|
||||
|
||||
List<Namespace> namespaces = Lists.newArrayList();
|
||||
if (!CollectionUtils.isEmpty(uniqueIds)) {
|
||||
if (CollUtil.isNotEmpty(uniqueIds)) {
|
||||
namespaces = namespaceMapper.selectList(Wrappers.<Namespace>lambdaQuery()
|
||||
.select(Namespace::getId, Namespace::getUniqueId, Namespace::getName)
|
||||
.in(Namespace::getUniqueId, uniqueIds));
|
||||
@ -267,7 +267,7 @@ public class SystemUserServiceImpl implements SystemUserService {
|
||||
.select(SystemUserPermission::getNamespaceId, SystemUserPermission::getGroupName)
|
||||
.eq(SystemUserPermission::getSystemUserId, id));
|
||||
|
||||
if (CollectionUtils.isEmpty(systemUserPermissions)) {
|
||||
if (CollUtil.isEmpty(systemUserPermissions)) {
|
||||
return Lists.newArrayList();
|
||||
}
|
||||
|
||||
|
@ -35,7 +35,6 @@ import com.google.common.graph.MutableGraph;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
@ -134,7 +133,7 @@ public class WorkflowBatchServiceImpl implements WorkflowBatchService {
|
||||
}
|
||||
|
||||
List<JobTaskBatch> jobTaskBatchList = jobTaskBatchMap.get(nodeInfo.getId());
|
||||
if (!CollectionUtils.isEmpty(jobTaskBatchList)) {
|
||||
if (CollUtil.isNotEmpty(jobTaskBatchList)) {
|
||||
jobTaskBatchList = jobTaskBatchList.stream()
|
||||
.sorted(Comparator.comparingInt(JobTaskBatch::getTaskBatchStatus))
|
||||
.collect(Collectors.toList());
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.aizuda.snailjob.server.web.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import com.aizuda.snailjob.common.core.enums.JobTaskBatchStatusEnum;
|
||||
import com.aizuda.snailjob.server.common.enums.JobTaskExecutorSceneEnum;
|
||||
@ -15,7 +16,6 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ -44,7 +44,7 @@ public class WorkflowNodeServiceImpl implements WorkflowNodeService {
|
||||
.in(JobTaskBatch::getTaskBatchStatus, JobTaskBatchStatusEnum.NOT_COMPLETE)
|
||||
);
|
||||
|
||||
if (CollectionUtils.isEmpty(jobTaskBatches)) {
|
||||
if (CollUtil.isEmpty(jobTaskBatches)) {
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user