private void checkStart() { if (!started.get()) { throw new JobSubmitException("JobClient did not started"); } } }
private void checkStart() { if (!started.get()) { throw new JobSubmitException("JobClient did not started"); } } }
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(); } } }
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(); } } }
/** * 异步提交任务 */ 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); } }
/** * 异步提交任务 */ 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 void checkField() throws JobSubmitException { if (StringUtils.isEmpty(taskId)) { throw new JobSubmitException("taskId can not be empty! job is " + toString()); } if (taskId.length() > 64) { throw new JobSubmitException("taskId length should not great than 64! job is " + toString()); } if (StringUtils.isEmpty(taskTrackerNodeGroup)) { throw new JobSubmitException("taskTrackerNodeGroup can not be empty! job is " + toString()); } if (taskTrackerNodeGroup.length() > 64) { throw new JobSubmitException("taskTrackerNodeGroup length should not great than 64! job is " + toString()); } if (StringUtils.isNotEmpty(cronExpression)) { if (!CronExpression.isValidExpression(cronExpression)) { throw new JobSubmitException("cronExpression invalid! job is " + toString()); } if (cronExpression.length() > 128) { throw new JobSubmitException("cronExpression length should not great than 128! job is " + toString()); } } if (maxRetryTimes < 0) { throw new JobSubmitException("maxRetryTimes invalid, must be great than zero! job is " + toString()); } if (repeatCount < -1) { throw new JobSubmitException("repeatCount invalid, must be great than -1! job is " + toString()); } } }
public void checkField() throws JobSubmitException { if (StringUtils.isEmpty(taskId)) { throw new JobSubmitException("taskId can not be empty! job is " + toString()); } if (taskId.length() > 64) { throw new JobSubmitException("taskId length should not great than 64! job is " + toString()); } if (StringUtils.isEmpty(taskTrackerNodeGroup)) { throw new JobSubmitException("taskTrackerNodeGroup can not be empty! job is " + toString()); } if (taskTrackerNodeGroup.length() > 64) { throw new JobSubmitException("taskTrackerNodeGroup length should not great than 64! job is " + toString()); } if (StringUtils.isNotEmpty(cronExpression)) { if (!CronExpression.isValidExpression(cronExpression)) { throw new JobSubmitException("cronExpression invalid! job is " + toString()); } if (cronExpression.length() > 128) { throw new JobSubmitException("cronExpression length should not great than 128! job is " + toString()); } } if (maxRetryTimes < 0) { throw new JobSubmitException("maxRetryTimes invalid, must be great than zero! job is " + toString()); } if (repeatCount < -1) { throw new JobSubmitException("repeatCount invalid, must be great than -1! job is " + toString()); } } }
private void checkStart() { if (!started.get()) { throw new JobSubmitException("JobClient did not started"); } } }
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(); } } }
/** * 异步提交任务 */ 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 void checkField() throws JobSubmitException { if (StringUtils.isEmpty(taskId)) { throw new JobSubmitException("taskId can not be empty! job is " + toString()); } if (taskId.length() > 64) { throw new JobSubmitException("taskId length should not great than 64! job is " + toString()); } if (StringUtils.isEmpty(taskTrackerNodeGroup)) { throw new JobSubmitException("taskTrackerNodeGroup can not be empty! job is " + toString()); } if (taskTrackerNodeGroup.length() > 64) { throw new JobSubmitException("taskTrackerNodeGroup length should not great than 64! job is " + toString()); } if (StringUtils.isNotEmpty(cronExpression)) { if (!CronExpression.isValidExpression(cronExpression)) { throw new JobSubmitException("cronExpression invalid! job is " + toString()); } if (cronExpression.length() > 128) { throw new JobSubmitException("cronExpression length should not great than 128! job is " + toString()); } } if (maxRetryTimes < 0) { throw new JobSubmitException("maxRetryTimes invalid, must be great than zero! job is " + toString()); } if (repeatCount < -1) { throw new JobSubmitException("repeatCount invalid, must be great than -1! job is " + toString()); } } }