com.xxl.job.admin.core.conf.XxlJobAdminConfig Java Examples

The following examples show how to use com.xxl.job.admin.core.conf.XxlJobAdminConfig. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: XxlJobDynamicScheduler.java    From microservices-platform with Apache License 2.0 6 votes vote down vote up
private void initRpcProvider(){
    // init
    XxlRpcProviderFactory xxlRpcProviderFactory = new XxlRpcProviderFactory();
    xxlRpcProviderFactory.initConfig(
            NetEnum.JETTY,
            Serializer.SerializeEnum.HESSIAN.getSerializer(),
            null,
            0,
            XxlJobAdminConfig.getAdminConfig().getAccessToken(),
            null,
            null);

    // add services
    xxlRpcProviderFactory.addService(AdminBiz.class.getName(), null, XxlJobAdminConfig.getAdminConfig().getAdminBiz());

    // jetty handler
    jettyServerHandler = new JettyServerHandler(xxlRpcProviderFactory);
}
 
Example #2
Source File: I18nUtil.java    From microservices-platform with Apache License 2.0 6 votes vote down vote up
public static Properties loadI18nProp(){
    if (prop != null) {
        return prop;
    }
    try {
        // build i18n prop
        String i18n = XxlJobAdminConfig.getAdminConfig().getI18n();
        i18n = StringUtils.isNotBlank(i18n)?("_"+i18n):i18n;
        String i18nFile = MessageFormat.format("i18n/message{0}.properties", i18n);

        // load prop
        Resource resource = new ClassPathResource(i18nFile);
        EncodedResource encodedResource = new EncodedResource(resource,"UTF-8");
        prop = PropertiesLoaderUtils.loadProperties(encodedResource);
    } catch (IOException e) {
        logger.error(e.getMessage(), e);
    }
    return prop;
}
 
Example #3
Source File: XxlJobScheduler.java    From xxl-job with GNU General Public License v3.0 6 votes vote down vote up
public static ExecutorBiz getExecutorBiz(String address) throws Exception {
    // valid
    if (address==null || address.trim().length()==0) {
        return null;
    }

    // load-cache
    address = address.trim();
    ExecutorBiz executorBiz = executorBizRepository.get(address);
    if (executorBiz != null) {
        return executorBiz;
    }

    // set-cache
    executorBiz = new ExecutorBizClient(address, XxlJobAdminConfig.getAdminConfig().getAccessToken());

    executorBizRepository.put(address, executorBiz);
    return executorBiz;
}
 
Example #4
Source File: JobGroupController.java    From microservices-platform with Apache License 2.0 6 votes vote down vote up
private List<String> findRegistryByAppName(String appNameParam){
	HashMap<String, List<String>> appAddressMap = new HashMap<String, List<String>>();
	List<XxlJobRegistry> list = XxlJobAdminConfig.getAdminConfig().getXxlJobRegistryDao().findAll(RegistryConfig.DEAD_TIMEOUT);
	if (list != null) {
		for (XxlJobRegistry item: list) {
			if (RegistryConfig.RegistType.EXECUTOR.name().equals(item.getRegistryGroup())) {
				String appName = item.getRegistryKey();
				List<String> registryList = appAddressMap.get(appName);
				if (registryList == null) {
					registryList = new ArrayList<String>();
				}

				if (!registryList.contains(item.getRegistryValue())) {
					registryList.add(item.getRegistryValue());
				}
				appAddressMap.put(appName, registryList);
			}
		}
	}
	return appAddressMap.get(appNameParam);
}
 
Example #5
Source File: I18nUtil.java    From zuihou-admin-cloud with Apache License 2.0 6 votes vote down vote up
public static Properties loadI18nProp() {
    if (prop != null) {
        return prop;
    }
    try {
        // build i18n prop
        String i18n = XxlJobAdminConfig.getAdminConfig().getI18n();
        i18n = StringUtils.isNotBlank(i18n) ? ("_" + i18n) : i18n;
        String i18nFile = MessageFormat.format("i18n/message{0}.properties", i18n);

        // load prop
        Resource resource = new ClassPathResource(i18nFile);
        EncodedResource encodedResource = new EncodedResource(resource, "UTF-8");
        prop = PropertiesLoaderUtils.loadProperties(encodedResource);
    } catch (IOException e) {
        logger.error(e.getMessage(), e);
    }
    return prop;
}
 
Example #6
Source File: JobGroupController.java    From zuihou-admin-boot with Apache License 2.0 6 votes vote down vote up
private List<String> findRegistryByAppName(String appNameParam) {
    HashMap<String, List<String>> appAddressMap = new HashMap<String, List<String>>();
    List<XxlJobRegistry> list = XxlJobAdminConfig.getAdminConfig().getXxlJobRegistryDao().findAll(RegistryConfig.DEAD_TIMEOUT);
    if (list != null) {
        for (XxlJobRegistry item : list) {
            if (RegistryConfig.RegistType.EXECUTOR.name().equals(item.getRegistryGroup())) {
                String appName = item.getRegistryKey();
                List<String> registryList = appAddressMap.get(appName);
                if (registryList == null) {
                    registryList = new ArrayList<String>();
                }

                if (!registryList.contains(item.getRegistryValue())) {
                    registryList.add(item.getRegistryValue());
                }
                appAddressMap.put(appName, registryList);
            }
        }
    }
    return appAddressMap.get(appNameParam);
}
 
Example #7
Source File: JobGroupController.java    From zuihou-admin-cloud with Apache License 2.0 6 votes vote down vote up
private List<String> findRegistryByAppName(String appNameParam) {
    HashMap<String, List<String>> appAddressMap = new HashMap<String, List<String>>();
    List<XxlJobRegistry> list = XxlJobAdminConfig.getAdminConfig().getXxlJobRegistryDao().findAll(RegistryConfig.DEAD_TIMEOUT);
    if (list != null) {
        for (XxlJobRegistry item : list) {
            if (RegistryConfig.RegistType.EXECUTOR.name().equals(item.getRegistryGroup())) {
                String appName = item.getRegistryKey();
                List<String> registryList = appAddressMap.get(appName);
                if (registryList == null) {
                    registryList = new ArrayList<String>();
                }

                if (!registryList.contains(item.getRegistryValue())) {
                    registryList.add(item.getRegistryValue());
                }
                appAddressMap.put(appName, registryList);
            }
        }
    }
    return appAddressMap.get(appNameParam);
}
 
