You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by cz...@apache.org on 2013/10/14 15:55:42 UTC
svn commit: r1531900 - in /sling/trunk/bundles/extensions/event/src:
main/java/org/apache/sling/event/impl/dea/
main/java/org/apache/sling/event/impl/jobs/
main/java/org/apache/sling/event/impl/jobs/config/
main/java/org/apache/sling/event/impl/jobs/co...
Author: cziegeler
Date: Mon Oct 14 13:55:41 2013
New Revision: 1531900
URL: http://svn.apache.org/r1531900
Log:
SLING-3168 : Deprecating JobUtil class?
Added:
sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/jobs/NotificationConstants.java (with props)
Modified:
sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/dea/DistributedEventReceiver.java
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
sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/MaintenanceTask.java
sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/Utility.java
sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/config/InternalQueueConfiguration.java
sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/console/InventoryPlugin.java
sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/console/WebConsolePlugin.java
sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/queues/AbstractJobQueue.java
sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/queues/AbstractParallelJobQueue.java
sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/timed/ScheduleInfo.java
sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/support/ResourceHelper.java
sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/jobs/Job.java
sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/jobs/JobUtil.java
sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/jobs/QueueConfiguration.java
sling/trunk/bundles/extensions/event/src/test/java/org/apache/sling/event/it/ClassloadingTest.java
Modified: sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/dea/DistributedEventReceiver.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/dea/DistributedEventReceiver.java?rev=1531900&r1=1531899&r2=1531900&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/dea/DistributedEventReceiver.java (original)
+++ sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/dea/DistributedEventReceiver.java Mon Oct 14 13:55:41 2013
@@ -49,7 +49,6 @@ import org.apache.sling.event.impl.jobs.
import org.apache.sling.event.impl.support.BatchResourceRemover;
import org.apache.sling.event.impl.support.Environment;
import org.apache.sling.event.impl.support.ResourceHelper;
-import org.apache.sling.event.jobs.JobUtil;
import org.osgi.service.event.Event;
import org.osgi.service.event.EventConstants;
import org.osgi.service.event.EventHandler;
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=1531900&r1=1531899&r2=1531900&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 Mon Oct 14 13:55:41 2013
@@ -29,8 +29,8 @@ 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.NotificationConstants;
import org.apache.sling.event.jobs.Queue;
/**
@@ -89,7 +89,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);
+ this.properties.put(NotificationConstants.NOTIFICATION_PROPERTY_JOB_ID, jobId);
}
/**
@@ -187,7 +187,7 @@ public class JobImpl implements Job {
@Override
public JobPriority getJobPriority() {
- return (JobPriority)this.getProperty(Job.PROPERTY_JOB_PRIORITY);
+ return JobPriority.NORM;
}
@Override
@@ -231,7 +231,6 @@ public class JobImpl implements Job {
public void updateQueueInfo(final Queue queue) {
this.properties.put(Job.PROPERTY_JOB_QUEUE_NAME, queue.getName());
this.properties.put(Job.PROPERTY_JOB_RETRIES, queue.getConfiguration().getMaxRetries());
- this.properties.put(Job.PROPERTY_JOB_PRIORITY, queue.getConfiguration().getPriority());
}
public void setProperty(final String name, final Object value) {
@@ -254,7 +253,7 @@ public class JobImpl implements Job {
this.properties.remove(Job.PROPERTY_JOB_PROGRESS_STEP);
this.properties.remove(Job.PROPERTY_RESULT_MESSAGE);
this.properties.put(Job.PROPERTY_JOB_STARTED_TIME, Calendar.getInstance());
- return new String[] {Job.PROPERTY_JOB_QUEUE_NAME, Job.PROPERTY_JOB_RETRIES, Job.PROPERTY_JOB_PRIORITY,
+ return new String[] {Job.PROPERTY_JOB_QUEUE_NAME, Job.PROPERTY_JOB_RETRIES,
Job.PROPERTY_JOB_PROGRESS_LOG, Job.PROPERTY_JOB_PROGRESS_ETA, PROPERTY_JOB_PROGRESS_STEPS,
PROPERTY_JOB_PROGRESS_STEP, Job.PROPERTY_RESULT_MESSAGE, Job.PROPERTY_JOB_STARTED_TIME};
}
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=1531900&r1=1531899&r2=1531900&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 Mon Oct 14 13:55:41 2013
@@ -73,9 +73,8 @@ import org.apache.sling.event.impl.suppo
import org.apache.sling.event.jobs.Job;
import org.apache.sling.event.jobs.JobBuilder;
import org.apache.sling.event.jobs.JobManager;
-import org.apache.sling.event.jobs.JobUtil;
-import org.apache.sling.event.jobs.JobUtil.JobPriority;
import org.apache.sling.event.jobs.JobsIterator;
+import org.apache.sling.event.jobs.NotificationConstants;
import org.apache.sling.event.jobs.Queue;
import org.apache.sling.event.jobs.QueueConfiguration;
import org.apache.sling.event.jobs.ScheduledJobInfo;
@@ -484,21 +483,21 @@ public class JobManagerImpl
} else {
if ( EventUtil.isLocal(event) ) {
// job notifications
- final String topic = (String)event.getProperty(JobUtil.NOTIFICATION_PROPERTY_JOB_TOPIC);
+ final String topic = (String)event.getProperty(NotificationConstants.NOTIFICATION_PROPERTY_JOB_TOPIC);
if ( topic != null ) { // this is just a sanity check
TopicStatisticsImpl ts = (TopicStatisticsImpl)this.topicStatistics.get(topic);
if ( ts == null ) {
this.topicStatistics.putIfAbsent(topic, new TopicStatisticsImpl(topic));
ts = (TopicStatisticsImpl)this.topicStatistics.get(topic);
}
- if ( event.getTopic().equals(JobUtil.TOPIC_JOB_CANCELLED) ) {
+ if ( event.getTopic().equals(NotificationConstants.TOPIC_JOB_CANCELLED) ) {
ts.addCancelled();
- } else if ( event.getTopic().equals(JobUtil.TOPIC_JOB_FAILED) ) {
+ } else if ( event.getTopic().equals(NotificationConstants.TOPIC_JOB_FAILED) ) {
ts.addFailed();
- } else if ( event.getTopic().equals(JobUtil.TOPIC_JOB_FINISHED) ) {
+ } else if ( event.getTopic().equals(NotificationConstants.TOPIC_JOB_FINISHED) ) {
final Long time = (Long)event.getProperty(Utility.PROPERTY_TIME);
ts.addFinished(time == null ? -1 : time);
- } else if ( event.getTopic().equals(JobUtil.TOPIC_JOB_STARTED) ) {
+ } else if ( event.getTopic().equals(NotificationConstants.TOPIC_JOB_STARTED) ) {
final Long time = (Long)event.getProperty(Utility.PROPERTY_TIME);
ts.addActivated(time == null ? -1 : time);
}
@@ -527,7 +526,6 @@ public class JobManagerImpl
// convert to integers (JCR supports only long...)
jobProperties.put(Job.PROPERTY_JOB_RETRIES, vm.get(Job.PROPERTY_JOB_RETRIES, Integer.class));
jobProperties.put(Job.PROPERTY_JOB_RETRY_COUNT, vm.get(Job.PROPERTY_JOB_RETRY_COUNT, Integer.class));
- jobProperties.put(Job.PROPERTY_JOB_PRIORITY, JobPriority.valueOf(vm.get(Job.PROPERTY_JOB_PRIORITY, JobPriority.NORM.name())));
if ( vm.get(Job.PROPERTY_JOB_PROGRESS_STEPS) != null ) {
jobProperties.put(Job.PROPERTY_JOB_PROGRESS_STEPS, vm.get(Job.PROPERTY_JOB_PROGRESS_STEPS, Integer.class));
}
@@ -1244,7 +1242,7 @@ public class JobManagerImpl
if ( logger.isDebugEnabled() ) {
logger.debug("Dropping job due to configuration of queue {} : {}", info.queueName, Utility.toString(jobTopic, jobName, jobProperties));
}
- Utility.sendNotification(this.eventAdmin, JobUtil.TOPIC_JOB_CANCELLED, jobTopic, jobName, jobProperties, null);
+ Utility.sendNotification(this.eventAdmin, NotificationConstants.TOPIC_JOB_CANCELLED, jobTopic, jobName, jobProperties, null);
} else {
// check for unique jobs
if ( jobName != null && !this.lock(jobName) ) {
@@ -1332,7 +1330,6 @@ public class JobManagerImpl
properties.put(Job.PROPERTY_JOB_QUEUE_NAME, info.queueConfiguration.getName());
properties.put(Job.PROPERTY_JOB_RETRY_COUNT, 0);
properties.put(Job.PROPERTY_JOB_RETRIES, info.queueConfiguration.getMaxRetries());
- properties.put(Job.PROPERTY_JOB_PRIORITY, info.queueConfiguration.getPriority().name());
properties.put(Job.PROPERTY_JOB_CREATED, Calendar.getInstance());
properties.put(Job.PROPERTY_JOB_CREATED_INSTANCE, Environment.APPLICATION_ID);
@@ -1355,7 +1352,6 @@ public class JobManagerImpl
properties);
// update property types - priority, add path and create job
- properties.put(Job.PROPERTY_JOB_PRIORITY, info.queueConfiguration.getPriority());
properties.put(JobImpl.PROPERTY_RESOURCE_PATH, path);
return new JobImpl(jobTopic, jobName, jobId, properties);
}
Modified: sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/MaintenanceTask.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/MaintenanceTask.java?rev=1531900&r1=1531899&r2=1531900&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/MaintenanceTask.java (original)
+++ sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/MaintenanceTask.java Mon Oct 14 13:55:41 2013
@@ -41,8 +41,6 @@ import org.apache.sling.event.impl.jobs.
import org.apache.sling.event.impl.support.Environment;
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.QueueConfiguration;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -724,7 +722,6 @@ public class MaintenanceTask {
if ( !properties.containsKey(Job.PROPERTY_JOB_RETRY_COUNT) ) {
properties.put(Job.PROPERTY_JOB_RETRY_COUNT, 0);
}
- properties.put(Job.PROPERTY_JOB_PRIORITY, JobPriority.NORM.name());
final List<InstanceDescription> potentialTargets = caps.getPotentialTargets("/", null);
String targetId = null;
@@ -743,7 +740,6 @@ public class MaintenanceTask {
properties.put(Job.PROPERTY_JOB_QUEUE_NAME, info.queueName);
properties.put(Job.PROPERTY_JOB_TARGET_INSTANCE, targetId);
properties.put(Job.PROPERTY_JOB_RETRIES, info.queueConfiguration.getMaxRetries());
- properties.put(Job.PROPERTY_JOB_PRIORITY, info.queueConfiguration.getPriority().name());
}
}
}
Modified: sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/Utility.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/Utility.java?rev=1531900&r1=1531899&r2=1531900&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/Utility.java (original)
+++ sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/Utility.java Mon Oct 14 13:55:41 2013
@@ -28,6 +28,7 @@ import java.util.Map;
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.NotificationConstants;
import org.apache.sling.event.jobs.consumer.JobConsumer;
import org.osgi.service.event.Event;
import org.osgi.service.event.EventAdmin;
@@ -139,10 +140,10 @@ public abstract class Utility {
final Long time) {
final Dictionary<String, Object> eventProps = new Hashtable<String, Object>();
// add basic job properties
- eventProps.put(JobUtil.NOTIFICATION_PROPERTY_JOB_ID, job.getId());
- eventProps.put(JobUtil.NOTIFICATION_PROPERTY_JOB_TOPIC, job.getTopic());
+ eventProps.put(NotificationConstants.NOTIFICATION_PROPERTY_JOB_ID, job.getId());
+ eventProps.put(NotificationConstants.NOTIFICATION_PROPERTY_JOB_TOPIC, job.getTopic());
if ( job.getName() != null ) {
- eventProps.put(JobUtil.NOTIFICATION_PROPERTY_JOB_NAME, job.getName());
+ eventProps.put(NotificationConstants.NOTIFICATION_PROPERTY_JOB_NAME, job.getName());
}
// copy payload
for(final String name : job.getPropertyNames()) {
Modified: sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/config/InternalQueueConfiguration.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/config/InternalQueueConfiguration.java?rev=1531900&r1=1531899&r2=1531900&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/config/InternalQueueConfiguration.java (original)
+++ sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/config/InternalQueueConfiguration.java Mon Oct 14 13:55:41 2013
@@ -83,7 +83,7 @@ public class InternalQueueConfiguration
private long retryDelay;
/** Thread priority. */
- private JobUtil.JobPriority priority;
+ private ThreadPriority priority;
/** The maximum number of parallel processes (for non ordered queues) */
private int maxParallelProcesses;
@@ -124,7 +124,7 @@ public class InternalQueueConfiguration
@Activate
protected void activate(final Map<String, Object> params) {
this.name = PropertiesUtil.toString(params.get(ConfigurationConstants.PROP_NAME), null);
- this.priority = JobUtil.JobPriority.valueOf(PropertiesUtil.toString(params.get(ConfigurationConstants.PROP_PRIORITY), ConfigurationConstants.DEFAULT_PRIORITY));
+ this.priority = ThreadPriority.valueOf(PropertiesUtil.toString(params.get(ConfigurationConstants.PROP_PRIORITY), ConfigurationConstants.DEFAULT_PRIORITY));
this.type = Type.valueOf(PropertiesUtil.toString(params.get(ConfigurationConstants.PROP_TYPE), ConfigurationConstants.DEFAULT_TYPE));
this.retries = PropertiesUtil.toInteger(params.get(ConfigurationConstants.PROP_RETRIES), ConfigurationConstants.DEFAULT_RETRIES);
this.retryDelay = PropertiesUtil.toLong(params.get(ConfigurationConstants.PROP_RETRY_DELAY), ConfigurationConstants.DEFAULT_RETRY_DELAY);
@@ -233,7 +233,7 @@ public class InternalQueueConfiguration
*/
@Override
public JobUtil.JobPriority getPriority() {
- return this.priority;
+ return JobUtil.JobPriority.valueOf(this.priority.name());
}
/**
@@ -306,4 +306,8 @@ public class InternalQueueConfiguration
return 0;
}
+ @Override
+ public ThreadPriority getThreadPriority() {
+ return this.priority;
+ }
}
Modified: sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/console/InventoryPlugin.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/console/InventoryPlugin.java?rev=1531900&r1=1531899&r2=1531900&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/console/InventoryPlugin.java (original)
+++ sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/console/InventoryPlugin.java Mon Oct 14 13:55:41 2013
@@ -252,7 +252,7 @@ public class InventoryPlugin implements
pw.printf("Max Parallel : %s%n", c.getMaxParallel());
pw.printf("Max Retries : %s%n", c.getMaxRetries());
pw.printf("Retry Delay : %s ms%n", c.getRetryDelayInMs());
- pw.printf("Priority : %s%n", c.getPriority());
+ pw.printf("Priority : %s%n", c.getThreadPriority());
pw.println();
}
if ( isEmpty ) {
@@ -388,7 +388,7 @@ public class InventoryPlugin implements
pw.printf(" \"maxParallel\" : %s,%n", c.getMaxParallel());
pw.printf(" \"maxRetries\" : %s,%n", c.getMaxRetries());
pw.printf(" \"retryDelayInMs\" : %s,%n", c.getRetryDelayInMs());
- pw.printf(" \"priority\" : \"%s\"%n", c.getPriority());
+ pw.printf(" \"priority\" : \"%s\"%n", c.getThreadPriority());
pw.println(" }");
pw.print(" }");
}
Modified: sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/console/WebConsolePlugin.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/console/WebConsolePlugin.java?rev=1531900&r1=1531899&r2=1531900&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/console/WebConsolePlugin.java (original)
+++ sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/console/WebConsolePlugin.java Mon Oct 14 13:55:41 2013
@@ -24,8 +24,6 @@ import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Collection;
import java.util.Date;
-import java.util.Dictionary;
-import java.util.Hashtable;
import java.util.List;
import java.util.Map;
@@ -45,18 +43,15 @@ import org.apache.sling.event.impl.jobs.
import org.apache.sling.event.impl.jobs.TopologyCapabilities;
import org.apache.sling.event.impl.jobs.config.InternalQueueConfiguration;
import org.apache.sling.event.impl.jobs.config.QueueConfigurationManager;
-import org.apache.sling.event.impl.support.ResourceHelper;
+import org.apache.sling.event.jobs.Job;
import org.apache.sling.event.jobs.JobManager;
-import org.apache.sling.event.jobs.JobUtil;
import org.apache.sling.event.jobs.Queue;
import org.apache.sling.event.jobs.QueueConfiguration;
import org.apache.sling.event.jobs.ScheduleInfo;
import org.apache.sling.event.jobs.ScheduledJobInfo;
import org.apache.sling.event.jobs.Statistics;
import org.apache.sling.event.jobs.TopicStatistics;
-import org.osgi.service.event.Event;
-import org.osgi.service.event.EventAdmin;
-import org.osgi.service.event.EventHandler;
+import org.apache.sling.event.jobs.consumer.JobConsumer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -66,14 +61,14 @@ import org.slf4j.LoggerFactory;
* @since 3.0
*/
@Component
-@Service(value={javax.servlet.Servlet.class, EventHandler.class})
+@Service(value={javax.servlet.Servlet.class, JobConsumer.class})
@Properties({
@Property(name="felix.webconsole.label", value="slingevent"),
@Property(name="felix.webconsole.title", value="Jobs"),
@Property(name="felix.webconsole.category", value="Sling"),
- @Property(name="event.topics", value={"sling/webconsole/test"})
+ @Property(name=JobConsumer.PROPERTY_TOPICS, value={"sling/webconsole/test"})
})
-public class WebConsolePlugin extends HttpServlet implements EventHandler {
+public class WebConsolePlugin extends HttpServlet implements JobConsumer {
private static final String SLING_WEBCONSOLE_TEST_JOB_TOPIC = "sling/webconsole/test";
@@ -85,9 +80,6 @@ public class WebConsolePlugin extends Ht
private JobManager jobManager;
@Reference
- private EventAdmin eventAdmin;
-
- @Reference
private QueueConfigurationManager queueConfigManager;
@Reference
@@ -161,8 +153,7 @@ public class WebConsolePlugin extends Ht
}
}
} else if ( "test".equals(cmd) ) {
- logger.info("Posting test event.");
- eventAdmin.postEvent(getTestEvent(null));
+ this.startTestJob();
} else if ( "restart".equals(cmd) ) {
this.jobManager.restart();
} else if ( "dropall".equals(cmd) ) {
@@ -185,14 +176,9 @@ public class WebConsolePlugin extends Ht
resp.sendRedirect(redirectTo);
}
- private Event getTestEvent(final String id) {
- final Dictionary<String, Object> props = new Hashtable<String, Object>();
- props.put(ResourceHelper.PROPERTY_JOB_TOPIC, SLING_WEBCONSOLE_TEST_JOB_TOPIC);
- if ( id != null ) {
- props.put(ResourceHelper.PROPERTY_JOB_NAME, id);
- }
-
- return new Event(JobUtil.TOPIC_JOB, props);
+ private void startTestJob() {
+ logger.info("Adding test job.");
+ this.jobManager.addJob(SLING_WEBCONSOLE_TEST_JOB_TOPIC, null);
}
@Override
@@ -329,7 +315,7 @@ public class WebConsolePlugin extends Ht
pw.printf("<tr><td>Last Finished</td><td>%s</td><td>Max Parallel</td><td>%s</td></tr>", formatDate(s.getLastFinishedJobTime()), c.getMaxParallel());
pw.printf("<tr><td>Queued Jobs</td><td>%s</td><td>Max Retries</td><td>%s</td></tr>", s.getNumberOfQueuedJobs(), c.getMaxRetries());
pw.printf("<tr><td>Active Jobs</td><td>%s</td><td>Retry Delay</td><td>%s ms</td></tr>", s.getNumberOfActiveJobs(), c.getRetryDelayInMs());
- pw.printf("<tr><td>Jobs</td><td>%s</td><td>Priority</td><td>%s</td></tr>", s.getNumberOfJobs(), c.getPriority());
+ pw.printf("<tr><td>Jobs</td><td>%s</td><td>Priority</td><td>%s</td></tr>", s.getNumberOfJobs(), c.getThreadPriority());
pw.printf("<tr><td>Finished Jobs</td><td>%s</td><td colspan='2'> </td></tr>", s.getNumberOfFinishedJobs());
pw.printf("<tr><td>Failed Jobs</td><td>%s</td><td colspan='2'> </td></tr>", s.getNumberOfFailedJobs());
pw.printf("<tr><td>Cancelled Jobs</td><td>%s</td><td colspan='2'> </td></tr>", s.getNumberOfCancelledJobs());
@@ -462,12 +448,8 @@ public class WebConsolePlugin extends Ht
}
@Override
- public void handleEvent(final Event event) {
- if ( SLING_WEBCONSOLE_TEST_JOB_TOPIC.equals(event.getTopic()) ) {
- logger.info("Received test event.");
-
- JobUtil.acknowledgeJob(event);
- JobUtil.finishedJob(event);
- }
+ public JobResult process(final Job job) {
+ logger.info("Received test event.");
+ return JobResult.OK;
}
}
Modified: sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/queues/AbstractJobQueue.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/queues/AbstractJobQueue.java?rev=1531900&r1=1531899&r2=1531900&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/queues/AbstractJobQueue.java (original)
+++ sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/queues/AbstractJobQueue.java Mon Oct 14 13:55:41 2013
@@ -41,7 +41,7 @@ import org.apache.sling.event.impl.jobs.
import org.apache.sling.event.impl.support.Environment;
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.NotificationConstants;
import org.apache.sling.event.jobs.Queue;
import org.apache.sling.event.jobs.Statistics;
import org.apache.sling.event.jobs.consumer.JobExecutionContext;
@@ -289,7 +289,7 @@ public abstract class AbstractJobQueue
}
final long queueTime = ack.started - ack.queued;
this.addActive(queueTime);
- Utility.sendNotification(this.eventAdmin, JobUtil.TOPIC_JOB_STARTED, ack.getJob(), queueTime);
+ Utility.sendNotification(this.eventAdmin, NotificationConstants.TOPIC_JOB_STARTED, ack.getJob(), queueTime);
synchronized ( this.processsingJobsLists ) {
this.processsingJobsLists.put(jobId, ack);
}
@@ -401,13 +401,13 @@ public abstract class AbstractJobQueue
handler.finished(result.getState(), keepJobs, rescheduleInfo.processingTime);
finishSuccessful = true;
if ( result.getState() == JobState.SUCCEEDED ) {
- Utility.sendNotification(this.eventAdmin, JobUtil.TOPIC_JOB_FINISHED, handler.getJob(), rescheduleInfo.processingTime);
+ Utility.sendNotification(this.eventAdmin, NotificationConstants.TOPIC_JOB_FINISHED, handler.getJob(), rescheduleInfo.processingTime);
} else {
- Utility.sendNotification(this.eventAdmin, JobUtil.TOPIC_JOB_CANCELLED, handler.getJob(), null);
+ Utility.sendNotification(this.eventAdmin, NotificationConstants.TOPIC_JOB_CANCELLED, handler.getJob(), null);
}
} else {
finishSuccessful = handler.reschedule();
- Utility.sendNotification(this.eventAdmin, JobUtil.TOPIC_JOB_FAILED, handler.getJob(), null);
+ Utility.sendNotification(this.eventAdmin, NotificationConstants.TOPIC_JOB_FAILED, handler.getJob(), null);
}
if ( !isAsync ) {
@@ -511,7 +511,7 @@ public abstract class AbstractJobQueue
if ( consumer != null ) {
final long queueTime = handler.started - handler.queued;
this.addActive(queueTime);
- Utility.sendNotification(this.eventAdmin, JobUtil.TOPIC_JOB_STARTED, job, queueTime);
+ Utility.sendNotification(this.eventAdmin, NotificationConstants.TOPIC_JOB_STARTED, job, queueTime);
synchronized ( this.processsingJobsLists ) {
this.processsingJobsLists.put(job.getId(), handler);
}
@@ -530,8 +530,8 @@ public abstract class AbstractJobQueue
final int oldPriority = currentThread.getPriority();
currentThread.setName(oldName + "-" + job.getQueueName() + "(" + job.getTopic() + ")");
- if ( job.getJobPriority() != null ) {
- switch ( job.getJobPriority() ) {
+ if ( configuration.getThreadPriority() != null ) {
+ switch ( configuration.getThreadPriority() ) {
case NORM : currentThread.setPriority(Thread.NORM_PRIORITY);
break;
case MIN : currentThread.setPriority(Thread.MIN_PRIORITY);
@@ -781,7 +781,7 @@ public abstract class AbstractJobQueue
public void run() {
for(final JobHandler job : events) {
job.cancel();
- Utility.sendNotification(eventAdmin, JobUtil.TOPIC_JOB_CANCELLED, job.getJob(), null);
+ Utility.sendNotification(eventAdmin, NotificationConstants.TOPIC_JOB_CANCELLED, job.getJob(), null);
}
}
}, "Apache Sling Queue RemoveAll Thread for " + this.queueName);
Modified: sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/queues/AbstractParallelJobQueue.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/queues/AbstractParallelJobQueue.java?rev=1531900&r1=1531899&r2=1531900&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/queues/AbstractParallelJobQueue.java (original)
+++ sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/queues/AbstractParallelJobQueue.java Mon Oct 14 13:55:41 2013
@@ -134,13 +134,7 @@ public abstract class AbstractParallelJo
put(info);
}
};
- try {
- scheduler.fireJobAt(jobName, t, null, fireDate);
- } catch (Exception e) {
- // we ignore the exception and just put back the job in the queue
- ignoreException(e);
- t.run();
- }
+ scheduler.schedule(t, scheduler.AT(fireDate).name(jobName));
} else {
// put directly into queue
put(info);
Modified: sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/timed/ScheduleInfo.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/timed/ScheduleInfo.java?rev=1531900&r1=1531899&r2=1531900&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/timed/ScheduleInfo.java (original)
+++ sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/timed/ScheduleInfo.java Mon Oct 14 13:55:41 2013
@@ -25,7 +25,6 @@ import java.util.concurrent.atomic.Atomi
import org.apache.sling.event.EventUtil;
import org.apache.sling.event.impl.support.Environment;
import org.apache.sling.event.impl.support.ResourceHelper;
-import org.apache.sling.event.jobs.JobUtil;
import org.osgi.service.event.Event;
final class ScheduleInfo implements Serializable {
Modified: sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/support/ResourceHelper.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/support/ResourceHelper.java?rev=1531900&r1=1531899&r2=1531900&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/support/ResourceHelper.java (original)
+++ sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/support/ResourceHelper.java Mon Oct 14 13:55:41 2013
@@ -77,6 +77,7 @@ public abstract class ResourceHelper {
JobUtil.PROPERTY_JOB_RUN_LOCAL,
JobUtil.PROPERTY_JOB_QUEUE_ORDERED,
JobUtil.PROPERTY_NOTIFICATION_JOB,
+ Job.PROPERTY_JOB_PRIORITY,
JobStatusNotifier.CONTEXT_PROPERTY_NAME,
JobImpl.PROPERTY_DELAY_OVERRIDE,
JobConsumer.PROPERTY_JOB_ASYNC_HANDLER,
Modified: sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/jobs/Job.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/jobs/Job.java?rev=1531900&r1=1531899&r2=1531900&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/jobs/Job.java (original)
+++ sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/jobs/Job.java Mon Oct 14 13:55:41 2013
@@ -21,8 +21,6 @@ package org.apache.sling.event.jobs;
import java.util.Calendar;
import java.util.Set;
-import org.apache.sling.event.jobs.consumer.JobConsumer;
-
import aQute.bnd.annotation.ProviderType;
/**
@@ -56,13 +54,9 @@ public interface Job {
String PROPERTY_JOB_QUEUE_NAME = "event.job.queuename";
/**
- * This property is set by the job handling to define the priority of this job
- * execution.
- * The property is evaluated by the job handling before starting the
- * {@link JobConsumer} and sets the priority of the thread accordingly.
- * For possible values see {@link JobUtil.JobPriority}.
- * If this property is set by the client creating the job it's value is ignored
+ * @deprecated
*/
+ @Deprecated
String PROPERTY_JOB_PRIORITY = "event.job.priority";
/**
@@ -235,12 +229,10 @@ public interface Job {
<T> T getProperty(String name, T defaultValue);
/**
- * This property is set by the job handling to define the priority of this job
- * execution.
- * The property is evaluated by the job handling before starting the
- * {@link JobConsumer} and sets the priority of the thread accordingly.
- * For possible values see {@link JobUtil.JobPriority}.
+ * This property is not supported anymore and always returns {@link JobUtil#JobPriority.NORM}.
+ * @deprecated
*/
+ @Deprecated
JobUtil.JobPriority getJobPriority();
/**
Modified: sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/jobs/JobUtil.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/jobs/JobUtil.java?rev=1531900&r1=1531899&r2=1531900&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/jobs/JobUtil.java (original)
+++ sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/jobs/JobUtil.java Mon Oct 14 13:55:41 2013
@@ -31,7 +31,9 @@ import org.slf4j.LoggerFactory;
* The <code>Job</code> class is an utility class for
* creating and processing jobs.
* @since 3.0
+ * @deprecated
*/
+@Deprecated
public abstract class JobUtil {
/**
@@ -150,6 +152,7 @@ public abstract class JobUtil {
/**
* The priority for jobs.
+ * @deprecated
*/
public enum JobPriority {
NORM,
@@ -176,50 +179,32 @@ public abstract class JobUtil {
*/
/**
- * Asynchronous notification event when a job is started.
- * The property {@link #NOTIFICATION_PROPERTY_JOB_TOPIC} contains the job topic,
- * the property {@link #NOTIFICATION_PROPERTY_JOB_NAME} might contain the job name,
- * and the property {@link #NOTIFICATION_PROPERTY_JOB_ID} contains the unique job id.
- * The time stamp of the event (as a Long) is available from the property
- * {@link org.osgi.service.event.EventConstants#TIMESTAMP}.
- * The payload of the job is available as additional job specific properties.
- */
- public static final String TOPIC_JOB_STARTED = "org/apache/sling/event/notification/job/START";
-
- /**
- * Asynchronous notification event when a job is finished.
- * The property {@link #NOTIFICATION_PROPERTY_JOB_TOPIC} contains the job topic,
- * the property {@link #NOTIFICATION_PROPERTY_JOB_NAME} might contain the job name,
- * and the property {@link #NOTIFICATION_PROPERTY_JOB_ID} contains the unique job id.
- * The time stamp of the event (as a Long) is available from the property
- * {@link org.osgi.service.event.EventConstants#TIMESTAMP}.
- * The payload of the job is available as additional job specific properties.
- */
- public static final String TOPIC_JOB_FINISHED = "org/apache/sling/event/notification/job/FINISHED";
-
- /**
- * Asynchronous notification event when a job failed.
- * If a job execution fails, it is rescheduled for another try.
- * The property {@link #NOTIFICATION_PROPERTY_JOB_TOPIC} contains the job topic,
- * the property {@link #NOTIFICATION_PROPERTY_JOB_NAME} might contain the job name,
- * and the property {@link #NOTIFICATION_PROPERTY_JOB_ID} contains the unique job id.
- * The time stamp of the event (as a Long) is available from the property
- * {@link org.osgi.service.event.EventConstants#TIMESTAMP}.
- * The payload of the job is available as additional job specific properties.
- */
- public static final String TOPIC_JOB_FAILED = "org/apache/sling/event/notification/job/FAILED";
-
- /** A
- * synchronous notification event when a job is cancelled.
- * If a job execution is cancelled it is not rescheduled.
- * The property {@link #NOTIFICATION_PROPERTY_JOB_TOPIC} contains the job topic,
- * the property {@link #NOTIFICATION_PROPERTY_JOB_NAME} might contain the job name,
- * and the property {@link #NOTIFICATION_PROPERTY_JOB_ID} contains the unique job id.
- * The time stamp of the event (as a Long) is available from the property
- * {@link org.osgi.service.event.EventConstants#TIMESTAMP}.
- * The payload of the job is available as additional job specific properties.
+ * @see NotificationConstants#TOPIC_JOB_STARTED
+ * @deprecated Use NotificationConstants#TOPIC_JOB_STARTED
*/
- public static final String TOPIC_JOB_CANCELLED = "org/apache/sling/event/notification/job/CANCELLED";
+ @Deprecated
+ public static final String TOPIC_JOB_STARTED = NotificationConstants.TOPIC_JOB_STARTED;
+
+ /**
+ * @see NotificationConstants#TOPIC_JOB_FINISHED
+ * @deprecated Use NotificationConstants#TOPIC_JOB_FINISHED
+ */
+ @Deprecated
+ public static final String TOPIC_JOB_FINISHED = NotificationConstants.TOPIC_JOB_FINISHED;
+
+ /**
+ * @see NotificationConstants#TOPIC_JOB_FAILED
+ * @deprecated Use NotificationConstants#TOPIC_JOB_FAILED
+ */
+ @Deprecated
+ public static final String TOPIC_JOB_FAILED = NotificationConstants.TOPIC_JOB_FAILED;
+
+ /**
+ * @see NotificationConstants#TOPIC_JOB_CANCELLED
+ * @deprecated Use NotificationConstants#TOPIC_JOB_CANCELLED
+ */
+ @Deprecated
+ public static final String TOPIC_JOB_CANCELLED = NotificationConstants.TOPIC_JOB_CANCELLED;
/**
* Property containing the job event. The value is of type org.osgi.service.event.Event.
@@ -229,22 +214,25 @@ public abstract class JobUtil {
public static final String PROPERTY_NOTIFICATION_JOB = "event.notification.job";
/**
- * Property containing the job topic. Value is of type String.
- * @see Job#getTopic()
+ * @see NotificationConstants#NOTIFICATION_PROPERTY_JOB_TOPIC
+ * @deprecated Use NotificationConstants#NOTIFICATION_PROPERTY_JOB_TOPIC
*/
- public static final String NOTIFICATION_PROPERTY_JOB_TOPIC = "event.job.topic";
+ @Deprecated
+ public static final String NOTIFICATION_PROPERTY_JOB_TOPIC = NotificationConstants.NOTIFICATION_PROPERTY_JOB_TOPIC;
/**
- * Property containing the optional job name. Value is of type String.
- * @see Job#getName()
+ * @see NotificationConstants#NOTIFICATION_PROPERTY_JOB_NAME
+ * @deprecated Use NotificationConstants#NOTIFICATION_PROPERTY_JOB_NAME
*/
- public static final String NOTIFICATION_PROPERTY_JOB_NAME = "event.job.id";
+ @Deprecated
+ public static final String NOTIFICATION_PROPERTY_JOB_NAME = NotificationConstants.NOTIFICATION_PROPERTY_JOB_NAME;
/**
- * Property containing the unique job ID. Value is of type String.
- * @see Job#getId()
+ * @see NotificationConstants#NOTIFICATION_PROPERTY_JOB_ID
+ * @deprecated Use NotificationConstants#NOTIFICATION_PROPERTY_JOB_ID
*/
- public static final String NOTIFICATION_PROPERTY_JOB_ID = "slingevent:eventId";
+ @Deprecated
+ public static final String NOTIFICATION_PROPERTY_JOB_ID = NotificationConstants.NOTIFICATION_PROPERTY_JOB_ID;
/**
* Is this a job event?
Added: sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/jobs/NotificationConstants.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/jobs/NotificationConstants.java?rev=1531900&view=auto
==============================================================================
--- sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/jobs/NotificationConstants.java (added)
+++ sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/jobs/NotificationConstants.java Mon Oct 14 13:55:41 2013
@@ -0,0 +1,95 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling.event.jobs;
+
+
+/**
+ * This class contains constants for event notifications
+ * @since 1.3
+ */
+public abstract class NotificationConstants {
+
+ /**
+ * Asynchronous notification event when a job is started.
+ * The property {@link #NOTIFICATION_PROPERTY_JOB_TOPIC} contains the job topic,
+ * the property {@link #NOTIFICATION_PROPERTY_JOB_NAME} might contain the job name,
+ * and the property {@link #NOTIFICATION_PROPERTY_JOB_ID} contains the unique job id.
+ * The time stamp of the event (as a Long) is available from the property
+ * {@link org.osgi.service.event.EventConstants#TIMESTAMP}.
+ * The payload of the job is available as additional job specific properties.
+ */
+ public static final String TOPIC_JOB_STARTED = "org/apache/sling/event/notification/job/START";
+
+ /**
+ * Asynchronous notification event when a job is finished.
+ * The property {@link #NOTIFICATION_PROPERTY_JOB_TOPIC} contains the job topic,
+ * the property {@link #NOTIFICATION_PROPERTY_JOB_NAME} might contain the job name,
+ * and the property {@link #NOTIFICATION_PROPERTY_JOB_ID} contains the unique job id.
+ * The time stamp of the event (as a Long) is available from the property
+ * {@link org.osgi.service.event.EventConstants#TIMESTAMP}.
+ * The payload of the job is available as additional job specific properties.
+ */
+ public static final String TOPIC_JOB_FINISHED = "org/apache/sling/event/notification/job/FINISHED";
+
+ /**
+ * Asynchronous notification event when a job failed.
+ * If a job execution fails, it is rescheduled for another try.
+ * The property {@link #NOTIFICATION_PROPERTY_JOB_TOPIC} contains the job topic,
+ * the property {@link #NOTIFICATION_PROPERTY_JOB_NAME} might contain the job name,
+ * and the property {@link #NOTIFICATION_PROPERTY_JOB_ID} contains the unique job id.
+ * The time stamp of the event (as a Long) is available from the property
+ * {@link org.osgi.service.event.EventConstants#TIMESTAMP}.
+ * The payload of the job is available as additional job specific properties.
+ */
+ public static final String TOPIC_JOB_FAILED = "org/apache/sling/event/notification/job/FAILED";
+
+ /** A
+ * synchronous notification event when a job is cancelled.
+ * If a job execution is cancelled it is not rescheduled.
+ * The property {@link #NOTIFICATION_PROPERTY_JOB_TOPIC} contains the job topic,
+ * the property {@link #NOTIFICATION_PROPERTY_JOB_NAME} might contain the job name,
+ * and the property {@link #NOTIFICATION_PROPERTY_JOB_ID} contains the unique job id.
+ * The time stamp of the event (as a Long) is available from the property
+ * {@link org.osgi.service.event.EventConstants#TIMESTAMP}.
+ * The payload of the job is available as additional job specific properties.
+ */
+ public static final String TOPIC_JOB_CANCELLED = "org/apache/sling/event/notification/job/CANCELLED";
+
+ /**
+ * Property containing the job topic. Value is of type String.
+ * @see Job#getTopic()
+ */
+ public static final String NOTIFICATION_PROPERTY_JOB_TOPIC = "event.job.topic";
+
+ /**
+ * Property containing the optional job name. Value is of type String.
+ * @see Job#getName()
+ */
+ public static final String NOTIFICATION_PROPERTY_JOB_NAME = "event.job.id";
+
+ /**
+ * Property containing the unique job ID. Value is of type String.
+ * @see Job#getId()
+ */
+ public static final String NOTIFICATION_PROPERTY_JOB_ID = "slingevent:eventId";
+
+ private NotificationConstants() {
+ // avoid instantiation
+ }
+}
\ No newline at end of file
Propchange: sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/jobs/NotificationConstants.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/jobs/NotificationConstants.java
------------------------------------------------------------------------------
svn:keywords = author date id revision rev url
Propchange: sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/jobs/NotificationConstants.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/jobs/QueueConfiguration.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/jobs/QueueConfiguration.java?rev=1531900&r1=1531899&r2=1531900&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/jobs/QueueConfiguration.java (original)
+++ sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/jobs/QueueConfiguration.java Mon Oct 14 13:55:41 2013
@@ -38,6 +38,16 @@ public interface QueueConfiguration {
}
/**
+ * The thread priority.
+ * @since 1.3
+ */
+ static enum ThreadPriority {
+ NORM,
+ MIN,
+ MAX
+ }
+
+ /**
* Return the retry delay in ms
*/
long getRetryDelayInMs();
@@ -54,10 +64,17 @@ public interface QueueConfiguration {
/**
* Return the thread priority for the job thread.
+ * @deprecated Use {@link #getThreadPriority()}
*/
+ @Deprecated
JobUtil.JobPriority getPriority();
/**
+ * Return the thread priority for the job thread
+ */
+ ThreadPriority getThreadPriority();
+
+ /**
* Return the max number of parallel processes.
*/
int getMaxParallel();
Modified: sling/trunk/bundles/extensions/event/src/test/java/org/apache/sling/event/it/ClassloadingTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/event/src/test/java/org/apache/sling/event/it/ClassloadingTest.java?rev=1531900&r1=1531899&r2=1531900&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/event/src/test/java/org/apache/sling/event/it/ClassloadingTest.java (original)
+++ sling/trunk/bundles/extensions/event/src/test/java/org/apache/sling/event/it/ClassloadingTest.java Mon Oct 14 13:55:41 2013
@@ -37,6 +37,7 @@ import org.apache.sling.event.impl.jobs.
import org.apache.sling.event.jobs.Job;
import org.apache.sling.event.jobs.JobManager;
import org.apache.sling.event.jobs.JobUtil;
+import org.apache.sling.event.jobs.NotificationConstants;
import org.apache.sling.event.jobs.QueueConfiguration;
import org.apache.sling.event.jobs.consumer.JobConsumer;
import org.apache.sling.testing.tools.retry.RetryLoop;
@@ -99,7 +100,7 @@ public class ClassloadingTest extends Ab
return JobResult.OK;
}
});
- final ServiceRegistration ehReg = this.registerEventHandler(JobUtil.TOPIC_JOB_FINISHED,
+ final ServiceRegistration ehReg = this.registerEventHandler(NotificationConstants.TOPIC_JOB_FINISHED,
new EventHandler() {
@Override
@@ -148,7 +149,7 @@ public class ClassloadingTest extends Ab
}
}, CONDITION_TIMEOUT_SECONDS, CONDITION_INTERVAL_MILLIS);
- final String jobTopic = (String)finishedEvents.get(0).getProperty(JobUtil.NOTIFICATION_PROPERTY_JOB_TOPIC);
+ final String jobTopic = (String)finishedEvents.get(0).getProperty(NotificationConstants.NOTIFICATION_PROPERTY_JOB_TOPIC);
assertNotNull(jobTopic);
assertEquals("Hello", finishedEvents.get(0).getProperty("string"));
assertEquals(new Integer(5), Integer.valueOf(finishedEvents.get(0).getProperty("int").toString()));