Pre Merge pull request !15 from 浩安/2.1.2-sha

pull/15/MERGE
浩安 6 years ago committed by Gitee
commit 5d8e28c110

@ -1,10 +1,12 @@
package com.xxl.job.admin.dao;
import com.xxl.job.admin.core.model.XxlJobGroup;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;
import java.util.List;
import com.xxl.job.admin.core.model.XxlJobGroup;
/**
* Created by xuxueli on 16/9/30.
@ -23,4 +25,20 @@ public interface XxlJobGroupDao {
public int remove(@Param("id") int id);
public XxlJobGroup load(@Param("id") int id);
/**
*
*
* @param appName /
* @param timeout
* @return
*/
@Update("UPDATE xxl_job_group gp\n" + "JOIN (\n" + "\tSELECT registry_key\n"
+ "\t\t,GROUP_CONCAT(DISTINCT registry_value ORDER BY registry_value SEPARATOR ',') address_list\n"
+ "\tFROM `xxl_job_registry` \n" + "\tWHERE registry_group='EXECUTOR' AND registry_key=#{appName}\n"
+ "\t\tAND update_time>= DATE_ADD(NOW(),INTERVAL -#{timeout} SECOND)\n"
+ ") reg ON gp.app_name=reg.registry_key\n" + "SET gp.address_list=reg.address_list\n"
+ "WHERE gp.app_name=#{appName} AND gp.address_type=0")
Integer refreshGroupByApp(@Param("appName") String appName, @Param("timeout") Integer timeout);
}

@ -13,6 +13,7 @@ import com.xxl.job.core.biz.AdminBiz;
import com.xxl.job.core.biz.model.HandleCallbackParam;
import com.xxl.job.core.biz.model.RegistryParam;
import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.enums.RegistryConfig;
import com.xxl.job.core.handler.IJobHandler;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -166,6 +167,7 @@ public class AdminBizImpl implements AdminBiz {
private void freshGroupRegistryInfo(RegistryParam registryParam){
// Under consideration, prevent affecting core tables
xxlJobGroupDao.refreshGroupByApp(registryParam.getRegistryKey(), RegistryConfig.DEAD_TIMEOUT);
}
}

Loading…
Cancel
Save