Example #8
Source File: I18nUtil.java    From xxl-job with GNU General Public License v3.0 6 votes vote down vote up
public static Properties loadI18nProp(){
    if (prop != null) {
        return prop;
    }
    try {
        // build i18n prop
        String i18n = XxlJobAdminConfig.getAdminConfig().getI18n();
        String i18nFile = MessageFormat.format("i18n/message_{0}.properties", i18n);

        // load prop
        Resource resource = new ClassPathResource(i18nFile);
        EncodedResource encodedResource = new EncodedResource(resource,"UTF-8");
        prop = PropertiesLoaderUtils.loadProperties(encodedResource);
    } catch (IOException e) {
        logger.error(e.getMessage(), e);
    }
    return prop;
}
 
Example #9
Source File: I18nUtil.java    From zuihou-admin-boot with Apache License 2.0 6 votes vote down vote up
public static Properties loadI18nProp() {
    if (prop != null) {
        return prop;
    }
    try {
        // build i18n prop
        String i18n = XxlJobAdminConfig.getAdminConfig().getI18n();
        i18n = StringUtils.isNotBlank(i18n) ? ("_" + i18n) : i18n;
        String i18nFile = MessageFormat.format("i18n/message{0}.properties", i18n);

        // load prop
        Resource resource = new ClassPathResource(i18nFile);
        EncodedResource encodedResource = new EncodedResource(resource, "UTF-8");
        prop = PropertiesLoaderUtils.loadProperties(encodedResource);
    } catch (IOException e) {
        logger.error(e.getMessage(), e);
    }
    return prop;
}
 
Example #10
Source File: MailUtil.java    From zuihou-admin-boot with Apache License 2.0 5 votes vote down vote up
/**
 * @param toAddress   收件人邮箱
 * @param mailSubject 邮件主题
 * @param mailBody    邮件正文
 * @return
 */
public static boolean sendMail(String toAddress, String mailSubject, String mailBody) {

    try {
        // Create the email message
        HtmlEmail email = new HtmlEmail();

        //email.setDebug(true);		// 将会打印一些log
        //email.setTLS(true);		// 是否TLS校验,,某些邮箱需要TLS安全校验,同理有SSL校验
        //email.setSSL(true);

        email.setHostName(XxlJobAdminConfig.getAdminConfig().getMailHost());

        if (XxlJobAdminConfig.getAdminConfig().isMailSSL()) {
            email.setSslSmtpPort(XxlJobAdminConfig.getAdminConfig().getMailPort());
            email.setSSLOnConnect(true);
        } else {
            email.setSmtpPort(Integer.valueOf(XxlJobAdminConfig.getAdminConfig().getMailPort()));
        }

        email.setAuthenticator(new DefaultAuthenticator(XxlJobAdminConfig.getAdminConfig().getMailUsername(), XxlJobAdminConfig.getAdminConfig().getMailPassword()));
        email.setCharset("UTF-8");

        email.setFrom(XxlJobAdminConfig.getAdminConfig().getMailUsername(), XxlJobAdminConfig.getAdminConfig().getMailSendNick());
        email.addTo(toAddress);
        email.setSubject(mailSubject);
        email.setMsg(mailBody);

        //email.attach(attachment);	// add the attachment

        email.send();                // send the email
        return true;
    } catch (EmailException e) {
        logger.error(e.getMessage(), e);

    }
    return false;
}
 
Example #11
Source File: JobFailMonitorHelper.java    From zuihou-admin-cloud with Apache License 2.0 5 votes vote down vote up
/**
 * fail alarm
 *
 * @param jobLog
 */
private void failAlarm(XxlJobInfo info, XxlJobLog jobLog) {

    // send monitor email
    if (info != null && info.getAlarmEmail() != null && info.getAlarmEmail().trim().length() > 0) {

        String alarmContent = "Alarm Job LogId=" + jobLog.getId();
        if (jobLog.getTriggerCode() != ReturnT.SUCCESS_CODE) {
            alarmContent += "<br>TriggerMsg=" + jobLog.getTriggerMsg();
        }
        if (jobLog.getHandleCode() > 0 && jobLog.getHandleCode() != ReturnT.SUCCESS_CODE) {
            alarmContent += "<br>HandleCode=" + jobLog.getHandleMsg();
        }

        Set<String> emailSet = new HashSet<String>(Arrays.asList(info.getAlarmEmail().split(",")));
        for (String email : emailSet) {
            XxlJobGroup group = XxlJobAdminConfig.getAdminConfig().getXxlJobGroupDao().load(Integer.valueOf(info.getJobGroup()));

            String title = I18nUtil.getString("jobconf_monitor");
            String content = MessageFormat.format(MAIL_BODY_TEMPLATE,
                    group != null ? group.getTitle() : "null",
                    info.getId(),
                    info.getJobDesc(),
                    alarmContent);

            MailUtil.sendMail(email, title, content);
        }
    }

    //  自定义报警策略, 如短信

}
 
Example #12
Source File: MailUtil.java    From zuihou-admin-cloud with Apache License 2.0 5 votes vote down vote up
/**
 * @param toAddress   收件人邮箱
 * @param mailSubject 邮件主题
 * @param mailBody    邮件正文
 * @return
 */
public static boolean sendMail(String toAddress, String mailSubject, String mailBody) {

    try {
        // Create the email message
        HtmlEmail email = new HtmlEmail();

        //email.setDebug(true);		// 将会打印一些log
        //email.setTLS(true);		// 是否TLS校验,,某些邮箱需要TLS安全校验,同理有SSL校验
        //email.setSSL(true);

        email.setHostName(XxlJobAdminConfig.getAdminConfig().getMailHost());

        if (XxlJobAdminConfig.getAdminConfig().isMailSSL()) {
            email.setSslSmtpPort(XxlJobAdminConfig.getAdminConfig().getMailPort());
            email.setSSLOnConnect(true);
        } else {
            email.setSmtpPort(Integer.valueOf(XxlJobAdminConfig.getAdminConfig().getMailPort()));
        }

        email.setAuthenticator(new DefaultAuthenticator(XxlJobAdminConfig.getAdminConfig().getMailUsername(), XxlJobAdminConfig.getAdminConfig().getMailPassword()));
        email.setCharset("UTF-8");

        email.setFrom(XxlJobAdminConfig.getAdminConfig().getMailUsername(), XxlJobAdminConfig.getAdminConfig().getMailSendNick());
        email.addTo(toAddress);
        email.setSubject(mailSubject);
        email.setMsg(mailBody);

        //email.attach(attachment);	// add the attachment

        email.send();                // send the email
        return true;
    } catch (EmailException e) {
        logger.error(e.getMessage(), e);

    }
    return false;
}
 
