LibraryResolverMaven(DbConn cnx) { mavenRepos = GlobalParameter.getParameter(cnx, "mavenRepo", "http://repo1.maven.org/maven2/").split(","); mavenSettingsClPath = GlobalParameter.getParameter(cnx, "mavenSettingsCL", null); mavenSettingsFilePath = GlobalParameter.getParameter(cnx, "mavenSettingsFile", null); }
private void setIsolationDefault(DbConn cnx) { this.launchIsolationDefault = GlobalParameter.getParameter(cnx, "launch_isolation_default", "Isolated"); String rns = GlobalParameter.getParameter(cnx, "job_runners", "com.enioka.jqm.tools.LegacyRunner,com.enioka.jqm.tools.MainRunner,com.enioka.jqm.tools.RunnableRunner"); for (String s : rns.split(",")) { runnerClasses.add(s); jqmlogger.info("Detected a job instance runner named " + s); } }
private String getFileProtocol(DbConn cnx) { if (protocol == null) { protocol = "http://"; try { String prm = GlobalParameter.getParameter(cnx, "enableWsApiSsl", "false"); if (Boolean.parseBoolean(prm)) { protocol = "https://"; } } catch (NoResultException e) { protocol = "http://"; } } return protocol; }
@Override public String defaultConnect() { DbConn cnx = Helpers.getNewDbSession(); try { return GlobalParameter.getParameter(cnx, "defaultConnection", null); } finally { Helpers.closeQuietly(cnx); } }
@Override public String defaultConnect() { DbConn cnx = Helpers.getNewDbSession(); try { return GlobalParameter.getParameter(cnx, "defaultConnection", null); } finally { Helpers.closeQuietly(cnx); } }
InternalPoller(JqmEngine e) { this.engine = e; DbConn cnx = Helpers.getNewDbSession(); // Get configuration data this.node = this.engine.getNode(); this.step = Long.parseLong(GlobalParameter.getParameter(cnx, "internalPollingPeriodMs", "60000")); cnx.close(); }
InternalPoller(JqmEngine e) { this.engine = e; DbConn cnx = Helpers.getNewDbSession(); // Get configuration data this.node = this.engine.getNode(); this.step = Long.parseLong(GlobalParameter.getParameter(cnx, "internalPollingPeriodMs", "60000")); cnx.close(); }
public CronScheduler(JqmEngine e) { this.node = e.getNode(); DbConn cnx = Helpers.getNewDbSession(); this.schedulerKeepAlive = Integer.parseInt(GlobalParameter.getParameter(cnx, "schedulerKeepAlive", "30000")); boolean shouldStart = !Boolean.parseBoolean(GlobalParameter.getParameter(cnx, "disableScheduler", "false")); if (!shouldStart) { jqmlogger.info("Scheduling functions are disabled"); return; } try { cnx.runUpdate("w_insert", this.node.getId()); cnx.commit(); jqmlogger.debug("This node is the first scheduling node to start inside the cluster"); } catch (DatabaseException ex) { // Ignore it (UK error). It means the line already exists inside the database. } cnx.close(); // Start the thread t = new Thread(this); t.start(); }
@Override public String getWebApiLocalUrl(DbConn cnx) { // Do not use port from engine.getNode, as it may have been set AFTER engine startup. Node node = Node.select_single(cnx, "node_select_by_id", this.engine.getNode().getId()); boolean useSsl = Boolean.parseBoolean(GlobalParameter.getParameter(cnx, "enableWsApiSsl", "false")); return (useSsl ? "https://localhost:" : "http://localhost:") + node.getPort(); } }
public CronScheduler(JqmEngine e) { this.node = e.getNode(); DbConn cnx = Helpers.getNewDbSession(); this.schedulerKeepAlive = Integer.parseInt(GlobalParameter.getParameter(cnx, "schedulerKeepAlive", "30000")); boolean shouldStart = !Boolean.parseBoolean(GlobalParameter.getParameter(cnx, "disableScheduler", "false")); if (!shouldStart) { jqmlogger.info("Scheduling functions are disabled"); return; } try { cnx.runUpdate("w_insert", this.node.getId()); cnx.commit(); jqmlogger.debug("This node is the first scheduling node to start inside the cluster"); } catch (DatabaseException ex) { // Ignore it (UK error). It means the line already exists inside the database. } cnx.close(); // Start the thread t = new Thread(this); t.start(); }
public RunningExternalJobInstance(DbConn cnx, JobInstance job, QueuePoller qp) { this.jobId = job.getId(); this.ji = job; this.qp = qp; opts = job.getJD().getJavaOpts() == null ? GlobalParameter.getParameter(cnx, "defaultExternalOpts", "-Xms32m -Xmx128m -XX:MaxPermSize=64m") : job.getJD().getJavaOpts(); killCheckPeriodMs = Integer.parseInt(GlobalParameter.getParameter(cnx, "internalPollingPeriodMs", "1000")); logFile = "./logs"; logFile = FilenameUtils.concat(logFile, StringUtils.leftPad("" + jobId, 10, "0") + ".log"); }
@Override public String getWebApiLocalUrl(DbConn cnx) { // Do not use port from engine.getNode, as it may have been set AFTER engine startup. Node node = Node.select_single(cnx, "node_select_by_id", this.engine.getNode().getId()); boolean useSsl = Boolean.parseBoolean(GlobalParameter.getParameter(cnx, "enableWsApiSsl", "false")); return (useSsl ? "https://localhost:" : "http://localhost:") + node.getPort(); } }
public RunningExternalJobInstance(DbConn cnx, JobInstance job, QueuePoller qp) { this.jobId = job.getId(); this.ji = job; this.qp = qp; opts = job.getJD().getJavaOpts() == null ? GlobalParameter.getParameter(cnx, "defaultExternalOpts", "-Xms32m -Xmx128m -XX:MaxMetaspaceSize=64m") : job.getJD().getJavaOpts(); killCheckPeriodMs = Integer.parseInt(GlobalParameter.getParameter(cnx, "internalPollingPeriodMs", "1000")); logFile = "./logs"; logFile = FilenameUtils.concat(logFile, StringUtils.leftPad("" + jobId, 10, "0") + ".log"); }
private void initResourceManagers(DbConn cnx) { jqmlogger.info("Initializing node-level resource managers"); // For now, single RM using a global parameter. Future: from db configuration. String itemList = GlobalParameter.getParameter(cnx, "discreteRmList", null); if (itemList == null) { return; } ResourceManager discreteResourceManagerConfiguration = new ResourceManager(); discreteResourceManagerConfiguration.setClassName(DiscreteResourceManager.class.getCanonicalName()); discreteResourceManagerConfiguration.setDeploymentParameterId(null); discreteResourceManagerConfiguration.setEnabled(true); discreteResourceManagerConfiguration.setKey(GlobalParameter.getParameter(cnx, "discreteRmName", "ports")); discreteResourceManagerConfiguration.setNodeId(this.node.getId()); discreteResourceManagerConfiguration.addParameter("com.enioka.jqm.rm.discrete.list", itemList); ResourceManagerBase rm1 = new DiscreteResourceManager(discreteResourceManagerConfiguration); rm1.refreshConfiguration(discreteResourceManagerConfiguration); this.resourceManagers.add(rm1); }
static void dumpParameters(DbConn cnx, Node n) String terse = GlobalParameter.getParameter(cnx, "disableVerboseStartup", "false"); if ("false".equals(terse))
private void initResourceManagers(DbConn cnx) { jqmlogger.info("Initializing node-level resource managers"); // For now, single RM using a global parameter. Future: from db configuration. String itemList = GlobalParameter.getParameter(cnx, "discreteRmList", null); if (itemList == null) { return; } ResourceManager discreteResourceManagerConfiguration = new ResourceManager(); discreteResourceManagerConfiguration.setClassName(DiscreteResourceManager.class.getCanonicalName()); discreteResourceManagerConfiguration.setDeploymentParameterId(null); discreteResourceManagerConfiguration.setEnabled(true); discreteResourceManagerConfiguration.setKey(GlobalParameter.getParameter(cnx, "discreteRmName", "ports")); discreteResourceManagerConfiguration.setNodeId(this.node.getId()); discreteResourceManagerConfiguration.addParameter("com.enioka.jqm.rm.discrete.list", itemList); ResourceManagerBase rm1 = new DiscreteResourceManager(discreteResourceManagerConfiguration); rm1.refreshConfiguration(discreteResourceManagerConfiguration); this.resourceManagers.add(rm1); }
String gp1 = GlobalParameter.getParameter(cnx, "logFilePerLaunch", "true"); if ("true".equals(gp1) || "both".equals(gp1)) String gp2 = GlobalParameter.getParameter(cnx, "directoryScannerRoot", ""); if (!gp2.isEmpty())
String gp1 = GlobalParameter.getParameter(cnx, "logFilePerLaunch", "true"); if ("true".equals(gp1) || "both".equals(gp1)) String gp2 = GlobalParameter.getParameter(cnx, "directoryScannerRoot", ""); if (!gp2.isEmpty())
/** * Called at the beginning of the main loop to check if the poller config is up to date (nbThread, pause...) */ private void refreshDeploymentParameter(DbConn cnx) { List<DeploymentParameter> prms = DeploymentParameter.select(cnx, "dp_select_by_id", this.dpId); if (prms.size() != 1) { this.stop(); return; } DeploymentParameter p = prms.get(0); if (p.getPollingInterval() != this.pollingInterval || (p.getEnabled() && this.maxNbThread != p.getNbThread()) || (this.maxNbThread > 0 && !p.getEnabled()) || (this.maxNbThread == 0 && p.getEnabled())) { applyDeploymentParameter(p); } this.strictPollingPeriod = Boolean.parseBoolean(GlobalParameter.getParameter(cnx, "strictPollingPeriod", "false")); }
/** * Called at the beginning of the main loop to check if the poller config is up to date (nbThread, pause...) */ private void refreshDeploymentParameter(DbConn cnx) { List<DeploymentParameter> prms = DeploymentParameter.select(cnx, "dp_select_by_id", this.dpId); if (prms.size() != 1) { this.stop(); return; } DeploymentParameter p = prms.get(0); if (p.getPollingInterval() != this.pollingInterval || (p.getEnabled() && this.maxNbThread != p.getNbThread()) || (this.maxNbThread > 0 && !p.getEnabled()) || (this.maxNbThread == 0 && p.getEnabled())) { applyDeploymentParameter(p); } this.strictPollingPeriod = Boolean.parseBoolean(GlobalParameter.getParameter(cnx, "strictPollingPeriod", "false")); }