@Override protected void doStart() throws Exception { super.doStart(); // create a scheduled thread pool with 1 thread as we only need one task as background task executor = getCamelContext().getExecutorServiceManager().newScheduledThreadPool(this, "MyBackgroundTask", 1); // schedule the task to run once every second executor.scheduleWithFixedDelay(this, 1, 1, TimeUnit.SECONDS); }
@Override protected void doStart() throws Exception { super.doStart(); // create a scheduled thread pool with 1 thread as we only need one task as background task executor = getCamelContext().getExecutorServiceManager().newScheduledThreadPool(this, "MyBackgroundTask", 1); // schedule the task to run once every second executor.scheduleWithFixedDelay(this, 1, 1, TimeUnit.SECONDS); }
@Override protected void doStop() throws Exception { // shutdown the thread pool getCamelContext().getExecutorServiceManager().shutdown(executor); super.doStop(); }
@Override protected void doStop() throws Exception { // shutdown the thread pool getCamelContext().getExecutorServiceManager().shutdown(executor); super.doStop(); }