Example #13
Source File: XxlJobDynamicScheduler.java    From zuihou-admin-cloud with Apache License 2.0 5 votes vote down vote up
private void initRpcProvider() {
    // init
    XxlRpcProviderFactory xxlRpcProviderFactory = new XxlRpcProviderFactory();
    xxlRpcProviderFactory.initConfig(NetEnum.JETTY, Serializer.SerializeEnum.HESSIAN.getSerializer(), null, 0, XxlJobAdminConfig.getAdminConfig().getAccessToken(), null, null);

    // add services
    xxlRpcProviderFactory.addService(AdminBiz.class.getName(), null, XxlJobAdminConfig.getAdminConfig().getAdminBiz());

    // jetty handler
    jettyServerHandler = new JettyServerHandler(xxlRpcProviderFactory);
}
 
Example #14
Source File: PermissionInterceptor.java    From zuihou-admin-cloud with Apache License 2.0 5 votes vote down vote up
public static String getLoginIdentityToken() {
    if (LOGIN_IDENTITY_TOKEN == null) {
        String username = XxlJobAdminConfig.getAdminConfig().getLoginUsername();
        String password = XxlJobAdminConfig.getAdminConfig().getLoginPassword();

        // login token
        String tokenTmp = DigestUtils.md5DigestAsHex(String.valueOf(username + "_" + password).getBytes());        //.getBytes("UTF-8")
        tokenTmp = new BigInteger(1, tokenTmp.getBytes()).toString(16);

        LOGIN_IDENTITY_TOKEN = tokenTmp;
    }
    return LOGIN_IDENTITY_TOKEN;
}
 
Example #15
Source File: JobFailMonitorHelper.java    From zuihou-admin-boot with Apache License 2.0 5 votes vote down vote up
/**
 * fail alarm
 *
 * @param jobLog
 */
private void failAlarm(XxlJobInfo info, XxlJobLog jobLog) {

    // send monitor email
    if (info != null && info.getAlarmEmail() != null && info.getAlarmEmail().trim().length() > 0) {

        String alarmContent = "Alarm Job LogId=" + jobLog.getId();
        if (jobLog.getTriggerCode() != ReturnT.SUCCESS_CODE) {
            alarmContent += "<br>TriggerMsg=" + jobLog.getTriggerMsg();
        }
        if (jobLog.getHandleCode() > 0 && jobLog.getHandleCode() != ReturnT.SUCCESS_CODE) {
            alarmContent += "<br>HandleCode=" + jobLog.getHandleMsg();
        }

        Set<String> emailSet = new HashSet<String>(Arrays.asList(info.getAlarmEmail().split(",")));
        for (String email : emailSet) {
            XxlJobGroup group = XxlJobAdminConfig.getAdminConfig().getXxlJobGroupDao().load(Integer.valueOf(info.getJobGroup()));

            String title = I18nUtil.getString("jobconf_monitor");
            String content = MessageFormat.format(MAIL_BODY_TEMPLATE,
                    group != null ? group.getTitle() : "null",
                    info.getId(),
                    info.getJobDesc(),
                    alarmContent);

            MailUtil.sendMail(email, title, content);
        }
    }

    //  自定义报警策略, 如短信

}
 
Example #16
Source File: XxlJobDynamicScheduler.java    From zuihou-admin-boot with Apache License 2.0 5 votes vote down vote up
private void initRpcProvider() {
    // init
    XxlRpcProviderFactory xxlRpcProviderFactory = new XxlRpcProviderFactory();
    xxlRpcProviderFactory.initConfig(NetEnum.JETTY, Serializer.SerializeEnum.HESSIAN.getSerializer(), null, 0, XxlJobAdminConfig.getAdminConfig().getAccessToken(), null, null);

    // add services
    xxlRpcProviderFactory.addService(AdminBiz.class.getName(), null, XxlJobAdminConfig.getAdminConfig().getAdminBiz());

    // jetty handler
    jettyServerHandler = new JettyServerHandler(xxlRpcProviderFactory);
}
 
Example #17
Source File: PermissionInterceptor.java    From zuihou-admin-boot with Apache License 2.0 5 votes vote down vote up
public static String getLoginIdentityToken() {
    if (LOGIN_IDENTITY_TOKEN == null) {
        String username = XxlJobAdminConfig.getAdminConfig().getLoginUsername();
        String password = XxlJobAdminConfig.getAdminConfig().getLoginPassword();

        // login token
        String tokenTmp = DigestUtils.md5DigestAsHex(String.valueOf(username + "_" + password).getBytes());        //.getBytes("UTF-8")
        tokenTmp = new BigInteger(1, tokenTmp.getBytes()).toString(16);

        LOGIN_IDENTITY_TOKEN = tokenTmp;
    }
    return LOGIN_IDENTITY_TOKEN;
}
 
Example #18
Source File: JobInfoControllerTest.java    From microservices-platform with Apache License 2.0 5 votes vote down vote up
@Before
public void login() throws Exception {
  MvcResult ret = mockMvc.perform(
      post("/login")
          .contentType(MediaType.APPLICATION_FORM_URLENCODED)
          .param("userName", XxlJobAdminConfig.getAdminConfig().getLoginUsername())
          .param("password", XxlJobAdminConfig.getAdminConfig().getLoginPassword())
  ).andReturn();
  cookie = ret.getResponse().getCookie(PermissionInterceptor.LOGIN_IDENTITY_KEY);
}
 
Example #19
Source File: JobTriggerPoolHelper.java    From xxl-job with GNU General Public License v3.0 5 votes vote down vote up
public void start(){
    fastTriggerPool = new ThreadPoolExecutor(
            10,
            XxlJobAdminConfig.getAdminConfig().getTriggerPoolFastMax(),
            60L,
            TimeUnit.SECONDS,
            new LinkedBlockingQueue<Runnable>(1000),
            new ThreadFactory() {
                @Override
                public Thread newThread(Runnable r) {
                    return new Thread(r, "xxl-job, admin JobTriggerPoolHelper-fastTriggerPool-" + r.hashCode());
                }
            });

    slowTriggerPool = new ThreadPoolExecutor(
            10,
            XxlJobAdminConfig.getAdminConfig().getTriggerPoolSlowMax(),
            60L,
            TimeUnit.SECONDS,
            new LinkedBlockingQueue<Runnable>(2000),
            new ThreadFactory() {
                @Override
                public Thread newThread(Runnable r) {
                    return new Thread(r, "xxl-job, admin JobTriggerPoolHelper-slowTriggerPool-" + r.hashCode());
                }
            });
}
 
