public void execute(JobMeta jobMeta, RunnerCallback callback) throws NoAvailableJobRunnerException { try { threadPoolExecutor.execute( new JobRunnerDelegate(appContext, jobMeta, callback)); if (LOGGER.isDebugEnabled()) { LOGGER.debug("Receive job success ! " + jobMeta); } } catch (RejectedExecutionException e) { LOGGER.warn("No more thread to run job ."); throw new NoAvailableJobRunnerException(e); } }
public void terminateJob(String jobId) { JobRunnerDelegate jobRunnerDelegate = JOBS.get(jobId); if (jobRunnerDelegate != null) { try { jobRunnerDelegate.currentThread().interrupt(); } catch (Throwable e) { LOGGER.error("terminateJob [" + jobId + "] error", e); } } } }
private boolean isStopToGetNewJob() { if (isInterrupted()) { // 如果当前线程被阻断了,那么也就不接受新任务了 return true; } // 机器资源是否充足 return !appContext.getConfig().getInternalData(Constants.MACHINE_RES_ENOUGH, true); }
blockedOn(interruptor); if (Thread.currentThread().isInterrupted()) { ((InterruptibleAdapter) interruptor).interrupt(); .in(jobMeta.getJobId(), this); this.curJobRunner = appContext.getRunnerPool().getRunnerFactory().newRunner(); Result result = this.curJobRunner.run(buildJobContext(logger, jobMeta)); LOGGER.error("Job execute error : {}, time: {}, {}", jobMeta.getJob(), time, t.getMessage(), t); } finally { checkInterrupted(logger); appContext.getRunnerPool().getRunningJobManager() .out(jobMeta.getJobId()); stat(response.getAction()); if (isStopToGetNewJob()) { response.setReceiveNewJob(false); blockedOn(null);
blockedOn(interruptor); if (Thread.currentThread().isInterrupted()) { ((InterruptibleAdapter) interruptor).interrupt(); .in(jobMeta.getJobId(), this); this.curJobRunner = appContext.getRunnerPool().getRunnerFactory().newRunner(); Result result = this.curJobRunner.run(buildJobContext(logger, jobMeta)); LOGGER.error("Job execute error : {}, time: {}, {}", jobMeta.getJob(), time, t.getMessage(), t); } finally { checkInterrupted(logger); appContext.getRunnerPool().getRunningJobManager() .out(jobMeta.getJobId()); stat(response.getAction()); if (isStopToGetNewJob()) { response.setReceiveNewJob(false); blockedOn(null);
blockedOn(interruptor); if (Thread.currentThread().isInterrupted()) { ((InterruptibleAdapter) interruptor).interrupt(); .in(jobMeta.getJobId(), this); this.curJobRunner = appContext.getRunnerPool().getRunnerFactory().newRunner(); Result result = this.curJobRunner.run(buildJobContext(jobMeta)); LOGGER.error("Job execute error : {}, time: {}, {}", jobMeta.getJob(), time, t.getMessage(), t); } finally { checkInterrupted(); logger.removeJobMeta(); appContext.getRunnerPool().getRunningJobManager() stat(response.getAction()); if (isStopToGetNewJob()) { response.setReceiveNewJob(false); LtsLoggerFactory.remove(); blockedOn(null);
private void checkInterrupted(BizLogger logger) { try { if (isInterrupted()) { logger.info("SYSTEM:Interrupted"); } } catch (Throwable t) { LOGGER.warn("checkInterrupted error", t); } }
public void execute(JobMeta jobMeta, RunnerCallback callback) throws NoAvailableJobRunnerException { try { threadPoolExecutor.execute( new JobRunnerDelegate(appContext, jobMeta, callback)); if (LOGGER.isDebugEnabled()) { LOGGER.debug("Receive job success ! " + jobMeta); } } catch (RejectedExecutionException e) { LOGGER.warn("No more thread to run job ."); throw new NoAvailableJobRunnerException(e); } }
public void terminateJob(String jobId) { JobRunnerDelegate jobRunnerDelegate = JOBS.get(jobId); if (jobRunnerDelegate != null) { try { jobRunnerDelegate.currentThread().interrupt(); } catch (Throwable e) { LOGGER.error("terminateJob [" + jobId + "] error", e); } } } }
private boolean isStopToGetNewJob() { if (isInterrupted()) { // 如果当前线程被阻断了,那么也就不接受新任务了 return true; } // 机器资源是否充足 return !appContext.getConfig().getInternalData(Constants.MACHINE_RES_ENOUGH, true); }
public void execute(JobMeta jobMeta, RunnerCallback callback) throws NoAvailableJobRunnerException { try { threadPoolExecutor.execute( new JobRunnerDelegate(appContext, jobMeta, callback)); if (LOGGER.isDebugEnabled()) { LOGGER.debug("Receive job success ! " + jobMeta); } } catch (RejectedExecutionException e) { LOGGER.warn("No more thread to run job ."); throw new NoAvailableJobRunnerException(e); } }
public void terminateJob(String jobId) { JobRunnerDelegate jobRunnerDelegate = JOBS.get(jobId); if (jobRunnerDelegate != null) { try { jobRunnerDelegate.currentThread().interrupt(); } catch (Throwable e) { LOGGER.error("terminateJob [" + jobId + "] error", e); } } } }
private void checkInterrupted(BizLogger logger) { try { if (isInterrupted()) { logger.info("SYSTEM:Interrupted"); } } catch (Throwable t) { LOGGER.warn("checkInterrupted error", t); } }
private boolean isStopToGetNewJob() { if (isInterrupted()) { // 如果当前线程被阻断了,那么也就不接受新任务了 return true; } // 机器资源是否充足 return !appContext.getConfig().getInternalData(Constants.MACHINE_RES_ENOUGH, true); }
private void checkInterrupted() { try { if (isInterrupted()) { logger.info("SYSTEM:Interrupted"); } } catch (Throwable t) { LOGGER.warn("checkInterrupted error", t); } }