Issue #2608 quartz components use single scheduler

configured quartz components to use a single scheduler
added workaround to camel limitation which requires management name set on context
added quartz properties file copied from the quartz jar (can be used to set thread count)


Former-commit-id: 16b34af5a8 [formerly f1c3efdd0e] [formerly 3959c9e023] [formerly 16b34af5a8 [formerly f1c3efdd0e] [formerly 3959c9e023] [formerly 1a5991dcf5 [formerly 3959c9e023 [formerly 2b16524026b3c8834e5846f8cd800ae4e1a95e07]]]]
Former-commit-id: 1a5991dcf5
Former-commit-id: 32bd012ee7 [formerly 1708f1c350] [formerly 8e0e1ea619f2364f9bacc1be3d52e01d6a4500f8 [formerly f0b260d1ce]]
Former-commit-id: 8b613f48d83eb607e6cb702166549c20dd5d2a20 [formerly d62dd50b7b]
Former-commit-id: b18c7dcee6
This commit is contained in:
Brian Clements 2014-01-10 14:32:44 -06:00
parent 1a528b0567
commit 62ce9cd76a
4 changed files with 216 additions and 2 deletions

View file

@ -344,5 +344,29 @@
<constructor-arg ref="requestServerKey" />
<constructor-arg ref="requestServiceRouter" />
</bean>
<!-- needed for camel quartz component workaround when JMX is disabled -->
<bean id="managementNameLifecycleStrategy"
class="com.raytheon.uf.edex.esb.camel.quartz.ManagementNameLifecycleStrategy" />
<!-- quartz component configuration.
Single scheduler used by all endpoints so there is only one threadpool.
Thread pool configured in edex/config/resources/quartz.properties -->
<bean id="quartzSchedulerFactory" class="org.quartz.impl.StdSchedulerFactory">
<constructor-arg value="quartz.properties" />
</bean>
<bean id="quartzScheduler" factory-bean="quartzSchedulerFactory"
factory-method="getScheduler" />
<bean id="quartz" class="org.apache.camel.component.quartz.QuartzComponent">
<property name="scheduler" ref="quartzScheduler" />
</bean>
<bean id="clusteredquartz"
class="com.raytheon.uf.edex.esb.camel.cluster.quartz.ClusteredQuartzComponent">
<property name="scheduler" ref="quartzScheduler" />
</bean>
</beans>

View file

@ -1,4 +1,5 @@
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.
.,\
resources/

View file

@ -0,0 +1,13 @@
org.quartz.scheduler.instanceName = DefaultQuartzScheduler
org.quartz.scheduler.rmi.export = false
org.quartz.scheduler.rmi.proxy = false
org.quartz.scheduler.wrapJobExecutionInUserTransaction = false
org.quartz.threadPool.class = org.quartz.simpl.SimpleThreadPool
org.quartz.threadPool.threadCount = 10
org.quartz.threadPool.threadPriority = 5
org.quartz.threadPool.threadsInheritContextClassLoaderOfInitializingThread = true
org.quartz.jobStore.misfireThreshold = 60000
org.quartz.jobStore.class = org.quartz.simpl.RAMJobStore

View file