Example #20
Source File: XxlJobTrigger.java    From microservices-platform with Apache License 2.0 5 votes vote down vote up
/**
 * trigger job
 *
 * @param jobId
 * @param triggerType
 * @param failRetryCount
 * 			>=0: use this param
 * 			<0: use param from job info config
 * @param executorShardingParam
 * @param executorParam
 *          null: use job param
 *          not null: cover job param
 */
public static void trigger(int jobId, TriggerTypeEnum triggerType, int failRetryCount, String executorShardingParam, String executorParam) {
    // load data
    XxlJobInfo jobInfo = XxlJobAdminConfig.getAdminConfig().getXxlJobInfoDao().loadById(jobId);
    if (jobInfo == null) {
        logger.warn(">>>>>>>>>>>> trigger fail, jobId invalid,jobId={}", jobId);
        return;
    }
    if (executorParam != null) {
        jobInfo.setExecutorParam(executorParam);
    }
    int finalFailRetryCount = failRetryCount>=0?failRetryCount:jobInfo.getExecutorFailRetryCount();
    XxlJobGroup group = XxlJobAdminConfig.getAdminConfig().getXxlJobGroupDao().load(jobInfo.getJobGroup());

    // sharding param
    int[] shardingParam = null;
    if (executorShardingParam!=null){
        String[] shardingArr = executorShardingParam.split("/");
        if (shardingArr.length==2 && StringUtils.isNumeric(shardingArr[0]) && StringUtils.isNumeric(shardingArr[1])) {
            shardingParam = new int[2];
            shardingParam[0] = Integer.valueOf(shardingArr[0]);
            shardingParam[1] = Integer.valueOf(shardingArr[1]);
        }
    }
    if (ExecutorRouteStrategyEnum.SHARDING_BROADCAST==ExecutorRouteStrategyEnum.match(jobInfo.getExecutorRouteStrategy(), null)
            && group.getRegistryList()!=null && !group.getRegistryList().isEmpty()
            && shardingParam==null) {
        for (int i = 0; i < group.getRegistryList().size(); i++) {
            processTrigger(group, jobInfo, finalFailRetryCount, triggerType, i, group.getRegistryList().size());
        }
    } else {
        if (shardingParam == null) {
            shardingParam = new int[]{0, 1};
        }
        processTrigger(group, jobInfo, finalFailRetryCount, triggerType, shardingParam[0], shardingParam[1]);
    }

}
 
Example #21
Source File: PermissionInterceptor.java    From microservices-platform with Apache License 2.0 5 votes vote down vote up
public static String getLoginIdentityToken() {
	if (LOGIN_IDENTITY_TOKEN == null) {
		String username = XxlJobAdminConfig.getAdminConfig().getLoginUsername();
		String password = XxlJobAdminConfig.getAdminConfig().getLoginPassword();

		// login token
		String tokenTmp = DigestUtils.md5DigestAsHex(String.valueOf(username + "_" + password).getBytes());		//.getBytes("UTF-8")
		tokenTmp = new BigInteger(1, tokenTmp.getBytes()).toString(16);

		LOGIN_IDENTITY_TOKEN = tokenTmp;
	}
	return LOGIN_IDENTITY_TOKEN;
}
 
Example #22
Source File: XxlJobTrigger.java    From xxl-job with GNU General Public License v3.0 4 votes vote down vote up
/**
 * @param group                     job group, registry list may be empty
 * @param jobInfo
 * @param finalFailRetryCount
 * @param triggerType
 * @param index                     sharding index
 * @param total                     sharding index
 */
