Repository: deltaspike Updated Branches: refs/heads/master 2018d4ed4 -> 68939f30a
DELTASPIKE-1032 added hints about manual scheduling Project: http://git-wip-us.apache.org/repos/asf/deltaspike/repo Commit: http://git-wip-us.apache.org/repos/asf/deltaspike/commit/68939f30 Tree: http://git-wip-us.apache.org/repos/asf/deltaspike/tree/68939f30 Diff: http://git-wip-us.apache.org/repos/asf/deltaspike/diff/68939f30 Branch: refs/heads/master Commit: 68939f30a2d55921d823b9232bb8cd914cfadb00 Parents: 2018d4e Author: gpetracek <[email protected]> Authored: Sat Apr 16 11:41:03 2016 +0200 Committer: gpetracek <[email protected]> Committed: Sat Apr 16 11:45:18 2016 +0200 ---------------------------------------------------------------------- documentation/src/main/asciidoc/scheduler.adoc | 25 +++++++++++++++++++++ 1 file changed, 25 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/deltaspike/blob/68939f30/documentation/src/main/asciidoc/scheduler.adoc ---------------------------------------------------------------------- diff --git a/documentation/src/main/asciidoc/scheduler.adoc b/documentation/src/main/asciidoc/scheduler.adoc index 88b7a14..2649ecf 100644 --- a/documentation/src/main/asciidoc/scheduler.adoc +++ b/documentation/src/main/asciidoc/scheduler.adoc @@ -237,6 +237,31 @@ or </alternatives> ----------------------------------------------------------------------------- +== Manual scheduling + +If the SPI provided by `org.apache.deltaspike.scheduler.spi.Scheduler` doesn't provide a method you are looking for, +you can use `#unwrap` to access the underlying scheduler. +Per default DeltaSpike uses an implementation of `org.quartz.Scheduler`. +Therefore, it's possible to inject `org.apache.deltaspike.scheduler.spi.Scheduler` and use it like in the following example: + +[source,java] +---------------------------------------------------------------------------------------------- +public class ManualJobScheduler +{ + @Inject + private Scheduler<Job> scheduler; + + @Override + public void scheduleJob(JobDetail jobDetail, Trigger trigger) throws SchedulerException + { + this.scheduler.unwrap(org.quartz.Scheduler.class).scheduleJob(jobDetail, trigger); + } +} +---------------------------------------------------------------------------------------------- + +With that it's e.g. possible to schedule quartz-jobs based on the same quartz-job(-class), but with different triggers,... +Also manually scheduled jobs benefit from DeltaSpike features like the support of `@Inject` in the job-instances. + == Execute java.lang.Runnable with ManagedExecutorService If you would like to use e.g. the `ManagedExecutorService` (with EE7+) to run the jobs,
