public static void startProcesses(int... process_ids) { try { ProcessDAO pDAO = ProcessDAO.getInstance(); PladipusProcessingTemplate runTemplate = null; try (CompomicsProducer producer = new CompomicsProducer(CompomicsQueue.JOB)) { for (int processID : process_ids) { if (runTemplate == null) { runTemplate = pDAO.getTemplate(processID); } // is the process complete? if (!pDAO.isCompletedProcess(processID) && !pDAO.isQueued(processID)) { producer.addMessage( pDAO.getXMLForProcess(processID), processID, runTemplate.getPriority()); } pDAO.setQueued(processID, true); } producer.run(); } } catch (JMSException | SQLException | IOException | ProcessStepInitialisationException | ParserConfigurationException | SAXException ex) { LOGGER.error("Could not start the selection", ex); } }
public static void stopProcess(int... process_ids) { LOGGER.info("Stopping processes..."); try { ProcessDAO pDAO = ProcessDAO.getInstance(); List<Integer> processesToCancel = new ArrayList<Integer>(); for (int processID : process_ids) { DeleteOperation dO = new DeleteOperation(); dO.deleteJobFromQueue(CompomicsQueue.JOB, processID); pDAO.setQueued(processID, false); } pDAO.resetProcesses(processesToCancel); } catch (Exception ex) { LOGGER.error("Could not cancel the selection", ex); } }