private static void processTrigger(XxlJobGroup group, XxlJobInfo jobInfo, int finalFailRetryCount, TriggerTypeEnum triggerType, int index, int total){

    // param
    ExecutorBlockStrategyEnum blockStrategy = ExecutorBlockStrategyEnum.match(jobInfo.getExecutorBlockStrategy(), ExecutorBlockStrategyEnum.SERIAL_EXECUTION);  // block strategy
    ExecutorRouteStrategyEnum executorRouteStrategyEnum = ExecutorRouteStrategyEnum.match(jobInfo.getExecutorRouteStrategy(), null);    // route strategy
    String shardingParam = (ExecutorRouteStrategyEnum.SHARDING_BROADCAST==executorRouteStrategyEnum)?String.valueOf(index).concat("/").concat(String.valueOf(total)):null;

    // 1、save log-id
    XxlJobLog jobLog = new XxlJobLog();
    jobLog.setJobGroup(jobInfo.getJobGroup());
    jobLog.setJobId(jobInfo.getId());
    jobLog.setTriggerTime(new Date());
    XxlJobAdminConfig.getAdminConfig().getXxlJobLogDao().save(jobLog);
    logger.debug(">>>>>>>>>>> xxl-job trigger start, jobId:{}", jobLog.getId());

    // 2、init trigger-param
    TriggerParam triggerParam = new TriggerParam();
    triggerParam.setJobId(jobInfo.getId());
    triggerParam.setExecutorHandler(jobInfo.getExecutorHandler());
    triggerParam.setExecutorParams(jobInfo.getExecutorParam());
    triggerParam.setExecutorBlockStrategy(jobInfo.getExecutorBlockStrategy());
    triggerParam.setExecutorTimeout(jobInfo.getExecutorTimeout());
    triggerParam.setLogId(jobLog.getId());
    triggerParam.setLogDateTime(jobLog.getTriggerTime().getTime());
    triggerParam.setGlueType(jobInfo.getGlueType());
    triggerParam.setGlueSource(jobInfo.getGlueSource());
    triggerParam.setGlueUpdatetime(jobInfo.getGlueUpdatetime().getTime());
    triggerParam.setBroadcastIndex(index);
    triggerParam.setBroadcastTotal(total);

    // 3、init address
    String address = null;
    ReturnT<String> routeAddressResult = null;
    if (group.getRegistryList()!=null && !group.getRegistryList().isEmpty()) {
        if (ExecutorRouteStrategyEnum.SHARDING_BROADCAST == executorRouteStrategyEnum) {
            if (index < group.getRegistryList().size()) {
                address = group.getRegistryList().get(index);
            } else {
                address = group.getRegistryList().get(0);
            }
        } else {
            routeAddressResult = executorRouteStrategyEnum.getRouter().route(triggerParam, group.getRegistryList());
            if (routeAddressResult.getCode() == ReturnT.SUCCESS_CODE) {
                address = routeAddressResult.getContent();
            }
        }
    } else {
        routeAddressResult = new ReturnT<String>(ReturnT.FAIL_CODE, I18nUtil.getString("jobconf_trigger_address_empty"));
    }

    // 4、trigger remote executor
    ReturnT<String> triggerResult = null;
    if (address != null) {
        triggerResult = runExecutor(triggerParam, address);
    } else {
        triggerResult = new ReturnT<String>(ReturnT.FAIL_CODE, null);
    }

    // 5、collection trigger info
    StringBuffer triggerMsgSb = new StringBuffer();
    triggerMsgSb.append(I18nUtil.getString("jobconf_trigger_type")).append(":").append(triggerType.getTitle());
    triggerMsgSb.append("<br>").append(I18nUtil.getString("jobconf_trigger_admin_adress")).append(":").append(IpUtil.getIp());
    triggerMsgSb.append("<br>").append(I18nUtil.getString("jobconf_trigger_exe_regtype")).append(":")
            .append( (group.getAddressType() == 0)?I18nUtil.getString("jobgroup_field_addressType_0"):I18nUtil.getString("jobgroup_field_addressType_1") );
    triggerMsgSb.append("<br>").append(I18nUtil.getString("jobconf_trigger_exe_regaddress")).append(":").append(group.getRegistryList());
    triggerMsgSb.append("<br>").append(I18nUtil.getString("jobinfo_field_executorRouteStrategy")).append(":").append(executorRouteStrategyEnum.getTitle());
    if (shardingParam != null) {
        triggerMsgSb.append("("+shardingParam+")");
    }
    triggerMsgSb.append("<br>").append(I18nUtil.getString("jobinfo_field_executorBlockStrategy")).append(":").append(blockStrategy.getTitle());
    triggerMsgSb.append("<br>").append(I18nUtil.getString("jobinfo_field_timeout")).append(":").append(jobInfo.getExecutorTimeout());
    triggerMsgSb.append("<br>").append(I18nUtil.getString("jobinfo_field_executorFailRetryCount")).append(":").append(finalFailRetryCount);

    triggerMsgSb.append("<br><br><span style=\"color:#00c0ef;\" > >>>>>>>>>>>"+ I18nUtil.getString("jobconf_trigger_run") +"<<<<<<<<<<< </span><br>")
            .append((routeAddressResult!=null&&routeAddressResult.getMsg()!=null)?routeAddressResult.getMsg()+"<br><br>":"").append(triggerResult.getMsg()!=null?triggerResult.getMsg():"");

    // 6、save log trigger-info
    jobLog.setExecutorAddress(address);
    jobLog.setExecutorHandler(jobInfo.getExecutorHandler());
    jobLog.setExecutorParam(jobInfo.getExecutorParam());
    jobLog.setExecutorShardingParam(shardingParam);
    jobLog.setExecutorFailRetryCount(finalFailRetryCount);
    //jobLog.setTriggerTime();
    jobLog.setTriggerCode(triggerResult.getCode());
    jobLog.setTriggerMsg(triggerMsgSb.toString());
    XxlJobAdminConfig.getAdminConfig().getXxlJobLogDao().updateTriggerInfo(jobLog);

    logger.debug(">>>>>>>>>>> xxl-job trigger end, jobId:{}", jobLog.getId());
}
 
Example #23
Source File: XxlJobTrigger.java    From xxl-job with GNU General Public License v3.0 4 votes vote down vote up
/**
 * trigger job
 *
 * @param jobId
 * @param triggerType
 * @param failRetryCount
 * 			>=0: use this param
 * 			<0: use param from job info config
 * @param executorShardingParam
 * @param executorParam
 *          null: use job param
 *          not null: cover job param
 * @param addressList
 *          null: use executor addressList
 *          not null: cover
 */
public static void trigger(int jobId,
                           TriggerTypeEnum triggerType,
                           int failRetryCount,
                           String executorShardingParam,
                           String executorParam,
                           String addressList) {

    // load data
    XxlJobInfo jobInfo = XxlJobAdminConfig.getAdminConfig().getXxlJobInfoDao().loadById(jobId);
    if (jobInfo == null) {
        logger.warn(">>>>>>>>>>>> trigger fail, jobId invalid,jobId={}", jobId);
        return;
    }
    if (executorParam != null) {
        jobInfo.setExecutorParam(executorParam);
    }
    int finalFailRetryCount = failRetryCount>=0?failRetryCount:jobInfo.getExecutorFailRetryCount();
    XxlJobGroup group = XxlJobAdminConfig.getAdminConfig().getXxlJobGroupDao().load(jobInfo.getJobGroup());

    // cover addressList
    if (addressList!=null && addressList.trim().length()>0) {
        group.setAddressType(1);
        group.setAddressList(addressList.trim());
    }

    // sharding param
    int[] shardingParam = null;
    if (executorShardingParam!=null){
        String[] shardingArr = executorShardingParam.split("/");
        if (shardingArr.length==2 && isNumeric(shardingArr[0]) && isNumeric(shardingArr[1])) {
            shardingParam = new int[2];
            shardingParam[0] = Integer.valueOf(shardingArr[0]);
            shardingParam[1] = Integer.valueOf(shardingArr[1]);
        }
    }
    if (ExecutorRouteStrategyEnum.SHARDING_BROADCAST==ExecutorRouteStrategyEnum.match(jobInfo.getExecutorRouteStrategy(), null)
            && group.getRegistryList()!=null && !group.getRegistryList().isEmpty()
            && shardingParam==null) {
        for (int i = 0; i < group.getRegistryList().size(); i++) {
            processTrigger(group, jobInfo, finalFailRetryCount, triggerType, i, group.getRegistryList().size());
        }
    } else {
        if (shardingParam == null) {
            shardingParam = new int[]{0, 1};
        }
        processTrigger(group, jobInfo, finalFailRetryCount, triggerType, shardingParam[0], shardingParam[1]);
    }

}
 
