diff --git a/pom.xml b/pom.xml
index 27da1ee..933028c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -65,7 +65,7 @@
11
- 3.0.0.Final
+ 3.0.1.Final
@@ -100,12 +100,6 @@
${version.jboss.logging.tools}
provided
-
- org.jboss.logging
- jboss-logging-processor
- ${version.jboss.logging.tools}
- provided
-
org.jboss.logging
jboss-logging
@@ -116,10 +110,22 @@
wildfly-common
2.0.0
+
+ io.smallrye.common
+ smallrye-common-annotation
+
+
+ io.smallrye.common
+ smallrye-common-constraint
+
io.smallrye.common
smallrye-common-cpu
+
+ io.smallrye.common
+ smallrye-common-function
+
org.junit.jupiter
junit-jupiter
@@ -177,7 +183,17 @@
maven-compiler-plugin
- full
+
+
+ org.jboss.logging
+ jboss-logging-processor
+ ${version.jboss.logging.tools}
+
+
+
+
+ --add-reads=org.jboss.threads=ALL-UNNAMED
+
@@ -193,6 +209,7 @@
${jboss.threads.eqe.unlimited-queue}
${jboss.threads.eqe.register-mbean}
+ true
diff --git a/src/main/java/module-info.java b/src/main/java/module-info.java
new file mode 100644
index 0000000..e68e5fb
--- /dev/null
+++ b/src/main/java/module-info.java
@@ -0,0 +1,14 @@
+module org.jboss.threads {
+ requires java.management;
+ requires jdk.unsupported;
+ requires org.jboss.logging;
+ requires static org.jboss.logging.annotations;
+ requires org.wildfly.common;
+ requires io.smallrye.common.annotation;
+ requires io.smallrye.common.constraint;
+ requires io.smallrye.common.cpu;
+ requires io.smallrye.common.function;
+
+ exports org.jboss.threads;
+ exports org.jboss.threads.management;
+}
\ No newline at end of file
diff --git a/src/main/java/org/jboss/threads/EnhancedQueueExecutor.java b/src/main/java/org/jboss/threads/EnhancedQueueExecutor.java
index 54d1a30..dd80d76 100644
--- a/src/main/java/org/jboss/threads/EnhancedQueueExecutor.java
+++ b/src/main/java/org/jboss/threads/EnhancedQueueExecutor.java
@@ -51,8 +51,8 @@
import org.jboss.threads.management.ManageableThreadPoolExecutorService;
import org.jboss.threads.management.StandardThreadPoolMXBean;
-import org.wildfly.common.Assert;
-import org.wildfly.common.cpu.ProcessorInfo;
+import io.smallrye.common.constraint.Assert;
+import io.smallrye.common.cpu.ProcessorInfo;
/**
* A task-or-thread queue backed thread pool executor service. Tasks are added in a FIFO manner, and consumers in a LIFO manner.
diff --git a/src/main/java/org/jboss/threads/EnhancedViewExecutor.java b/src/main/java/org/jboss/threads/EnhancedViewExecutor.java
index f076dab..5118d8b 100644
--- a/src/main/java/org/jboss/threads/EnhancedViewExecutor.java
+++ b/src/main/java/org/jboss/threads/EnhancedViewExecutor.java
@@ -1,10 +1,9 @@
package org.jboss.threads;
import org.jboss.logging.Logger;
-import org.wildfly.common.Assert;
-import org.wildfly.common.annotation.Nullable;
-import org.wildfly.common.cpu.ProcessorInfo;
-import org.wildfly.common.lock.Locks;
+import io.smallrye.common.constraint.Assert;
+import io.smallrye.common.constraint.Nullable;
+import io.smallrye.common.cpu.ProcessorInfo;
import java.util.ArrayList;
import java.util.Collections;
@@ -17,6 +16,7 @@
import java.util.concurrent.RejectedExecutionException;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.Lock;
+import java.util.concurrent.locks.ReentrantLock;
import static org.jboss.threads.JBossExecutors.unsafe;
@@ -100,7 +100,7 @@ final class EnhancedViewExecutor extends ViewExecutor {
this.executeLock = queueLimit == 0
? null
// Lock must be reentrant to handle same-thread executors or CallerRunsPolicy
- : Locks.reentrantLock();
+ : new ReentrantLock();
this.setExceptionHandler(uncaughtExceptionHandler);
}
diff --git a/src/main/java/org/jboss/threads/JBossExecutors.java b/src/main/java/org/jboss/threads/JBossExecutors.java
index 91752d3..8b8f00c 100644
--- a/src/main/java/org/jboss/threads/JBossExecutors.java
+++ b/src/main/java/org/jboss/threads/JBossExecutors.java
@@ -11,7 +11,7 @@
import java.security.AccessController;
import org.jboss.logging.Logger;
-import org.wildfly.common.Assert;
+import io.smallrye.common.constraint.Assert;
import sun.misc.Unsafe;
/**
diff --git a/src/main/java/org/jboss/threads/JBossThread.java b/src/main/java/org/jboss/threads/JBossThread.java
index 1b56cca..f6f8300 100644
--- a/src/main/java/org/jboss/threads/JBossThread.java
+++ b/src/main/java/org/jboss/threads/JBossThread.java
@@ -9,8 +9,8 @@
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.locks.LockSupport;
-import org.wildfly.common.Assert;
-import org.wildfly.common.cpu.ProcessorInfo;
+import io.smallrye.common.constraint.Assert;
+import io.smallrye.common.cpu.ProcessorInfo;
import org.wildfly.common.function.ExceptionBiConsumer;
import org.wildfly.common.function.ExceptionBiFunction;
import org.wildfly.common.function.ExceptionConsumer;
@@ -19,7 +19,6 @@
import org.wildfly.common.function.ExceptionObjLongConsumer;
import org.wildfly.common.function.ExceptionRunnable;
import org.wildfly.common.function.ExceptionSupplier;
-import org.wildfly.common.function.Functions;
/**
* A JBoss thread. Supports logging and extra operations.
@@ -255,6 +254,7 @@ public static T executeWithInterruptDeferred(final Callable action) throw
* @param the action's return type
* @return the value returned from the callable
*/
+ @Deprecated
public static T executeWithInterruptDeferred(final PrivilegedAction action) {
final JBossThread thread = currentThread();
if (registerDeferral(thread)) try {
@@ -277,6 +277,7 @@ public static T executeWithInterruptDeferred(final PrivilegedAction actio
* @return the value returned from the callable
* @throws Exception if the action throws an exception
*/
+ @Deprecated
public static T executeWithInterruptDeferred(final PrivilegedExceptionAction action) throws Exception {
final JBossThread thread = currentThread();
if (registerDeferral(thread)) try {
@@ -289,6 +290,7 @@ public static T executeWithInterruptDeferred(final PrivilegedExceptionAction
}
}
+ @Deprecated
public static R applyInterruptDeferredEx(final ExceptionBiFunction function, T param1, U param2) throws E {
final JBossThread thread = currentThread();
if (registerDeferral(thread)) try {
@@ -301,14 +303,17 @@ public static R applyInterruptDeferredEx(final Ex
}
}
+ @Deprecated
public static R applyInterruptDeferredEx(final ExceptionFunction function, T param) throws E {
- return applyInterruptDeferredEx(Functions.exceptionFunctionBiFunction(), function, param);
+ return applyInterruptDeferredEx(ExceptionFunction::apply, function, param);
}
+ @Deprecated
public static T getInterruptDeferredEx(final ExceptionSupplier supplier) throws E {
- return applyInterruptDeferredEx(Functions.exceptionFunctionBiFunction(), Functions.exceptionSupplierFunction(), supplier);
+ return applyInterruptDeferredEx(ExceptionSupplier::get, supplier);
}
+ @Deprecated
public static void acceptInterruptDeferredEx(final ExceptionObjLongConsumer consumer, T param1, long param2) throws E {
final JBossThread thread = currentThread();
if (registerDeferral(thread)) try {
@@ -321,6 +326,7 @@ public static void acceptInterruptDeferredEx(final Exce
}
}
+ @Deprecated
public static void acceptInterruptDeferredEx(final ExceptionObjIntConsumer consumer, T param1, int param2) throws E {
final JBossThread thread = currentThread();
if (registerDeferral(thread)) try {
@@ -333,6 +339,7 @@ public static void acceptInterruptDeferredEx(final Exce
}
}
+ @Deprecated
public static void acceptInterruptDeferredEx(final ExceptionBiConsumer consumer, T param1, U param2) throws E {
final JBossThread thread = currentThread();
if (registerDeferral(thread)) try {
@@ -345,15 +352,17 @@ public static void acceptInterruptDeferredEx(final E
}
}
+ @Deprecated
public static void acceptInterruptDeferredEx(final ExceptionConsumer consumer, T param) throws E {
- acceptInterruptDeferredEx(Functions.exceptionConsumerBiConsumer(), consumer, param);
+ acceptInterruptDeferredEx(ExceptionConsumer::accept, consumer, param);
}
+ @Deprecated
public static void runInterruptDeferredEx(final ExceptionRunnable runnable) throws E {
- acceptInterruptDeferredEx(Functions.exceptionConsumerBiConsumer(), Functions.exceptionRunnableConsumer(), runnable);
+ acceptInterruptDeferredEx(ExceptionRunnable::run, runnable);
}
-
+ @Deprecated
public static R applyInterruptResumedEx(final ExceptionBiFunction function, T param1, U param2) throws E {
final JBossThread thread = currentThread();
if (unregisterDeferral(thread)) try {
@@ -366,14 +375,17 @@ public static R applyInterruptResumedEx(final Exc
}
}
+ @Deprecated
public static R applyInterruptResumedEx(final ExceptionFunction function, T param) throws E {
- return applyInterruptResumedEx(Functions.exceptionFunctionBiFunction(), function, param);
+ return applyInterruptResumedEx(ExceptionFunction::apply, function, param);
}
+ @Deprecated
public static T getInterruptResumedEx(final ExceptionSupplier supplier) throws E {
- return applyInterruptResumedEx(Functions.exceptionFunctionBiFunction(), Functions.exceptionSupplierFunction(), supplier);
+ return applyInterruptResumedEx(ExceptionSupplier::get, supplier);
}
+ @Deprecated
public static void acceptInterruptResumedEx(final ExceptionObjLongConsumer consumer, T param1, long param2) throws E {
final JBossThread thread = currentThread();
if (unregisterDeferral(thread)) try {
@@ -386,6 +398,7 @@ public static void acceptInterruptResumedEx(final Excep
}
}
+ @Deprecated
public static void acceptInterruptResumedEx(final ExceptionObjIntConsumer consumer, T param1, int param2) throws E {
final JBossThread thread = currentThread();
if (unregisterDeferral(thread)) try {
@@ -398,6 +411,7 @@ public static void acceptInterruptResumedEx(final Excep
}
}
+ @Deprecated
public static void acceptInterruptResumedEx(final ExceptionBiConsumer consumer, T param1, U param2) throws E {
final JBossThread thread = currentThread();
if (unregisterDeferral(thread)) try {
@@ -410,12 +424,14 @@ public static void acceptInterruptResumedEx(final Ex
}
}
+ @Deprecated
public static void acceptInterruptResumedEx(final ExceptionConsumer consumer, T param) throws E {
- acceptInterruptResumedEx(Functions.exceptionConsumerBiConsumer(), consumer, param);
+ acceptInterruptResumedEx(ExceptionConsumer::accept, consumer, param);
}
+ @Deprecated
public static void runInterruptResumedEx(final ExceptionRunnable runnable) throws E {
- acceptInterruptResumedEx(Functions.exceptionConsumerBiConsumer(), Functions.exceptionRunnableConsumer(), runnable);
+ acceptInterruptResumedEx(ExceptionRunnable::run, runnable);
}
private static boolean unregisterDeferral(final JBossThread thread) {
@@ -578,6 +594,7 @@ public static InterruptHandler getAndSetInterruptHandler(final InterruptHandler
}
}
+ @Deprecated
public static R applyWithInterruptHandler(InterruptHandler interruptHandler, ExceptionBiFunction function, T param1, U param2) throws E {
final JBossThread thread = currentThread();
if (thread == null) {
@@ -593,14 +610,17 @@ public static R applyWithInterruptHandler(Interru
}
}
+ @Deprecated
public static R applyWithInterruptHandler(InterruptHandler interruptHandler, ExceptionFunction function, T param1) throws E {
- return applyWithInterruptHandler(interruptHandler, Functions.exceptionFunctionBiFunction(), function, param1);
+ return applyWithInterruptHandler(interruptHandler, ExceptionFunction::apply, function, param1);
}
+ @Deprecated
public static R getWithInterruptHandler(InterruptHandler interruptHandler, ExceptionSupplier function) throws E {
- return applyWithInterruptHandler(interruptHandler, Functions.exceptionFunctionBiFunction(), Functions.exceptionSupplierFunction(), function);
+ return applyWithInterruptHandler(interruptHandler, ExceptionSupplier::get, function);
}
+ @Deprecated
public static void acceptWithInterruptHandler(InterruptHandler interruptHandler, ExceptionObjLongConsumer function, T param1, long param2) throws E {
final JBossThread thread = currentThread();
if (thread == null) {
@@ -618,6 +638,7 @@ public static void acceptWithInterruptHandler(Interrupt
}
}
+ @Deprecated
public static void acceptWithInterruptHandler(InterruptHandler interruptHandler, ExceptionObjIntConsumer function, T param1, int param2) throws E {
final JBossThread thread = currentThread();
if (thread == null) {
@@ -635,6 +656,7 @@ public static void acceptWithInterruptHandler(Interrupt
}
}
+ @Deprecated
public static void acceptWithInterruptHandler(InterruptHandler interruptHandler, ExceptionBiConsumer function, T param1, U param2) throws E {
final JBossThread thread = currentThread();
if (thread == null) {
@@ -652,12 +674,14 @@ public static void acceptWithInterruptHandler(Interr
}
}
+ @Deprecated
public static void acceptWithInterruptHandler(InterruptHandler interruptHandler, ExceptionConsumer function, T param1) throws E {
- acceptWithInterruptHandler(interruptHandler, Functions.exceptionConsumerBiConsumer(), function, param1);
+ acceptWithInterruptHandler(interruptHandler, ExceptionConsumer::accept, function, param1);
}
+ @Deprecated
public static void runWithInterruptHandler(InterruptHandler interruptHandler, ExceptionRunnable function) throws E {
- acceptWithInterruptHandler(interruptHandler, Functions.exceptionConsumerBiConsumer(), Functions.exceptionRunnableConsumer(), function);
+ acceptWithInterruptHandler(interruptHandler, ExceptionRunnable::run, function);
}
/**
diff --git a/src/main/java/org/jboss/threads/ManagedThreadPoolExecutor.java b/src/main/java/org/jboss/threads/ManagedThreadPoolExecutor.java
index 482cafa..ad0ccf4 100644
--- a/src/main/java/org/jboss/threads/ManagedThreadPoolExecutor.java
+++ b/src/main/java/org/jboss/threads/ManagedThreadPoolExecutor.java
@@ -9,7 +9,7 @@
import org.jboss.threads.management.ManageableThreadPoolExecutorService;
import org.jboss.threads.management.StandardThreadPoolMXBean;
-import org.wildfly.common.Assert;
+import io.smallrye.common.constraint.Assert;
/**
* A version of {@link ThreadPoolExecutor} which implements {@link ManageableThreadPoolExecutorService} in order to allow
diff --git a/src/main/java/org/jboss/threads/Messages.java b/src/main/java/org/jboss/threads/Messages.java
index 7e87533..ac0fd53 100644
--- a/src/main/java/org/jboss/threads/Messages.java
+++ b/src/main/java/org/jboss/threads/Messages.java
@@ -1,5 +1,7 @@
package org.jboss.threads;
+import static java.lang.invoke.MethodHandles.*;
+
import java.time.Duration;
import org.jboss.logging.BasicLogger;
@@ -14,8 +16,8 @@
*/
@MessageLogger(projectCode = "JBTHR", length = 5)
interface Messages extends BasicLogger {
- Messages msg = Logger.getMessageLogger(Messages.class, "org.jboss.threads");
- Messages intMsg = Logger.getMessageLogger(Messages.class, "org.jboss.threads.interrupt-handler");
+ Messages msg = Logger.getMessageLogger(lookup(), Messages.class, "org.jboss.threads");
+ Messages intMsg = Logger.getMessageLogger(lookup(), Messages.class, "org.jboss.threads.interrupt-handler");
// version
@Message(value = "JBoss Threads version %s")
diff --git a/src/main/java/org/jboss/threads/ViewExecutor.java b/src/main/java/org/jboss/threads/ViewExecutor.java
index acbb71c..3a0ab30 100644
--- a/src/main/java/org/jboss/threads/ViewExecutor.java
+++ b/src/main/java/org/jboss/threads/ViewExecutor.java
@@ -1,6 +1,6 @@
package org.jboss.threads;
-import org.wildfly.common.Assert;
+import io.smallrye.common.constraint.Assert;
import java.security.PrivilegedAction;
import java.util.concurrent.AbstractExecutorService;
diff --git a/src/main/java/org/jboss/threads/management/ManageableThreadPoolExecutorService.java b/src/main/java/org/jboss/threads/management/ManageableThreadPoolExecutorService.java
index 73355cb..05ec1c5 100644
--- a/src/main/java/org/jboss/threads/management/ManageableThreadPoolExecutorService.java
+++ b/src/main/java/org/jboss/threads/management/ManageableThreadPoolExecutorService.java
@@ -2,7 +2,7 @@
import java.util.concurrent.ExecutorService;
-import org.wildfly.common.annotation.NotNull;
+import io.smallrye.common.constraint.NotNull;
/**
* A thread pool for which an MBean can be obtained.