You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2015/09/28 11:29:59 UTC
camel git commit: CAMEL-7454: Allow quartz2 to not prefix scheduler
instance name with camel context name,
to allow reusing instance among multiple camel contexts,
for people who dare that.
Repository: camel
Updated Branches:
refs/heads/master 6d3d1309c -> a6543970c
CAMEL-7454: Allow quartz2 to not prefix scheduler instance name with camel context name, to allow reusing instance among multiple camel contexts, for people who dare that.
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/a6543970
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/a6543970
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/a6543970
Branch: refs/heads/master
Commit: a6543970c5fe216d513e7827acd227cc351fdbad
Parents: 6d3d130
Author: Claus Ibsen <da...@apache.org>
Authored: Mon Sep 28 11:23:25 2015 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Mon Sep 28 11:23:25 2015 +0200
----------------------------------------------------------------------
.../component/quartz2/QuartzComponent.java | 28 +++++++++++++++++---
1 file changed, 24 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/a6543970/components/camel-quartz2/src/main/java/org/apache/camel/component/quartz2/QuartzComponent.java
----------------------------------------------------------------------
diff --git a/components/camel-quartz2/src/main/java/org/apache/camel/component/quartz2/QuartzComponent.java b/components/camel-quartz2/src/main/java/org/apache/camel/component/quartz2/QuartzComponent.java
index 78d20ed..33dea2a 100644
--- a/components/camel-quartz2/src/main/java/org/apache/camel/component/quartz2/QuartzComponent.java
+++ b/components/camel-quartz2/src/main/java/org/apache/camel/component/quartz2/QuartzComponent.java
@@ -58,6 +58,7 @@ public class QuartzComponent extends UriEndpointComponent implements StartupList
private boolean autoStartScheduler = true;
private boolean prefixJobNameWithEndpointId;
private boolean enableJmx = true;
+ private boolean prefixInstanceName = true;
public QuartzComponent() {
super(QuartzEndpoint.class);
@@ -139,6 +140,20 @@ public class QuartzComponent extends UriEndpointComponent implements StartupList
this.propertiesFile = propertiesFile;
}
+ public boolean isPrefixInstanceName() {
+ return prefixInstanceName;
+ }
+
+ /**
+ * Whether to prefix the Quartz Scheduler instance name with the CamelContext name.
+ * <p/>
+ * This is enabled by default, to let each CamelContext use its own Quartz scheduler instance by default.
+ * You can set this option to <tt>false</tt> to reuse Quartz scheduler instances between multiple CamelContext's.
+ */
+ public void setPrefixInstanceName(boolean prefixInstanceName) {
+ this.prefixInstanceName = prefixInstanceName;
+ }
+
public SchedulerFactory getSchedulerFactory() throws SchedulerException {
if (schedulerFactory == null) {
schedulerFactory = createSchedulerFactory();
@@ -157,8 +172,10 @@ public class QuartzComponent extends UriEndpointComponent implements StartupList
prop.put("org.terracotta.quartz.skipUpdateCheck", "true");
// camel context name will be a suffix to use one scheduler per context
- String instName = createInstanceName(prop);
- prop.setProperty(StdSchedulerFactory.PROP_SCHED_INSTANCE_NAME, instName);
+ if (isPrefixInstanceName()) {
+ String instName = createInstanceName(prop);
+ prop.setProperty(StdSchedulerFactory.PROP_SCHED_INSTANCE_NAME, instName);
+ }
// enable jmx unless configured to not do so
if (enableJmx && !prop.containsKey("org.quartz.scheduler.jmx.export")) {
@@ -187,8 +204,11 @@ public class QuartzComponent extends UriEndpointComponent implements StartupList
}
// camel context name will be a suffix to use one scheduler per context
- String instName = createInstanceName(prop);
- prop.setProperty(StdSchedulerFactory.PROP_SCHED_INSTANCE_NAME, instName);
+ if (isPrefixInstanceName()) {
+ // camel context name will be a suffix to use one scheduler per context
+ String instName = createInstanceName(prop);
+ prop.setProperty(StdSchedulerFactory.PROP_SCHED_INSTANCE_NAME, instName);
+ }
// force disabling update checker (will do online check over the internet)
prop.put("org.quartz.scheduler.skipUpdateCheck", "true");