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

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


The following commit(s) were added to refs/heads/master by this push:
     new d71467e  SLING-13419 : bump quartz to 2.5.2 (#9)
d71467e is described below

commit d71467e6e233bf9ccfefc9b5403ba479580701a5
Author: Rishabh Kumar <[email protected]>
AuthorDate: Wed Nov 11 20:27:24 2026 +0530

    SLING-13419 : bump quartz to 2.5.2 (#9)
    
    Co-authored-by: Rishabh Kumar <[email protected]>
    Co-authored-by: Copilot <[email protected]>
---
 bnd.bnd                                            |  4 ++
 pom.xml                                            |  6 +-
 .../commons/scheduler/impl/QuartzThreadPool.java   |  1 +
 .../commons/scheduler/impl/WebConsolePrinter.java  |  2 +-
 .../scheduler/impl/QuartzThreadPoolTest.java       | 66 ++++++++++++++++++++++
 5 files changed, 75 insertions(+), 4 deletions(-)

diff --git a/bnd.bnd b/bnd.bnd
index b14a124..1f801af 100644
--- a/bnd.bnd
+++ b/bnd.bnd
@@ -1,6 +1,10 @@
 Import-Package: \
     !commonj.work, \
     !com.mchange.v2.c3p0, \
+    !jakarta.servlet, \
+    !jakarta.servlet.http, \
+    !jakarta.transaction, \
+    !jakarta.xml.bind, \
     !javax.ejb, \
     !javax.jms, \
     !javax.mail, \
diff --git a/pom.xml b/pom.xml
index 5590bf2..d7c7bfa 100644
--- a/pom.xml
+++ b/pom.xml
@@ -29,7 +29,7 @@
 
     <artifactId>org.apache.sling.commons.scheduler</artifactId>
     <packaging>jar</packaging>
-    <version>2.7.15-SNAPSHOT</version>
+    <version>2.8.0-SNAPSHOT</version>
 
     <name>Apache Sling Commons Scheduler Support</name>
     <description>
@@ -37,7 +37,7 @@
     </description>
 
     <properties>
-        <sling.java.version>8</sling.java.version>
+        <sling.java.version>11</sling.java.version>
     </properties>
 
     <scm>
@@ -144,7 +144,7 @@
         <dependency>
             <groupId>org.quartz-scheduler</groupId>
             <artifactId>quartz</artifactId>
-            <version>2.3.2</version>
+            <version>2.5.2</version>
             <scope>compile</scope>
         </dependency>
         <dependency>
diff --git 
a/src/main/java/org/apache/sling/commons/scheduler/impl/QuartzThreadPool.java 
b/src/main/java/org/apache/sling/commons/scheduler/impl/QuartzThreadPool.java
index cbe5d75..f1522c7 100644
--- 
a/src/main/java/org/apache/sling/commons/scheduler/impl/QuartzThreadPool.java
+++ 
b/src/main/java/org/apache/sling/commons/scheduler/impl/QuartzThreadPool.java
@@ -103,6 +103,7 @@ public class QuartzThreadPool implements 
org.quartz.spi.ThreadPool {
                     this.lock.wait();
                 } catch (final InterruptedException e) {
                     Thread.currentThread().interrupt();
+                    return 0;
                 }
             }
             return this.counter;
diff --git 
a/src/main/java/org/apache/sling/commons/scheduler/impl/WebConsolePrinter.java 
b/src/main/java/org/apache/sling/commons/scheduler/impl/WebConsolePrinter.java
index dc0bea6..b27f66b 100644
--- 
a/src/main/java/org/apache/sling/commons/scheduler/impl/WebConsolePrinter.java
+++ 
b/src/main/java/org/apache/sling/commons/scheduler/impl/WebConsolePrinter.java
@@ -100,7 +100,7 @@ public class WebConsolePrinter {
                                 final JobInfo info = new JobInfo();
                                 info.name = desc.name;
                                 info.className = desc.job.getClass().getName();
-                                info.concurrent = 
!detail.isConcurrentExectionDisallowed();
+                                info.concurrent = 
!detail.isConcurrentExecutionDisallowed();
                                 // check run on information
                                 if ( desc.runOn != null ) {
                                     if ( desc.isRunOnLeader() ) {
diff --git 
a/src/test/java/org/apache/sling/commons/scheduler/impl/QuartzThreadPoolTest.java
 
b/src/test/java/org/apache/sling/commons/scheduler/impl/QuartzThreadPoolTest.java
new file mode 100644
index 0000000..cef5fff
--- /dev/null
+++ 
b/src/test/java/org/apache/sling/commons/scheduler/impl/QuartzThreadPoolTest.java
@@ -0,0 +1,66 @@
+/*
+ * 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.commons.scheduler.impl;
+
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import org.apache.sling.commons.threads.ModifiableThreadPoolConfig;
+import org.apache.sling.commons.threads.ThreadPool;
+import org.junit.Assert;
+import org.junit.Test;
+import org.mockito.ArgumentCaptor;
+import org.mockito.Mockito;
+
+/**
+ * Tests for {@link QuartzThreadPool}.
+ */
+public class QuartzThreadPoolTest {
+
+    /**
+     * An interrupted scheduler must release the pool lock so jobs and 
shutdown can proceed.
+     */
+    @Test(timeout = 5000)
+    public void testInterruptedWaitReleasesPoolLock() throws 
InterruptedException {
+        ModifiableThreadPoolConfig config = new ModifiableThreadPoolConfig();
+        config.setMaxPoolSize(1);
+        ThreadPool executor = Mockito.mock(ThreadPool.class);
+        Mockito.when(executor.getConfiguration()).thenReturn(config);
+        QuartzThreadPool pool = new QuartzThreadPool(executor);
+        Assert.assertTrue(pool.runInThread(() -> {}));
+        ArgumentCaptor<Runnable> job = ArgumentCaptor.forClass(Runnable.class);
+        Mockito.verify(executor).execute(job.capture());
+
+        AtomicInteger available = new AtomicInteger(-1);
+        AtomicBoolean interrupted = new AtomicBoolean();
+        Thread scheduler = new Thread(() -> {
+            Thread.currentThread().interrupt();
+            available.set(pool.blockForAvailableThreads());
+            interrupted.set(Thread.currentThread().isInterrupted());
+        });
+        scheduler.setDaemon(true);
+        scheduler.start();
+        scheduler.join(1000);
+
+        Assert.assertFalse("Interrupted scheduler must stop waiting", 
scheduler.isAlive());
+        Assert.assertEquals(0, available.get());
+        Assert.assertTrue("Interrupt status must be preserved", 
interrupted.get());
+        job.getValue().run();
+        Assert.assertEquals(1, pool.blockForAvailableThreads());
+        pool.shutdown(false);
+    }
+}

Reply via email to