sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r1532972 - in /sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event: impl/jobs/JobManagerImpl.java jobs/JobManager.java
Date Thu, 17 Oct 2013 05:53:08 GMT
Author: cziegeler
Date: Thu Oct 17 05:53:07 2013
New Revision: 1532972

URL: http://svn.apache.org/r1532972
Log:
SLING-3028 :  Support for progress tracking of jobs

Modified:
    sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/JobManagerImpl.java
    sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/jobs/JobManager.java

Modified: sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/JobManagerImpl.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/JobManagerImpl.java?rev=1532972&r1=1532971&r2=1532972&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/JobManagerImpl.java
(original)
+++ sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/JobManagerImpl.java
Thu Oct 17 05:53:07 2013
@@ -1532,6 +1532,9 @@ public class JobManagerImpl
         return null;
     }
 
+    /**
+     * Internal method to add a job
+     */
     public Job addJob(final String topic, final String name,
             final Map<String, Object> properties,
             final List<String> errors) {
@@ -1549,4 +1552,17 @@ public class JobManagerImpl
         }
         return result;
     }
+
+    /**
+     * @see org.apache.sling.event.jobs.JobManager#retryJobById(java.lang.String)
+     */
+    @Override
+    public Job retryJobById(final String jobId) {
+        final JobImpl job = (JobImpl)this.getJobById(jobId);
+        if ( job != null && this.configuration.isStoragePath(job.getResourcePath())
) {
+            this.internalRemoveJobById(jobId, true);
+            return this.addJob(job.getTopic(), job.getName(), job.getProperties());
+        }
+        return null;
+    }
 }

Modified: sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/jobs/JobManager.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/jobs/JobManager.java?rev=1532972&r1=1532971&r2=1532972&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/jobs/JobManager.java
(original)
+++ sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/jobs/JobManager.java
Thu Oct 17 05:53:07 2013
@@ -180,6 +180,16 @@ public interface JobManager {
     void stopJobById(String jobId);
 
     /**
+     * Retry a cancelled job.
+     * If a job has failed permanently it can be requeued with this method. The job will
be
+     * removed from the history and put into the queue again. The new job will get a new
job id.
+     * For all other jobs calling this method has no effect and it simply returns <code>null</code>.
+     * @param jobId The job id.
+     * @return If the job is requeued, the new job object otherwise <code>null</code>
+     */
+    Job retryJobById(String jobId);
+
+    /**
      * Fluent API to create, start and schedule new jobs
      * @param topic Required topic
      * @return A job builder



Mime
View raw message