polygene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nic...@apache.org
Subject [3/4] zest-qi4j git commit: Durable Schedules doesn't seem to work properly. Adding UUID.
Date Sat, 11 Jul 2015 12:19:22 GMT
Durable Schedules doesn't seem to work properly. Adding UUID.


Project: http://git-wip-us.apache.org/repos/asf/zest-qi4j/repo
Commit: http://git-wip-us.apache.org/repos/asf/zest-qi4j/commit/8e2c2b4b
Tree: http://git-wip-us.apache.org/repos/asf/zest-qi4j/tree/8e2c2b4b
Diff: http://git-wip-us.apache.org/repos/asf/zest-qi4j/diff/8e2c2b4b

Branch: refs/heads/develop
Commit: 8e2c2b4ba812d0b66e69641d8aeb64c5af9b07ec
Parents: c28df39
Author: Niclas Hedhman <niclas@hedhman.org>
Authored: Sat Jul 11 14:25:40 2015 +0300
Committer: Niclas Hedhman <niclas@hedhman.org>
Committed: Sat Jul 11 14:25:40 2015 +0300

----------------------------------------------------------------------
 .../org/qi4j/library/scheduler/schedule/ScheduleFactory.java | 8 ++++++++
 1 file changed, 8 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/zest-qi4j/blob/8e2c2b4b/libraries/scheduler/src/main/java/org/qi4j/library/scheduler/schedule/ScheduleFactory.java
----------------------------------------------------------------------
diff --git a/libraries/scheduler/src/main/java/org/qi4j/library/scheduler/schedule/ScheduleFactory.java
b/libraries/scheduler/src/main/java/org/qi4j/library/scheduler/schedule/ScheduleFactory.java
index 7f5b88c..94b7fd2 100644
--- a/libraries/scheduler/src/main/java/org/qi4j/library/scheduler/schedule/ScheduleFactory.java
+++ b/libraries/scheduler/src/main/java/org/qi4j/library/scheduler/schedule/ScheduleFactory.java
@@ -27,6 +27,7 @@ import org.qi4j.library.scheduler.SchedulerService;
 import org.qi4j.library.scheduler.Task;
 import org.qi4j.library.scheduler.schedule.cron.CronSchedule;
 import org.qi4j.library.scheduler.schedule.once.OnceSchedule;
+import org.qi4j.spi.uuid.UuidIdentityGeneratorService;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -48,6 +49,9 @@ public interface ScheduleFactory
         @Service
         private SchedulerService scheduler;
 
+        @Service
+        private UuidIdentityGeneratorService uuid;
+
         @Override
         public CronSchedule newCronSchedule( Task task, String cronExpression, DateTime start,
boolean durable )
         {
@@ -74,6 +78,7 @@ public interface ScheduleFactory
             CronSchedule prototype = builder.prototype();
             prototype.task().set( task );
             prototype.start().set( start );
+            prototype.identity().set( uuid.generate( CronSchedule.class ) );
             prototype.cronExpression().set( cronExpression );
             CronSchedule schedule = builder.newInstance();
             logger.info( "Schedule {} created: {}", schedule.presentationString(), schedule.identity().get()
);
@@ -87,6 +92,7 @@ public interface ScheduleFactory
             CronSchedule builderInstance = builder.instance();
             builderInstance.task().set( task );
             builderInstance.start().set( start );
+            builderInstance.identity().set( uuid.generate( CronSchedule.class ) );
             builderInstance.cronExpression().set( cronExpression );
             CronSchedule schedule = builder.newInstance();
             logger.info( "Schedule {} created: {}", schedule.presentationString(), schedule.identity().get()
);
@@ -99,6 +105,7 @@ public interface ScheduleFactory
             OnceSchedule builderInstance = builder.prototype();
             builderInstance.task().set( task );
             builderInstance.start().set( runAt );
+            builderInstance.identity().set( uuid.generate( CronSchedule.class ) );
             OnceSchedule schedule = builder.newInstance();
             logger.info( "Schedule {} created: {}", schedule.presentationString(), schedule.identity().get()
);
             return schedule;
@@ -111,6 +118,7 @@ public interface ScheduleFactory
             OnceSchedule builderInstance = builder.instance();
             builderInstance.task().set( task );
             builderInstance.start().set( runAt );
+            builderInstance.identity().set( uuid.generate( CronSchedule.class ) );
             OnceSchedule schedule = builder.newInstance();
             logger.info( "Schedule {} created: {}", schedule.presentationString(), schedule.identity().get()
);
             return schedule;


Mime
View raw message