use of com.xxl.job.core.rpc.netcom.NetComClientProxy in project xxl-job by xuxueli.
the class XxlJobDynamicScheduler method getExecutorBiz.
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 = (ExecutorBiz) new NetComClientProxy(ExecutorBiz.class, address, accessToken).getObject();
executorBizRepository.put(address, executorBiz);
return executorBiz;
}
use of com.xxl.job.core.rpc.netcom.NetComClientProxy in project xxl-job by xuxueli.
the class AdminBizTest method registryTest.
/**
* registry executor
*
* @throws Exception
*/
@Test
public void registryTest() throws Exception {
AdminBiz adminBiz = (AdminBiz) new NetComClientProxy(AdminBiz.class, addressUrl, accessToken).getObject();
// test executor registry
RegistryParam registryParam = new RegistryParam(RegistryConfig.RegistType.EXECUTOR.name(), "xxl-job-executor-example", "127.0.0.1:9999");
ReturnT<String> returnT = adminBiz.registry(registryParam);
Assert.assertTrue(returnT.getCode() == ReturnT.SUCCESS_CODE);
}
use of com.xxl.job.core.rpc.netcom.NetComClientProxy in project xxl-job by xuxueli.
the class DemoJobHandlerTest method main.
public static void main(String[] args) throws Exception {
// param
String jobHandler = "demoJobHandler";
String params = "";
// trigger data
TriggerParam triggerParam = new TriggerParam();
triggerParam.setJobId(1);
triggerParam.setExecutorHandler(jobHandler);
triggerParam.setExecutorParams(params);
triggerParam.setExecutorBlockStrategy(ExecutorBlockStrategyEnum.COVER_EARLY.name());
triggerParam.setGlueType(GlueTypeEnum.BEAN.name());
triggerParam.setGlueSource(null);
triggerParam.setGlueUpdatetime(System.currentTimeMillis());
triggerParam.setLogId(1);
triggerParam.setLogDateTim(System.currentTimeMillis());
// do remote trigger
String accessToken = null;
ExecutorBiz executorBiz = (ExecutorBiz) new NetComClientProxy(ExecutorBiz.class, "127.0.0.1:9999", null).getObject();
ReturnT<String> runResult = executorBiz.run(triggerParam);
}
use of com.xxl.job.core.rpc.netcom.NetComClientProxy in project xxl-job by xuxueli.
the class AdminBizTest method registryRemove.
/**
* registry executor remove
*
* @throws Exception
*/
@Test
public void registryRemove() throws Exception {
AdminBiz adminBiz = (AdminBiz) new NetComClientProxy(AdminBiz.class, addressUrl, accessToken).getObject();
// test executor registry remove
RegistryParam registryParam = new RegistryParam(RegistryConfig.RegistType.EXECUTOR.name(), "xxl-job-executor-example", "127.0.0.1:9999");
ReturnT<String> returnT = adminBiz.registryRemove(registryParam);
Assert.assertTrue(returnT.getCode() == ReturnT.SUCCESS_CODE);
}
use of com.xxl.job.core.rpc.netcom.NetComClientProxy in project xxl-job by xuxueli.
the class AdminBizTest method triggerJob.
/**
* trigger job for once
*
* @throws Exception
*/
@Test
public void triggerJob() throws Exception {
AdminBiz adminBiz = (AdminBiz) new NetComClientProxy(AdminBiz.class, addressUrl, accessToken).getObject();
int jobId = 1;
ReturnT<String> returnT = adminBiz.triggerJob(jobId);
Assert.assertTrue(returnT.getCode() == ReturnT.SUCCESS_CODE);
}
Aggregations