diff --git a/README.md b/README.md index 9c3d84e..6423a2a 100644 --- a/README.md +++ b/README.md @@ -20,14 +20,14 @@ xtool 是一个小小的 Java 工具集,遵循简单、可靠的原则,不 com.igeeksky.xtool xtool - 1.1.1 + 1.1.2 ``` ### 2.2.Gradle ```groovy -implementation group: 'com.igeeksky.xtool', name: 'xtool', version: '1.1.1' +implementation group: 'com.igeeksky.xtool', name: 'xtool', version: '1.1.2' ``` ### 2.3.编译安装 @@ -80,6 +80,10 @@ mvn clean install ## 4. 更新日志 +### 1.1.2 + +1. add Shutdown API + ### 1.1.1 1. add RingBuffer diff --git a/docs/Reference.md b/docs/Reference.md index 5ecaab0..f2e35b9 100644 --- a/docs/Reference.md +++ b/docs/Reference.md @@ -1,6 +1,6 @@ ## xtool 参考文档 -Author: [Patrick.Lau](mailto:patricklauxx@gmail.com) Version: 1.1.1 +Author: [Patrick.Lau](mailto:patricklauxx@gmail.com) Version: 1.1.2 [![License](https://img.shields.io/badge/license-Apache%202-4EB1BA.svg)](https://www.apache.org/licenses/LICENSE-2.0.html) [![Release](https://img.shields.io/github/v/release/patricklaux/xtool)](https://github.com/patricklaux/xtool/releases) [![Maven Central](https://img.shields.io/maven-central/v/com.igeeksky.xtool/xtool.svg?label=Maven%20Central)](https://search.maven.org/search?q=g:%22com.igeeksky.xtool%22%20AND%20a:%22xtool%22) [![codecov](https://codecov.io/gh/patricklaux/xtool/branch/main/graph/badge.svg?token=VJ87A1IAVH)](https://codecov.io/gh/patricklaux/xtool) [![Last commit](https://img.shields.io/github/last-commit/patricklaux/xtool)](https://github.com/patricklaux/xtool/commits) [![Join the chat at https://gitter.im/igeeksky/xtool](https://badges.gitter.im/igeeksky/xtool.svg)](https://gitter.im/igeeksky/xtool?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) @@ -26,14 +26,14 @@ xtool 是一个小小的 Java 工具集,遵循简单、可靠的原则,不 com.igeeksky.xtool xtool - 1.1.1 + 1.1.2 ``` #### 1.2.2.Gradle ```groovy -implementation group: 'com.igeeksky.xtool', name: 'xtool', version: '1.1.1' +implementation group: 'com.igeeksky.xtool', name: 'xtool', version: '1.1.2' ``` #### 1.2.3.编译安装 diff --git a/pom.xml b/pom.xml index 62e53dd..d6ce969 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.igeeksky.xtool xtool - 1.1.1 + 1.1.2 xtool xtool is a very small set of Java tools. https://github.com/patricklaux/xtool diff --git a/src/main/java/com/igeeksky/xtool/core/Shutdown.java b/src/main/java/com/igeeksky/xtool/core/Shutdown.java new file mode 100644 index 0000000..9e00f8c --- /dev/null +++ b/src/main/java/com/igeeksky/xtool/core/Shutdown.java @@ -0,0 +1,46 @@ +package com.igeeksky.xtool.core; + +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.TimeUnit; + +/** + * 优雅关停接口 + *

+ * 线程池对象及工厂类对象建议实现此接口。 + * + * @author Patrick.Lau + * @since 1.1.2 + */ +public interface Shutdown { + + /** + * 关闭(根据配置参数或默认参数执行优雅关闭) + */ + void shutdown(); + + /** + * 关闭(根据传入参数执行优雅关闭) + * + * @param quietPeriod 静默时间 + * @param timeout 超时时间 + * @param unit 时间单位 + */ + void shutdown(long quietPeriod, long timeout, TimeUnit unit); + + /** + * 异步关闭(根据配置参数或默认参数执行优雅关闭) + * + * @return {@link CompletableFuture} + */ + CompletableFuture shutdownAsync(); + + /** + * 异步关闭(根据传入参数执行优雅关闭) + * + * @param quietPeriod 静默时间 + * @param unit 时间单位 + * @return {@link CompletableFuture} + */ + CompletableFuture shutdownAsync(long quietPeriod, long timeout, TimeUnit unit); + +} \ No newline at end of file