private void checkStart() { if (!started.get()) { throw new JobSubmitException("JobClient did not started"); } } }
public static <T extends Node> T create(Class<T> clazz) { try { return clazz.newInstance(); } catch (Exception e) { throw new LtsRuntimeException("Create Node error: clazz=" + clazz, e); } }
public static Date getNextTriggerTime(String cronExpression) { try { CronExpression cron = new CronExpression(cronExpression); return cron.getTimeAfter(new Date()); } catch (ParseException e) { throw new CronException(e); } }
public void invokeAsync(Channel channel, RemotingCommand request, AsyncCallback asyncCallback) throws RemotingSendException { try { remotingServer.invokeAsync(channel, request, appContext.getConfig().getInvokeTimeoutMillis(), asyncCallback); } catch (Throwable t) { throw new RemotingSendException(t); } }
public static <T extends Node> T create(Class<T> clazz) { try { return clazz.newInstance(); } catch (Exception e) { throw new LtsRuntimeException("Create Node error: clazz=" + clazz, e); } }
private void checkStart() { if (!started.get()) { throw new JobSubmitException("JobClient did not started"); } } }
public RemotingCommand invokeSync(Channel channel, RemotingCommand request) throws RemotingSendException { try { return remotingServer.invokeSync(channel, request, appContext.getConfig().getInvokeTimeoutMillis()); } catch (Throwable t) { throw new RemotingSendException(t); } }
public static Date getNextTriggerTime(String cronExpression, Date timeAfter) { try { CronExpression cron = new CronExpression(cronExpression); if (timeAfter == null) { timeAfter = new Date(); } return cron.getTimeAfter(timeAfter); } catch (ParseException e) { throw new CronException(e); } }
protected String readSqlFile(String path) { InputStream is = this.getClass().getClassLoader().getResourceAsStream(path); try { return FileUtils.read(is, Constants.CHARSET); } catch (IOException e) { throw new LtsRuntimeException("Read sql file : [" + path + "] error ", e); } }
private void checkFields(List<Job> jobs) { // 参数验证 if (CollectionUtils.isEmpty(jobs)) { throw new JobSubmitException("Job can not be null!"); } for (Job job : jobs) { if (job == null) { throw new JobSubmitException("Job can not be null!"); } else { job.checkField(); } } }
public void invokeAsync(Channel channel, RemotingCommand request, AsyncCallback asyncCallback) throws RemotingSendException { try { remotingServer.invokeAsync(channel, request, appContext.getConfig().getInvokeTimeoutMillis(), asyncCallback); } catch (Throwable t) { throw new RemotingSendException(t); } }
public static Date getNextTriggerTime(String cronExpression, Date timeAfter) { try { CronExpression cron = new CronExpression(cronExpression); if (timeAfter == null) { timeAfter = new Date(); } return cron.getTimeAfter(timeAfter); } catch (ParseException e) { throw new CronException(e); } }
public void addScheduleJobForOneHour(JobPo jobPo) { if (jobPo.isCron()) { addCronJobForInterval(jobPo, new Date()); } else if (jobPo.isRepeatable()) { addRepeatJobForInterval(jobPo, new Date()); } else { throw new LtsRuntimeException("Only For Cron Or Repeat Job Now"); } }
private void checkFields(List<Job> jobs) { // 参数验证 if (CollectionUtils.isEmpty(jobs)) { throw new JobSubmitException("Job can not be null!"); } for (Job job : jobs) { if (job == null) { throw new JobSubmitException("Job can not be null!"); } else { job.checkField(); } } }
public void invokeOneway(Channel channel, RemotingCommand request) throws RemotingSendException { try { remotingServer.invokeOneway(channel, request, appContext.getConfig().getInvokeTimeoutMillis()); } catch (Throwable t) { throw new RemotingSendException(t); } }
public static Date getNextTriggerTime(String cronExpression) { try { CronExpression cron = new CronExpression(cronExpression); return cron.getTimeAfter(new Date()); } catch (ParseException e) { throw new CronException(e); } }
public void addScheduleJobForOneHour(JobPo jobPo) { if (jobPo.isCron()) { addCronJobForInterval(jobPo, new Date()); } else if (jobPo.isRepeatable()) { addRepeatJobForInterval(jobPo, new Date()); } else { throw new LtsRuntimeException("Only For Cron Or Repeat Job Now"); } }
/** * 异步提交任务 */ private void asyncSubmit(RemotingCommand requestCommand, final SubmitCallback submitCallback) throws JobTrackerNotFoundException { final CountDownLatch latch = new CountDownLatch(1); remotingClient.invokeAsync(requestCommand, new AsyncCallback() { @Override public void operationComplete(ResponseFuture responseFuture) { try { submitCallback.call(responseFuture.getResponseCommand()); } finally { latch.countDown(); } } }); try { latch.await(Constants.LATCH_TIMEOUT_MILLIS, TimeUnit.MILLISECONDS); } catch (InterruptedException e) { throw new JobSubmitException("Submit job failed, async request timeout!", e); } }
public RemotingCommand invokeSync(Channel channel, RemotingCommand request) throws RemotingSendException { try { return remotingServer.invokeSync(channel, request, appContext.getConfig().getInvokeTimeoutMillis()); } catch (Throwable t) { throw new RemotingSendException(t); } }
public void invokeOneway(Channel channel, RemotingCommand request) throws RemotingSendException { try { remotingServer.invokeOneway(channel, request, appContext.getConfig().getInvokeTimeoutMillis()); } catch (Throwable t) { throw new RemotingSendException(t); } }