Return-Path: X-Original-To: apmail-camel-issues-archive@minotaur.apache.org Delivered-To: apmail-camel-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 1089A10FA8 for ; Sun, 9 Mar 2014 07:19:51 +0000 (UTC) Received: (qmail 65927 invoked by uid 500); 9 Mar 2014 07:19:50 -0000 Delivered-To: apmail-camel-issues-archive@camel.apache.org Received: (qmail 65861 invoked by uid 500); 9 Mar 2014 07:19:48 -0000 Mailing-List: contact issues-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@camel.apache.org Delivered-To: mailing list issues@camel.apache.org Received: (qmail 65839 invoked by uid 99); 9 Mar 2014 07:19:47 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 09 Mar 2014 07:19:47 +0000 Date: Sun, 9 Mar 2014 07:19:47 +0000 (UTC) From: "Claus Ibsen (JIRA)" To: issues@camel.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (CAMEL-7276) camel-quartz - use of management name to provide default scheduler name breaks context isolation MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/CAMEL-7276?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Claus Ibsen updated CAMEL-7276: ------------------------------- Priority: Minor (was: Major) > camel-quartz - use of management name to provide default scheduler name breaks context isolation > ------------------------------------------------------------------------------------------------ > > Key: CAMEL-7276 > URL: https://issues.apache.org/jira/browse/CAMEL-7276 > Project: Camel > Issue Type: Bug > Components: camel-quartz > Affects Versions: 2.12.3 > Reporter: Bob Browning > Assignee: Claus Ibsen > Priority: Minor > Fix For: 2.12.4, 2.13.0 > > > When using the camel-quartz component in an unmanged context with multiple camel contexts, for example in a JUnit test case, causes the scheduler to be created with the instance name "DefaultQuartzScheduler" which is then shared across all camel context's within the same jvm. > This is in contradiction of the previous behaviour that uses `getCamelContext.getName()` which isolates the scheduler by denoting that the default instance is specific to the camel context. > {code} > package org.apache.camel.component.quartz; > import org.apache.camel.CamelContext; > import org.apache.camel.impl.DefaultCamelContext; > import org.apache.camel.management.JmxSystemPropertyKeys; > import org.junit.Test; > import org.quartz.Scheduler; > import org.quartz.SchedulerException; > import static org.junit.Assert.assertNotEquals; > import static org.junit.Assert.assertNotSame; > /** > * Test regression of camel-context isolation of default scheduler instance introduced in CAMEL-7034. > */ > public class QuartzComponentCamelContextSchedulerIsolationTest { > @Test > public void testSchedulerIsolation_unmanaged() throws Exception { > disableJMX(); > testSchedulerIsolation(); > } > @Test > public void testSchedulerIsolation_managed() throws Exception { > enableJMX(); > testSchedulerIsolation(); > } > private void testSchedulerIsolation() throws Exception { > CamelContext context = createCamelContext(); > context.start(); > CamelContext anotherContext = createCamelContext(); > assertNotEquals(anotherContext.getName(), context.getName()); > assertNotEquals(anotherContext, context); > assertNotSame(getDefaultScheduler(context), getDefaultScheduler(anotherContext)); > } > /** > * Create a new camel context instance. > */ > private DefaultCamelContext createCamelContext() { > return new DefaultCamelContext(); > } > /** > * Get the quartz component for the provided camel context. > */ > private QuartzComponent getQuartzComponent(CamelContext context) { > return context.getComponent("quartz", QuartzComponent.class); > } > /** > * Get the default scheduler for the provided camel context. > */ > private Scheduler getDefaultScheduler(CamelContext context) throws SchedulerException { > return getQuartzComponent(context).getFactory().getScheduler(); > } > /** > * Disables the JMX agent. > */ > private void disableJMX() { > System.setProperty(JmxSystemPropertyKeys.DISABLED, "true"); > } > /** > * Enables the JMX agent. > */ > private void enableJMX() { > System.setProperty(JmxSystemPropertyKeys.DISABLED, "false"); > } > } > {code} -- This message was sent by Atlassian JIRA (v6.2#6252)