, Serializable {
* Returns the element at the top of the stack.
*
* @return The element at the top of the stack.
- * @throws java.util.NoSuchElementException if the stack is empty.
+ * @throws NoSuchElementException if the stack is empty.
*/
String pop();
diff --git a/milky-thread/src/main/java/cn/sliew/milky/thread/ThreadEagerQueue.java b/milky-concurrent/milky-concurrent-thread/src/main/java/cn/sliew/milky/concurrent/thread/ThreadEagerQueue.java
similarity index 93%
rename from milky-thread/src/main/java/cn/sliew/milky/thread/ThreadEagerQueue.java
rename to milky-concurrent/milky-concurrent-thread/src/main/java/cn/sliew/milky/concurrent/thread/ThreadEagerQueue.java
index 579b93a1..cf9c93f0 100644
--- a/milky-thread/src/main/java/cn/sliew/milky/thread/ThreadEagerQueue.java
+++ b/milky-concurrent/milky-concurrent-thread/src/main/java/cn/sliew/milky/concurrent/thread/ThreadEagerQueue.java
@@ -1,4 +1,4 @@
-package cn.sliew.milky.thread;
+package cn.sliew.milky.concurrent.thread;
import java.util.concurrent.LinkedTransferQueue;
import java.util.concurrent.ThreadPoolExecutor;
diff --git a/milky-thread/src/main/java/cn/sliew/milky/thread/ThreadPoolConfigEnum.java b/milky-concurrent/milky-concurrent-thread/src/main/java/cn/sliew/milky/concurrent/thread/ThreadPoolConfigEnum.java
similarity index 97%
rename from milky-thread/src/main/java/cn/sliew/milky/thread/ThreadPoolConfigEnum.java
rename to milky-concurrent/milky-concurrent-thread/src/main/java/cn/sliew/milky/concurrent/thread/ThreadPoolConfigEnum.java
index c992fd98..9b58a70f 100644
--- a/milky-thread/src/main/java/cn/sliew/milky/thread/ThreadPoolConfigEnum.java
+++ b/milky-concurrent/milky-concurrent-thread/src/main/java/cn/sliew/milky/concurrent/thread/ThreadPoolConfigEnum.java
@@ -1,4 +1,4 @@
-package cn.sliew.milky.thread;
+package cn.sliew.milky.concurrent.thread;
import java.util.Collections;
import java.util.HashMap;
diff --git a/milky-thread/src/main/java/cn/sliew/milky/thread/ThreadPoolExecutorBuilder.java b/milky-concurrent/milky-concurrent-thread/src/main/java/cn/sliew/milky/concurrent/thread/ThreadPoolExecutorBuilder.java
similarity index 93%
rename from milky-thread/src/main/java/cn/sliew/milky/thread/ThreadPoolExecutorBuilder.java
rename to milky-concurrent/milky-concurrent-thread/src/main/java/cn/sliew/milky/concurrent/thread/ThreadPoolExecutorBuilder.java
index 58e764d2..d49988e6 100644
--- a/milky-thread/src/main/java/cn/sliew/milky/thread/ThreadPoolExecutorBuilder.java
+++ b/milky-concurrent/milky-concurrent-thread/src/main/java/cn/sliew/milky/concurrent/thread/ThreadPoolExecutorBuilder.java
@@ -1,9 +1,10 @@
-package cn.sliew.milky.thread;
+package cn.sliew.milky.concurrent.thread;
+import cn.sliew.milky.common.concurrent.DaemonThreadFactory;
import cn.sliew.milky.common.unit.TimeValue;
import cn.sliew.milky.common.unit.TimeValues;
-import cn.sliew.milky.thread.metrics.ThreadPoolExecutorMetrics;
-import cn.sliew.milky.thread.rejected.policy.AbortPolicyWithReport;
+import cn.sliew.milky.concurrent.thread.metrics.ThreadPoolExecutorMetrics;
+import cn.sliew.milky.concurrent.thread.policy.AbortPolicyWithReport;
import io.micrometer.core.instrument.MeterRegistry;
import java.util.concurrent.BlockingQueue;
diff --git a/milky-thread/src/main/java/cn/sliew/milky/thread/ThreadPoolManager.java b/milky-concurrent/milky-concurrent-thread/src/main/java/cn/sliew/milky/concurrent/thread/ThreadPoolManager.java
similarity index 89%
rename from milky-thread/src/main/java/cn/sliew/milky/thread/ThreadPoolManager.java
rename to milky-concurrent/milky-concurrent-thread/src/main/java/cn/sliew/milky/concurrent/thread/ThreadPoolManager.java
index d7e06746..25dc6232 100644
--- a/milky-thread/src/main/java/cn/sliew/milky/thread/ThreadPoolManager.java
+++ b/milky-concurrent/milky-concurrent-thread/src/main/java/cn/sliew/milky/concurrent/thread/ThreadPoolManager.java
@@ -1,4 +1,4 @@
-package cn.sliew.milky.thread;
+package cn.sliew.milky.concurrent.thread;
import java.util.concurrent.TimeUnit;
diff --git a/milky-thread/src/main/java/cn/sliew/milky/thread/ThreadPoolType.java b/milky-concurrent/milky-concurrent-thread/src/main/java/cn/sliew/milky/concurrent/thread/ThreadPoolType.java
similarity index 95%
rename from milky-thread/src/main/java/cn/sliew/milky/thread/ThreadPoolType.java
rename to milky-concurrent/milky-concurrent-thread/src/main/java/cn/sliew/milky/concurrent/thread/ThreadPoolType.java
index ec5faf17..522ebdcd 100644
--- a/milky-thread/src/main/java/cn/sliew/milky/thread/ThreadPoolType.java
+++ b/milky-concurrent/milky-concurrent-thread/src/main/java/cn/sliew/milky/concurrent/thread/ThreadPoolType.java
@@ -1,4 +1,4 @@
-package cn.sliew.milky.thread;
+package cn.sliew.milky.concurrent.thread;
import java.util.Collections;
import java.util.HashMap;
diff --git a/milky-thread/src/main/java/cn/sliew/milky/thread/XRejectedExecutionHandler.java b/milky-concurrent/milky-concurrent-thread/src/main/java/cn/sliew/milky/concurrent/thread/XRejectedExecutionHandler.java
similarity index 83%
rename from milky-thread/src/main/java/cn/sliew/milky/thread/XRejectedExecutionHandler.java
rename to milky-concurrent/milky-concurrent-thread/src/main/java/cn/sliew/milky/concurrent/thread/XRejectedExecutionHandler.java
index 7a2031ec..33de6ed9 100644
--- a/milky-thread/src/main/java/cn/sliew/milky/thread/XRejectedExecutionHandler.java
+++ b/milky-concurrent/milky-concurrent-thread/src/main/java/cn/sliew/milky/concurrent/thread/XRejectedExecutionHandler.java
@@ -1,4 +1,4 @@
-package cn.sliew.milky.thread;
+package cn.sliew.milky.concurrent.thread;
import java.util.concurrent.RejectedExecutionHandler;
diff --git a/milky-thread/src/main/java/cn/sliew/milky/thread/context/DefaultThreadContextMap.java b/milky-concurrent/milky-concurrent-thread/src/main/java/cn/sliew/milky/concurrent/thread/context/DefaultThreadContextMap.java
similarity index 96%
rename from milky-thread/src/main/java/cn/sliew/milky/thread/context/DefaultThreadContextMap.java
rename to milky-concurrent/milky-concurrent-thread/src/main/java/cn/sliew/milky/concurrent/thread/context/DefaultThreadContextMap.java
index 713807d4..fea7496c 100644
--- a/milky-thread/src/main/java/cn/sliew/milky/thread/context/DefaultThreadContextMap.java
+++ b/milky-concurrent/milky-concurrent-thread/src/main/java/cn/sliew/milky/concurrent/thread/context/DefaultThreadContextMap.java
@@ -1,7 +1,7 @@
-package cn.sliew.milky.thread.context;
+package cn.sliew.milky.concurrent.thread.context;
-import cn.sliew.milky.thread.ThreadContext;
-import cn.sliew.milky.thread.ThreadContextMap;
+import cn.sliew.milky.concurrent.thread.ThreadContext;
+import cn.sliew.milky.concurrent.thread.ThreadContextMap;
import java.util.Collections;
import java.util.HashMap;
diff --git a/milky-thread/src/main/java/cn/sliew/milky/thread/context/DefaultThreadContextStack.java b/milky-concurrent/milky-concurrent-thread/src/main/java/cn/sliew/milky/concurrent/thread/context/DefaultThreadContextStack.java
similarity index 96%
rename from milky-thread/src/main/java/cn/sliew/milky/thread/context/DefaultThreadContextStack.java
rename to milky-concurrent/milky-concurrent-thread/src/main/java/cn/sliew/milky/concurrent/thread/context/DefaultThreadContextStack.java
index e833d016..c584f9b4 100644
--- a/milky-thread/src/main/java/cn/sliew/milky/thread/context/DefaultThreadContextStack.java
+++ b/milky-concurrent/milky-concurrent-thread/src/main/java/cn/sliew/milky/concurrent/thread/context/DefaultThreadContextStack.java
@@ -1,9 +1,12 @@
-package cn.sliew.milky.thread.context;
+package cn.sliew.milky.concurrent.thread.context;
-import cn.sliew.milky.thread.ThreadContext;
-import cn.sliew.milky.thread.ThreadContextStack;
+import cn.sliew.milky.concurrent.thread.ThreadContext;
+import cn.sliew.milky.concurrent.thread.ThreadContextStack;
-import java.util.*;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
public class DefaultThreadContextStack implements ThreadContextStack {
diff --git a/milky-thread/src/main/java/cn/sliew/milky/thread/context/MutableThreadContextStack.java b/milky-concurrent/milky-concurrent-thread/src/main/java/cn/sliew/milky/concurrent/thread/context/MutableThreadContextStack.java
similarity index 97%
rename from milky-thread/src/main/java/cn/sliew/milky/thread/context/MutableThreadContextStack.java
rename to milky-concurrent/milky-concurrent-thread/src/main/java/cn/sliew/milky/concurrent/thread/context/MutableThreadContextStack.java
index 388972c3..7fdca208 100644
--- a/milky-thread/src/main/java/cn/sliew/milky/thread/context/MutableThreadContextStack.java
+++ b/milky-concurrent/milky-concurrent-thread/src/main/java/cn/sliew/milky/concurrent/thread/context/MutableThreadContextStack.java
@@ -1,7 +1,7 @@
-package cn.sliew.milky.thread.context;
+package cn.sliew.milky.concurrent.thread.context;
-import cn.sliew.milky.thread.ThreadContext;
-import cn.sliew.milky.thread.ThreadContextStack;
+import cn.sliew.milky.concurrent.thread.ThreadContext;
+import cn.sliew.milky.concurrent.thread.ThreadContextStack;
import java.util.ArrayList;
import java.util.Collection;
diff --git a/milky-thread/src/main/java/cn/sliew/milky/thread/metrics/ThreadPoolExecutorMetrics.java b/milky-concurrent/milky-concurrent-thread/src/main/java/cn/sliew/milky/concurrent/thread/metrics/ThreadPoolExecutorMetrics.java
similarity index 96%
rename from milky-thread/src/main/java/cn/sliew/milky/thread/metrics/ThreadPoolExecutorMetrics.java
rename to milky-concurrent/milky-concurrent-thread/src/main/java/cn/sliew/milky/concurrent/thread/metrics/ThreadPoolExecutorMetrics.java
index 99b8fb07..ba74e005 100644
--- a/milky-thread/src/main/java/cn/sliew/milky/thread/metrics/ThreadPoolExecutorMetrics.java
+++ b/milky-concurrent/milky-concurrent-thread/src/main/java/cn/sliew/milky/concurrent/thread/metrics/ThreadPoolExecutorMetrics.java
@@ -1,6 +1,6 @@
-package cn.sliew.milky.thread.metrics;
+package cn.sliew.milky.concurrent.thread.metrics;
-import cn.sliew.milky.thread.MilkyThreadPoolExecutor;
+import cn.sliew.milky.concurrent.thread.MilkyThreadPoolExecutor;
import io.micrometer.core.instrument.FunctionCounter;
import io.micrometer.core.instrument.Gauge;
import io.micrometer.core.instrument.MeterRegistry;
diff --git a/milky-thread/src/main/java/cn/sliew/milky/thread/rejected/policy/AbortPolicyWithReport.java b/milky-concurrent/milky-concurrent-thread/src/main/java/cn/sliew/milky/concurrent/thread/policy/AbortPolicyWithReport.java
similarity index 95%
rename from milky-thread/src/main/java/cn/sliew/milky/thread/rejected/policy/AbortPolicyWithReport.java
rename to milky-concurrent/milky-concurrent-thread/src/main/java/cn/sliew/milky/concurrent/thread/policy/AbortPolicyWithReport.java
index fcd19791..e746323e 100644
--- a/milky-thread/src/main/java/cn/sliew/milky/thread/rejected/policy/AbortPolicyWithReport.java
+++ b/milky-concurrent/milky-concurrent-thread/src/main/java/cn/sliew/milky/concurrent/thread/policy/AbortPolicyWithReport.java
@@ -1,8 +1,8 @@
-package cn.sliew.milky.thread.rejected.policy;
+package cn.sliew.milky.concurrent.thread.policy;
-import cn.sliew.milky.thread.RunnableWrapper;
-import cn.sliew.milky.thread.SizeBlockingQueue;
-import cn.sliew.milky.thread.XRejectedExecutionHandler;
+import cn.sliew.milky.common.concurrent.RunnableWrapper;
+import cn.sliew.milky.concurrent.thread.SizeBlockingQueue;
+import cn.sliew.milky.concurrent.thread.XRejectedExecutionHandler;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
diff --git a/milky-thread/src/main/java/cn/sliew/milky/thread/rejected/policy/JVMUtil.java b/milky-concurrent/milky-concurrent-thread/src/main/java/cn/sliew/milky/concurrent/thread/policy/JVMUtil.java
similarity index 98%
rename from milky-thread/src/main/java/cn/sliew/milky/thread/rejected/policy/JVMUtil.java
rename to milky-concurrent/milky-concurrent-thread/src/main/java/cn/sliew/milky/concurrent/thread/policy/JVMUtil.java
index bc2ada72..9d13248d 100644
--- a/milky-thread/src/main/java/cn/sliew/milky/thread/rejected/policy/JVMUtil.java
+++ b/milky-concurrent/milky-concurrent-thread/src/main/java/cn/sliew/milky/concurrent/thread/policy/JVMUtil.java
@@ -1,4 +1,4 @@
-package cn.sliew.milky.thread.rejected.policy;
+package cn.sliew.milky.concurrent.thread.policy;
import java.io.OutputStream;
import java.lang.management.*;
diff --git a/milky-concurrent/pom.xml b/milky-concurrent/pom.xml
index b6bc6927..1cfd96e0 100644
--- a/milky-concurrent/pom.xml
+++ b/milky-concurrent/pom.xml
@@ -10,23 +10,16 @@
../pom.xml
milky-concurrent
- jar
+ pom
${project.artifactId}
+
+ milky-concurrent-thread
+ milky-concurrent-future
+
+
true
-
-
- cn.sliew
- milky-common
-
-
- cn.sliew
- milky-test
- test
-
-
-
\ No newline at end of file
diff --git a/milky-concurrent/src/main/java/cn/sliew/milky/concurrent/threadpool/DaemonThreadFactory.java b/milky-concurrent/src/main/java/cn/sliew/milky/concurrent/threadpool/DaemonThreadFactory.java
deleted file mode 100644
index 92cc669c..00000000
--- a/milky-concurrent/src/main/java/cn/sliew/milky/concurrent/threadpool/DaemonThreadFactory.java
+++ /dev/null
@@ -1,43 +0,0 @@
-package cn.sliew.milky.concurrent.threadpool;
-
-import java.util.concurrent.ThreadFactory;
-import java.util.concurrent.atomic.AtomicInteger;
-
-import static cn.sliew.milky.common.check.Ensures.checkNotNull;
-
-class DaemonThreadFactory implements ThreadFactory {
-
- private final int threadPriority = Thread.NORM_PRIORITY;
-
- private final String threadNamePrefix;
-
- private final boolean daemon;
-
- private final ThreadGroup threadGroup;
-
- private final AtomicInteger threadCount = new AtomicInteger(0);
-
- DaemonThreadFactory(String threadNamePrefix, boolean daemon, ThreadGroup threadGroup) {
- this.threadNamePrefix = checkNotNull(threadNamePrefix);
- this.daemon = daemon;
- SecurityManager s = System.getSecurityManager();
- this.threadGroup = (s != null) ? s.getThreadGroup() : Thread.currentThread().getThreadGroup();
- }
-
- @Override
- public Thread newThread(Runnable runnable) {
- Thread thread = new Thread(threadGroup, runnable, nextThreadName());
- thread.setPriority(threadPriority);
- thread.setDaemon(daemon);
- return thread;
- }
-
- /**
- * Return the thread name to use for a newly created {@link Thread}.
- * The default implementation returns the specified thread name prefix
- * with an increasing thread count appended: e.g. "SimpleAsyncTaskExecutor-0".
- */
- protected String nextThreadName() {
- return threadNamePrefix + this.threadCount.incrementAndGet();
- }
-}
diff --git a/milky-thread/src/main/java/cn/sliew/milky/thread/RunnableWrapper.java b/milky-thread/src/main/java/cn/sliew/milky/thread/RunnableWrapper.java
deleted file mode 100644
index adda7538..00000000
--- a/milky-thread/src/main/java/cn/sliew/milky/thread/RunnableWrapper.java
+++ /dev/null
@@ -1,62 +0,0 @@
-package cn.sliew.milky.thread;
-
-import java.util.concurrent.RejectedExecutionException;
-
-/**
- * An extension to runnable.
- */
-public interface RunnableWrapper extends Runnable {
-
- @Override
- default void run() {
- try {
- doRun();
- } catch (RejectedExecutionException t) {
- onRejection(t);
- } catch (Exception t) {
- onFailure(t);
- } finally {
- onAfter();
- }
- }
-
- /**
- * This method has the same semantics as {@link Runnable#run()}
- *
- * @throws InterruptedException if the run method throws an InterruptedException
- */
- void doRun() throws Exception;
-
- /**
- * This method is called in a finally block after successful execution
- * or on a rejection.
- *
- * @see MilkyThreadPoolExecutor#execute(java.lang.Runnable)
- */
- default void onAfter() {
- // nothing by default
- }
-
- /**
- * This method is invoked for all exception thrown by {@link #doRun()}
- */
- void onFailure(Exception e);
-
- /**
- * This should be executed if the thread-pool executing this action rejected the execution.
- * The default implementation forwards to {@link #onFailure(Exception)}
- *
- * @see MilkyThreadPoolExecutor#execute(java.lang.Runnable)
- */
- default void onRejection(Exception e) {
- onFailure(e);
- }
-
- /**
- * Should the runnable force its execution in case it gets rejected?
- */
- default boolean isForceExecution() {
- return false;
- }
-
-}
diff --git a/milky/pom.xml b/milky/pom.xml
index 05d8c7be..222ee5c9 100644
--- a/milky/pom.xml
+++ b/milky/pom.xml
@@ -24,10 +24,6 @@
cn.sliew
milky-common
-
- cn.sliew
- milky-concurrent
-
cn.sliew
milky-test
diff --git a/pom.xml b/pom.xml
index cc7c2e64..12cbec9f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -63,7 +63,6 @@
milky-serialize
milky-log
milky-event
- milky-thread
milky-config
milky-io
milky-dsl
@@ -80,31 +79,60 @@
${java.version}
true
3.0.0-M5
+
+ 1.18.32
+ 1.4.2.Final
+ 0.1.1
+ 0.2.0
+ 1.1.1
+ 2.17.1
+ 2.23.1
+ 4.0.0
+ 1.13.0
+ 5.8.30
+ 33.2.1-jre
org.apiguardian
apiguardian-api
- 1.1.1
+ ${apiguardian.version}
- ${project.groupId}
- milky-common
- ${project.version}
+ com.fasterxml.jackson
+ jackson-bom
+ ${jackson.version}
+ pom
+ import
+
+ org.apache.logging.log4j
+ log4j-bom
+ ${log4j.version}
+ pom
+ import
+
+
+ io.micrometer
+ micrometer-bom
+ ${micrometer.version}
+ pom
+ import
+
+
${project.groupId}
- milky-log
+ milky-common
${project.version}
${project.groupId}
- milky-concurrent
+ milky-log
${project.version}
@@ -118,33 +146,37 @@
${project.version}
-
- com.fasterxml.jackson
- jackson-bom
- 2.13.5
- pom
- import
+ org.projectlombok
+ lombok
+ ${lombok.version}
- org.apache.logging.log4j
- log4j-bom
- 2.17.1
- pom
- import
+ org.mapstruct
+ mapstruct
+ ${org.mapstruct.version}
- io.micrometer
- micrometer-bom
- 1.7.4
- pom
- import
+ org.mapstruct.extensions.spring
+ mapstruct-spring-annotations
+ ${org.mapstruct.extensions.spring.version}
+
+
+
+ cn.hutool
+ hutool-all
+ ${hutool.version}
+
+
+ com.google.guava
+ guava
+ ${guava.version}
com.lmax
disruptor
- 3.4.4
+ ${disruptor.version}
@@ -368,6 +400,23 @@
**/package-info.java
+
+
+ org.projectlombok
+ lombok
+ ${lombok.version}
+
+
+ org.mapstruct
+ mapstruct-processor
+ ${mapstruct.version}
+
+
+ org.projectlombok
+ lombok-mapstruct-binding
+ ${mapstruct.lombok.binding.version}
+
+