[ https://issues.apache.org/jira/browse/CAMEL-7215?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13903388#comment-13903388 ]
ASF GitHub Bot commented on CAMEL-7215: --------------------------------------- GitHub user davidkeen opened a pull request: https://github.com/apache/camel/pull/98 CAMEL-7215 Stop and un-schedule jobs on route removal. Call doStop() in onRemove (as in CronScheduledRoutePolicy) so jobs are un-scheduled. You can merge this pull request into a Git repository by running: $ git pull https://github.com/apache/camel camel-7215 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/camel/pull/98.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #98 ---- commit 2457f7a51a67c3cdeea816362380141ac792d6b9 Author: David Keen <dkk...@gmail.com> Date: 2014-02-17T17:14:28Z CAMEL-7215 Stop and un-schedule jobs on route removal. (see CronScheduledRoutePolicy). ---- > Stop and un-schedule jobs on removal of route > --------------------------------------------- > > Key: CAMEL-7215 > URL: https://issues.apache.org/jira/browse/CAMEL-7215 > Project: Camel > Issue Type: Improvement > Components: camel-quartz, camel-quartz2 > Affects Versions: 2.12.2 > Environment: Using job-store 'org.quartz.simpl.RAMJobStore' > Reporter: David Keen > > When using SimpleScheduledRoutePolicy, jobs are not deleted when a route is > removed. > I got the following exception when removing a route and re-adding it to a > running context. > {code} > Stacktrace > --------------------------------------------------------------------------------------------------------------------------------------- > org.apache.camel.FailedToCreateRouteException: Failed to create route foo: > Route(foo)[[From[quartz... because of > org.quartz.ObjectAlreadyExistsException: Unable to store Job : > 'jobGroup-foo.job-STOP-foo', because one already exists with this > identification. > at > org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:182) > ~[camel-core-2.12.2.jar:2.12.2] > at > org.apache.camel.impl.DefaultCamelContext.startRoute(DefaultCamelContext.java:770) > ~[camel-core-2.12.2.jar:2.12.2] > at > org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCamelContext.java:1914) > ~[camel-core-2.12.2.jar:2.12.2] > at > org.apache.camel.impl.DefaultCamelContext.addRouteDefinitions(DefaultCamelContext.java:707) > ~[camel-core-2.12.2.jar:2.12.2] > at > org.apache.camel.builder.RouteBuilder.populateRoutes(RouteBuilder.java:337) > ~[camel-core-2.12.2.jar:2.12.2] > at > org.apache.camel.builder.RouteBuilder.addRoutesToCamelContext(RouteBuilder.java:264) > ~[camel-core-2.12.2.jar:2.12.2] > at > org.apache.camel.impl.DefaultCamelContext.addRoutes(DefaultCamelContext.java:669) > ~[camel-core-2.12.2.jar:2.12.2] > ... > Caused by: org.apache.camel.RuntimeCamelException: > org.quartz.ObjectAlreadyExistsException: Unable to store Job : > 'jobGroup-foo.job-STOP-foo', because one already exists with this > identification. > at > org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException(ObjectHelper.java:1352) > ~[camel-core-2.12.2.jar:2.12.2] > at > org.apache.camel.routepolicy.quartz2.SimpleScheduledRoutePolicy.onInit(SimpleScheduledRoutePolicy.java:48) > ~[camel-quartz2-2.12.2.jar:2.12.2] > at > org.apache.camel.impl.DefaultRouteContext.commit(DefaultRouteContext.java:202) > ~[camel-core-2.12.2.jar:2.12.2] > at > org.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:916) > ~[camel-core-2.12.2.jar:2.12.2] > ... > Caused by: org.quartz.ObjectAlreadyExistsException: Unable to store Job : > 'jobGroup-foo.job-STOP-foo', because one already exists with this > identification. > at org.quartz.simpl.RAMJobStore.storeJob(RAMJobStore.java:279) > ~[quartz-2.2.1.jar:na] > at > org.quartz.simpl.RAMJobStore.storeJobAndTrigger(RAMJobStore.java:251) > ~[quartz-2.2.1.jar:na] > at > org.quartz.core.QuartzScheduler.scheduleJob(QuartzScheduler.java:886) > ~[quartz-2.2.1.jar:na] > at org.quartz.impl.StdScheduler.scheduleJob(StdScheduler.java:249) > ~[quartz-2.2.1.jar:na] > at > org.apache.camel.routepolicy.quartz2.ScheduledRoutePolicy.scheduleRoute(ScheduledRoutePolicy.java:116) > ~[camel-quartz2-2.12.2.jar:2.12.2] > {code} > The SimpleScheduledRoutePolicy should remove the scheduled jobs on route > removal. This is what CronScheduledRoutePolicy does. -- This message was sent by Atlassian JIRA (v6.1.5#6160)