@ -0,0 +1,176 @@
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.uf.edex.esb.camel.quartz;
import java.util.Collection;
import java.util.concurrent.ThreadPoolExecutor;
import org.apache.camel.CamelContext;
import org.apache.camel.Component;
import org.apache.camel.Endpoint;
import org.apache.camel.ErrorHandlerFactory;
import org.apache.camel.Processor;
import org.apache.camel.Route;
import org.apache.camel.Service;
import org.apache.camel.VetoCamelContextStartException;
import org.apache.camel.impl.DefaultCamelContext;
import org.apache.camel.spi.LifecycleStrategy;
import org.apache.camel.spi.RouteContext;
/**
* Ensures that the management name field of the camel context is set. If it is
* found to be null, it will be populated with the name of the context. This is
* to work around a limitation in the QuartzComponent that it uses the
* management name as a hash key for contexts.
* https://issues.apache.org/jira/browse/CAMEL-7132
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jan 13, 2014 2608 bclement Initial creation
*
* </pre>
*
* @author bclement
* @version 1.0
*/
public class ManagementNameLifecycleStrategy implements LifecycleStrategy {
/* (non-Javadoc)
* @see org.apache.camel.spi.LifecycleStrategy#onContextStart(org.apache.camel.CamelContext)
*/
@Override
public void onContextStart(CamelContext context)
throws VetoCamelContextStartException {
if (context.getManagementName() == null
&& context instanceof DefaultCamelContext) {
((DefaultCamelContext) context)
.setManagementName(context.getName());
}
}
/* (non-Javadoc)
* @see org.apache.camel.spi.LifecycleStrategy#onContextStop(org.apache.camel.CamelContext)
*/
@Override
public void onContextStop(CamelContext context) {
}
/* (non-Javadoc)
* @see org.apache.camel.spi.LifecycleStrategy#onComponentAdd(java.lang.String, org.apache.camel.Component)
*/
@Override
public void onComponentAdd(String name, Component component) {
}
/* (non-Javadoc)
* @see org.apache.camel.spi.LifecycleStrategy#onComponentRemove(java.lang.String, org.apache.camel.Component)
*/
@Override
public void onComponentRemove(String name, Component component) {
}
/* (non-Javadoc)
* @see org.apache.camel.spi.LifecycleStrategy#onEndpointAdd(org.apache.camel.Endpoint)
*/
@Override
public void onEndpointAdd(Endpoint endpoint) {
}
/* (non-Javadoc)
* @see org.apache.camel.spi.LifecycleStrategy#onEndpointRemove(org.apache.camel.Endpoint)
*/
@Override
public void onEndpointRemove(Endpoint endpoint) {
}
/* (non-Javadoc)
* @see org.apache.camel.spi.LifecycleStrategy#onServiceAdd(org.apache.camel.CamelContext, org.apache.camel.Service, org.apache.camel.Route)
*/
@Override
public void onServiceAdd(CamelContext context, Service service, Route route) {
}
/* (non-Javadoc)
* @see org.apache.camel.spi.LifecycleStrategy#onServiceRemove(org.apache.camel.CamelContext, org.apache.camel.Service, org.apache.camel.Route)
*/
@Override
public void onServiceRemove(CamelContext context, Service service,
Route route) {
}
/* (non-Javadoc)
* @see org.apache.camel.spi.LifecycleStrategy#onRoutesAdd(java.util.Collection)
*/
@Override
public void onRoutesAdd(Collection<Route> routes) {
}
/* (non-Javadoc)
* @see org.apache.camel.spi.LifecycleStrategy#onRoutesRemove(java.util.Collection)
*/
@Override
public void onRoutesRemove(Collection<Route> routes) {
}
/* (non-Javadoc)
* @see org.apache.camel.spi.LifecycleStrategy#onRouteContextCreate(org.apache.camel.spi.RouteContext)
*/
@Override
public void onRouteContextCreate(RouteContext routeContext) {
}
/* (non-Javadoc)
* @see org.apache.camel.spi.LifecycleStrategy#onErrorHandlerAdd(org.apache.camel.spi.RouteContext, org.apache.camel.Processor, org.apache.camel.ErrorHandlerFactory)
*/
@Override
public void onErrorHandlerAdd(RouteContext routeContext,
Processor errorHandler, ErrorHandlerFactory errorHandlerBuilder) {
}
/* (non-Javadoc)
* @see org.apache.camel.spi.LifecycleStrategy#onErrorHandlerRemove(org.apache.camel.spi.RouteContext, org.apache.camel.Processor, org.apache.camel.ErrorHandlerFactory)
*/
@Override
public void onErrorHandlerRemove(RouteContext routeContext,
Processor errorHandler, ErrorHandlerFactory errorHandlerBuilder) {
}
/* (non-Javadoc)
* @see org.apache.camel.spi.LifecycleStrategy#onThreadPoolAdd(org.apache.camel.CamelContext, java.util.concurrent.ThreadPoolExecutor, java.lang.String, java.lang.String, java.lang.String, java.lang.String)
*/
@Override
public void onThreadPoolAdd(CamelContext camelContext,
ThreadPoolExecutor threadPool, String id, String sourceId,
String routeId, String threadPoolProfileId) {
}
/* (non-Javadoc)
* @see org.apache.camel.spi.LifecycleStrategy#onThreadPoolRemove(org.apache.camel.CamelContext, java.util.concurrent.ThreadPoolExecutor)
*/
@Override
public void onThreadPoolRemove(CamelContext camelContext,
ThreadPoolExecutor threadPool) {
}
}