Example #24
Source File: JobRegistryMonitorHelper.java    From xxl-job with GNU General Public License v3.0 4 votes vote down vote up
public void start(){
	registryThread = new Thread(new Runnable() {
		@Override
		public void run() {
			while (!toStop) {
				try {
					// auto registry group
					List<XxlJobGroup> groupList = XxlJobAdminConfig.getAdminConfig().getXxlJobGroupDao().findByAddressType(0);
					if (groupList!=null && !groupList.isEmpty()) {

						// remove dead address (admin/executor)
						List<Integer> ids = XxlJobAdminConfig.getAdminConfig().getXxlJobRegistryDao().findDead(RegistryConfig.DEAD_TIMEOUT, new Date());
						if (ids!=null && ids.size()>0) {
							XxlJobAdminConfig.getAdminConfig().getXxlJobRegistryDao().removeDead(ids);
						}

						// fresh online address (admin/executor)
						HashMap<String, List<String>> appAddressMap = new HashMap<String, List<String>>();
						List<XxlJobRegistry> list = XxlJobAdminConfig.getAdminConfig().getXxlJobRegistryDao().findAll(RegistryConfig.DEAD_TIMEOUT, new Date());
						if (list != null) {
							for (XxlJobRegistry item: list) {
								if (RegistryConfig.RegistType.EXECUTOR.name().equals(item.getRegistryGroup())) {
									String appname = item.getRegistryKey();
									List<String> registryList = appAddressMap.get(appname);
									if (registryList == null) {
										registryList = new ArrayList<String>();
									}

									if (!registryList.contains(item.getRegistryValue())) {
										registryList.add(item.getRegistryValue());
									}
									appAddressMap.put(appname, registryList);
								}
							}
						}

						// fresh group address
						for (XxlJobGroup group: groupList) {
							List<String> registryList = appAddressMap.get(group.getAppname());
							String addressListStr = null;
							if (registryList!=null && !registryList.isEmpty()) {
								Collections.sort(registryList);
								addressListStr = "";
								for (String item:registryList) {
									addressListStr += item + ",";
								}
								addressListStr = addressListStr.substring(0, addressListStr.length()-1);
							}
							group.setAddressList(addressListStr);
							XxlJobAdminConfig.getAdminConfig().getXxlJobGroupDao().update(group);
						}
					}
				} catch (Exception e) {
					if (!toStop) {
						logger.error(">>>>>>>>>>> xxl-job, job registry monitor thread error:{}", e);
					}
				}
				try {
					TimeUnit.SECONDS.sleep(RegistryConfig.BEAT_TIMEOUT);
				} catch (InterruptedException e) {
					if (!toStop) {
						logger.error(">>>>>>>>>>> xxl-job, job registry monitor thread error:{}", e);
					}
				}
			}
			logger.info(">>>>>>>>>>> xxl-job, job registry monitor thread stop");
		}
	});
	registryThread.setDaemon(true);
	registryThread.setName("xxl-job, admin JobRegistryMonitorHelper");
	registryThread.start();
}
 
Example #25
Source File: JobFailMonitorHelper.java    From xxl-job with GNU General Public License v3.0 4 votes vote down vote up
public void start(){
	monitorThread = new Thread(new Runnable() {

		@Override
		public void run() {

			// monitor
			while (!toStop) {
				try {

					List<Long> failLogIds = XxlJobAdminConfig.getAdminConfig().getXxlJobLogDao().findFailJobLogIds(1000);
					if (failLogIds!=null && !failLogIds.isEmpty()) {
						for (long failLogId: failLogIds) {

							// lock log
							int lockRet = XxlJobAdminConfig.getAdminConfig().getXxlJobLogDao().updateAlarmStatus(failLogId, 0, -1);
							if (lockRet < 1) {
								continue;
							}
							XxlJobLog log = XxlJobAdminConfig.getAdminConfig().getXxlJobLogDao().load(failLogId);
							XxlJobInfo info = XxlJobAdminConfig.getAdminConfig().getXxlJobInfoDao().loadById(log.getJobId());

							// 1、fail retry monitor
							if (log.getExecutorFailRetryCount() > 0) {
								JobTriggerPoolHelper.trigger(log.getJobId(), TriggerTypeEnum.RETRY, (log.getExecutorFailRetryCount()-1), log.getExecutorShardingParam(), log.getExecutorParam(), null);
								String retryMsg = "<br><br><span style=\"color:#F39C12;\" > >>>>>>>>>>>"+ I18nUtil.getString("jobconf_trigger_type_retry") +"<<<<<<<<<<< </span><br>";
								log.setTriggerMsg(log.getTriggerMsg() + retryMsg);
								XxlJobAdminConfig.getAdminConfig().getXxlJobLogDao().updateTriggerInfo(log);
							}

							// 2、fail alarm monitor
							int newAlarmStatus = 0;		// 告警状态:0-默认、-1=锁定状态、1-无需告警、2-告警成功、3-告警失败
							if (info!=null && info.getAlarmEmail()!=null && info.getAlarmEmail().trim().length()>0) {
								boolean alarmResult = XxlJobAdminConfig.getAdminConfig().getJobAlarmer().alarm(info, log);
								newAlarmStatus = alarmResult?2:3;
							} else {
								newAlarmStatus = 1;
							}

							XxlJobAdminConfig.getAdminConfig().getXxlJobLogDao().updateAlarmStatus(failLogId, -1, newAlarmStatus);
						}
					}

				} catch (Exception e) {
					if (!toStop) {
						logger.error(">>>>>>>>>>> xxl-job, job fail monitor thread error:{}", e);
					}
				}

                   try {
                       TimeUnit.SECONDS.sleep(10);
                   } catch (Exception e) {
                       if (!toStop) {
                           logger.error(e.getMessage(), e);
                       }
                   }

               }

			logger.info(">>>>>>>>>>> xxl-job, job fail monitor thread stop");

		}
	});
	monitorThread.setDaemon(true);
	monitorThread.setName("xxl-job, admin JobFailMonitorHelper");
	monitorThread.start();
}
 
