/** * Ended JI, but not OK. */ public static int getNonOkCount(DbConn cnx) { return cnx.runSelectSingle("history_select_count_notended", Integer.class); }
/** * Ended JI, but not OK. */ public static int getNonOkCount(DbConn cnx) { return cnx.runSelectSingle("history_select_count_notended", Integer.class); }
public static int getHistoryAllCount(DbConn cnx) { return cnx.runSelectSingle("history_select_count_all", Integer.class); }
public static int getOkCount(DbConn cnx) { return cnx.runSelectSingle("history_select_count_ended", Integer.class); }
public static int getHistoryAllCount(DbConn cnx) { return cnx.runSelectSingle("history_select_count_all", Integer.class); }
public static int getQueueAllCount(DbConn cnx) { return cnx.runSelectSingle("ji_select_count_all", Integer.class); }
public <T> T runSelectSingle(String query_key, Class<T> clazz, Object... params) { return runSelectSingle(query_key, 1, clazz, params); }
public static int getQueueAllCount(DbConn cnx) { return cnx.runSelectSingle("ji_select_count_all", Integer.class); }
public static int getQueueRunningCount(DbConn cnx) { return cnx.runSelectSingle("ji_select_count_running", Integer.class); }
public <T> T runSelectSingle(String query_key, Class<T> clazz, Object... params) { return runSelectSingle(query_key, 1, clazz, params); }
public static int getQueueRunningCount(DbConn cnx) { return cnx.runSelectSingle("ji_select_count_running", Integer.class); }
public static int getOkCount(DbConn cnx) { return cnx.runSelectSingle("history_select_count_ended", Integer.class); }
@Override public Long getRunTimeSeconds() { if (this.ji.getExecutionDate() == null) { DbConn cnx = Helpers.getNewDbSession(); this.ji.setExecutionDate(cnx.runSelectSingle("ji_select_execution_date_by_id", Calendar.class, this.ji.getId())); cnx.close(); } if (this.ji.getExecutionDate() == null) { return 0L; } return (Calendar.getInstance().getTimeInMillis() - this.ji.getExecutionDate().getTimeInMillis()) / 1000; }
@Override public Long getRunTimeSeconds() { if (this.ji.getExecutionDate() == null) { DbConn cnx = Helpers.getNewDbSession(); this.ji.setExecutionDate(cnx.runSelectSingle("ji_select_execution_date_by_id", Calendar.class, this.ji.getId())); cnx.close(); } if (this.ji.getExecutionDate() == null) { return 0L; } return (Calendar.getInstance().getTimeInMillis() - this.ji.getExecutionDate().getTimeInMillis()) / 1000; }
@Override public long getCumulativeJobInstancesCount() { DbConn em2 = Helpers.getNewDbSession(); try { return em2.runSelectSingle("history_select_count_for_poller", Long.class, this.queue.getId(), this.engine.getNode().getId()); } finally { Helpers.closeQuietly(em2); } }
@Override public float getJobsFinishedPerSecondLastMinute() { DbConn em2 = Helpers.getNewDbSession(); try { return em2.runSelectSingle("history_select_count_last_mn_for_poller", Float.class, this.queue.getId(), this.engine.getNode().getId()); } finally { Helpers.closeQuietly(em2); } }
@Override public long getCumulativeJobInstancesCount() { DbConn em2 = Helpers.getNewDbSession(); try { return em2.runSelectSingle("history_select_count_for_poller", Long.class, this.queue.getId(), this.engine.getNode().getId()); } finally { Helpers.closeQuietly(em2); } }
@Override public float getJobsFinishedPerSecondLastMinute() { DbConn em2 = Helpers.getNewDbSession(); try { return em2.runSelectSingle("history_select_count_last_mn_for_poller", Float.class, this.queue.getId(), this.engine.getNode().getId()); } finally { Helpers.closeQuietly(em2); } }
@Test public void testRunnableInject() throws Exception { JqmSimpleTest.create(cnx, "pyl.EngineApiInjectThread").expectOk(3).run(this); Assert.assertEquals(3, (int) cnx.runSelectSingle("message_select_count_all", Integer.class)); Assert.assertEquals(100, (int) Query.create().addSortAsc(Sort.ID).run().get(0).getProgress()); }
@Test public void testMainTypeInject() throws Exception { JqmSimpleTest.create(cnx, "pyl.EngineApiInject").setSessionId("123X").expectOk(3).run(this); Assert.assertEquals(3, (int) cnx.runSelectSingle("message_select_count_all", Integer.class)); Assert.assertEquals(100, (int) Query.create().run().get(0).getProgress()); }