deltaspike-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From johndam...@apache.org
Subject svn commit: r1756698 [14/18] - /deltaspike/site/trunk/content/documentation/
Date Thu, 18 Aug 2016 00:36:56 GMT
Modified: deltaspike/site/trunk/content/documentation/scheduler.html
URL: http://svn.apache.org/viewvc/deltaspike/site/trunk/content/documentation/scheduler.html?rev=1756698&r1=1756697&r2=1756698&view=diff
==============================================================================
--- deltaspike/site/trunk/content/documentation/scheduler.html (original)
+++ deltaspike/site/trunk/content/documentation/scheduler.html Thu Aug 18 00:36:56 2016
@@ -1,680 +1,680 @@
-<!DOCTYPE html>
-<head>
-    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
-    <meta charset="utf-8">
-    <meta name="viewport" content="width=device-width, initial-scale=1.0">
-    <meta name="description" content="deltaspike-generate-pages">
-    <meta name="author" content="chm">
-    <!-- No caching headers -->
-    <meta http-equiv="cache-control" content="no-cache"/>
-    <meta http-equiv="pragma" content="no-cache"/>
-    <meta http-equiv="expires" content="-1"/>
-
-    <title>Scheduler Module</title>
-
-    <!--
-        Licensed to the Apache Software Foundation (ASF) under one
-        or more contributor license agreements.  See the NOTICE file
-        distributed with this work for additional information
-        regarding copyright ownership.  The ASF licenses this file
-        to you under the Apache License, Version 2.0 (the
-        "License"); you may not use this file except in compliance
-        with the License.  You may obtain a copy of the License at
-
-        http://www.apache.org/licenses/LICENSE-2.0
-
-        Unless required by applicable law or agreed to in writing,
-        software distributed under the License is distributed on an
-        "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-        KIND, either express or implied.  See the License for the
-        specific language governing permissions and limitations
-        under the License.
-    -->
-
-    <!-- Styles -->
-    <link href="https://deltaspike.apache.org/resources/css/bootstrap.css" rel="stylesheet">
-    <link href="https://deltaspike.apache.org/resources/css/bootstrap-responsive.css" rel="stylesheet">
-    <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/3.1.0/css/font-awesome.min.css" rel="stylesheet">
-
-    
-
-    
-        <!-- Tocify - nice dynamic autoscrolling TOC -->
-        <link href="https://cdnjs.cloudflare.com/ajax/libs/jquery.tocify/1.9.0/stylesheets/jquery.tocify.min.css" rel="stylesheet">
-        <script src="https://code.jquery.com/jquery-1.11.3.min.js"></script>
-        <script src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js"></script>
-        <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.tocify/1.9.0/javascripts/jquery.tocify.min.js"></script>
-
-
-        <script type="text/javascript">
-            $(function () {
-                $("#toc").tocify({
-                    scrollTo: 50,
-                    extendPage: true,
-                    context: "#doc-content",
-                    selectors: "h2,h3,h4,h5"
-                });
-                $(".fallback-toc").hide();
-            });
-        </script>
-    
-
-    <style type="text/css">
-        /* Stylesheet for CodeRay to match GitHub theme | MIT License | http://foundation.zurb.com */
-/*pre.CodeRay {background-color:#f7f7f8;}*/
-.CodeRay .line-numbers{border-right:1px solid #d8d8d8;padding:0 0.5em 0 .25em}
-.CodeRay span.line-numbers{display:inline-block;margin-right:.5em;color:rgba(0,0,0,.3)}
-.CodeRay .line-numbers strong{font-weight: normal}
-table.CodeRay{border-collapse:separate;border-spacing:0;margin-bottom:0;border:0;background:none}
-table.CodeRay td{vertical-align: top}
-table.CodeRay td.line-numbers{text-align:right}
-table.CodeRay td.line-numbers>pre{padding:0;color:rgba(0,0,0,.3)}
-table.CodeRay td.code{padding:0 0 0 .5em}
-table.CodeRay td.code>pre{padding:0}
-.CodeRay .debug{color:#fff !important;background:#000080 !important}
-.CodeRay .annotation{color:#007}
-.CodeRay .attribute-name{color:#000080}
-.CodeRay .attribute-value{color:#700}
-.CodeRay .binary{color:#509}
-.CodeRay .comment{color:#998;font-style:italic}
-.CodeRay .char{color:#04d}
-.CodeRay .char .content{color:#04d}
-.CodeRay .char .delimiter{color:#039}
-.CodeRay .class{color:#458;font-weight:bold}
-.CodeRay .complex{color:#a08}
-.CodeRay .constant,.CodeRay .predefined-constant{color:#008080}
-.CodeRay .color{color:#099}
-.CodeRay .class-variable{color:#369}
-.CodeRay .decorator{color:#b0b}
-.CodeRay .definition{color:#099}
-.CodeRay .delimiter{color:#000}
-.CodeRay .doc{color:#970}
-.CodeRay .doctype{color:#34b}
-.CodeRay .doc-string{color:#d42}
-.CodeRay .escape{color:#666}
-.CodeRay .entity{color:#800}
-.CodeRay .error{color:#808}
-.CodeRay .exception{color:inherit}
-.CodeRay .filename{color:#099}
-.CodeRay .function{color:#900;font-weight:bold}
-.CodeRay .global-variable{color:#008080}
-.CodeRay .hex{color:#058}
-.CodeRay .integer,.CodeRay .float{color:#099}
-.CodeRay .include{color:#555}
-.CodeRay .inline{color:#00}
-.CodeRay .inline .inline{background:#ccc}
-.CodeRay .inline .inline .inline{background:#bbb}
-.CodeRay .inline .inline-delimiter{color:#d14}
-.CodeRay .inline-delimiter{color:#d14}
-.CodeRay .important{color:#555;font-weight:bold}
-.CodeRay .interpreted{color:#b2b}
-.CodeRay .instance-variable{color:#008080}
-.CodeRay .label{color:#970}
-.CodeRay .local-variable{color:#963}
-.CodeRay .octal{color:#40e}
-.CodeRay .predefined{color:#369}
-.CodeRay .preprocessor{color:#579}
-.CodeRay .pseudo-class{color:#555}
-.CodeRay .directive{font-weight:bold}
-.CodeRay .type{font-weight:bold}
-.CodeRay .predefined-type{color:inherit}
-.CodeRay .reserved,.CodeRay .keyword {color:#000;font-weight:bold}
-.CodeRay .key{color:#808}
-.CodeRay .key .delimiter{color:#606}
-.CodeRay .key .char{color:#80f}
-.CodeRay .value{color:#088}
-.CodeRay .regexp .delimiter{color:#808}
-.CodeRay .regexp .content{color:#808}
-.CodeRay .regexp .modifier{color:#808}
-.CodeRay .regexp .char{color:#d14}
-.CodeRay .regexp .function{color:#404;font-weight:bold}
-.CodeRay .string{color:#d20}
-.CodeRay .string .string .string{background:#ffd0d0}
-.CodeRay .string .content{color:#d14}
-.CodeRay .string .char{color:#d14}
-.CodeRay .string .delimiter{color:#d14}
-.CodeRay .shell{color:#d14}
-.CodeRay .shell .delimiter{color:#d14}
-.CodeRay .symbol{color:#990073}
-.CodeRay .symbol .content{color:#a60}
-.CodeRay .symbol .delimiter{color:#630}
-.CodeRay .tag{color:#008080}
-.CodeRay .tag-special{color:#d70}
-.CodeRay .variable{color:#036}
-.CodeRay .insert{background:#afa}
-.CodeRay .delete{background:#faa}
-.CodeRay .change{color:#aaf;background:#007}
-.CodeRay .head{color:#f8f;background:#505}
-.CodeRay .insert .insert{color:#080}
-.CodeRay .delete .delete{color:#800}
-.CodeRay .change .change{color:#66f}
-.CodeRay .head .head{color:#f4f}
-
-        body {
-            padding-top: 60px;
-            padding-bottom: 40px;
-        }
-
-        .toc-like {
-            border-radius: 6px;
-            border: 1px solid #ccc;
-        }
-
-        .toc-like li {
-            line-height: 30px;
-            text-indent: 10px;
-        }
-
-        .toc-like li.custom-toc-header {
-            font-weight: bold;
-            background: #666;
-            color: white;
-            cursor: initial !important;
-            padding: 5px;
-        }
-
-        .toc-like li.custom-toc-header a {
-            color: white;
-            font-style: normal;
-            text-shadow: none;
-            padding: 0;
-        }
-
-        .toc-like li.custom-toc-header:hover a {
-            background: #666;
-        }
-
-        .page-title {
-            text-align: left;
-        }
-
-        #doc-content h2,
-        #doc-content h3,
-        #doc-content h4,
-        #doc-content h5,
-        #doc-content h6 {
-            padding-top: 0;
-            margin-top: 25px;
-            margin-bottom: 10px;
-            line-height: 1.4em;
-        }
-
-        #doc-content h2 {
-            border-bottom: 1px solid lightgrey;
-        }
-
-
-    </style>
-
-    <script type="text/javascript">
-
-        var _gaq = _gaq || [];
-        _gaq.push(['_setAccount', 'UA-36103647-1']);
-        _gaq.push(['_trackPageview']);
-
-        (function () {
-            var ga = document.createElement('script');
-            ga.type = 'text/javascript';
-            ga.async = true;
-            ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
-            var s = document.getElementsByTagName('script')[0];
-            s.parentNode.insertBefore(ga, s);
-        })();
-
-    </script>
-</head>
-
-<body>
-
-<div class="navbar navbar-fixed-top">
-    <div class="navbar-inner">
-        <div class="container">
-            <a class="btn btn-navbar" data-toggle="collapse"
-               data-target=".nav-collapse"> <span class="icon-bar"></span> <span
-            class="icon-bar"></span> <span class="icon-bar"></span>
-            </a>
-            <a class="brand logocolor" href="../index.html">Apache DeltaSpike</a>
-
-            <div class="nav-collapse">
-
-                
-                <ul class="nav">
-                    <li><a href="../index.html">Home</a></li>
-                    <li class="active"><a href="../documentation">Documentation</a></li>
-                    <li  ><a href="../javadoc.html">Javadoc</a></li>
-                    <li ><a href="../source.html">Source</a></li>
-                    <li ><a href="../download.html">Download</a></li>
-                    <li ><a href="../community.html">Community</a></li>
-                    <!-- <li><a href="./support.html">Support</a></li>  -->
-                    <li ><a href="../news.html">News</a></li>
-                </ul>
-            </div>
-            <!--/.nav-collapse -->
-            <form id="search-form" action="https://www.google.com/search"
-                  method="get" class="navbar-search pull-right">
-                <input value="deltaspike.apache.org" name="sitesearch"
-                       type="hidden"> <input class="search-query" name="q"
-                                             id="query" type="text">
-            </form>
-        </div>
-    </div>
-</div>
-
-<div class="container">
-    <div class="row-fluid">
-
-        
-
-        <div class="span8">
-            <div class="page-title">
-                <h1>Scheduler Module</h1>
-            </div>
-
-            <div id="doc-content">
-                <div class="sect1">
-<h2 id="_overview">Overview</h2>
-<div class="sectionbody">
-<div class="paragraph">
-<p>The Scheduler module provides simple integration with Quartz v2 (default) or any other scheduler that supports cron-expressions for job-classes.</p>
-</div>
-</div>
-</div>
-<div class="sect1">
-<h2 id="_project_setup">Project Setup</h2>
-<div class="sectionbody">
-<div class="paragraph">
-<p>The configuration information provided here is for Maven-based projects and it assumes that you have already declared the DeltaSpike version and DeltaSpike Core module for your projects, as detailed in <a href="configure.html">Configure DeltaSpike in Your Projects</a>. For Maven-independent projects, see <a href="configure.html#config-maven-indep">Configure DeltaSpike in Maven-independent Projects</a>.</p>
-</div>
-<div class="sect2">
-<h3 id="_1_declare_scheduler_module_dependencies">1. Declare Scheduler Module Dependencies</h3>
-<div class="paragraph">
-<p>Add the Scheduler module to the list of dependencies in the project <code>pom.xml</code> file using this code snippet:</p>
-</div>
-<div class="listingblock">
-<div class="content">
-<pre class="CodeRay highlight"><code data-lang="xml"><span class="tag">&lt;dependency&gt;</span>
-    <span class="tag">&lt;groupId&gt;</span>org.apache.deltaspike.modules<span class="tag">&lt;/groupId&gt;</span>
-    <span class="tag">&lt;artifactId&gt;</span>deltaspike-scheduler-module-api<span class="tag">&lt;/artifactId&gt;</span>
-    <span class="tag">&lt;version&gt;</span>${deltaspike.version}<span class="tag">&lt;/version&gt;</span>
-    <span class="tag">&lt;scope&gt;</span>compile<span class="tag">&lt;/scope&gt;</span>
-<span class="tag">&lt;/dependency&gt;</span>
-
-<span class="tag">&lt;dependency&gt;</span>
-    <span class="tag">&lt;groupId&gt;</span>org.apache.deltaspike.modules<span class="tag">&lt;/groupId&gt;</span>
-    <span class="tag">&lt;artifactId&gt;</span>deltaspike-scheduler-module-impl<span class="tag">&lt;/artifactId&gt;</span>
-    <span class="tag">&lt;version&gt;</span>${deltaspike.version}<span class="tag">&lt;/version&gt;</span>
-    <span class="tag">&lt;scope&gt;</span>runtime<span class="tag">&lt;/scope&gt;</span>
-<span class="tag">&lt;/dependency&gt;</span></code></pre>
-</div>
-</div>
-<div class="paragraph">
-<p>Or if you&#8217;re using Gradle, add these dependencies to your <code>build.gradle</code>:</p>
-</div>
-<div class="listingblock">
-<div class="content">
-<pre class="CodeRay highlight"><code>     runtime 'org.apache.deltaspike.modules:deltaspike-scheduler-module-impl'
-     compile 'org.apache.deltaspike.modules:deltaspike-scheduler-module-api'</code></pre>
-</div>
-</div>
-</div>
-<div class="sect2">
-<h3 id="_2_declare_external_dependencies">2. Declare External Dependencies</h3>
-<div class="paragraph">
-<p>By default, the Scheduler module looks to integrate with Quartz. If this is the scheduler you would like to use, add Quartz 2.x to the list of project dependencies using this code snippet:</p>
-</div>
-<div class="listingblock">
-<div class="content">
-<pre class="CodeRay highlight"><code data-lang="xml"><span class="tag">&lt;dependency&gt;</span>
-    <span class="tag">&lt;groupId&gt;</span>org.quartz-scheduler<span class="tag">&lt;/groupId&gt;</span>
-    <span class="tag">&lt;artifactId&gt;</span>quartz<span class="tag">&lt;/artifactId&gt;</span>
-    <span class="tag">&lt;version&gt;</span>2.2.1<span class="tag">&lt;/version&gt;</span>
-<span class="tag">&lt;/dependency&gt;</span></code></pre>
-</div>
-</div>
-<div class="paragraph">
-<p>Or if you&#8217;re using Gradle, add these dependencies to your <code>build.gradle</code>:</p>
-</div>
-<div class="listingblock">
-<div class="content">
-<pre class="CodeRay highlight"><code>     compile 'org.quartz-scheduler:quartz'</code></pre>
-</div>
-</div>
-</div>
-<div class="sect2">
-<h3 id="_3_declare_container_control_dependency">3. Declare Container Control dependency</h3>
-<div class="paragraph">
-<p>Scheduled jobs can have built-in CDI contexts started for the duration of their execution using <code>@Scheduled#startScopes</code> which internally uses the <a href="container-control.html">Container Control module</a>. The dependency on the API and the appropriate implementation needs to be declared manually even if the feature is not used. An example for the Weld implementation:</p>
-</div>
-<div class="listingblock">
-<div class="content">
-<pre class="CodeRay highlight"><code data-lang="xml"><span class="tag">&lt;dependency&gt;</span>
-    <span class="tag">&lt;groupId&gt;</span>org.apache.deltaspike.cdictrl<span class="tag">&lt;/groupId&gt;</span>
-    <span class="tag">&lt;artifactId&gt;</span>deltaspike-cdictrl-api<span class="tag">&lt;/artifactId&gt;</span>
-    <span class="tag">&lt;version&gt;</span>${deltaspike.version}<span class="tag">&lt;/version&gt;</span>
-    <span class="tag">&lt;scope&gt;</span>compile<span class="tag">&lt;/scope&gt;</span>
-<span class="tag">&lt;/dependency&gt;</span>
-
-<span class="tag">&lt;dependency&gt;</span>
-    <span class="tag">&lt;groupId&gt;</span>org.apache.deltaspike.cdictrl<span class="tag">&lt;/groupId&gt;</span>
-    <span class="tag">&lt;artifactId&gt;</span>deltaspike-cdictrl-weld<span class="tag">&lt;/artifactId&gt;</span>
-    <span class="tag">&lt;version&gt;</span>${deltaspike.version}<span class="tag">&lt;/version&gt;</span>
-    <span class="tag">&lt;scope&gt;</span>runtime<span class="tag">&lt;/scope&gt;</span>
-<span class="tag">&lt;/dependency&gt;</span></code></pre>
-</div>
-</div>
-<div class="paragraph">
-<p>Of ir you&#8217;re using Gradle:</p>
-</div>
-<div class="listingblock">
-<div class="content">
-<pre class="CodeRay highlight"><code>dependencies {
-    runtime 'org.apache.deltaspike.cdictrl:deltaspike-cdictrl-weld'
-    compile 'org.apache.deltaspike.cdictrl:deltaspike-cdictrl-api'
-}</code></pre>
-</div>
-</div>
-</div>
-</div>
-</div>
-<div class="sect1">
-<h2 id="__scheduled_with_org_quartz_job_or_java_lang_runnable">@Scheduled with org.quartz.Job or java.lang.Runnable</h2>
-<div class="sectionbody">
-<div class="paragraph">
-<p>Just annotate your Quartz-Jobs with <code>@Scheduled</code> and they will get
-picked up and passed to the scheduler automatically (during the
-bootstrapping process).</p>
-</div>
-<div class="listingblock">
-<div class="title">Scheduled task based on org.quartz.Job</div>
-<div class="content">
-<pre class="CodeRay highlight"><code data-lang="java"><span class="annotation">@Scheduled</span>(cronExpression = <span class="string"><span class="delimiter">&quot;</span><span class="content">0 0/10 * * * ?</span><span class="delimiter">&quot;</span></span>)
-<span class="directive">public</span> <span class="type">class</span> <span class="class">CdiAwareQuartzJob</span> <span class="directive">implements</span> org.quartz.Job
-{
-    <span class="annotation">@Inject</span>
-    <span class="directive">private</span> MyService service;
-
-    <span class="annotation">@Override</span>
-    <span class="directive">public</span> <span class="type">void</span> execute(JobExecutionContext context) <span class="directive">throws</span> JobExecutionException
-    {
-        <span class="comment">//...</span>
-    }
-}</code></pre>
-</div>
-</div>
-<div class="paragraph">
-<p>As an alternative it&#8217;s possible to annotate an implementation of <code>java.lang.Runnable</code> (since DeltaSpike v1.5.3):</p>
-</div>
-<div class="listingblock">
-<div class="title">Scheduled task based on java.lang.Runnable</div>
-<div class="content">
-<pre class="CodeRay highlight"><code data-lang="java"><span class="annotation">@Scheduled</span>(cronExpression = <span class="string"><span class="delimiter">&quot;</span><span class="content">0 0/10 * * * ?</span><span class="delimiter">&quot;</span></span>)
-<span class="directive">public</span> <span class="type">class</span> <span class="class">CdiAwareRunnableJob</span> <span class="directive">implements</span> java.lang.Runnable
-{
-    <span class="annotation">@Inject</span>
-    <span class="directive">private</span> MyService service;
-
-    <span class="annotation">@Override</span>
-    <span class="directive">public</span> <span class="type">void</span> run()
-    {
-        <span class="comment">//...</span>
-    }
-}</code></pre>
-</div>
-</div>
-<div class="paragraph">
-<p>Behind the scenes DeltaSpike registers an adapter for Quartz which just delegates to the <code>run</code>-method once the adapter gets called by Quartz.
-Technically you end up with almost the same, just with a reduced API for implementing (all) your scheduled jobs.
-Therefore the main difference is that your code is independent of Quartz-classes.
-However, you need to select <code>org.quartz.Job</code> or <code>java.lang.Runnable</code> for all your scheduled-tasks, bot not both!</p>
-</div>
-<div class="paragraph">
-<p>In such scheduled-tasks CDI based dependency-injection is enabled.
-Furthermore, the request- and session-scope get started (and stopped)
-per job-execution. Therefore, the container-control module (of
-DeltaSpike) is required. That can be controlled via
-<code>@Scheduled#startScopes</code> (possible values: all scopes supported by the
-container-control module as well as <code>{}</code> for 'no scopes').</p>
-</div>
-<div class="paragraph">
-<p>With 'false' for <code>@Scheduled#onStartup</code>, it is even possible to
-schedule/install jobs dynamically.</p>
-</div>
-<div class="paragraph">
-<p>The following example shows how to use it, if you are using <code>org.quartz.Job</code> (and not <code>java.lang.Runnable</code>).</p>
-</div>
-<div class="listingblock">
-<div class="title">Example</div>
-<div class="content">
-<pre class="CodeRay highlight"><code data-lang="java"><span class="annotation">@ApplicationScoped</span>
-<span class="directive">public</span> <span class="type">class</span> <span class="class">ProjectStageAwareSchedulerController</span>
-{
-    <span class="annotation">@Inject</span>
-    <span class="directive">private</span> Scheduler&lt;Job&gt; jobScheduler;
-
-    <span class="annotation">@Inject</span>
-    <span class="directive">private</span> ProjectStage projectStage;
-
-    <span class="directive">public</span> <span class="type">void</span> registerJobs()
-    {
-        <span class="keyword">if</span> (ProjectStage.Production.equals(<span class="local-variable">this</span>.projectStage))
-        {
-            <span class="comment">//see 'false' for @Scheduled#onStartup</span>
-            <span class="local-variable">this</span>.jobScheduler.registerNewJob(ManualCdiAwareQuartzJob.class);
-        }
-    }
-
-    <span class="annotation">@Scheduled</span>(cronExpression = <span class="string"><span class="delimiter">&quot;</span><span class="content">0 0/10 * * * ?</span><span class="delimiter">&quot;</span></span>, onStartup = <span class="predefined-constant">false</span>)
-    <span class="directive">public</span> <span class="type">class</span> <span class="class">ManualCdiAwareQuartzJob</span> <span class="directive">implements</span> org.quartz.Job
-    {
-        <span class="annotation">@Inject</span>
-        <span class="directive">private</span> MyService service;
-
-        <span class="annotation">@Override</span>
-        <span class="directive">public</span> <span class="type">void</span> execute(JobExecutionContext context) <span class="directive">throws</span> JobExecutionException
-        {
-            <span class="comment">//...</span>
-        }
-    }
-}</code></pre>
-</div>
-</div>
-</div>
-</div>
-<div class="sect1">
-<h2 id="_configurable_cron_expressions">Configurable CRON expressions</h2>
-<div class="sectionbody">
-<div class="paragraph">
-<p>In some cases it might be useful to configure a cron-expression e.g. per Project-Stage.
-Therefore, DeltaSpike (v1.6.0+) allows to use keys instead of hardcoded expressions.</p>
-</div>
-<div class="paragraph">
-<p>In the previous examples we had e.g. <code>@Scheduled(cronExpression = "0 0/10 * * * ?")</code>.
-Instead of hardcoding it that way, it&#8217;s possible to use e.g. <code>@Scheduled(cronExpression = "{myCronExpression}")</code> and
-in one of the active config-sources used by DeltaSpike a concrete expression can be defined e.g. via <code>myCronExpression=0 0/10 * * * ?</code>.
-Using e.g. <code>myCronExpression.Development=0 0/5 * * * ?</code> would allow to change the configured expression for Project-Stage development.</p>
-</div>
-</div>
-</div>
-<div class="sect1">
-<h2 id="_manual_scheduler_control">Manual Scheduler Control</h2>
-<div class="sectionbody">
-<div class="paragraph">
-<p>The SPI allows to control the scheduler (or integrate any other
-compatible scheduler as an alternative to Quartz2)</p>
-</div>
-<div class="paragraph">
-<p>Via standard injection like</p>
-</div>
-<div class="listingblock">
-<div class="content">
-<pre class="CodeRay highlight"><code data-lang="java"><span class="annotation">@Inject</span>
-<span class="directive">private</span> Scheduler&lt;Job&gt; jobScheduler;</code></pre>
-</div>
-</div>
-<div class="paragraph">
-<p>it is possible to manually start/stop the scheduler,
-pause/resume/interrupt/check scheduled jobs, register jobs manually or
-start a job once (without registering it permanently).</p>
-</div>
-<div class="paragraph">
-<p><strong>Attention</strong>: To use a typed injection-point and avoid deployment failure with some versions of Weld, you must use</p>
-</div>
-<div class="listingblock">
-<div class="content">
-<pre class="CodeRay highlight"><code data-lang="java"><span class="directive">public</span> <span class="type">class</span> <span class="class">QuartzSchedulerProducer</span>
-{
-    <span class="annotation">@Produces</span>
-    <span class="annotation">@ApplicationScoped</span>
-    <span class="directive">protected</span> Scheduler&lt;Job&gt; produceScheduler(Scheduler scheduler)
-    {
-        <span class="keyword">return</span> scheduler;
-    }
-}</code></pre>
-</div>
-</div>
-<div class="paragraph">
-<p>or</p>
-</div>
-<div class="listingblock">
-<div class="content">
-<pre class="CodeRay highlight"><code data-lang="xml"><span class="tag">&lt;alternatives&gt;</span>
-  <span class="tag">&lt;class&gt;</span>org.apache.deltaspike.scheduler.impl.QuartzSchedulerProducer<span class="tag">&lt;/class&gt;</span>
-<span class="tag">&lt;/alternatives&gt;</span></code></pre>
-</div>
-</div>
-</div>
-</div>
-<div class="sect1">
-<h2 id="_manual_scheduling">Manual scheduling</h2>
-<div class="sectionbody">
-<div class="paragraph">
-<p>If the SPI provided by <code>org.apache.deltaspike.scheduler.spi.Scheduler</code> doesn&#8217;t provide a method you are looking for,
-you can use <code>#unwrap</code> to access the underlying scheduler.
-Per default DeltaSpike uses an implementation of <code>org.quartz.Scheduler</code>.
-Therefore, it&#8217;s possible to inject <code>org.apache.deltaspike.scheduler.spi.Scheduler</code> and use it like in the following example:</p>
-</div>
-<div class="listingblock">
-<div class="content">
-<pre class="CodeRay highlight"><code data-lang="java"><span class="directive">public</span> <span class="type">class</span> <span class="class">ManualJobScheduler</span>
-{
-    <span class="annotation">@Inject</span>
-    <span class="directive">private</span> Scheduler&lt;Job&gt; scheduler;
-
-    <span class="annotation">@Override</span>
-    <span class="directive">public</span> <span class="type">void</span> scheduleJob(JobDetail jobDetail, Trigger trigger) <span class="directive">throws</span> SchedulerException
-    {
-        <span class="local-variable">this</span>.scheduler.unwrap(org.quartz.Scheduler.class).scheduleJob(jobDetail, trigger);
-    }
-}</code></pre>
-</div>
-</div>
-<div class="paragraph">
-<p>With that it&#8217;s e.g. possible to schedule quartz-jobs based on the same quartz-job(-class), but with different triggers,&#8230;&#8203;
-Also manually scheduled jobs benefit from DeltaSpike features like the support of <code>@Inject</code> in the job-instances.</p>
-</div>
-</div>
-</div>
-<div class="sect1">
-<h2 id="_execute_java_lang_runnable_with_managedexecutorservice">Execute java.lang.Runnable with ManagedExecutorService</h2>
-<div class="sectionbody">
-<div class="paragraph">
-<p>If you would like to use e.g. the <code>ManagedExecutorService</code> (with EE7+) to run the jobs,
-you can provide a custom adapter by adding e.g.
-<code>deltaspike.scheduler.runnable-adapter-class=mypackage.DelegatingJobRunnableAdapter</code> to <code>META-INF/apache-deltaspike.properties</code>.
-Such an adapter just needs to implement <code>org.quartz.Job</code> and in case of EE7+ inject e.g. <code>ManagedExecutorService</code> as shown in the following example:</p>
-</div>
-<div class="listingblock">
-<div class="content">
-<pre class="CodeRay highlight"><code data-lang="java"><span class="directive">public</span> <span class="type">class</span> <span class="class">DelegatingJobRunnableAdapter</span> <span class="directive">implements</span> java.lang.Runnable
-{
-    <span class="annotation">@Resource</span>
-    <span class="directive">private</span> ManagedExecutorService managedExecutorService;
-
-    <span class="annotation">@Override</span>
-    <span class="directive">public</span> <span class="type">void</span> run()
-    {
-        <span class="predefined-type">Class</span>&lt;? <span class="directive">extends</span> <span class="predefined-type">Runnable</span>&gt; jobClass =
-            ClassUtils.tryToLoadClassForName(context.getJobDetail().getKey().getName(), <span class="predefined-type">Runnable</span>.class);
-
-        <span class="predefined-type">Runnable</span> runnableBean = BeanProvider.getContextualReference(jobClass);
-        managedExecutorService.execute(runnableBean);
-    }
-}</code></pre>
-</div>
-</div>
-</div>
-</div>
-<div class="sect1">
-<h2 id="_custom_scheduler">Custom Scheduler</h2>
-<div class="sectionbody">
-<div class="paragraph">
-<p>It is possible to replace the default integration with Quartz. Any scheduler that supports cron-expressions for job-classes can be used.
-For more information, see <a href="https://deltaspike.apache.org/javadoc/1.7.1/org/apache/deltaspike/scheduler/spi/Scheduler.html">Scheduler javadoc</a>.</p>
-</div>
-</div>
-</div>
-            </div>
-        </div>
-
-        
-            <div class="span4">
-                <div id="toc">
-                    <div class="moduledeps">
-                        <ul class="toc-like nav nav-list">
-                            
-                                <li class="custom-toc-header">Depends on</li>
-                                
-                                    <li><a href="core.html">Core</a></li>
-                                
-                                    <li><a href="container-control.html">Container control</a></li>
-                                
-                            
-                            
-                                <li class="custom-toc-header"><a href="core.html#_internal_configuration">Configuration</a></li>
-                                
-                                    <li><a href="https://github.com/apache/deltaspike/blob/master/deltaspike/modules/scheduler/impl/src/main/java/org/apache/deltaspike/scheduler/impl/SchedulerBaseConfig.java">SchedulerBaseConfig</a></li>
-                                
-                            
-                            
-                                <li class="custom-toc-header">Table of Contents</li>
-                            
-                        </ul>
-                    </div>
-                </div>
-                
-                    <div class="fallback-toc">
-                        <ul class="sectlevel1">
-<li><a href="#_overview">Overview</a></li>
-<li><a href="#_project_setup">Project Setup</a>
-<ul class="sectlevel2">
-<li><a href="#_1_declare_scheduler_module_dependencies">1. Declare Scheduler Module Dependencies</a></li>
-<li><a href="#_2_declare_external_dependencies">2. Declare External Dependencies</a></li>
-<li><a href="#_3_declare_container_control_dependency">3. Declare Container Control dependency</a></li>
-</ul>
-</li>
-<li><a href="#__scheduled_with_org_quartz_job_or_java_lang_runnable">@Scheduled with org.quartz.Job or java.lang.Runnable</a></li>
-<li><a href="#_configurable_cron_expressions">Configurable CRON expressions</a></li>
-<li><a href="#_manual_scheduler_control">Manual Scheduler Control</a></li>
-<li><a href="#_manual_scheduling">Manual scheduling</a></li>
-<li><a href="#_execute_java_lang_runnable_with_managedexecutorservice">Execute java.lang.Runnable with ManagedExecutorService</a></li>
-<li><a href="#_custom_scheduler">Custom Scheduler</a></li>
-</ul>
-                    </div>
-                
-            </div>
-        
-
-    </div>
-    <div class="row">
-        <hr>
-        <footer>
-            <p>Copyright &copy; 2011-2016 The Apache Software Foundation,
-                Licensed under the Apache License, Version 2.0.</p>
-
-            <p>Apache and the Apache feather logo are trademarks of The Apache Software Foundation.</p>
-        </footer>
-    </div>
-</div>
-
-</body>
+<!DOCTYPE html>
+<head>
+    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+    <meta charset="utf-8">
+    <meta name="viewport" content="width=device-width, initial-scale=1.0">
+    <meta name="description" content="deltaspike-generate-pages">
+    <meta name="author" content="chm">
+    <!-- No caching headers -->
+    <meta http-equiv="cache-control" content="no-cache"/>
+    <meta http-equiv="pragma" content="no-cache"/>
+    <meta http-equiv="expires" content="-1"/>
+
+    <title>Scheduler Module</title>
+
+    <!--
+        Licensed to the Apache Software Foundation (ASF) under one
+        or more contributor license agreements.  See the NOTICE file
+        distributed with this work for additional information
+        regarding copyright ownership.  The ASF licenses this file
+        to you under the Apache License, Version 2.0 (the
+        "License"); you may not use this file except in compliance
+        with the License.  You may obtain a copy of the License at
+
+        http://www.apache.org/licenses/LICENSE-2.0
+
+        Unless required by applicable law or agreed to in writing,
+        software distributed under the License is distributed on an
+        "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+        KIND, either express or implied.  See the License for the
+        specific language governing permissions and limitations
+        under the License.
+    -->
+
+    <!-- Styles -->
+    <link href="https://deltaspike.apache.org/resources/css/bootstrap.css" rel="stylesheet">
+    <link href="https://deltaspike.apache.org/resources/css/bootstrap-responsive.css" rel="stylesheet">
+    <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/3.1.0/css/font-awesome.min.css" rel="stylesheet">
+
+    
+
+    
+        <!-- Tocify - nice dynamic autoscrolling TOC -->
+        <link href="https://cdnjs.cloudflare.com/ajax/libs/jquery.tocify/1.9.0/stylesheets/jquery.tocify.min.css" rel="stylesheet">
+        <script src="https://code.jquery.com/jquery-1.11.3.min.js"></script>
+        <script src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js"></script>
+        <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.tocify/1.9.0/javascripts/jquery.tocify.min.js"></script>
+
+
+        <script type="text/javascript">
+            $(function () {
+                $("#toc").tocify({
+                    scrollTo: 50,
+                    extendPage: true,
+                    context: "#doc-content",
+                    selectors: "h2,h3,h4,h5"
+                });
+                $(".fallback-toc").hide();
+            });
+        </script>
+    
+
+    <style type="text/css">
+        /* Stylesheet for CodeRay to match GitHub theme | MIT License | http://foundation.zurb.com */
+/*pre.CodeRay {background-color:#f7f7f8;}*/
+.CodeRay .line-numbers{border-right:1px solid #d8d8d8;padding:0 0.5em 0 .25em}
+.CodeRay span.line-numbers{display:inline-block;margin-right:.5em;color:rgba(0,0,0,.3)}
+.CodeRay .line-numbers strong{font-weight: normal}
+table.CodeRay{border-collapse:separate;border-spacing:0;margin-bottom:0;border:0;background:none}
+table.CodeRay td{vertical-align: top}
+table.CodeRay td.line-numbers{text-align:right}
+table.CodeRay td.line-numbers>pre{padding:0;color:rgba(0,0,0,.3)}
+table.CodeRay td.code{padding:0 0 0 .5em}
+table.CodeRay td.code>pre{padding:0}
+.CodeRay .debug{color:#fff !important;background:#000080 !important}
+.CodeRay .annotation{color:#007}
+.CodeRay .attribute-name{color:#000080}
+.CodeRay .attribute-value{color:#700}
+.CodeRay .binary{color:#509}
+.CodeRay .comment{color:#998;font-style:italic}
+.CodeRay .char{color:#04d}
+.CodeRay .char .content{color:#04d}
+.CodeRay .char .delimiter{color:#039}
+.CodeRay .class{color:#458;font-weight:bold}
+.CodeRay .complex{color:#a08}
+.CodeRay .constant,.CodeRay .predefined-constant{color:#008080}
+.CodeRay .color{color:#099}
+.CodeRay .class-variable{color:#369}
+.CodeRay .decorator{color:#b0b}
+.CodeRay .definition{color:#099}
+.CodeRay .delimiter{color:#000}
+.CodeRay .doc{color:#970}
+.CodeRay .doctype{color:#34b}
+.CodeRay .doc-string{color:#d42}
+.CodeRay .escape{color:#666}
+.CodeRay .entity{color:#800}
+.CodeRay .error{color:#808}
+.CodeRay .exception{color:inherit}
+.CodeRay .filename{color:#099}
+.CodeRay .function{color:#900;font-weight:bold}
+.CodeRay .global-variable{color:#008080}
+.CodeRay .hex{color:#058}
+.CodeRay .integer,.CodeRay .float{color:#099}
+.CodeRay .include{color:#555}
+.CodeRay .inline{color:#00}
+.CodeRay .inline .inline{background:#ccc}
+.CodeRay .inline .inline .inline{background:#bbb}
+.CodeRay .inline .inline-delimiter{color:#d14}
+.CodeRay .inline-delimiter{color:#d14}
+.CodeRay .important{color:#555;font-weight:bold}
+.CodeRay .interpreted{color:#b2b}
+.CodeRay .instance-variable{color:#008080}
+.CodeRay .label{color:#970}
+.CodeRay .local-variable{color:#963}
+.CodeRay .octal{color:#40e}
+.CodeRay .predefined{color:#369}
+.CodeRay .preprocessor{color:#579}
+.CodeRay .pseudo-class{color:#555}
+.CodeRay .directive{font-weight:bold}
+.CodeRay .type{font-weight:bold}
+.CodeRay .predefined-type{color:inherit}
+.CodeRay .reserved,.CodeRay .keyword {color:#000;font-weight:bold}
+.CodeRay .key{color:#808}
+.CodeRay .key .delimiter{color:#606}
+.CodeRay .key .char{color:#80f}
+.CodeRay .value{color:#088}
+.CodeRay .regexp .delimiter{color:#808}
+.CodeRay .regexp .content{color:#808}
+.CodeRay .regexp .modifier{color:#808}
+.CodeRay .regexp .char{color:#d14}
+.CodeRay .regexp .function{color:#404;font-weight:bold}
+.CodeRay .string{color:#d20}
+.CodeRay .string .string .string{background:#ffd0d0}
+.CodeRay .string .content{color:#d14}
+.CodeRay .string .char{color:#d14}
+.CodeRay .string .delimiter{color:#d14}
+.CodeRay .shell{color:#d14}
+.CodeRay .shell .delimiter{color:#d14}
+.CodeRay .symbol{color:#990073}
+.CodeRay .symbol .content{color:#a60}
+.CodeRay .symbol .delimiter{color:#630}
+.CodeRay .tag{color:#008080}
+.CodeRay .tag-special{color:#d70}
+.CodeRay .variable{color:#036}
+.CodeRay .insert{background:#afa}
+.CodeRay .delete{background:#faa}
+.CodeRay .change{color:#aaf;background:#007}
+.CodeRay .head{color:#f8f;background:#505}
+.CodeRay .insert .insert{color:#080}
+.CodeRay .delete .delete{color:#800}
+.CodeRay .change .change{color:#66f}
+.CodeRay .head .head{color:#f4f}
+
+        body {
+            padding-top: 60px;
+            padding-bottom: 40px;
+        }
+
+        .toc-like {
+            border-radius: 6px;
+            border: 1px solid #ccc;
+        }
+
+        .toc-like li {
+            line-height: 30px;
+            text-indent: 10px;
+        }
+
+        .toc-like li.custom-toc-header {
+            font-weight: bold;
+            background: #666;
+            color: white;
+            cursor: initial !important;
+            padding: 5px;
+        }
+
+        .toc-like li.custom-toc-header a {
+            color: white;
+            font-style: normal;
+            text-shadow: none;
+            padding: 0;
+        }
+
+        .toc-like li.custom-toc-header:hover a {
+            background: #666;
+        }
+
+        .page-title {
+            text-align: left;
+        }
+
+        #doc-content h2,
+        #doc-content h3,
+        #doc-content h4,
+        #doc-content h5,
+        #doc-content h6 {
+            padding-top: 0;
+            margin-top: 25px;
+            margin-bottom: 10px;
+            line-height: 1.4em;
+        }
+
+        #doc-content h2 {
+            border-bottom: 1px solid lightgrey;
+        }
+
+
+    </style>
+
+    <script type="text/javascript">
+
+        var _gaq = _gaq || [];
+        _gaq.push(['_setAccount', 'UA-36103647-1']);
+        _gaq.push(['_trackPageview']);
+
+        (function () {
+            var ga = document.createElement('script');
+            ga.type = 'text/javascript';
+            ga.async = true;
+            ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
+            var s = document.getElementsByTagName('script')[0];
+            s.parentNode.insertBefore(ga, s);
+        })();
+
+    </script>
+</head>
+
+<body>
+
+<div class="navbar navbar-fixed-top">
+    <div class="navbar-inner">
+        <div class="container">
+            <a class="btn btn-navbar" data-toggle="collapse"
+               data-target=".nav-collapse"> <span class="icon-bar"></span> <span
+            class="icon-bar"></span> <span class="icon-bar"></span>
+            </a>
+            <a class="brand logocolor" href="../index.html">Apache DeltaSpike</a>
+
+            <div class="nav-collapse">
+
+                
+                <ul class="nav">
+                    <li><a href="../index.html">Home</a></li>
+                    <li class="active"><a href="../documentation">Documentation</a></li>
+                    <li  ><a href="../javadoc.html">Javadoc</a></li>
+                    <li ><a href="../source.html">Source</a></li>
+                    <li ><a href="../download.html">Download</a></li>
+                    <li ><a href="../community.html">Community</a></li>
+                    <!-- <li><a href="./support.html">Support</a></li>  -->
+                    <li ><a href="../news.html">News</a></li>
+                </ul>
+            </div>
+            <!--/.nav-collapse -->
+            <form id="search-form" action="https://www.google.com/search"
+                  method="get" class="navbar-search pull-right">
+                <input value="deltaspike.apache.org" name="sitesearch"
+                       type="hidden"> <input class="search-query" name="q"
+                                             id="query" type="text">
+            </form>
+        </div>
+    </div>
+</div>
+
+<div class="container">
+    <div class="row-fluid">
+
+        
+
+        <div class="span8">
+            <div class="page-title">
+                <h1>Scheduler Module</h1>
+            </div>
+
+            <div id="doc-content">
+                <div class="sect1">
+<h2 id="_overview">Overview</h2>
+<div class="sectionbody">
+<div class="paragraph">
+<p>The Scheduler module provides simple integration with Quartz v2 (default) or any other scheduler that supports cron-expressions for job-classes.</p>
+</div>
+</div>
+</div>
+<div class="sect1">
+<h2 id="_project_setup">Project Setup</h2>
+<div class="sectionbody">
+<div class="paragraph">
+<p>The configuration information provided here is for Maven-based projects and it assumes that you have already declared the DeltaSpike version and DeltaSpike Core module for your projects, as detailed in <a href="configure.html">Configure DeltaSpike in Your Projects</a>. For Maven-independent projects, see <a href="configure.html#config-maven-indep">Configure DeltaSpike in Maven-independent Projects</a>.</p>
+</div>
+<div class="sect2">
+<h3 id="_1_declare_scheduler_module_dependencies">1. Declare Scheduler Module Dependencies</h3>
+<div class="paragraph">
+<p>Add the Scheduler module to the list of dependencies in the project <code>pom.xml</code> file using this code snippet:</p>
+</div>
+<div class="listingblock">
+<div class="content">
+<pre class="CodeRay highlight"><code data-lang="xml"><span class="tag">&lt;dependency&gt;</span>
+    <span class="tag">&lt;groupId&gt;</span>org.apache.deltaspike.modules<span class="tag">&lt;/groupId&gt;</span>
+    <span class="tag">&lt;artifactId&gt;</span>deltaspike-scheduler-module-api<span class="tag">&lt;/artifactId&gt;</span>
+    <span class="tag">&lt;version&gt;</span>${deltaspike.version}<span class="tag">&lt;/version&gt;</span>
+    <span class="tag">&lt;scope&gt;</span>compile<span class="tag">&lt;/scope&gt;</span>
+<span class="tag">&lt;/dependency&gt;</span>
+
+<span class="tag">&lt;dependency&gt;</span>
+    <span class="tag">&lt;groupId&gt;</span>org.apache.deltaspike.modules<span class="tag">&lt;/groupId&gt;</span>
+    <span class="tag">&lt;artifactId&gt;</span>deltaspike-scheduler-module-impl<span class="tag">&lt;/artifactId&gt;</span>
+    <span class="tag">&lt;version&gt;</span>${deltaspike.version}<span class="tag">&lt;/version&gt;</span>
+    <span class="tag">&lt;scope&gt;</span>runtime<span class="tag">&lt;/scope&gt;</span>
+<span class="tag">&lt;/dependency&gt;</span></code></pre>
+</div>
+</div>
+<div class="paragraph">
+<p>Or if you&#8217;re using Gradle, add these dependencies to your <code>build.gradle</code>:</p>
+</div>
+<div class="listingblock">
+<div class="content">
+<pre class="CodeRay highlight"><code>     runtime 'org.apache.deltaspike.modules:deltaspike-scheduler-module-impl'
+     compile 'org.apache.deltaspike.modules:deltaspike-scheduler-module-api'</code></pre>
+</div>
+</div>
+</div>
+<div class="sect2">
+<h3 id="_2_declare_external_dependencies">2. Declare External Dependencies</h3>
+<div class="paragraph">
+<p>By default, the Scheduler module looks to integrate with Quartz. If this is the scheduler you would like to use, add Quartz 2.x to the list of project dependencies using this code snippet:</p>
+</div>
+<div class="listingblock">
+<div class="content">
+<pre class="CodeRay highlight"><code data-lang="xml"><span class="tag">&lt;dependency&gt;</span>
+    <span class="tag">&lt;groupId&gt;</span>org.quartz-scheduler<span class="tag">&lt;/groupId&gt;</span>
+    <span class="tag">&lt;artifactId&gt;</span>quartz<span class="tag">&lt;/artifactId&gt;</span>
+    <span class="tag">&lt;version&gt;</span>2.2.1<span class="tag">&lt;/version&gt;</span>
+<span class="tag">&lt;/dependency&gt;</span></code></pre>
+</div>
+</div>
+<div class="paragraph">
+<p>Or if you&#8217;re using Gradle, add these dependencies to your <code>build.gradle</code>:</p>
+</div>
+<div class="listingblock">
+<div class="content">
+<pre class="CodeRay highlight"><code>     compile 'org.quartz-scheduler:quartz'</code></pre>
+</div>
+</div>
+</div>
+<div class="sect2">
+<h3 id="_3_declare_container_control_dependency">3. Declare Container Control dependency</h3>
+<div class="paragraph">
+<p>Scheduled jobs can have built-in CDI contexts started for the duration of their execution using <code>@Scheduled#startScopes</code> which internally uses the <a href="container-control.html">Container Control module</a>. The dependency on the API and the appropriate implementation needs to be declared manually even if the feature is not used. An example for the Weld implementation:</p>
+</div>
+<div class="listingblock">
+<div class="content">
+<pre class="CodeRay highlight"><code data-lang="xml"><span class="tag">&lt;dependency&gt;</span>
+    <span class="tag">&lt;groupId&gt;</span>org.apache.deltaspike.cdictrl<span class="tag">&lt;/groupId&gt;</span>
+    <span class="tag">&lt;artifactId&gt;</span>deltaspike-cdictrl-api<span class="tag">&lt;/artifactId&gt;</span>
+    <span class="tag">&lt;version&gt;</span>${deltaspike.version}<span class="tag">&lt;/version&gt;</span>
+    <span class="tag">&lt;scope&gt;</span>compile<span class="tag">&lt;/scope&gt;</span>
+<span class="tag">&lt;/dependency&gt;</span>
+
+<span class="tag">&lt;dependency&gt;</span>
+    <span class="tag">&lt;groupId&gt;</span>org.apache.deltaspike.cdictrl<span class="tag">&lt;/groupId&gt;</span>
+    <span class="tag">&lt;artifactId&gt;</span>deltaspike-cdictrl-weld<span class="tag">&lt;/artifactId&gt;</span>
+    <span class="tag">&lt;version&gt;</span>${deltaspike.version}<span class="tag">&lt;/version&gt;</span>
+    <span class="tag">&lt;scope&gt;</span>runtime<span class="tag">&lt;/scope&gt;</span>
+<span class="tag">&lt;/dependency&gt;</span></code></pre>
+</div>
+</div>
+<div class="paragraph">
+<p>Of ir you&#8217;re using Gradle:</p>
+</div>
+<div class="listingblock">
+<div class="content">
+<pre class="CodeRay highlight"><code>dependencies {
+    runtime 'org.apache.deltaspike.cdictrl:deltaspike-cdictrl-weld'
+    compile 'org.apache.deltaspike.cdictrl:deltaspike-cdictrl-api'
+}</code></pre>
+</div>
+</div>
+</div>
+</div>
+</div>
+<div class="sect1">
+<h2 id="__scheduled_with_org_quartz_job_or_java_lang_runnable">@Scheduled with org.quartz.Job or java.lang.Runnable</h2>
+<div class="sectionbody">
+<div class="paragraph">
+<p>Just annotate your Quartz-Jobs with <code>@Scheduled</code> and they will get
+picked up and passed to the scheduler automatically (during the
+bootstrapping process).</p>
+</div>
+<div class="listingblock">
+<div class="title">Scheduled task based on org.quartz.Job</div>
+<div class="content">
+<pre class="CodeRay highlight"><code data-lang="java"><span class="annotation">@Scheduled</span>(cronExpression = <span class="string"><span class="delimiter">&quot;</span><span class="content">0 0/10 * * * ?</span><span class="delimiter">&quot;</span></span>)
+<span class="directive">public</span> <span class="type">class</span> <span class="class">CdiAwareQuartzJob</span> <span class="directive">implements</span> org.quartz.Job
+{
+    <span class="annotation">@Inject</span>
+    <span class="directive">private</span> MyService service;
+
+    <span class="annotation">@Override</span>
+    <span class="directive">public</span> <span class="type">void</span> execute(JobExecutionContext context) <span class="directive">throws</span> JobExecutionException
+    {
+        <span class="comment">//...</span>
+    }
+}</code></pre>
+</div>
+</div>
+<div class="paragraph">
+<p>As an alternative it&#8217;s possible to annotate an implementation of <code>java.lang.Runnable</code> (since DeltaSpike v1.5.3):</p>
+</div>
+<div class="listingblock">
+<div class="title">Scheduled task based on java.lang.Runnable</div>
+<div class="content">
+<pre class="CodeRay highlight"><code data-lang="java"><span class="annotation">@Scheduled</span>(cronExpression = <span class="string"><span class="delimiter">&quot;</span><span class="content">0 0/10 * * * ?</span><span class="delimiter">&quot;</span></span>)
+<span class="directive">public</span> <span class="type">class</span> <span class="class">CdiAwareRunnableJob</span> <span class="directive">implements</span> java.lang.Runnable
+{
+    <span class="annotation">@Inject</span>
+    <span class="directive">private</span> MyService service;
+
+    <span class="annotation">@Override</span>
+    <span class="directive">public</span> <span class="type">void</span> run()
+    {
+        <span class="comment">//...</span>
+    }
+}</code></pre>
+</div>
+</div>
+<div class="paragraph">
+<p>Behind the scenes DeltaSpike registers an adapter for Quartz which just delegates to the <code>run</code>-method once the adapter gets called by Quartz.
+Technically you end up with almost the same, just with a reduced API for implementing (all) your scheduled jobs.
+Therefore the main difference is that your code is independent of Quartz-classes.
+However, you need to select <code>org.quartz.Job</code> or <code>java.lang.Runnable</code> for all your scheduled-tasks, bot not both!</p>
+</div>
+<div class="paragraph">
+<p>In such scheduled-tasks CDI based dependency-injection is enabled.
+Furthermore, the request- and session-scope get started (and stopped)
+per job-execution. Therefore, the container-control module (of
+DeltaSpike) is required. That can be controlled via
+<code>@Scheduled#startScopes</code> (possible values: all scopes supported by the
+container-control module as well as <code>{}</code> for 'no scopes').</p>
+</div>
+<div class="paragraph">
+<p>With 'false' for <code>@Scheduled#onStartup</code>, it is even possible to
+schedule/install jobs dynamically.</p>
+</div>
+<div class="paragraph">
+<p>The following example shows how to use it, if you are using <code>org.quartz.Job</code> (and not <code>java.lang.Runnable</code>).</p>
+</div>
+<div class="listingblock">
+<div class="title">Example</div>
+<div class="content">
+<pre class="CodeRay highlight"><code data-lang="java"><span class="annotation">@ApplicationScoped</span>
+<span class="directive">public</span> <span class="type">class</span> <span class="class">ProjectStageAwareSchedulerController</span>
+{
+    <span class="annotation">@Inject</span>
+    <span class="directive">private</span> Scheduler&lt;Job&gt; jobScheduler;
+
+    <span class="annotation">@Inject</span>
+    <span class="directive">private</span> ProjectStage projectStage;
+
+    <span class="directive">public</span> <span class="type">void</span> registerJobs()
+    {
+        <span class="keyword">if</span> (ProjectStage.Production.equals(<span class="local-variable">this</span>.projectStage))
+        {
+            <span class="comment">//see 'false' for @Scheduled#onStartup</span>
+            <span class="local-variable">this</span>.jobScheduler.registerNewJob(ManualCdiAwareQuartzJob.class);
+        }
+    }
+
+    <span class="annotation">@Scheduled</span>(cronExpression = <span class="string"><span class="delimiter">&quot;</span><span class="content">0 0/10 * * * ?</span><span class="delimiter">&quot;</span></span>, onStartup = <span class="predefined-constant">false</span>)
+    <span class="directive">public</span> <span class="type">class</span> <span class="class">ManualCdiAwareQuartzJob</span> <span class="directive">implements</span> org.quartz.Job
+    {
+        <span class="annotation">@Inject</span>
+        <span class="directive">private</span> MyService service;
+
+        <span class="annotation">@Override</span>
+        <span class="directive">public</span> <span class="type">void</span> execute(JobExecutionContext context) <span class="directive">throws</span> JobExecutionException
+        {
+            <span class="comment">//...</span>
+        }
+    }
+}</code></pre>
+</div>
+</div>
+</div>
+</div>
+<div class="sect1">
+<h2 id="_configurable_cron_expressions">Configurable CRON expressions</h2>
+<div class="sectionbody">
+<div class="paragraph">
+<p>In some cases it might be useful to configure a cron-expression e.g. per Project-Stage.
+Therefore, DeltaSpike (v1.6.0+) allows to use keys instead of hardcoded expressions.</p>
+</div>
+<div class="paragraph">
+<p>In the previous examples we had e.g. <code>@Scheduled(cronExpression = "0 0/10 * * * ?")</code>.
+Instead of hardcoding it that way, it&#8217;s possible to use e.g. <code>@Scheduled(cronExpression = "{myCronExpression}")</code> and
+in one of the active config-sources used by DeltaSpike a concrete expression can be defined e.g. via <code>myCronExpression=0 0/10 * * * ?</code>.
+Using e.g. <code>myCronExpression.Development=0 0/5 * * * ?</code> would allow to change the configured expression for Project-Stage development.</p>
+</div>
+</div>
+</div>
+<div class="sect1">
+<h2 id="_manual_scheduler_control">Manual Scheduler Control</h2>
+<div class="sectionbody">
+<div class="paragraph">
+<p>The SPI allows to control the scheduler (or integrate any other
+compatible scheduler as an alternative to Quartz2)</p>
+</div>
+<div class="paragraph">
+<p>Via standard injection like</p>
+</div>
+<div class="listingblock">
+<div class="content">
+<pre class="CodeRay highlight"><code data-lang="java"><span class="annotation">@Inject</span>
+<span class="directive">private</span> Scheduler&lt;Job&gt; jobScheduler;</code></pre>
+</div>
+</div>
+<div class="paragraph">
+<p>it is possible to manually start/stop the scheduler,
+pause/resume/interrupt/check scheduled jobs, register jobs manually or
+start a job once (without registering it permanently).</p>
+</div>
+<div class="paragraph">
+<p><strong>Attention</strong>: To use a typed injection-point and avoid deployment failure with some versions of Weld, you must use</p>
+</div>
+<div class="listingblock">
+<div class="content">
+<pre class="CodeRay highlight"><code data-lang="java"><span class="directive">public</span> <span class="type">class</span> <span class="class">QuartzSchedulerProducer</span>
+{
+    <span class="annotation">@Produces</span>
+    <span class="annotation">@ApplicationScoped</span>
+    <span class="directive">protected</span> Scheduler&lt;Job&gt; produceScheduler(Scheduler scheduler)
+    {
+        <span class="keyword">return</span> scheduler;
+    }
+}</code></pre>
+</div>
+</div>
+<div class="paragraph">
+<p>or</p>
+</div>
+<div class="listingblock">
+<div class="content">
+<pre class="CodeRay highlight"><code data-lang="xml"><span class="tag">&lt;alternatives&gt;</span>
+  <span class="tag">&lt;class&gt;</span>org.apache.deltaspike.scheduler.impl.QuartzSchedulerProducer<span class="tag">&lt;/class&gt;</span>
+<span class="tag">&lt;/alternatives&gt;</span></code></pre>
+</div>
+</div>
+</div>
+</div>
+<div class="sect1">
+<h2 id="_manual_scheduling">Manual scheduling</h2>
+<div class="sectionbody">
+<div class="paragraph">
+<p>If the SPI provided by <code>org.apache.deltaspike.scheduler.spi.Scheduler</code> doesn&#8217;t provide a method you are looking for,
+you can use <code>#unwrap</code> to access the underlying scheduler.
+Per default DeltaSpike uses an implementation of <code>org.quartz.Scheduler</code>.
+Therefore, it&#8217;s possible to inject <code>org.apache.deltaspike.scheduler.spi.Scheduler</code> and use it like in the following example:</p>
+</div>
+<div class="listingblock">
+<div class="content">
+<pre class="CodeRay highlight"><code data-lang="java"><span class="directive">public</span> <span class="type">class</span> <span class="class">ManualJobScheduler</span>
+{
+    <span class="annotation">@Inject</span>
+    <span class="directive">private</span> Scheduler&lt;Job&gt; scheduler;
+
+    <span class="annotation">@Override</span>
+    <span class="directive">public</span> <span class="type">void</span> scheduleJob(JobDetail jobDetail, Trigger trigger) <span class="directive">throws</span> SchedulerException
+    {
+        <span class="local-variable">this</span>.scheduler.unwrap(org.quartz.Scheduler.class).scheduleJob(jobDetail, trigger);
+    }
+}</code></pre>
+</div>
+</div>
+<div class="paragraph">
+<p>With that it&#8217;s e.g. possible to schedule quartz-jobs based on the same quartz-job(-class), but with different triggers,&#8230;&#8203;
+Also manually scheduled jobs benefit from DeltaSpike features like the support of <code>@Inject</code> in the job-instances.</p>
+</div>
+</div>
+</div>
+<div class="sect1">
+<h2 id="_execute_java_lang_runnable_with_managedexecutorservice">Execute java.lang.Runnable with ManagedExecutorService</h2>
+<div class="sectionbody">
+<div class="paragraph">
+<p>If you would like to use e.g. the <code>ManagedExecutorService</code> (with EE7+) to run the jobs,
+you can provide a custom adapter by adding e.g.
+<code>deltaspike.scheduler.runnable-adapter-class=mypackage.DelegatingJobRunnableAdapter</code> to <code>META-INF/apache-deltaspike.properties</code>.
+Such an adapter just needs to implement <code>org.quartz.Job</code> and in case of EE7+ inject e.g. <code>ManagedExecutorService</code> as shown in the following example:</p>
+</div>
+<div class="listingblock">
+<div class="content">
+<pre class="CodeRay highlight"><code data-lang="java"><span class="directive">public</span> <span class="type">class</span> <span class="class">DelegatingJobRunnableAdapter</span> <span class="directive">implements</span> java.lang.Runnable
+{
+    <span class="annotation">@Resource</span>
+    <span class="directive">private</span> ManagedExecutorService managedExecutorService;
+
+    <span class="annotation">@Override</span>
+    <span class="directive">public</span> <span class="type">void</span> run()
+    {
+        <span class="predefined-type">Class</span>&lt;? <span class="directive">extends</span> <span class="predefined-type">Runnable</span>&gt; jobClass =
+            ClassUtils.tryToLoadClassForName(context.getJobDetail().getKey().getName(), <span class="predefined-type">Runnable</span>.class);
+
+        <span class="predefined-type">Runnable</span> runnableBean = BeanProvider.getContextualReference(jobClass);
+        managedExecutorService.execute(runnableBean);
+    }
+}</code></pre>
+</div>
+</div>
+</div>
+</div>
+<div class="sect1">
+<h2 id="_custom_scheduler">Custom Scheduler</h2>
+<div class="sectionbody">
+<div class="paragraph">
+<p>It is possible to replace the default integration with Quartz. Any scheduler that supports cron-expressions for job-classes can be used.
+For more information, see <a href="https://deltaspike.apache.org/javadoc/1.7.1/org/apache/deltaspike/scheduler/spi/Scheduler.html">Scheduler javadoc</a>.</p>
+</div>
+</div>
+</div>
+            </div>
+        </div>
+
+        
+            <div class="span4">
+                <div id="toc">
+                    <div class="moduledeps">
+                        <ul class="toc-like nav nav-list">
+                            
+                                <li class="custom-toc-header">Depends on</li>
+                                
+                                    <li><a href="core.html">Core</a></li>
+                                
+                                    <li><a href="container-control.html">Container control</a></li>
+                                
+                            
+                            
+                                <li class="custom-toc-header"><a href="core.html#_internal_configuration">Configuration</a></li>
+                                
+                                    <li><a href="https://github.com/apache/deltaspike/blob/master/deltaspike/modules/scheduler/impl/src/main/java/org/apache/deltaspike/scheduler/impl/SchedulerBaseConfig.java">SchedulerBaseConfig</a></li>
+                                
+                            
+                            
+                                <li class="custom-toc-header">Table of Contents</li>
+                            
+                        </ul>
+                    </div>
+                </div>
+                
+                    <div class="fallback-toc">
+                        <ul class="sectlevel1">
+<li><a href="#_overview">Overview</a></li>
+<li><a href="#_project_setup">Project Setup</a>
+<ul class="sectlevel2">
+<li><a href="#_1_declare_scheduler_module_dependencies">1. Declare Scheduler Module Dependencies</a></li>
+<li><a href="#_2_declare_external_dependencies">2. Declare External Dependencies</a></li>
+<li><a href="#_3_declare_container_control_dependency">3. Declare Container Control dependency</a></li>
+</ul>
+</li>
+<li><a href="#__scheduled_with_org_quartz_job_or_java_lang_runnable">@Scheduled with org.quartz.Job or java.lang.Runnable</a></li>
+<li><a href="#_configurable_cron_expressions">Configurable CRON expressions</a></li>
+<li><a href="#_manual_scheduler_control">Manual Scheduler Control</a></li>
+<li><a href="#_manual_scheduling">Manual scheduling</a></li>
+<li><a href="#_execute_java_lang_runnable_with_managedexecutorservice">Execute java.lang.Runnable with ManagedExecutorService</a></li>
+<li><a href="#_custom_scheduler">Custom Scheduler</a></li>
+</ul>
+                    </div>
+                
+            </div>
+        
+
+    </div>
+    <div class="row">
+        <hr>
+        <footer>
+            <p>Copyright &copy; 2011-2016 The Apache Software Foundation,
+                Licensed under the Apache License, Version 2.0.</p>
+
+            <p>Apache and the Apache feather logo are trademarks of The Apache Software Foundation.</p>
+        </footer>
+    </div>
+</div>
+
+</body>
 </html>
\ No newline at end of file



Mime
View raw message