Example #26
Source File: JobLosedMonitorHelper.java    From xxl-job with GNU General Public License v3.0 4 votes vote down vote up
public void start(){
	monitorThread = new Thread(new Runnable() {

		@Override
		public void run() {

			// monitor
			while (!toStop) {
				try {
					// 任务结果丢失处理:调度记录停留在 "运行中" 状态超过10min,且对应执行器心跳注册失败不在线,则将本地调度主动标记失败;
					Date losedTime = DateUtil.addMinutes(new Date(), -10);
					List<Long> losedJobIds  = XxlJobAdminConfig.getAdminConfig().getXxlJobLogDao().findLostJobIds(losedTime);

					if (losedJobIds!=null && losedJobIds.size()>0) {
						for (Long logId: losedJobIds) {

							XxlJobLog jobLog = new XxlJobLog();
							jobLog.setId(logId);

							jobLog.setHandleTime(new Date());
							jobLog.setHandleCode(ReturnT.FAIL_CODE);
							jobLog.setHandleMsg( I18nUtil.getString("joblog_lost_fail") );

							XxlJobAdminConfig.getAdminConfig().getXxlJobLogDao().updateHandleInfo(jobLog);
						}

					}
				} catch (Exception e) {
					if (!toStop) {
						logger.error(">>>>>>>>>>> xxl-job, job fail monitor thread error:{}", e);
					}
				}

                   try {
                       TimeUnit.SECONDS.sleep(60);
                   } catch (Exception e) {
                       if (!toStop) {
                           logger.error(e.getMessage(), e);
                       }
                   }

               }

			logger.info(">>>>>>>>>>> xxl-job, JobLosedMonitorHelper stop");

		}
	});
	monitorThread.setDaemon(true);
	monitorThread.setName("xxl-job, admin JobLosedMonitorHelper");
	monitorThread.start();
}
 
Example #27
Source File: EmailJobAlarm.java    From xxl-job with GNU General Public License v3.0 4 votes vote down vote up
/**
 * fail alarm
 *
 * @param jobLog
 */
public boolean doAlarm(XxlJobInfo info, XxlJobLog jobLog){
    boolean alarmResult = true;

    // send monitor email
    if (info!=null && info.getAlarmEmail()!=null && info.getAlarmEmail().trim().length()>0) {

        // alarmContent
        String alarmContent = "Alarm Job LogId=" + jobLog.getId();
        if (jobLog.getTriggerCode() != ReturnT.SUCCESS_CODE) {
            alarmContent += "<br>TriggerMsg=<br>" + jobLog.getTriggerMsg();
        }
        if (jobLog.getHandleCode()>0 && jobLog.getHandleCode() != ReturnT.SUCCESS_CODE) {
            alarmContent += "<br>HandleCode=" + jobLog.getHandleMsg();
        }

        // email info
        XxlJobGroup group = XxlJobAdminConfig.getAdminConfig().getXxlJobGroupDao().load(Integer.valueOf(info.getJobGroup()));
        String personal = I18nUtil.getString("admin_name_full");
        String title = I18nUtil.getString("jobconf_monitor");
        String content = MessageFormat.format(loadEmailJobAlarmTemplate(),
                group!=null?group.getTitle():"null",
                info.getId(),
                info.getJobDesc(),
                alarmContent);

        Set<String> emailSet = new HashSet<String>(Arrays.asList(info.getAlarmEmail().split(",")));
        for (String email: emailSet) {

            // make mail
            try {
                MimeMessage mimeMessage = XxlJobAdminConfig.getAdminConfig().getMailSender().createMimeMessage();

                MimeMessageHelper helper = new MimeMessageHelper(mimeMessage, true);
                helper.setFrom(XxlJobAdminConfig.getAdminConfig().getEmailFrom(), personal);
                helper.setTo(email);
                helper.setSubject(title);
                helper.setText(content, true);

                XxlJobAdminConfig.getAdminConfig().getMailSender().send(mimeMessage);
            } catch (Exception e) {
                logger.error(">>>>>>>>>>> xxl-job, job fail alarm email send error, JobLogId:{}", jobLog.getId(), e);

                alarmResult = false;
            }

        }
    }

    return alarmResult;
}
 
Example #28
Source File: JobRegistryMonitorHelper.java    From zuihou-admin-cloud with Apache License 2.0 4 votes vote down vote up
public void start() {
    registryThread = new Thread(new Runnable() {
        @Override
        public void run() {
            while (!toStop) {
                try {
                    // auto registry group
                    List<XxlJobGroup> groupList = XxlJobAdminConfig.getAdminConfig().getXxlJobGroupDao().findByAddressType(0);
                    if (CollectionUtils.isNotEmpty(groupList)) {

                        // remove dead address (admin/executor)
                        XxlJobAdminConfig.getAdminConfig().getXxlJobRegistryDao().removeDead(RegistryConfig.DEAD_TIMEOUT);

                        // fresh online address (admin/executor)
                        HashMap<String, List<String>> appAddressMap = new HashMap<String, List<String>>();
                        List<XxlJobRegistry> list = XxlJobAdminConfig.getAdminConfig().getXxlJobRegistryDao().findAll(RegistryConfig.DEAD_TIMEOUT);
                        if (list != null) {
                            for (XxlJobRegistry item : list) {
                                if (RegistryConfig.RegistType.EXECUTOR.name().equals(item.getRegistryGroup())) {
                                    String appName = item.getRegistryKey();
                                    List<String> registryList = appAddressMap.get(appName);
                                    if (registryList == null) {
                                        registryList = new ArrayList<String>();
                                    }

                                    if (!registryList.contains(item.getRegistryValue())) {
                                        registryList.add(item.getRegistryValue());
                                    }
                                    appAddressMap.put(appName, registryList);
                                }
                            }
                        }

                        // fresh group address
                        for (XxlJobGroup group : groupList) {
                            List<String> registryList = appAddressMap.get(group.getAppName());
                            String addressListStr = null;
                            if (CollectionUtils.isNotEmpty(registryList)) {
                                Collections.sort(registryList);
                                addressListStr = StringUtils.join(registryList, ",");
                            }
                            group.setAddressList(addressListStr);
                            XxlJobAdminConfig.getAdminConfig().getXxlJobGroupDao().update(group);
                        }
                    }
                } catch (Exception e) {
                    logger.error("job registry instance error:{}", e);
                }
                try {
                    TimeUnit.SECONDS.sleep(RegistryConfig.BEAT_TIMEOUT);
                } catch (InterruptedException e) {
                    logger.error("job registry instance error:{}", e);
                }
            }
        }
    });
    registryThread.setDaemon(true);
    registryThread.start();
}
 
