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 2015/10/26 11:16:43 UTC

svn commit: r1710549 [2/2] - in /sling/trunk/bundles/extensions/event: ./ src/main/java/org/apache/sling/event/ src/main/java/org/apache/sling/event/impl/jobs/ src/main/java/org/apache/sling/event/impl/jobs/config/ src/main/java/org/apache/sling/event/...

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=1710549&r1=1710548&r2=1710549&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 26 10:16:42 2015
@@ -54,12 +54,6 @@ public interface Job {
     String PROPERTY_JOB_QUEUE_NAME = "event.job.queuename";
 
     /**
-     * @deprecated
-     */
-    @Deprecated
-    String PROPERTY_JOB_PRIORITY = "event.job.priority";
-
-    /**
      * The property to track the retry count for jobs. Value is of type Integer.
      * On first execution the value of this property is zero.
      * This property is managed by the job handling.
@@ -201,14 +195,6 @@ public interface Job {
     String getId();
 
     /**
-     * Optional job name
-     * @return The job name or <code>null</code>
-     * @deprecated
-     */
-    @Deprecated
-    String getName();
-
-    /**
      * Get the value of a property.
      * @param name The property name
      * @return The value of the property or <code>null</code>
@@ -252,13 +238,6 @@ public interface Job {
     <T> T getProperty(String name, T defaultValue);
 
     /**
-     * This property is not supported anymore and always returns {@link JobUtil#JobPriority.NORM}.
-     * @deprecated
-     */
-    @Deprecated
-    JobUtil.JobPriority getJobPriority();
-
-    /**
      * On first execution the value of this property is zero.
      * This property is managed by the job handling.
      */

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=1710549&r1=1710548&r2=1710549&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 Mon Oct 26 10:16:42 2015
@@ -21,8 +21,6 @@ package org.apache.sling.event.jobs;
 import java.util.Collection;
 import java.util.Map;
 
-import org.osgi.service.event.Event;
-
 import aQute.bnd.annotation.ProviderType;
 
 
@@ -207,131 +205,4 @@ public interface JobManager {
      * @since 1.4
      */
     Collection<ScheduledJobInfo> getScheduledJobs(String topic, long limit, Map<String, Object>... templates);
-
-    /**
-     * Restart the job manager.
-     * This method restarts the job manager and all queues - currently processed jobs will be finished.
-     * The job manager should only be restarted if really necessary!
-     * @deprecated This method does nothing
-     */
-    @Deprecated
-    void restart();
-
-    /**
-     * Add a new job
-     *
-     * If the topic is <code>null</code> or illegal, no job is created and <code>null</code> is returned.
-     * If properties are provided, all of them must be serializable. If there are non serializable
-     * objects in the properties, no job is created and <code>null</code> is returned.
-     * A job topic is a hierarchical name separated by dashes, each part has to start with a letter,
-     * allowed characters are letters, numbers and the underscore.
-     *
-     * This method allows to specify a job name which should uniquely identify this job. If a job with
-     * the same name is started on different instances, the job is still processed only once. However,
-     * the topology api in combination with the leader selection provides a better way for
-     * dealing with this situation and as jobs with name come with a heavy processing overhead
-     * these should be avoided.
-     *
-     * The returned job object is a snapshot of the job state taken at the time of creation. Updates
-     * to the job state are not reflected and the client needs to get a new job object using the job id.
-     *
-     * If the queue for processing this job is configured to drop the job, <code>null</code> is returned
-     * as well.
-     *
-     * @param topic The required job topic.
-     * @param name  Optional unique job name
-     * @param properties Optional job properties. The properties must be serializable.
-     * @return The new job - or <code>null</code> if the job could not be created.
-     * @since 1.2
-     * @deprecated
-     */
-    @Deprecated
-    Job addJob(String topic, String name, Map<String, Object> properties);
-
-    /**
-     * Return a job based on the unique job name.
-     *
-     * The returned job object is a snapshot of the job state taken at the time of the call. Updates
-     * to the job state are not reflected and the client needs to get a new job object using the job id.
-     *
-     * @return A job or <code>null</code>
-     * @since 1.2
-     * @deprecated
-     */
-    @Deprecated
-    Job getJobByName(String name);
-
-    /**
-     * Return all jobs either running or scheduled.
-     *
-     * @param type Required parameter for the type: either all jobs, only queued or only started can be returned.
-     * @param topic Topic can be used as a filter, if it is non-null, only jobs with this topic will be returned.
-     * @param templates A list of filter property maps. Each map acts like a template. The searched job
-     *                    must match the template (AND query). By providing several maps, different filters
-     *                    are possible (OR query).
-     * @return A non null collection.
-     * @deprecated Use {@link #findJobs(QueryType, String, long, Map...)}
-     */
-    @Deprecated
-    JobsIterator queryJobs(QueryType type, String topic, Map<String, Object>... templates);
-
-    /**
-     * Return all jobs either running or scheduled.
-     *
-     * @param type Required parameter for the type: either all jobs, only queued or only started can be returned.
-     * @param topic Topic can be used as a filter, if it is non-null, only jobs with this topic will be returned.
-     * @param limit A positive number indicating the maximum number of jobs returned by the iterator.
-     * @param templates A list of filter property maps. Each map acts like a template. The searched job
-     *                    must match the template (AND query). By providing several maps, different filters
-     *                    are possible (OR query).
-     * @return A non null collection.
-     * @since 1.1
-     * @deprecated Use {@link #findJobs(QueryType, String, long, Map...)}
-     */
-    @Deprecated
-    JobsIterator queryJobs(QueryType type, String topic, long limit, Map<String, Object>... templates);
-
-    /**
-     * Find a job - either scheduled or active.
-     * This method searches for an event with the given topic and filter properties. If more than one
-     * job matches, the first one found is returned which could be any of the matching jobs.
-     *
-     * @param topic Topic is required.
-     * @param template The map acts like a template. The searched job
-     *                    must match the template (AND query).
-     * @return An event or <code>null</code>
-     * @deprecated Use {@link #getJob(String, Map)}
-     */
-    @Deprecated
-    Event findJob(String topic, Map<String, Object> template);
-
-    /**
-     * Cancel this job.
-     * Canceling a job might fail if the job is currently in processing.
-     * @param jobId The unique identifier as found in the property {@link JobUtil#JOB_ID}.
-     * @return <code>true</code> if the job could be cancelled or does not exist anymore.
-     *         <code>false</code> otherwise.
-     * @deprecated Use {@link #removeJobById(String)}
-     */
-    @Deprecated
-    boolean removeJob(String jobId);
-
-    /**
-     * Cancel this job.
-     * This method acts like {@link #removeJob(String)} with the exception that it waits
-     * for a job to finish. The job will be removed when this method returns - however
-     * this method blocks until the job is finished!
-     * @param jobId The unique identifier as found in the property {@link JobUtil#JOB_ID}.
-     * @deprecated Use {@link #removeJobById(String)}
-     */
-    @Deprecated
-    void forceRemoveJob(String jobId);
-
-    /**
-     * Is job processing enabled?
-     * It is possible to completely turn off job processing.
-     * @deprecated This method always returns true
-     */
-    @Deprecated
-    boolean isJobProcessingEnabled();
 }

Modified: sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/jobs/Queue.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/jobs/Queue.java?rev=1710549&r1=1710548&r2=1710549&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/jobs/Queue.java (original)
+++ sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/jobs/Queue.java Mon Oct 26 10:16:42 2015
@@ -70,15 +70,6 @@ public interface Queue {
     boolean isSuspended();
 
     /**
-     * Remove all outstanding jobs from the queue. This does not delete
-     * the jobs. The jobs are either processed by a different cluster node
-     * or on restart.
-     * @deprecated This method does nothing anymore
-     */
-    @Deprecated
-    void clear();
-
-    /**
      * Remove all outstanding jobs and delete them. This actually cancels
      * all outstanding jobs.
      */

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=1710549&r1=1710548&r2=1710549&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 26 10:16:42 2015
@@ -33,10 +33,8 @@ public interface QueueConfiguration {
         UNORDERED,          // unordered, parallel processing (push)
         ORDERED,            // ordered, FIFO (push)
         TOPIC_ROUND_ROBIN,  // unordered, parallel processing, executed based on topic (push)
-        @Deprecated
-        IGNORE,             // This queue type is not supported anymore
-        @Deprecated
-        DROP                // This queue type is not supported anymore
+        _UNSUPPORTED_1,     // This queue type is not supported anymore
+        _UNSUPPORTED_2      // This queue type is not supported anymore
     }
 
     /**
@@ -65,13 +63,6 @@ public interface QueueConfiguration {
     Type getType();
 
     /**
-     * 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();
@@ -82,18 +73,6 @@ public interface QueueConfiguration {
     int getMaxParallel();
 
     /**
-     * @deprecated This information is not used anymore
-     */
-    @Deprecated
-    boolean isLocalQueue();
-
-    /**
-     * @deprecated This information is not used anymore
-     */
-    @Deprecated
-    String[] getApplicationIds();
-
-    /**
      * The list of topics this queue is bound to.
      */
     String[] getTopics();

Modified: sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/jobs/package-info.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/jobs/package-info.java?rev=1710549&r1=1710548&r2=1710549&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/jobs/package-info.java (original)
+++ sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/jobs/package-info.java Mon Oct 26 10:16:42 2015
@@ -17,7 +17,7 @@
  * under the License.
  */
 
-@Version("1.6.0")
+@Version("2.0.0")
 package org.apache.sling.event.jobs;
 
 import aQute.bnd.annotation.Version;

Modified: sling/trunk/bundles/extensions/event/src/test/java/org/apache/sling/event/impl/jobs/JobsImplTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/event/src/test/java/org/apache/sling/event/impl/jobs/JobsImplTest.java?rev=1710549&r1=1710548&r2=1710549&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/event/src/test/java/org/apache/sling/event/impl/jobs/JobsImplTest.java (original)
+++ sling/trunk/bundles/extensions/event/src/test/java/org/apache/sling/event/impl/jobs/JobsImplTest.java Mon Oct 26 10:16:42 2015
@@ -37,11 +37,11 @@ public class JobsImplTest {
         final Map<String, Object> properties = new HashMap<String, Object>();
         properties.put(Job.PROPERTY_JOB_CREATED, now);
 
-        final JobImpl job1 = new JobImpl("test", null, "hello_1", properties);
-        final JobImpl job2 = new JobImpl("test", null, "hello_2", properties);
-        final JobImpl job3 = new JobImpl("test", null, "hello_4", properties);
-        final JobImpl job4 = new JobImpl("test", null, "hello_30", properties);
-        final JobImpl job5 = new JobImpl("test", null, "hello_50", properties);
+        final JobImpl job1 = new JobImpl("test", "hello_1", properties);
+        final JobImpl job2 = new JobImpl("test", "hello_2", properties);
+        final JobImpl job3 = new JobImpl("test", "hello_4", properties);
+        final JobImpl job4 = new JobImpl("test", "hello_30", properties);
+        final JobImpl job5 = new JobImpl("test", "hello_50", properties);
 
         final List<JobImpl> list = new ArrayList<JobImpl>();
         list.add(job5);

Modified: sling/trunk/bundles/extensions/event/src/test/java/org/apache/sling/event/impl/jobs/config/TopologyCapabilitiesTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/event/src/test/java/org/apache/sling/event/impl/jobs/config/TopologyCapabilitiesTest.java?rev=1710549&r1=1710548&r2=1710549&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/event/src/test/java/org/apache/sling/event/impl/jobs/config/TopologyCapabilitiesTest.java (original)
+++ sling/trunk/bundles/extensions/event/src/test/java/org/apache/sling/event/impl/jobs/config/TopologyCapabilitiesTest.java Mon Oct 26 10:16:42 2015
@@ -57,15 +57,15 @@ public class TopologyCapabilitiesTest {
     }
 
     @Test public void testMatching() {
-        assertEquals(1, caps.getPotentialTargets("foo", null).size());
-        assertEquals(0, caps.getPotentialTargets("foo/a", null).size());
-        assertEquals(0, caps.getPotentialTargets("bar", null).size());
-        assertEquals(1, caps.getPotentialTargets("bar/foo", null).size());
-        assertEquals(0, caps.getPotentialTargets("bar/foo/a", null).size());
-        assertEquals(1, caps.getPotentialTargets("a/b", null).size());
-        assertEquals(1, caps.getPotentialTargets("a/b(c", null).size());
-        assertEquals(0, caps.getPotentialTargets("x", null).size());
-        assertEquals(0, caps.getPotentialTargets("x/y", null).size());
-        assertEquals(1, caps.getPotentialTargets("d/1/2", null).size());
+        assertEquals(1, caps.getPotentialTargets("foo").size());
+        assertEquals(0, caps.getPotentialTargets("foo/a").size());
+        assertEquals(0, caps.getPotentialTargets("bar").size());
+        assertEquals(1, caps.getPotentialTargets("bar/foo").size());
+        assertEquals(0, caps.getPotentialTargets("bar/foo/a").size());
+        assertEquals(1, caps.getPotentialTargets("a/b").size());
+        assertEquals(1, caps.getPotentialTargets("a/b(c").size());
+        assertEquals(0, caps.getPotentialTargets("x").size());
+        assertEquals(0, caps.getPotentialTargets("x/y").size());
+        assertEquals(1, caps.getPotentialTargets("d/1/2").size());
     }
 }

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=1710549&r1=1710548&r2=1710549&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 26 10:16:42 2015
@@ -19,7 +19,6 @@
 package org.apache.sling.event.it;
 
 import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
 
 import java.io.IOException;
 import java.io.Serializable;
@@ -32,7 +31,6 @@ import java.util.List;
 import java.util.Map;
 import java.util.concurrent.atomic.AtomicInteger;
 
-import org.apache.sling.event.EventPropertiesMap;
 import org.apache.sling.event.impl.jobs.config.ConfigurationConstants;
 import org.apache.sling.event.jobs.Job;
 import org.apache.sling.event.jobs.JobManager;
@@ -86,7 +84,7 @@ public class ClassloadingTest extends Ab
         this.removeConfiguration(this.queueConfigPid);
         super.cleanup();
     }
-
+/*
     @Test(timeout = DEFAULT_TEST_TIMEOUT)
     public void testSimpleClassloading() throws Exception {
         final AtomicInteger processedJobsCount = new AtomicInteger(0);
@@ -165,7 +163,7 @@ public class ClassloadingTest extends Ab
             ehReg.unregister();
         }
     }
-
+*/
     @Test(timeout = DEFAULT_TEST_TIMEOUT)
     public void testFailedClassloading() throws Exception {
         final AtomicInteger failedJobsCount = new AtomicInteger(0);