16 changed files with 88 additions and 95 deletions
@ -0,0 +1,16 @@ |
|||
package app.platform.scheduler.executor; |
|||
|
|||
import io.sc.platform.core.ApplicationLauncher; |
|||
import io.sc.platform.core.PlatformSpringBootServletInitializer; |
|||
import org.springframework.boot.autoconfigure.SpringBootApplication; |
|||
import org.springframework.web.WebApplicationInitializer; |
|||
|
|||
/** |
|||
* 应用程序入口 |
|||
*/ |
|||
@SpringBootApplication(proxyBeanMethods = false) |
|||
public class Application extends PlatformSpringBootServletInitializer implements WebApplicationInitializer { |
|||
public static void main(String[] args) throws Exception { |
|||
ApplicationLauncher.run(Application.class,args); |
|||
} |
|||
} |
@ -0,0 +1,16 @@ |
|||
package app.platform.scheduler.manager; |
|||
|
|||
import io.sc.platform.core.ApplicationLauncher; |
|||
import io.sc.platform.core.PlatformSpringBootServletInitializer; |
|||
import org.springframework.boot.autoconfigure.SpringBootApplication; |
|||
import org.springframework.web.WebApplicationInitializer; |
|||
|
|||
/** |
|||
* 应用程序入口 |
|||
*/ |
|||
@SpringBootApplication(proxyBeanMethods = false) |
|||
public class Application extends PlatformSpringBootServletInitializer implements WebApplicationInitializer { |
|||
public static void main(String[] args) throws Exception { |
|||
ApplicationLauncher.run(Application.class,args); |
|||
} |
|||
} |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,7 +1,10 @@ |
|||
package io.sc.platform.scheduler.core.enums; |
|||
|
|||
/** |
|||
* 任务阻塞策略(调度过于密集,执行器来不及处理时的处理策略) |
|||
*/ |
|||
public enum BlockStrategy { |
|||
SERIAL_EXECUTION, //单机串行
|
|||
DISCARD_LATER, //丢弃后续调度
|
|||
COVER_EARLY; //覆盖先前调度
|
|||
SERIAL_EXECUTION, //单机串行,调度请求进入单机执行器后,调度请求进入FIFO队列并以串行方式运行
|
|||
DISCARD_LATER, //丢弃后续调度,调度请求进入单机执行器后,发现执行器存在运行的调度任务,本次请求将会被丢弃并标记为失败
|
|||
COVER_EARLY; //覆盖先前调度,调度请求进入单机执行器后,发现执行器存在运行的调度任务,将会终止运行中的调度任务并清空队列,然后运行本地调度任务
|
|||
} |
|||
|
@ -0,0 +1,15 @@ |
|||
package io.sc.platform.scheduler.core.vo.task; |
|||
|
|||
import io.sc.platform.scheduler.core.vo.Task; |
|||
|
|||
public class BeanTask extends Task { |
|||
private String bean; |
|||
|
|||
public String getBean() { |
|||
return bean; |
|||
} |
|||
|
|||
public void setBean(String bean) { |
|||
this.bean = bean; |
|||
} |
|||
} |
@ -1,45 +0,0 @@ |
|||
package io.sc.platform.scheduler.executor; |
|||
|
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author xuxueli 2017-07-27 21:52:49 |
|||
*/ |
|||
public interface AdminBiz { |
|||
|
|||
|
|||
// ---------------------- callback ----------------------
|
|||
|
|||
/** |
|||
* callback |
|||
* |
|||
* @param callbackParamList |
|||
* @return |
|||
*/ |
|||
public ReturnT<String> callback(List<HandleCallbackParam> callbackParamList); |
|||
|
|||
|
|||
// ---------------------- registry ----------------------
|
|||
|
|||
/** |
|||
* registry |
|||
* |
|||
* @param registryParam |
|||
* @return |
|||
*/ |
|||
public ReturnT<String> registry(RegistryParam registryParam); |
|||
|
|||
/** |
|||
* registry remove |
|||
* |
|||
* @param registryParam |
|||
* @return |
|||
*/ |
|||
public ReturnT<String> registryRemove(RegistryParam registryParam); |
|||
|
|||
|
|||
// ---------------------- biz (custome) ----------------------
|
|||
// group、job ... manage
|
|||
|
|||
} |
@ -1,47 +0,0 @@ |
|||
package io.sc.platform.scheduler.executor; |
|||
|
|||
|
|||
import io.sc.platform.scheduler.executor.util.XxlJobRemotingUtil; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* admin api test |
|||
* |
|||
* @author xuxueli 2017-07-28 22:14:52 |
|||
*/ |
|||
public class AdminBizClient implements AdminBiz { |
|||
|
|||
public AdminBizClient() { |
|||
} |
|||
public AdminBizClient(String addressUrl, String accessToken) { |
|||
this.addressUrl = addressUrl; |
|||
this.accessToken = accessToken; |
|||
|
|||
// valid
|
|||
if (!this.addressUrl.endsWith("/")) { |
|||
this.addressUrl = this.addressUrl + "/"; |
|||
} |
|||
} |
|||
|
|||
private String addressUrl ; |
|||
private String accessToken; |
|||
private int timeout = 3; |
|||
|
|||
|
|||
@Override |
|||
public ReturnT<String> callback(List<HandleCallbackParam> callbackParamList) { |
|||
return XxlJobRemotingUtil.postBody(addressUrl+"api/callback", accessToken, timeout, callbackParamList, String.class); |
|||
} |
|||
|
|||
@Override |
|||
public ReturnT<String> registry(RegistryParam registryParam) { |
|||
return XxlJobRemotingUtil.postBody(addressUrl + "api/registry", accessToken, timeout, registryParam, String.class); |
|||
} |
|||
|
|||
@Override |
|||
public ReturnT<String> registryRemove(RegistryParam registryParam) { |
|||
return XxlJobRemotingUtil.postBody(addressUrl + "api/registryRemove", accessToken, timeout, registryParam, String.class); |
|||
} |
|||
|
|||
} |
Binary file not shown.
@ -0,0 +1,35 @@ |
|||
package io.sc.platform.scheduler.manager.server.jpa.entity.task; |
|||
|
|||
import io.sc.platform.scheduler.core.vo.Task; |
|||
import io.sc.platform.scheduler.core.vo.task.BeanTask; |
|||
import io.sc.platform.scheduler.manager.server.jpa.entity.TaskEntity; |
|||
|
|||
import javax.persistence.Column; |
|||
import javax.persistence.DiscriminatorValue; |
|||
import javax.persistence.Entity; |
|||
import javax.validation.constraints.Size; |
|||
|
|||
@Entity |
|||
@DiscriminatorValue("BEAN") |
|||
public class BeanTaskEntity extends TaskEntity { |
|||
//Handler名称
|
|||
@Column(name="BEAN_", length=255) |
|||
@Size(max=255) |
|||
private String bean; |
|||
|
|||
@Override |
|||
public BeanTask toVo() { |
|||
BeanTask vo =new BeanTask(); |
|||
super.toVo(vo); |
|||
vo.setBean(this.getBean()); |
|||
return vo; |
|||
} |
|||
|
|||
public String getBean() { |
|||
return bean; |
|||
} |
|||
|
|||
public void setBean(String bean) { |
|||
this.bean = bean; |
|||
} |
|||
} |
Binary file not shown.
Binary file not shown.
Loading…
Reference in new issue