Example #29
Source File: JobFailMonitorHelper.java    From zuihou-admin-cloud with Apache License 2.0 4 votes vote down vote up
public void start() {
    monitorThread = new Thread(new Runnable() {

        @Override
        public void run() {
            // monitor
            while (!toStop) {
                try {
                    List<Integer> jobLogIdList = new ArrayList<Integer>();
                    //一次性从BlockingQueue获取所有可用的数据对象(还可以指定获取数据的个数),
                    //    通过该方法,可以提升获取数据效率;不需要多次分批加锁或释放锁。
                    int drainToNum = JobFailMonitorHelper.instance.queue.drainTo(jobLogIdList);

                    if (CollectionUtils.isNotEmpty(jobLogIdList)) {
                        for (Integer jobLogId : jobLogIdList) {
                            if (jobLogId == null || jobLogId == 0) {
                                continue;
                            }
                            XxlJobLog log = XxlJobAdminConfig.getAdminConfig().getXxlJobLogDao().load(jobLogId);
                            if (log == null) {
                                continue;
                            }
				/*
				 判断执行成功的字段有2个,xxl_job_qrtz_trigger_log 表的TriggerCode=调度器调度状态 、HandleCode=执行器执行状态

				  */
                            if (IJobHandler.SUCCESS.getCode() == log.getTriggerCode() && log.getHandleCode() == 0) {
                                // job running
                                JobFailMonitorHelper.monitor(jobLogId);
                                logger.debug(">>>>>>>>>>> job monitor, job running, JobLogId:{}", jobLogId);
                            } else if (IJobHandler.SUCCESS.getCode() == log.getHandleCode()) {
                                // job success, pass
                                logger.info(">>>>>>>>>>> job monitor, job success, JobLogId:{}", jobLogId);
                            } else /*if (IJobHandler.FAIL.getCode() == log.getTriggerCode()
						|| IJobHandler.FAIL.getCode() == log.getHandleCode()
						|| IJobHandler.FAIL_RETRY.getCode() == log.getHandleCode() )*/ {

                                // job fail,

                                // 1、fail retry
                                XxlJobInfo info = XxlJobAdminConfig.getAdminConfig().getXxlJobInfoDao().loadById(log.getJobId());

                                if (log.getExecutorFailRetryCount() > 0) {
                                    JobTriggerPoolHelper.trigger(log.getJobId(), TriggerTypeEnum.RETRY, (log.getExecutorFailRetryCount() - 1), log.getExecutorShardingParam(), null);
                                    String retryMsg = "<br><br><span style=\"color:#F39C12;\" > >>>>>>>>>>>" + I18nUtil.getString("jobconf_trigger_type_retry") + "<<<<<<<<<<< </span><br>";
                                    log.setTriggerMsg(log.getTriggerMsg() + retryMsg);
                                    XxlJobAdminConfig.getAdminConfig().getXxlJobLogDao().updateTriggerInfo(log);
                                }

                                // 2、fail alarm
                                failAlarm(info, log);

                                logger.info(">>>>>>>>>>> job monitor, job fail, JobLogId:{}", jobLogId);
                            }/* else {
					JobFailMonitorHelper.monitor(jobLogId);
					logger.info(">>>>>>>>>>> job monitor, job status unknown, JobLogId:{}", jobLogId);
				}*/
                        }
                    }

                    TimeUnit.SECONDS.sleep(10);
                } catch (Exception e) {
                    logger.error("job monitor error:{}", e);
                }
            }

            // monitor all clear
            List<Integer> jobLogIdList = new ArrayList<Integer>();
            int drainToNum = getInstance().queue.drainTo(jobLogIdList);
            if (jobLogIdList != null && jobLogIdList.size() > 0) {
                for (Integer jobLogId : jobLogIdList) {
                    XxlJobLog log = XxlJobAdminConfig.getAdminConfig().getXxlJobLogDao().load(jobLogId);
                    if (ReturnT.FAIL_CODE == log.getTriggerCode() || ReturnT.FAIL_CODE == log.getHandleCode()) {
                        // job fail,
                        XxlJobInfo info = XxlJobAdminConfig.getAdminConfig().getXxlJobInfoDao().loadById(log.getJobId());

                        failAlarm(info, log);
                        logger.info(">>>>>>>>>>> job monitor last, job fail, JobLogId:{}", jobLogId);
                    }
                }
            }

        }
    });
    monitorThread.setDaemon(true);//守护线程
    monitorThread.start();
}
 
Example #30
Source File: XxlJobTrigger.java    From zuihou-admin-cloud with Apache License 2.0 4 votes vote down vote up
/**
 * trigger job
 *
 * @param jobId
 * @param triggerType
 * @param failRetryCount        >=0: use this param
 *                              <0: use param from job info config
 * @param executorShardingParam
 * @param executorParam         null: use job param
 *                              not null: cover job param
 */
public static void trigger(int jobId, TriggerTypeEnum triggerType, int failRetryCount, String executorShardingParam, String executorParam) {
    // load data
    XxlJobInfo jobInfo = XxlJobAdminConfig.getAdminConfig().getXxlJobInfoDao().loadById(jobId);
    if (jobInfo == null) {
        logger.warn(">>>>>>>>>>>> trigger fail, jobId invalid,jobId={}", jobId);
        return;
    }
    //这里是为了区分 定时 和 cron 类型
    if (JobTypeEnum.TIMES.eq(jobInfo.getType())) {
        triggerType = TriggerTypeEnum.TIMING;
    }

    //设置执行参数
    if (executorParam != null) {
        jobInfo.setExecutorParam(executorParam);
    }
    //失败重试次数
    int finalFailRetryCount = failRetryCount >= 0 ? failRetryCount : jobInfo.getExecutorFailRetryCount();
    //任务组
    XxlJobGroup group = XxlJobAdminConfig.getAdminConfig().getXxlJobGroupDao().load(jobInfo.getJobGroup());

    // sharding param 分片参数
    int[] shardingParam = null;
    if (executorShardingParam != null) {
        String[] shardingArr = executorShardingParam.split("/");
        if (shardingArr.length == 2 && StringUtils.isNumeric(shardingArr[0]) && StringUtils.isNumeric(shardingArr[1])) {
            shardingParam = new int[2];
            shardingParam[0] = Integer.valueOf(shardingArr[0]);
            shardingParam[1] = Integer.valueOf(shardingArr[1]);
        }
    }
    //分片广播
    if (ExecutorRouteStrategyEnum.SHARDING_BROADCAST == ExecutorRouteStrategyEnum.match(jobInfo.getExecutorRouteStrategy(), null)
            && CollectionUtils.isNotEmpty(group.getRegistryList()) && shardingParam == null) {
        for (int i = 0; i < group.getRegistryList().size(); i++) {
            processTrigger(group, jobInfo, finalFailRetryCount, triggerType, i, group.getRegistryList().size());
        }
    } else {
        if (shardingParam == null) {
            shardingParam = new int[]{0, 1};
        }
        processTrigger(group, jobInfo, finalFailRetryCount, triggerType, shardingParam[0], shardingParam[1]);
    }

}