@Override public void run() String child = jm.parameters().get("child"); jm.enqueue(jm.applicationName(), jm.userName(), null, jm.sessionID(), jm.application(), jm.module(), jm.keyword1(), jm.keyword2(), jm.keyword3(), p); jm.enqueue(jm.applicationName(), jm.userName(), null, jm.sessionID(), jm.application(), jm.module(), jm.keyword1(), jm.keyword2(), jm.keyword3(), p); jm.enqueue(jm.applicationName(), jm.userName(), null, jm.sessionID(), jm.application(), jm.module(), jm.keyword1(), jm.keyword2(), jm.keyword3(), p); jm.enqueue(jm.applicationName(), jm.userName(), null, jm.sessionID(), jm.application(), jm.module(), jm.keyword1(), jm.keyword2(), jm.keyword3(), p); jm.enqueue(jm.applicationName(), jm.userName(), null, jm.sessionID(), jm.application(), jm.module(), jm.keyword1(), jm.keyword2(), jm.keyword3(), p); jm.waitChildren();
public void addDeliverable(String path, String fileLabel) throws IOException { jm.addDeliverable(path, fileLabel); }
public int enQueueSynchronously(String applicationName, String user, String mail, String sessionID, String application, String module, String keyword1, String keyword2, String keyword3, Map<String, String> parameters) { return jm.enqueueSync(applicationName, user, mail, sessionID, application, module, keyword1, keyword2, keyword3, parameters); }
@Override public void run() { Map<String, String> p = new HashMap<>(); p.put("nbJob", ((Integer.parseInt(jm.parameters().get("nbJob")) + 1) + "")); if (Integer.parseInt(jm.parameters().get("nbJob")) >= 9) { return; } jm.sendMsg("launching first job"); jm.enqueue(jm.applicationName(), null, null, null, null, null, null, null, null, p); jm.sendMsg("launching second job"); jm.enqueue(jm.applicationName(), null, null, null, null, null, null, null, null, p); } }
@Override public void run() { for (Map.Entry<String, String> e : jm.parameters().entrySet()) { jm.sendMsg(String.format("{}-{}", e.getKey(), e.getValue())); } } }
System.out.println("JobDefID: " + jm.jobApplicationId()); System.out.println("Application: " + jm.application()); System.out.println("JobName: " + jm.applicationName()); System.out.println("Default JDBC: " + jm.defaultConnect()); System.out.println("Keyword1: " + jm.keyword1()); System.out.println("Keyword2: " + jm.keyword2()); System.out.println("Keyword3: " + jm.keyword3()); System.out.println("Module: " + jm.module()); System.out.println("Session ID: " + jm.sessionID()); System.out.println("Restart enabled: " + jm.canBeRestarted()); System.out.println("JI ID: " + jm.jobInstanceID()); System.out.println("Parent JI ID: " + jm.parentID()); System.out.println("Nb of parameters: " + jm.parameters().size()); jm.sendProgress(10); jm.sendMsg("houba hop"); File workDir = jm.getWorkDir(); System.out.println("Work dir is " + workDir.getAbsolutePath()); jm.addDeliverable(dest.getAbsolutePath(), "TEST"); if (jm.parameters().size() == 0) jm.sendProgress(33); Map<String, String> prms = new HashMap<String, String>(); prms.put("rr", "2nd run"); System.out.println("creating a new async job instance request"); int i = jm.enqueue(jm.applicationName(), null, null, null, jm.application(), jm.module(), null, null, null, prms);
this.api.yield(); return this.api.jobApplicationId(); return this.api.parentID(); return this.api.jobInstanceID(); return this.api.canBeRestarted(); return this.api.applicationName(); return this.api.sessionID(); return this.api.application(); return this.api.module(); return this.api.keyword1(); return this.api.keyword2(); return this.api.keyword3(); return this.api.definitionKeyword1(); return this.api.definitionKeyword2(); return this.api.definitionKeyword3();
@Override public void run() if (jm.parameters().containsKey("fail")) if (jm.parameters().containsKey("succeed")) int failId = jm.enqueueSync(jm.applicationName(), jm.userName(), null, null, null, null, null, null, null, prms); int successId = jm.enqueueSync(jm.applicationName(), jm.userName(), null, null, null, null, null, null, null, prms); if (!jm.hasEnded(failId)) if (!jm.hasFailed(failId)) if (!jm.hasSucceeded(successId))
@Override public void run() { System.out.println("Spring job 2"); if (parameters == null || parameters.size() == 0) { throw new RuntimeException("parameters were not set"); } if (s1 == null) { throw new RuntimeException("services were not set"); } s1.getInt(); if (jmp == null) { throw new RuntimeException("JobManager was not set"); } JobManager jm = jmp.getObject(); System.out.println("Job instance ID is " + jm.jobInstanceID()); int instanceId = jm.jobInstanceID(); jm.enqueueSync("Job1", jm.userName(), null, null, null, jm.module(), null, null, null, jm.parameters()); if (instanceId != jmp.getObject().jobInstanceID()) { throw new RuntimeException("The job manager was not really thread local"); } } }
@Override public void run() { log.info("Starting payload"); EntityManagerFactory emf = Persistence.createEntityManagerFactory("marsu-pu"); EntityManager em = emf.createEntityManager(); log.info("Running query"); List<Entity> res = em.createQuery("SELECT e from Entity e", Entity.class).getResultList(); log.info(res.size()); if (jm.parameters().size() == 0) { log.info("Queuing again - with parameter and through the JM API"); Map<String, String> prms = new HashMap<String, String>(); prms.put("stop", "1"); jm.enqueue(jm.applicationName(), null, null, null, null, null, null, null, null, prms); } else { System.out.println(jm.parameters().get("stop")); } log.info("End of payload"); } }
@Override public void run() { System.out.println("PARAMETRE FIBO 2: " + jm.parameters().get("p2")); if (Integer.parseInt(jm.parameters().get("p1")) <= 100) { System.out.println("BEFORE ENQUEUE"); JobRequest.create(jm.applicationName(), jm.userName()).addParameter("p1", jm.parameters().get("p2")) .addParameter("p2", "" + (Integer.parseInt(jm.parameters().get("p2")) + Integer.parseInt(jm.parameters().get("p1")))) .submit(); } System.out.println("QUIT FIBO"); } }
boolean purgeDeletedNodes = Boolean.parseBoolean(jm.parameters().get("purgeDeletedNodes")); boolean purgeDeletedQueues = Boolean.parseBoolean(jm.parameters().get("purgeDeletedQueues")); int historyRetentionInDays = Integer.parseInt(jm.parameters().get("historyRetentionInDays")); String dataSourceName = jm.parameters().get("purgeDatasourceName"); String tablePrefix = jm.parameters().get("tablePrefix"); jm.sendProgress(0); c = ds.getConnection(); c.setAutoCommit(false); jm.sendProgress(20); PreparedStatement s2 = c.prepareStatement(String.format( "DELETE FROM %sMESSAGE o WHERE o.JOB_INSTANCE IN (SELECT h.id FROM %sHISTORY h %s)", tablePrefix, tablePrefix, wh)); jm.sendMsg(String.format("%s messages purged", res)); jm.sendProgress(5); PreparedStatement s1 = c.prepareStatement(String.format( "DELETE FROM %sDELIVERABLE o WHERE o.JOB_INSTANCE IN (SELECT h.id FROM %sHISTORY h %s)", tablePrefix, tablePrefix, wh)); s1.setTimestamp(1, new Timestamp(((Calendar) limit).getTimeInMillis())); res = s1.executeUpdate(); jm.sendMsg(String.format("%s deliverables purged", res)); jm.sendProgress(40); PreparedStatement s3 = c.prepareStatement( String.format("DELETE FROM %sJOB_INSTANCE_PARAMETER o WHERE o.JOB_INSTANCE IN (SELECT h.id FROM %sHISTORY h %s)", s3.setTimestamp(1, new Timestamp(((Calendar) limit).getTimeInMillis())); res = s3.executeUpdate();
@Override public void run() { String file = jm.parameters().get("filepath"); String fileName = jm.parameters().get("fileName"); System.out.println("FILENAME: " + fileName); try { PrintWriter out = new PrintWriter(new FileWriter(file + fileName)); out.println("Hello World!"); out.close(); jm.addDeliverable(file + fileName, "JobGenADeliverableFamily"); } catch (Exception e) { e.printStackTrace(); } } }
public String getApplicationName() { return jm.applicationName(); }
public void sendProgress(Integer progress) { jm.sendProgress(progress); }
public Map<String, String> getParameters() { return jm.parameters(); }
public Integer getJobInstanceId() { return jm.jobInstanceID(); } }
public int enQueue(String applicationName, String user, String mail, String sessionID, String application, String module, String keyword1, String keyword2, String keyword3, Map<String, String> parameters) { return jm.enqueue(applicationName, user, mail, sessionID, application, module, keyword1, keyword2, keyword3, parameters); }
public String getModule() { return jm.module(); }