incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r1480167 - in /sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs: JobImpl.java JobManagerImpl.java
Date Wed, 08 May 2013 06:15:05 GMT
Author: cziegeler
Date: Wed May  8 06:15:04 2013
New Revision: 1480167

URL: http://svn.apache.org/r1480167
Log:
Add more log messages when a job is discarded

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

Modified: sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/JobImpl.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/JobImpl.java?rev=1480167&r1=1480166&r2=1480167&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/JobImpl.java
(original)
+++ sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/JobImpl.java
Wed May  8 06:15:04 2013
@@ -27,6 +27,7 @@ import org.apache.sling.api.resource.Val
 import org.apache.sling.api.wrappers.ValueMapDecorator;
 import org.apache.sling.event.impl.support.ResourceHelper;
 import org.apache.sling.event.jobs.Job;
+import org.apache.sling.event.jobs.JobUtil;
 import org.apache.sling.event.jobs.JobUtil.JobPriority;
 import org.apache.sling.event.jobs.Queue;
 
@@ -76,6 +77,7 @@ public class JobImpl implements Job {
         this.readErrorList = (List<Exception>) properties.remove(ResourceHelper.PROPERTY_MARKER_READ_ERROR_LIST);
 
         this.properties = new ValueMapDecorator(properties);
+        this.properties.put(JobUtil.NOTIFICATION_PROPERTY_JOB_ID, jobId);
     }
 
     /**

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=1480167&r1=1480166&r2=1480167&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
Wed May  8 06:15:04 2013
@@ -486,8 +486,10 @@ public class JobManagerImpl
             try {
                 final ValueMap vm = ResourceHelper.getValueMap(resource);
 
+                // check job topic and job id
                 final String errorMessage = Utility.checkJobTopic(vm.get(JobUtil.PROPERTY_JOB_TOPIC));
-                if ( errorMessage == null ) {
+                final String jobId = vm.get(JobUtil.JOB_ID, String.class);
+                if ( errorMessage == null && jobId != null ) {
                     final String topic = vm.get(JobUtil.PROPERTY_JOB_TOPIC, String.class);
                     final Map<String, Object> jobProperties = ResourceHelper.cloneValueMap(vm);
 
@@ -506,9 +508,15 @@ public class JobManagerImpl
                     }
                     job = new JobImpl(topic,
                             (String)jobProperties.get(JobUtil.PROPERTY_JOB_NAME),
-                            (String)jobProperties.get(JobUtil.JOB_ID),
+                            jobId,
                             jobProperties);
                 } else {
+                    if ( errorMessage != null ) {
+                        logger.warn(errorMessage + " : " + resource.getPath());
+                    }
+                    if ( jobId == null ) {
+                        logger.warn("Discarding job - no job id found : " + resource.getPath());
+                    }
                     // remove the job as the topic is invalid anyway
                     try {
                         resource.getResourceResolver().delete(resource);



Mime
View raw message