deltaspike-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gpetra...@apache.org
Subject git commit: DELTASPIKE-618 support for manually registered job-instances
Date Thu, 29 May 2014 17:31:49 GMT
Repository: deltaspike
Updated Branches:
  refs/heads/master 271b24a4f -> e7e0d82ec


DELTASPIKE-618 support for manually registered job-instances


Project: http://git-wip-us.apache.org/repos/asf/deltaspike/repo
Commit: http://git-wip-us.apache.org/repos/asf/deltaspike/commit/e7e0d82e
Tree: http://git-wip-us.apache.org/repos/asf/deltaspike/tree/e7e0d82e
Diff: http://git-wip-us.apache.org/repos/asf/deltaspike/diff/e7e0d82e

Branch: refs/heads/master
Commit: e7e0d82ec3623118d7735bd675a107ecb140369d
Parents: 271b24a
Author: gpetracek <gpetracek@apache.org>
Authored: Thu May 29 19:29:17 2014 +0200
Committer: gpetracek <gpetracek@apache.org>
Committed: Thu May 29 19:29:17 2014 +0200

----------------------------------------------------------------------
 .../apache/deltaspike/scheduler/impl/QuartzScheduler.java   | 9 +++++++++
 1 file changed, 9 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltaspike/blob/e7e0d82e/deltaspike/modules/scheduler/impl/src/main/java/org/apache/deltaspike/scheduler/impl/QuartzScheduler.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/scheduler/impl/src/main/java/org/apache/deltaspike/scheduler/impl/QuartzScheduler.java
b/deltaspike/modules/scheduler/impl/src/main/java/org/apache/deltaspike/scheduler/impl/QuartzScheduler.java
index 484d6dc..86e7046 100644
--- a/deltaspike/modules/scheduler/impl/src/main/java/org/apache/deltaspike/scheduler/impl/QuartzScheduler.java
+++ b/deltaspike/modules/scheduler/impl/src/main/java/org/apache/deltaspike/scheduler/impl/QuartzScheduler.java
@@ -22,6 +22,7 @@ import org.apache.deltaspike.cdise.api.ContextControl;
 import org.apache.deltaspike.core.api.config.ConfigResolver;
 import org.apache.deltaspike.core.api.provider.BeanProvider;
 import org.apache.deltaspike.core.util.ExceptionUtils;
+import org.apache.deltaspike.core.util.metadata.AnnotationInstanceProvider;
 import org.apache.deltaspike.scheduler.api.Scheduled;
 import org.apache.deltaspike.scheduler.spi.Scheduler;
 import org.quartz.CronScheduleBuilder;
@@ -47,6 +48,8 @@ import java.util.logging.Logger;
 //vetoed class (see SchedulerExtension)
 public class QuartzScheduler implements Scheduler<Job>
 {
+    private static final Scheduled DEFAULT_SCHEDULED_LITERAL = AnnotationInstanceProvider.of(Scheduled.class);
+
     protected org.quartz.Scheduler scheduler;
 
     @Override
@@ -295,6 +298,12 @@ public class QuartzScheduler implements Scheduler<Job>
         {
             Scheduled scheduled = jobExecutionContext.getJobInstance().getClass().getAnnotation(Scheduled.class);
 
+            //can happen with manually registered job-instances (via #unwrap)
+            if (scheduled == null)
+            {
+                scheduled = DEFAULT_SCHEDULED_LITERAL;
+            }
+
             Collections.addAll(this.scopes, scheduled.startScopes());
 
             if (!this.scopes.isEmpty())


Mime
View raw message