commit
d0f5c1f6ee
@ -1,142 +1,143 @@
|
|||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>com.xuxueli</groupId>
|
<groupId>com.xuxueli</groupId>
|
||||||
<artifactId>xxl-job</artifactId>
|
<artifactId>xxl-job</artifactId>
|
||||||
<version>2.2.0-SNAPSHOT</version>
|
<version>2.2.0-SNAPSHOT</version>
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
|
|
||||||
<name>${project.artifactId}</name>
|
<name>${project.artifactId}</name>
|
||||||
<description>A distributed task scheduling framework.</description>
|
<description>A distributed task scheduling framework.</description>
|
||||||
<url>https://www.xuxueli.com/</url>
|
<url>https://www.xuxueli.com/</url>
|
||||||
|
|
||||||
<modules>
|
<modules>
|
||||||
<module>xxl-job-core</module>
|
<module>xxl-job-core</module>
|
||||||
<module>xxl-job-admin</module>
|
<module>xxl-job-admin</module>
|
||||||
<module>xxl-job-executor-samples</module>
|
<module>xxl-job-executor-samples</module>
|
||||||
</modules>
|
</modules>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||||
<maven.compiler.encoding>UTF-8</maven.compiler.encoding>
|
<maven.compiler.encoding>UTF-8</maven.compiler.encoding>
|
||||||
<maven.compiler.source>1.7</maven.compiler.source>
|
<maven.compiler.source>1.8</maven.compiler.source>
|
||||||
<maven.compiler.target>1.7</maven.compiler.target>
|
<maven.compiler.target>1.8</maven.compiler.target>
|
||||||
<maven.test.skip>true</maven.test.skip>
|
<maven.test.skip>true</maven.test.skip>
|
||||||
|
|
||||||
<xxl-rpc.version>1.5.0</xxl-rpc.version>
|
<xxl-rpc.version>1.5.0</xxl-rpc.version>
|
||||||
|
|
||||||
<spring.version>4.3.25.RELEASE</spring.version>
|
<spring.version>5.2.5.RELEASE</spring.version>
|
||||||
<spring-boot.version>1.5.22.RELEASE</spring-boot.version>
|
<spring-boot.version>2.2.5.RELEASE</spring-boot.version>
|
||||||
<mybatis-spring-boot-starter.version>1.3.5</mybatis-spring-boot-starter.version>
|
|
||||||
<mysql-connector-java.version>5.1.48</mysql-connector-java.version>
|
<mybatis-spring-boot-starter.version>2.1.2</mybatis-spring-boot-starter.version>
|
||||||
|
<mysql-connector-java.version>8.0.19</mysql-connector-java.version>
|
||||||
<slf4j-api.version>1.7.29</slf4j-api.version>
|
|
||||||
<junit.version>4.12</junit.version>
|
<slf4j-api.version>1.7.30</slf4j-api.version>
|
||||||
|
<junit.version>4.13</junit.version>
|
||||||
<groovy.version>2.5.8</groovy.version>
|
|
||||||
|
<groovy.version>3.0.2</groovy.version>
|
||||||
<maven-source-plugin.version>3.2.0</maven-source-plugin.version>
|
|
||||||
<maven-javadoc-plugin.version>3.1.1</maven-javadoc-plugin.version>
|
<maven-source-plugin.version>3.2.1</maven-source-plugin.version>
|
||||||
<maven-gpg-plugin.version>1.6</maven-gpg-plugin.version>
|
<maven-javadoc-plugin.version>3.2.0</maven-javadoc-plugin.version>
|
||||||
<maven-war-plugin.version>3.2.3</maven-war-plugin.version>
|
<maven-gpg-plugin.version>1.6</maven-gpg-plugin.version>
|
||||||
</properties>
|
<maven-war-plugin.version>3.2.3</maven-war-plugin.version>
|
||||||
|
</properties>
|
||||||
<build>
|
|
||||||
<plugins>
|
<build>
|
||||||
</plugins>
|
<plugins>
|
||||||
</build>
|
</plugins>
|
||||||
|
</build>
|
||||||
|
|
||||||
<licenses>
|
|
||||||
<license>
|
<licenses>
|
||||||
<name>GNU General Public License version 3</name>
|
<license>
|
||||||
<url>https://opensource.org/licenses/GPL-3.0</url>
|
<name>GNU General Public License version 3</name>
|
||||||
</license>
|
<url>https://opensource.org/licenses/GPL-3.0</url>
|
||||||
</licenses>
|
</license>
|
||||||
|
</licenses>
|
||||||
<scm>
|
|
||||||
<tag>master</tag>
|
<scm>
|
||||||
<url>https://github.com/xuxueli/xxl-job.git</url>
|
<tag>master</tag>
|
||||||
<connection>scm:git:https://github.com/xuxueli/xxl-job.git</connection>
|
<url>https://github.com/xuxueli/xxl-job.git</url>
|
||||||
<developerConnection>scm:git:git@github.com:xuxueli/xxl-job.git</developerConnection>
|
<connection>scm:git:https://github.com/xuxueli/xxl-job.git</connection>
|
||||||
</scm>
|
<developerConnection>scm:git:git@github.com:xuxueli/xxl-job.git</developerConnection>
|
||||||
<developers>
|
</scm>
|
||||||
<developer>
|
<developers>
|
||||||
<id>XXL</id>
|
<developer>
|
||||||
<name>xuxueli</name>
|
<id>XXL</id>
|
||||||
<email>931591021@qq.com</email>
|
<name>xuxueli</name>
|
||||||
<url>https://github.com/xuxueli</url>
|
<email>931591021@qq.com</email>
|
||||||
</developer>
|
<url>https://github.com/xuxueli</url>
|
||||||
</developers>
|
</developer>
|
||||||
|
</developers>
|
||||||
<profiles>
|
|
||||||
|
<profiles>
|
||||||
<profile>
|
|
||||||
<id>release</id>
|
<profile>
|
||||||
<build>
|
<id>release</id>
|
||||||
<plugins>
|
<build>
|
||||||
<!-- Source -->
|
<plugins>
|
||||||
<plugin>
|
<!-- Source -->
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<plugin>
|
||||||
<artifactId>maven-source-plugin</artifactId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<version>${maven-source-plugin.version}</version>
|
<artifactId>maven-source-plugin</artifactId>
|
||||||
<executions>
|
<version>${maven-source-plugin.version}</version>
|
||||||
<execution>
|
<executions>
|
||||||
<phase>package</phase>
|
<execution>
|
||||||
<goals>
|
<phase>package</phase>
|
||||||
<goal>jar-no-fork</goal>
|
<goals>
|
||||||
</goals>
|
<goal>jar-no-fork</goal>
|
||||||
</execution>
|
</goals>
|
||||||
</executions>
|
</execution>
|
||||||
</plugin>
|
</executions>
|
||||||
<!-- Javadoc -->
|
</plugin>
|
||||||
<plugin>
|
<!-- Javadoc -->
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<plugin>
|
||||||
<artifactId>maven-javadoc-plugin</artifactId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<version>${maven-javadoc-plugin.version}</version>
|
<artifactId>maven-javadoc-plugin</artifactId>
|
||||||
<executions>
|
<version>${maven-javadoc-plugin.version}</version>
|
||||||
<execution>
|
<executions>
|
||||||
<phase>package</phase>
|
<execution>
|
||||||
<goals>
|
<phase>package</phase>
|
||||||
<goal>jar</goal>
|
<goals>
|
||||||
</goals>
|
<goal>jar</goal>
|
||||||
<configuration>
|
</goals>
|
||||||
<doclint>none</doclint>
|
<configuration>
|
||||||
</configuration>
|
<doclint>none</doclint>
|
||||||
</execution>
|
</configuration>
|
||||||
</executions>
|
</execution>
|
||||||
</plugin>
|
</executions>
|
||||||
<!-- GPG -->
|
</plugin>
|
||||||
<plugin>
|
<!-- GPG -->
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<plugin>
|
||||||
<artifactId>maven-gpg-plugin</artifactId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<version>${maven-gpg-plugin.version}</version>
|
<artifactId>maven-gpg-plugin</artifactId>
|
||||||
<configuration>
|
<version>${maven-gpg-plugin.version}</version>
|
||||||
<useAgent>false</useAgent>
|
<configuration>
|
||||||
</configuration>
|
<useAgent>false</useAgent>
|
||||||
<executions>
|
</configuration>
|
||||||
<execution>
|
<executions>
|
||||||
<phase>verify</phase>
|
<execution>
|
||||||
<goals>
|
<phase>verify</phase>
|
||||||
<goal>sign</goal>
|
<goals>
|
||||||
</goals>
|
<goal>sign</goal>
|
||||||
</execution>
|
</goals>
|
||||||
</executions>
|
</execution>
|
||||||
</plugin>
|
</executions>
|
||||||
</plugins>
|
</plugin>
|
||||||
</build>
|
</plugins>
|
||||||
<distributionManagement>
|
</build>
|
||||||
<snapshotRepository>
|
<distributionManagement>
|
||||||
<id>oss</id>
|
<snapshotRepository>
|
||||||
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
|
<id>oss</id>
|
||||||
</snapshotRepository>
|
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
|
||||||
<repository>
|
</snapshotRepository>
|
||||||
<id>oss</id>
|
<repository>
|
||||||
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
|
<id>oss</id>
|
||||||
</repository>
|
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
|
||||||
</distributionManagement>
|
</repository>
|
||||||
</profile>
|
</distributionManagement>
|
||||||
</profiles>
|
</profile>
|
||||||
|
</profiles>
|
||||||
|
|
||||||
</project>
|
</project>
|
@ -0,0 +1,20 @@
|
|||||||
|
package com.xxl.job.admin.core.alarm;
|
||||||
|
|
||||||
|
import com.xxl.job.admin.core.model.XxlJobInfo;
|
||||||
|
import com.xxl.job.admin.core.model.XxlJobLog;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author xuxueli 2020-01-19
|
||||||
|
*/
|
||||||
|
public interface JobAlarm {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* job alarm
|
||||||
|
*
|
||||||
|
* @param info
|
||||||
|
* @param jobLog
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public boolean doAlarm(XxlJobInfo info, XxlJobLog jobLog);
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,65 @@
|
|||||||
|
package com.xxl.job.admin.core.alarm;
|
||||||
|
|
||||||
|
import com.xxl.job.admin.core.model.XxlJobInfo;
|
||||||
|
import com.xxl.job.admin.core.model.XxlJobLog;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.beans.BeansException;
|
||||||
|
import org.springframework.beans.factory.InitializingBean;
|
||||||
|
import org.springframework.context.ApplicationContext;
|
||||||
|
import org.springframework.context.ApplicationContextAware;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
public class JobAlarmer implements ApplicationContextAware, InitializingBean {
|
||||||
|
private static Logger logger = LoggerFactory.getLogger(JobAlarmer.class);
|
||||||
|
|
||||||
|
private ApplicationContext applicationContext;
|
||||||
|
private List<JobAlarm> jobAlarmList;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
|
||||||
|
this.applicationContext = applicationContext;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void afterPropertiesSet() throws Exception {
|
||||||
|
Map<String, JobAlarm> serviceBeanMap = applicationContext.getBeansOfType(JobAlarm.class);
|
||||||
|
if (serviceBeanMap != null && serviceBeanMap.size() > 0) {
|
||||||
|
jobAlarmList = new ArrayList<JobAlarm>(serviceBeanMap.values());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* job alarm
|
||||||
|
*
|
||||||
|
* @param info
|
||||||
|
* @param jobLog
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public boolean alarm(XxlJobInfo info, XxlJobLog jobLog) {
|
||||||
|
|
||||||
|
boolean result = false;
|
||||||
|
if (jobAlarmList!=null && jobAlarmList.size()>0) {
|
||||||
|
result = true; // success means all-success
|
||||||
|
for (JobAlarm alarm: jobAlarmList) {
|
||||||
|
boolean resultItem = false;
|
||||||
|
try {
|
||||||
|
resultItem = alarm.doAlarm(info, jobLog);
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error(e.getMessage(), e);
|
||||||
|
}
|
||||||
|
if (!resultItem) {
|
||||||
|
result = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1,24 +1,24 @@
|
|||||||
package com.xxl.job.core.handler.annotation;
|
//package com.xxl.job.core.handler.annotation;
|
||||||
|
//
|
||||||
import java.lang.annotation.ElementType;
|
//import java.lang.annotation.ElementType;
|
||||||
import java.lang.annotation.Inherited;
|
//import java.lang.annotation.Inherited;
|
||||||
import java.lang.annotation.Retention;
|
//import java.lang.annotation.Retention;
|
||||||
import java.lang.annotation.RetentionPolicy;
|
//import java.lang.annotation.RetentionPolicy;
|
||||||
import java.lang.annotation.Target;
|
//import java.lang.annotation.Target;
|
||||||
|
//
|
||||||
/**
|
///**
|
||||||
* annotation for job handler
|
// * annotation for job handler
|
||||||
*
|
// *
|
||||||
* will be replaced by {@link com.xxl.job.core.handler.annotation.XxlJob}
|
// * will be replaced by {@link com.xxl.job.core.handler.annotation.XxlJob}
|
||||||
*
|
// *
|
||||||
* @author 2016-5-17 21:06:49
|
// * @author 2016-5-17 21:06:49
|
||||||
*/
|
// */
|
||||||
@Target({ElementType.TYPE})
|
//@Target({ElementType.TYPE})
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
//@Retention(RetentionPolicy.RUNTIME)
|
||||||
@Inherited
|
//@Inherited
|
||||||
@Deprecated
|
//@Deprecated
|
||||||
public @interface JobHandler {
|
//public @interface JobHandler {
|
||||||
|
//
|
||||||
String value() default "";
|
// String value();
|
||||||
|
//
|
||||||
}
|
//}
|
||||||
|
Loading…
Reference in new issue