You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by di...@apache.org on 2021/12/30 12:54:13 UTC

[sling-org-apache-sling-sitemap] branch master updated: SLING-11036: use dedicated threadpool for scheduled jobs (#4)

This is an automated email from the ASF dual-hosted git repository.

diru pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-sitemap.git


The following commit(s) were added to refs/heads/master by this push:
     new 5e44147  SLING-11036: use dedicated threadpool for scheduled jobs (#4)
5e44147 is described below

commit 5e441476f66ab8400c4fffea6664b23dd8df5b77
Author: Dirk Rudolph <di...@apache.org>
AuthorDate: Thu Dec 30 13:54:06 2021 +0100

    SLING-11036: use dedicated threadpool for scheduled jobs (#4)
---
 src/main/java/org/apache/sling/sitemap/impl/SitemapScheduler.java | 5 ++++-
 src/main/java/org/apache/sling/sitemap/impl/SitemapStorage.java   | 4 +++-
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/main/java/org/apache/sling/sitemap/impl/SitemapScheduler.java b/src/main/java/org/apache/sling/sitemap/impl/SitemapScheduler.java
index ec6898d..d0fdc72 100644
--- a/src/main/java/org/apache/sling/sitemap/impl/SitemapScheduler.java
+++ b/src/main/java/org/apache/sling/sitemap/impl/SitemapScheduler.java
@@ -48,7 +48,8 @@ import static org.apache.sling.sitemap.SitemapUtil.findSitemapRoots;
         configurationPolicy = ConfigurationPolicy.REQUIRE,
         property = {
                 Scheduler.PROPERTY_SCHEDULER_CONCURRENT + ":Boolean=false",
-                Scheduler.PROPERTY_SCHEDULER_RUN_ON + "=" + Scheduler.VALUE_RUN_ON_SINGLE
+                Scheduler.PROPERTY_SCHEDULER_RUN_ON + "=" + Scheduler.VALUE_RUN_ON_SINGLE,
+                Scheduler.PROPERTY_SCHEDULER_THREAD_POOL + "=" + SitemapScheduler.THREADPOOL_NAME
         }
 )
 @Designate(ocd = SitemapScheduler.Configuration.class, factory = true)
@@ -83,6 +84,8 @@ public class SitemapScheduler implements Runnable {
         String searchPath() default "/content";
     }
 
+    public static final String THREADPOOL_NAME = "org-apache-sling-sitemap";
+
     private static final Logger LOG = LoggerFactory.getLogger(SitemapScheduler.class);
     private static final Map<String, Object> AUTH = Collections.singletonMap(ResourceResolverFactory.SUBSERVICE,
             "sitemap-reader");
diff --git a/src/main/java/org/apache/sling/sitemap/impl/SitemapStorage.java b/src/main/java/org/apache/sling/sitemap/impl/SitemapStorage.java
index 5ba3273..9acbecf 100644
--- a/src/main/java/org/apache/sling/sitemap/impl/SitemapStorage.java
+++ b/src/main/java/org/apache/sling/sitemap/impl/SitemapStorage.java
@@ -58,7 +58,8 @@ import static org.apache.sling.sitemap.impl.SitemapEventUtil.newUpdateEvent;
         property = {
                 Scheduler.PROPERTY_SCHEDULER_NAME + "=sitemap-storage-cleanup",
                 Scheduler.PROPERTY_SCHEDULER_CONCURRENT + ":Boolean=false",
-                Scheduler.PROPERTY_SCHEDULER_RUN_ON + "=" + Scheduler.VALUE_RUN_ON_SINGLE
+                Scheduler.PROPERTY_SCHEDULER_RUN_ON + "=" + Scheduler.VALUE_RUN_ON_SINGLE,
+                Scheduler.PROPERTY_SCHEDULER_THREAD_POOL + "=" + SitemapScheduler.THREADPOOL_NAME
         }
 )
 @Designate(ocd = SitemapStorage.Configuration.class)
@@ -146,6 +147,7 @@ public class SitemapStorage implements Runnable {
                 }
             }
             for (Resource resource : toDelete) {
+                LOG.debug("Purging: {}", resource.getPath());
                 resolver.delete(resource);
             }
             resolver.commit();