/** * Create an History object from a {@link JobInstance}. (if it does not exist, exception). * */ public static void create(DbConn cnx, int launchId, State finalState, Calendar endDate) { JobInstance ji = JobInstance.select_id(cnx, launchId); create(cnx, ji, finalState, endDate); } }
/** * Create an History object from a {@link JobInstance}. (if it does not exist, exception). * */ public static void create(DbConn cnx, int launchId, State finalState, Calendar endDate) { JobInstance ji = JobInstance.select_id(cnx, launchId); create(cnx, ji, finalState, endDate); } }
public static JobInstance run(int jobInstanceId) { jqmlogger.debug("Single runner was asked to start with ID " + jobInstanceId); DbConn cnx = Helpers.getNewDbSession(); com.enioka.jqm.model.JobInstance jr = com.enioka.jqm.model.JobInstance.select_id(cnx, jobInstanceId); cnx.close(); if (jr == null) { throw new IllegalArgumentException("There is no JobRequest by ID " + jobInstanceId); } return run(jr); }
public static JobInstance run(int jobInstanceId) { jqmlogger.debug("Single runner was asked to start with ID " + jobInstanceId); DbConn cnx = Helpers.getNewDbSession(); com.enioka.jqm.model.JobInstance jr = com.enioka.jqm.model.JobInstance.select_id(cnx, jobInstanceId); cnx.close(); if (jr == null) { throw new IllegalArgumentException("There is no JobRequest by ID " + jobInstanceId); } return run(jr); }
@Override public void run() { Thread.currentThread().setName("JQM single runner;killerloop;" + jobId); DbConn cnx = null; while (!Thread.interrupted()) { cnx = Helpers.getNewDbSession(); com.enioka.jqm.model.JobInstance job = com.enioka.jqm.model.JobInstance.select_id(cnx, jobId); cnx.close(); if (job != null && job.getInstruction().equals(com.enioka.jqm.model.Instruction.KILL)) { jqmlogger.debug( "Job " + jobId + " has received a kill order. It's JVM will be killed after a grace shutdown period"); System.exit(1); // Launch the exit hook. break; } try { Thread.sleep(poll); } catch (InterruptedException e) { break; } } } };
@Override public void run() { Thread.currentThread().setName("JQM single runner;killerloop;" + jobId); DbConn cnx = null; while (!Thread.interrupted()) { cnx = Helpers.getNewDbSession(); com.enioka.jqm.model.JobInstance job = com.enioka.jqm.model.JobInstance.select_id(cnx, jobId); cnx.close(); if (job != null && job.getInstruction().equals(com.enioka.jqm.model.Instruction.KILL)) { jqmlogger.debug( "Job " + jobId + " has received a kill order. It's JVM will be killed after a grace shutdown period"); System.exit(1); // Launch the exit hook. break; } try { Thread.sleep(poll); } catch (InterruptedException e) { break; } } } };
job = com.enioka.jqm.model.JobInstance.select_id(cnx, job.getId()); job.loadPrmCache(cnx);
job = com.enioka.jqm.model.JobInstance.select_id(cnx, job.getId()); job.loadPrmCache(cnx);
after.add(Calendar.YEAR, -1); JqmClientFactory.getClient().setJobRunAfter(i2, after); Assert.assertTrue(com.enioka.jqm.model.JobInstance.select_id(cnx, i2).getNotBefore().before(Calendar.getInstance())); Assert.assertNull(com.enioka.jqm.model.JobInstance.select_id(cnx, i4).getNotBefore()); JqmClientFactory.getClient().setJobRunAfter(i4, after); Assert.assertTrue(com.enioka.jqm.model.JobInstance.select_id(cnx, i4).getNotBefore().before(Calendar.getInstance()));