|
|
@@ -1,6 +1,5 @@
|
|
1
|
1
|
package com.xxl.job.admin.service.impl;
|
|
2
|
2
|
|
|
3
|
|
-import com.xxl.job.admin.core.model.XxlJobGroup;
|
|
4
|
3
|
import com.xxl.job.admin.core.model.XxlJobInfo;
|
|
5
|
4
|
import com.xxl.job.admin.core.model.XxlJobLog;
|
|
6
|
5
|
import com.xxl.job.admin.core.thread.JobTriggerPoolHelper;
|
|
|
@@ -18,8 +17,6 @@ import com.xxl.job.core.handler.IJobHandler;
|
|
18
|
17
|
import org.slf4j.Logger;
|
|
19
|
18
|
import org.slf4j.LoggerFactory;
|
|
20
|
19
|
import org.springframework.stereotype.Service;
|
|
21
|
|
-import org.springframework.util.CollectionUtils;
|
|
22
|
|
-import org.springframework.util.StringUtils;
|
|
23
|
20
|
|
|
24
|
21
|
import javax.annotation.Resource;
|
|
25
|
22
|
import java.text.MessageFormat;
|
|
|
@@ -132,6 +129,9 @@ public class AdminBizImpl implements AdminBiz {
|
|
132
|
129
|
int ret = xxlJobRegistryDao.registryUpdate(registryParam.getRegistGroup(), registryParam.getRegistryKey(), registryParam.getRegistryValue());
|
|
133
|
130
|
if (ret < 1) {
|
|
134
|
131
|
xxlJobRegistryDao.registrySave(registryParam.getRegistGroup(), registryParam.getRegistryKey(), registryParam.getRegistryValue());
|
|
|
132
|
+
|
|
|
133
|
+ // fresh
|
|
|
134
|
+ freshGroupRegistryInfo(registryParam);
|
|
135
|
135
|
}
|
|
136
|
136
|
return ReturnT.SUCCESS;
|
|
137
|
137
|
}
|
|
|
@@ -139,39 +139,16 @@ public class AdminBizImpl implements AdminBiz {
|
|
139
|
139
|
@Override
|
|
140
|
140
|
public ReturnT<String> registryRemove(RegistryParam registryParam) {
|
|
141
|
141
|
int ret = xxlJobRegistryDao.registryDelete(registryParam.getRegistGroup(), registryParam.getRegistryKey(), registryParam.getRegistryValue());
|
|
142
|
|
- if (ret == 1) {
|
|
143
|
|
- List<XxlJobGroup> autoRegisterGroups = xxlJobGroupDao.findAutoRegisterGroupByAppName(registryParam.getRegistryKey());
|
|
144
|
|
- removeRegisterFromGroups(autoRegisterGroups, registryParam.getRegistryValue());
|
|
|
142
|
+ if (ret > 0) {
|
|
|
143
|
+
|
|
|
144
|
+ // fresh
|
|
|
145
|
+ freshGroupRegistryInfo(registryParam);
|
|
145
|
146
|
}
|
|
146
|
147
|
return ReturnT.SUCCESS;
|
|
147
|
148
|
}
|
|
148
|
149
|
|
|
149
|
|
- private void removeRegisterFromGroups(List<XxlJobGroup> groups, String address) {
|
|
150
|
|
- if (StringUtils.isEmpty(address)) {
|
|
151
|
|
- return;
|
|
152
|
|
- }
|
|
153
|
|
- if (CollectionUtils.isEmpty(groups)) {
|
|
154
|
|
- return;
|
|
155
|
|
- }
|
|
156
|
|
-
|
|
157
|
|
- for (XxlJobGroup group : groups) {
|
|
158
|
|
- List<String> addressList = group.getRegistryList();
|
|
159
|
|
- if (addressList == null) {
|
|
160
|
|
- continue;
|
|
161
|
|
- }
|
|
162
|
|
- if (!addressList.contains(address)) {
|
|
163
|
|
- continue;
|
|
164
|
|
- }
|
|
165
|
|
-
|
|
166
|
|
- addressList.remove(address);
|
|
167
|
|
- String newAddressListStr = StringUtils.collectionToCommaDelimitedString(addressList);
|
|
168
|
|
- String oldAddressListStr = group.getAddressList();
|
|
169
|
|
- int update = xxlJobGroupDao.updateAddressListById(group.getId(), newAddressListStr);
|
|
170
|
|
- if (logger.isDebugEnabled()) {
|
|
171
|
|
- logger.debug("update group name [{}] title [{}] old address list [{}] new address list [{}] update result [{}]",
|
|
172
|
|
- group.getAppName(), group.getTitle(), oldAddressListStr, newAddressListStr, update);
|
|
173
|
|
- }
|
|
174
|
|
- }
|
|
|
150
|
+ private void freshGroupRegistryInfo(RegistryParam registryParam){
|
|
|
151
|
+ // Under consideration, prevent affecting core tables
|
|
175
|
152
|
}
|
|
176
|
153
|
|
|
177
|
154
|
}
|