提交 0e1eb6cb authored 作者: xuxueli's avatar xuxueli

调度中心与执行器通讯规范为双向restful,方便跨语言,以及第三方执行器实现;通讯组件xxl-rpc方案调整为Jetty+Gson方案;

上级 895ad80e
差异被折叠。
...@@ -28,7 +28,7 @@ public class XxlJobExecutor { ...@@ -28,7 +28,7 @@ public class XxlJobExecutor {
// ---------------------- param ---------------------- // ---------------------- param ----------------------
private String adminAddresses; private String adminAddresses;
private String accessToken; private String accessToken;
private String appName; private String appname;
private String address; private String address;
private String ip; private String ip;
private int port; private int port;
...@@ -41,8 +41,8 @@ public class XxlJobExecutor { ...@@ -41,8 +41,8 @@ public class XxlJobExecutor {
public void setAccessToken(String accessToken) { public void setAccessToken(String accessToken) {
this.accessToken = accessToken; this.accessToken = accessToken;
} }
public void setAppName(String appName) { public void setAppname(String appname) {
this.appName = appName; this.appname = appname;
} }
public void setAddress(String address) { public void setAddress(String address) {
this.address = address; this.address = address;
...@@ -78,7 +78,7 @@ public class XxlJobExecutor { ...@@ -78,7 +78,7 @@ public class XxlJobExecutor {
TriggerCallbackThread.getInstance().start(); TriggerCallbackThread.getInstance().start();
// init executor-server // init executor-server
initEmbedServer(address, ip, port, appName, accessToken); initEmbedServer(address, ip, port, appname, accessToken);
} }
public void destroy(){ public void destroy(){
// destory executor-server // destory executor-server
......
...@@ -35,7 +35,7 @@ public class EmbedServer { ...@@ -35,7 +35,7 @@ public class EmbedServer {
private ExecutorBiz executorBiz; private ExecutorBiz executorBiz;
private Thread thread; private Thread thread;
public void start(final String address, final int port, final String appName, final String accessToken) { public void start(final String address, final int port, final String appname, final String accessToken) {
executorBiz = new ExecutorBizImpl(); executorBiz = new ExecutorBizImpl();
thread = new Thread(new Runnable() { thread = new Thread(new Runnable() {
...@@ -69,7 +69,7 @@ public class EmbedServer { ...@@ -69,7 +69,7 @@ public class EmbedServer {
logger.info(">>>>>>>>>>> xxl-job remoting server start success, nettype = {}, port = {}", EmbedServer.class, port); logger.info(">>>>>>>>>>> xxl-job remoting server start success, nettype = {}, port = {}", EmbedServer.class, port);
// start registry // start registry
startRegistry(appName, address); startRegistry(appname, address);
// wait util stop // wait util stop
future.channel().closeFuture().sync(); future.channel().closeFuture().sync();
...@@ -227,9 +227,9 @@ public class EmbedServer { ...@@ -227,9 +227,9 @@ public class EmbedServer {
// ---------------------- registry ---------------------- // ---------------------- registry ----------------------
public void startRegistry(final String appName, final String address) { public void startRegistry(final String appname, final String address) {
// start registry // start registry
ExecutorRegistryThread.getInstance().start(appName, address); ExecutorRegistryThread.getInstance().start(appname, address);
} }
public void stopRegistry() { public void stopRegistry() {
......
...@@ -23,11 +23,11 @@ public class ExecutorRegistryThread { ...@@ -23,11 +23,11 @@ public class ExecutorRegistryThread {
private Thread registryThread; private Thread registryThread;
private volatile boolean toStop = false; private volatile boolean toStop = false;
public void start(final String appName, final String address){ public void start(final String appname, final String address){
// valid // valid
if (appName==null || appName.trim().length()==0) { if (appname==null || appname.trim().length()==0) {
logger.warn(">>>>>>>>>>> xxl-job, executor registry config fail, appName is null."); logger.warn(">>>>>>>>>>> xxl-job, executor registry config fail, appname is null.");
return; return;
} }
if (XxlJobExecutor.getAdminBizList() == null) { if (XxlJobExecutor.getAdminBizList() == null) {
...@@ -42,7 +42,7 @@ public class ExecutorRegistryThread { ...@@ -42,7 +42,7 @@ public class ExecutorRegistryThread {
// registry // registry
while (!toStop) { while (!toStop) {
try { try {
RegistryParam registryParam = new RegistryParam(RegistryConfig.RegistType.EXECUTOR.name(), appName, address); RegistryParam registryParam = new RegistryParam(RegistryConfig.RegistType.EXECUTOR.name(), appname, address);
for (AdminBiz adminBiz: XxlJobExecutor.getAdminBizList()) { for (AdminBiz adminBiz: XxlJobExecutor.getAdminBizList()) {
try { try {
ReturnT<String> registryResult = adminBiz.registry(registryParam); ReturnT<String> registryResult = adminBiz.registry(registryParam);
...@@ -78,7 +78,7 @@ public class ExecutorRegistryThread { ...@@ -78,7 +78,7 @@ public class ExecutorRegistryThread {
// registry remove // registry remove
try { try {
RegistryParam registryParam = new RegistryParam(RegistryConfig.RegistType.EXECUTOR.name(), appName, address); RegistryParam registryParam = new RegistryParam(RegistryConfig.RegistType.EXECUTOR.name(), appname, address);
for (AdminBiz adminBiz: XxlJobExecutor.getAdminBizList()) { for (AdminBiz adminBiz: XxlJobExecutor.getAdminBizList()) {
try { try {
ReturnT<String> registryResult = adminBiz.registryRemove(registryParam); ReturnT<String> registryResult = adminBiz.registryRemove(registryParam);
......
...@@ -46,7 +46,7 @@ public class FrameLessXxlJobConfig { ...@@ -46,7 +46,7 @@ public class FrameLessXxlJobConfig {
xxlJobExecutor = new XxlJobExecutor(); xxlJobExecutor = new XxlJobExecutor();
xxlJobExecutor.setAdminAddresses(xxlJobProp.getProperty("xxl.job.admin.addresses")); xxlJobExecutor.setAdminAddresses(xxlJobProp.getProperty("xxl.job.admin.addresses"));
xxlJobExecutor.setAccessToken(xxlJobProp.getProperty("xxl.job.accessToken")); xxlJobExecutor.setAccessToken(xxlJobProp.getProperty("xxl.job.accessToken"));
xxlJobExecutor.setAppName(xxlJobProp.getProperty("xxl.job.executor.appname")); xxlJobExecutor.setAppname(xxlJobProp.getProperty("xxl.job.executor.appname"));
xxlJobExecutor.setAddress(xxlJobProp.getProperty("xxl.job.executor.address")); xxlJobExecutor.setAddress(xxlJobProp.getProperty("xxl.job.executor.address"));
xxlJobExecutor.setIp(xxlJobProp.getProperty("xxl.job.executor.ip")); xxlJobExecutor.setIp(xxlJobProp.getProperty("xxl.job.executor.ip"));
xxlJobExecutor.setPort(Integer.valueOf(xxlJobProp.getProperty("xxl.job.executor.port"))); xxlJobExecutor.setPort(Integer.valueOf(xxlJobProp.getProperty("xxl.job.executor.port")));
......
...@@ -29,7 +29,7 @@ public class JbootConfig extends JbootAppListenerBase { ...@@ -29,7 +29,7 @@ public class JbootConfig extends JbootAppListenerBase {
xxlJobExecutor.setAdminAddresses(Jboot.configValue("xxl.job.admin.addresses")); xxlJobExecutor.setAdminAddresses(Jboot.configValue("xxl.job.admin.addresses"));
xxlJobExecutor.setAccessToken(Jboot.configValue("xxl.job.accessToken")); xxlJobExecutor.setAccessToken(Jboot.configValue("xxl.job.accessToken"));
xxlJobExecutor.setAddress(Jboot.configValue("xxl.job.executor.address")); xxlJobExecutor.setAddress(Jboot.configValue("xxl.job.executor.address"));
xxlJobExecutor.setAppName(Jboot.configValue("xxl.job.executor.appname")); xxlJobExecutor.setAppname(Jboot.configValue("xxl.job.executor.appname"));
xxlJobExecutor.setIp(Jboot.configValue("xxl.job.executor.ip")); xxlJobExecutor.setIp(Jboot.configValue("xxl.job.executor.ip"));
xxlJobExecutor.setPort(Integer.valueOf(Jboot.configValue("xxl.job.executor.port"))); xxlJobExecutor.setPort(Integer.valueOf(Jboot.configValue("xxl.job.executor.port")));
xxlJobExecutor.setLogPath(Jboot.configValue("xxl.job.executor.logpath")); xxlJobExecutor.setLogPath(Jboot.configValue("xxl.job.executor.logpath"));
......
...@@ -36,7 +36,7 @@ public class JFinalCoreConfig extends JFinalConfig { ...@@ -36,7 +36,7 @@ public class JFinalCoreConfig extends JFinalConfig {
xxlJobExecutor.setAdminAddresses(xxlJobProp.get("xxl.job.admin.addresses")); xxlJobExecutor.setAdminAddresses(xxlJobProp.get("xxl.job.admin.addresses"));
xxlJobExecutor.setAccessToken(xxlJobProp.get("xxl.job.accessToken")); xxlJobExecutor.setAccessToken(xxlJobProp.get("xxl.job.accessToken"));
xxlJobExecutor.setAddress(xxlJobProp.get("xxl.job.executor.address")); xxlJobExecutor.setAddress(xxlJobProp.get("xxl.job.executor.address"));
xxlJobExecutor.setAppName(xxlJobProp.get("xxl.job.executor.appname")); xxlJobExecutor.setAppname(xxlJobProp.get("xxl.job.executor.appname"));
xxlJobExecutor.setIp(xxlJobProp.get("xxl.job.executor.ip")); xxlJobExecutor.setIp(xxlJobProp.get("xxl.job.executor.ip"));
xxlJobExecutor.setPort(xxlJobProp.getInt("xxl.job.executor.port")); xxlJobExecutor.setPort(xxlJobProp.getInt("xxl.job.executor.port"));
......
...@@ -37,7 +37,7 @@ public class NutzSetup implements Setup { ...@@ -37,7 +37,7 @@ public class NutzSetup implements Setup {
xxlJobExecutor = new XxlJobExecutor(); xxlJobExecutor = new XxlJobExecutor();
xxlJobExecutor.setAdminAddresses(xxlJobProp.get("xxl.job.admin.addresses")); xxlJobExecutor.setAdminAddresses(xxlJobProp.get("xxl.job.admin.addresses"));
xxlJobExecutor.setAccessToken(xxlJobProp.get("xxl.job.accessToken")); xxlJobExecutor.setAccessToken(xxlJobProp.get("xxl.job.accessToken"));
xxlJobExecutor.setAppName(xxlJobProp.get("xxl.job.executor.appname")); xxlJobExecutor.setAppname(xxlJobProp.get("xxl.job.executor.appname"));
xxlJobExecutor.setAddress(xxlJobProp.get("xxl.job.executor.address")); xxlJobExecutor.setAddress(xxlJobProp.get("xxl.job.executor.address"));
xxlJobExecutor.setIp(xxlJobProp.get("xxl.job.executor.ip")); xxlJobExecutor.setIp(xxlJobProp.get("xxl.job.executor.ip"));
xxlJobExecutor.setPort(xxlJobProp.getInt("xxl.job.executor.port")); xxlJobExecutor.setPort(xxlJobProp.getInt("xxl.job.executor.port"));
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
<!-- 访问令牌[选填],非空则进行匹配校验 --> <!-- 访问令牌[选填],非空则进行匹配校验 -->
<property name="accessToken" value="${xxl.job.accessToken}" /> <property name="accessToken" value="${xxl.job.accessToken}" />
<!-- 执行器AppName[选填],为空则关闭自动注册 --> <!-- 执行器AppName[选填],为空则关闭自动注册 -->
<property name="appName" value="${xxl.job.executor.appname}" /> <property name="appname" value="${xxl.job.executor.appname}" />
<!-- 注册地址[选填],优先使用该配置作为注册地址,为空时使用内嵌服务 ”IP:PORT“ 作为注册地址 --> <!-- 注册地址[选填],优先使用该配置作为注册地址,为空时使用内嵌服务 ”IP:PORT“ 作为注册地址 -->
<property name="address" value="${xxl.job.executor.address}" /> <property name="address" value="${xxl.job.executor.address}" />
<!-- 执行器IP[选填],为空则自动获取 --> <!-- 执行器IP[选填],为空则自动获取 -->
......
...@@ -23,7 +23,7 @@ public class XxlJobConfig { ...@@ -23,7 +23,7 @@ public class XxlJobConfig {
private String accessToken; private String accessToken;
@Value("${xxl.job.executor.appname}") @Value("${xxl.job.executor.appname}")
private String appName; private String appname;
@Value("${xxl.job.executor.address}") @Value("${xxl.job.executor.address}")
private String address; private String address;
...@@ -46,7 +46,7 @@ public class XxlJobConfig { ...@@ -46,7 +46,7 @@ public class XxlJobConfig {
logger.info(">>>>>>>>>>> xxl-job config init."); logger.info(">>>>>>>>>>> xxl-job config init.");
XxlJobSpringExecutor xxlJobSpringExecutor = new XxlJobSpringExecutor(); XxlJobSpringExecutor xxlJobSpringExecutor = new XxlJobSpringExecutor();
xxlJobSpringExecutor.setAdminAddresses(adminAddresses); xxlJobSpringExecutor.setAdminAddresses(adminAddresses);
xxlJobSpringExecutor.setAppName(appName); xxlJobSpringExecutor.setAppname(appname);
xxlJobSpringExecutor.setAddress(address); xxlJobSpringExecutor.setAddress(address);
xxlJobSpringExecutor.setIp(ip); xxlJobSpringExecutor.setIp(ip);
xxlJobSpringExecutor.setPort(port); xxlJobSpringExecutor.setPort(port);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论