/** * This actually starts the different engines configured with {@link #addNode(String)}.<br> * This can usually only be called once (it can actually be called again but only after calling {@link #stop()}). */ public JqmAsyncTester start() { if (hasStarted) { throw new IllegalStateException("cannot start twice"); } if (nodes.isEmpty()) { throw new IllegalStateException("no engines defined"); } if (queues.isEmpty()) { throw new IllegalStateException("no queues defined"); } if (!oneQueueDeployed) { throw new IllegalStateException("no queue was ever deployed to any node"); } hasStarted = true; for (Node n : nodes.values()) { engines.put(n.getName(), JqmEngineFactory.startEngine(n.getName(), null)); } return this; }
/** * This actually starts the different engines configured with {@link #addNode(String)}.<br> * This can usually only be called once (it can actually be called again but only after calling {@link #stop()}). */ public JqmAsyncTester start() { if (hasStarted) { throw new IllegalStateException("cannot start twice"); } if (nodes.isEmpty()) { throw new IllegalStateException("no engines defined"); } if (queues.isEmpty()) { throw new IllegalStateException("no queues defined"); } if (!oneQueueDeployed) { throw new IllegalStateException("no queue was ever deployed to any node"); } hasStarted = true; for (Node n : nodes.values()) { engines.put(n.getName(), JqmEngineFactory.startEngine(n.getName(), null)); } return this; }
private void registerMBean() { try { if (this.engine.loadJmxBeans) { MBeanServer mbs = ManagementFactory.getPlatformMBeanServer(); name = new ObjectName( "com.enioka.jqm:type=Node.Queue,Node=" + this.engine.getNode().getName() + ",name=" + this.queue.getName()); // Unregister MBean if it already exists. This may happen during frequent DP modifications. try { mbs.getMBeanInfo(name); mbs.unregisterMBean(name); } catch (InstanceNotFoundException e) { // Nothing to do, this should be the normal case. } mbs.registerMBean(this, name); } } catch (Exception e) { throw new JqmInitError("Could not create JMX beans", e); } }
private void registerMBean() { try { if (this.engine.loadJmxBeans) { MBeanServer mbs = ManagementFactory.getPlatformMBeanServer(); name = new ObjectName( "com.enioka.jqm:type=Node.Queue,Node=" + this.engine.getNode().getName() + ",name=" + this.queue.getName()); // Unregister MBean if it already exists. This may happen during frequent DP modifications. try { mbs.getMBeanInfo(name); mbs.unregisterMBean(name); } catch (InstanceNotFoundException e) { // Nothing to do, this should be the normal case. } mbs.registerMBean(this, name); } } catch (Exception e) { throw new JqmInitError("Could not create JMX beans", e); } }
@Override public String getJmxBeanName() { return "com.enioka.jqm:type=Node.Queue.JobInstance,Node=" + this.engine.getNode().getName() + ",Queue=" + this.qp.getQueue().getName() + ",name=" + this.ji.getId(); }
@Override public String getJmxBeanName() { return "com.enioka.jqm:type=Node.Queue.JobInstance,Node=" + this.engine.getNode().getName() + ",Queue=" + this.qp.getQueue().getName() + ",name=" + this.ji.getId(); }
void applyDeploymentParameter(DeploymentParameter dp) { this.pollingInterval = dp.getPollingInterval(); this.maxNbThread = dp.getEnabled() ? dp.getNbThread() : 0; this.dpId = dp.getId(); jqmlogger.info("Engine {}" + " will poll JobInstances on queue {} every {} s", engine.getNode().getName(), queue.getName(), pollingInterval / 1000); this.threadresourceManagerConfiguration.addParameter("com.enioka.jqm.rm.quantity.quantity", "" + this.maxNbThread); this.resourceManagers.get(0).refreshConfiguration(this.threadresourceManagerConfiguration); }
void applyDeploymentParameter(DeploymentParameter dp) { this.pollingInterval = dp.getPollingInterval(); this.maxNbThread = dp.getEnabled() ? dp.getNbThread() : 0; this.dpId = dp.getId(); jqmlogger.info("Engine {}" + " will poll JobInstances on queue {} every {} s", engine.getNode().getName(), queue.getName(), pollingInterval / 1000); this.threadresourceManagerConfiguration.addParameter("com.enioka.jqm.rm.quantity.quantity", "" + this.maxNbThread); this.resourceManagers.get(0).refreshConfiguration(this.threadresourceManagerConfiguration); }
webAppContext.setInitParameter("jqmnode", node.getName()); webAppContext.setInitParameter("jqmnodeid", node.getId().toString());
webAppContext.setInitParameter("jqmnode", node.getName()); webAppContext.setInitParameter("jqmnodeid", node.getId().toString());
env.put("JQM_JI_DELIVERY_DIR", this.deliveryDir.getAbsolutePath()); env.put("JQM_NODE_NAME", this.ji.getNode().getName()); env.put("JQM_NODE_APPLICATION_ROOT", this.ji.getNode().getRepo()); env.put("JQM_NODE_LOG_LEVEL", this.ji.getNode().getRootLogLevel());
env.put("JQM_JI_DELIVERY_DIR", this.deliveryDir.getAbsolutePath()); env.put("JQM_NODE_NAME", this.ji.getNode().getName()); env.put("JQM_NODE_APPLICATION_ROOT", this.ji.getNode().getRepo()); env.put("JQM_NODE_LOG_LEVEL", this.ji.getNode().getRootLogLevel());
.info("Poller loop on queue " + this.queue.getName() + " is stopping [engine " + this.engine.getNode().getName() + "]"); waitForAllThreads(60L * 1000);
@Test public void testTemplate() throws Exception { NodeDto template = MetaService.getNode(cnx, TestHelpers.nodeMix.getId()); template.setPort(123); MetaService.upsertNode(cnx, template); cnx.commit(); NodeDto target = MetaService.getNode(cnx, TestHelpers.node.getId()); Assert.assertEquals(3, MetaService.getNodeQueueMappings(cnx, target.getId()).size()); // Capital letter -> should be ignored. Main.runCommand(new String[] { "Install-NodeTemPlate", "-t", TestHelpers.nodeMix.getName(), "-n", TestHelpers.node.getName() }); target = MetaService.getNode(cnx, TestHelpers.node.getId()); Assert.assertEquals(template.getPort(), target.getPort()); Assert.assertEquals(1, MetaService.getNodeQueueMappings(cnx, target.getId()).size()); } }
"com.enioka.jqm:type=Node.Queue.JobInstance,Node=" + TestHelpers.node.getName() + ",Queue=VIPQueue,name=" + i); System.out.println("Name to kill: " + killBean.toString()); mbeans = mbsc.queryMBeans(killBean, null); ObjectName engine = new ObjectName("com.enioka.jqm:type=Node,name=" + TestHelpers.node.getName()); JqmEngineMBean proxyEngine = JMX.newMBeanProxy(mbsc, engine, JqmEngineMBean.class); Assert.assertEquals(1, proxyEngine.getCumulativeJobInstancesCount() + proxyEngine.getCurrentlyRunningJobCount()); ObjectName poller = new ObjectName("com.enioka.jqm:type=Node.Queue,Node=" + TestHelpers.node.getName() + ",name=VIPQueue"); QueuePollerMBean proxyPoller = JMX.newMBeanProxy(mbsc, poller, QueuePollerMBean.class); Assert.assertEquals(1, proxyPoller.getCumulativeJobInstancesCount() + proxyPoller.getCurrentActiveThreadCount());
/** * Create an History object from a {@link JobInstance}. * */ public static void create(DbConn cnx, JobInstance ji, State finalState, Calendar endDate) { JobDef jd = ji.getJD(); Node n = ji.getNode(); Queue q = ji.getQ(); if (endDate == null) { cnx.runUpdate("history_insert", ji.getId(), jd.getApplication(), jd.getApplicationName(), ji.getAttributionDate(), ji.getEmail(), ji.getCreationDate(), ji.getExecutionDate(), jd.isHighlander(), ji.getApplication(), ji.getKeyword1(), ji.getKeyword2(), ji.getKeyword3(), ji.getModule(), jd.getKeyword1(), jd.getKeyword2(), jd.getKeyword3(), jd.getModule(), n == null ? null : n.getName(), ji.getParentId(), ji.getProgress(), q == null ? null : q.getName(), 0, ji.getSessionID(), finalState.toString(), ji.getUserName(), ji.getJdId(), n == null ? null : n.getId(), ji.getQueue(), ji.isFromSchedule(), ji.getPriority()); } else { cnx.runUpdate("history_insert_with_end_date", ji.getId(), jd.getApplication(), jd.getApplicationName(), ji.getAttributionDate(), ji.getEmail(), endDate, ji.getCreationDate(), ji.getExecutionDate(), jd.isHighlander(), ji.getApplication(), ji.getKeyword1(), ji.getKeyword2(), ji.getKeyword3(), ji.getModule(), jd.getKeyword1(), jd.getKeyword2(), jd.getKeyword3(), jd.getModule(), n.getName(), ji.getParentId(), ji.getProgress(), q.getName(), 0, ji.getSessionID(), finalState.toString(), ji.getUserName(), ji.getJdId(), ji.getNode().getId(), ji.getQueue(), ji.isFromSchedule(), ji.getPriority()); } }
/** * Create an History object from a {@link JobInstance}. * */ public static void create(DbConn cnx, JobInstance ji, State finalState, Calendar endDate) { JobDef jd = ji.getJD(); Node n = ji.getNode(); Queue q = ji.getQ(); if (endDate == null) { cnx.runUpdate("history_insert", ji.getId(), jd.getApplication(), jd.getApplicationName(), ji.getAttributionDate(), ji.getEmail(), ji.getCreationDate(), ji.getExecutionDate(), jd.isHighlander(), ji.getApplication(), ji.getKeyword1(), ji.getKeyword2(), ji.getKeyword3(), ji.getModule(), jd.getKeyword1(), jd.getKeyword2(), jd.getKeyword3(), jd.getModule(), n == null ? null : n.getName(), ji.getParentId(), ji.getProgress(), q == null ? null : q.getName(), 0, ji.getSessionID(), finalState.toString(), ji.getUserName(), ji.getJdId(), n == null ? null : n.getId(), ji.getQueue(), ji.isFromSchedule(), ji.getPriority()); } else { cnx.runUpdate("history_insert_with_end_date", ji.getId(), jd.getApplication(), jd.getApplicationName(), ji.getAttributionDate(), ji.getEmail(), endDate, ji.getCreationDate(), ji.getExecutionDate(), jd.isHighlander(), ji.getApplication(), ji.getKeyword1(), ji.getKeyword2(), ji.getKeyword3(), ji.getModule(), jd.getKeyword1(), jd.getKeyword2(), jd.getKeyword3(), jd.getModule(), n.getName(), ji.getParentId(), ji.getProgress(), q.getName(), 0, ji.getSessionID(), finalState.toString(), ji.getUserName(), ji.getJdId(), ji.getNode().getId(), ji.getQueue(), ji.isFromSchedule(), ji.getPriority()); } }