Skip to content

Commit

Permalink
Prepare release
Browse files Browse the repository at this point in the history
  • Loading branch information
looly committed Dec 25, 2024
2 parents 2959e83 + 6a9ee9a commit ced8bf8
Show file tree
Hide file tree
Showing 63 changed files with 885 additions and 124 deletions.
20 changes: 20 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,26 @@

# 🚀Changelog

-------------------------------------------------------------------------------------------------------------
# 5.8.35(2024-12-25)

### 🐣新特性
* 【poi 】 优化ExcelWriter中使用比较器writer的方法,只对第一条数据进行排序(pr#3807@Github)
* 【extra 】 优化Ftp.download,返回false抛出异常(issue#3805@Github)
* 【core 】 优化MAC地址正则(issue#IB95X4@Gitee)
* 【json 】 JSON的getByPath方法新增更为通用的指定出参类型重载(pr#3814@Github)
* 【core 】 DateUtil.parseUTC方法标记废弃,改名为parseISO8601(issue#IBB6I5@Gitee)
* 【core 】 添加EnumUtil#getBy(Class, Func1, Object)方法(pr#1283@Gitee)
* 【db 】 添加Entity.addCondition方法(issue#IBCDL2@Gitee)
* 【poi 】 添加StopReadException,定义sax读取时用户可手动终止(issue#3820@Github)

### 🐞Bug修复
* 【crypto 】 修复JWTSignerUtil.createSigner中algorithmId未转换问题(issue#3806@Github)
* 【core 】 修复DateUtil.rangeContains未重置问题(issue#IB8OFS@Gitee)
* 【cache 】 修复StampedCache类get方法并发问题(issue#IBCIQG@Gitee)
* 【cache 】 修复FIFOCache类使用StampedCache导致并发读的并发问题(issue#IBCIQG@Gitee)
* 【cache 】 废弃StampedCache,可能造成Map循环调用导致死锁(issue#IBDGBZ@Gitee)

-------------------------------------------------------------------------------------------------------------
# 5.8.34(2024-11-25)

Expand Down
10 changes: 7 additions & 3 deletions README-EN.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@
<a target="_blank" href='https://github.com/dromara/hutool'>
<img src="https://img.shields.io/github/stars/dromara/hutool.svg?style=social" alt="github star"/>
</a>
<a target="_blank" href='https://gitcode.com/dromara/hutool'>
<img src="https://gitcode.com/dromara/hutool/star/badge.svg" alt="gitcode star"/>
</a>
</p>

<br/>
Expand Down Expand Up @@ -150,18 +153,18 @@ We provide the T-Shirt and Sweater with Hutool Logo, please visit the shop:
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>5.8.34</version>
<version>5.8.35</version>
</dependency>
```

### 🍐Gradle
```
implementation 'cn.hutool:hutool-all:5.8.34'
implementation 'cn.hutool:hutool-all:5.8.35'
```

## 📥Download

- [Maven Repo](https://repo1.maven.org/maven2/cn/hutool/hutool-all/5.8.34/)
- [Maven Repo](https://repo1.maven.org/maven2/cn/hutool/hutool-all/5.8.35/)

> 🔔️note:
> Hutool 5.x supports JDK8+ and is not tested on Android platforms, and cannot guarantee that all tool classes or tool methods are available.
Expand Down Expand Up @@ -199,6 +202,7 @@ When submitting feedback, please indicate which JDK version, Hutool version, and

- [Gitee issue](https://gitee.com/dromara/hutool/issues)
- [Github issue](https://github.com/dromara/hutool/issues)
- [Gitcode issue](https://gitcode.com/dromara/hutool/issues)

### 🧬Principles of PR(pull request)

Expand Down
14 changes: 9 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@
<a target="_blank" href='https://github.com/dromara/hutool'>
<img src="https://img.shields.io/github/stars/dromara/hutool.svg?style=social" alt="github star"/>
</a>
<a target="_blank" href='https://gitcode.com/dromara/hutool'>
<img src="https://gitcode.com/dromara/hutool/star/badge.svg" alt="gitcode star"/>
</a>
</p>

<br/>
Expand Down Expand Up @@ -143,20 +146,20 @@ Hutool = Hu + tool,是原公司项目底层代码剥离后的开源库,“Hu
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>5.8.34</version>
<version>5.8.35</version>
</dependency>
```

### 🍐Gradle
```
implementation 'cn.hutool:hutool-all:5.8.34'
implementation 'cn.hutool:hutool-all:5.8.35'
```

### 📥下载jar

点击以下链接,下载`hutool-all-X.X.X.jar`即可:

- [Maven中央库](https://repo1.maven.org/maven2/cn/hutool/hutool-all/5.8.34/)
- [Maven中央库](https://repo1.maven.org/maven2/cn/hutool/hutool-all/5.8.35/)

> 🔔️注意
> Hutool 5.x支持JDK8+,对Android平台没有测试,不能保证所有工具类或工具方法可用。
Expand Down Expand Up @@ -191,15 +194,16 @@ Hutool的源码分为两个分支,功能如下:

- [Gitee issue](https://gitee.com/dromara/hutool/issues)
- [Github issue](https://github.com/dromara/hutool/issues)
- [Gitcode issue](https://gitcode.com/dromara/hutool/issues)


### 🧬贡献代码的步骤

1. 在Gitee或者Github上fork项目到自己的repo
1. 在Gitee或者Github/Gitcode上fork项目到自己的repo
2. 把fork过去的项目也就是你的项目clone到你的本地
3. 修改代码(记得一定要修改v5-dev分支)
4. commit后push到自己的库(v5-dev分支)
5. 登录Gitee或Github在你首页可以看到一个 pull request 按钮,点击它,填写一些说明信息,然后提交即可。
5. 登录Gitee或Github/Gitcode在你首页可以看到一个 pull request 按钮,点击它,填写一些说明信息,然后提交即可。
6. 等待维护者合并

### 📐PR遵照的原则
Expand Down
8 changes: 6 additions & 2 deletions bin/push_dev.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@
echo -e "\033[32mCheckout to v5-dev\033[0m"
git checkout v5-dev

echo -e "\033[32mPush to origin v5-dev\033[0m"
echo -e "\033[32mPush to Github(origin) v5-dev\033[0m"
git push origin v5-dev
echo -e "\033[32mPush to osc v5-dev\033[0m"

echo -e "\033[32mPush to Gitee v5-dev\033[0m"
git push osc v5-dev

echo -e "\033[32mPush to Gitcode v5-dev\033[0m"
git push gitcode v5-dev
8 changes: 6 additions & 2 deletions bin/push_master.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@ git checkout v5-master
echo -e "\033[32mMerge v5-dev branch\033[0m"
git merge v5-dev -m 'Prepare release'

echo -e "\033[32mPush to origin v5-master\033[0m"
echo -e "\033[32mPush to Github(origin) v5-master\033[0m"
git push origin v5-master
echo -e "\033[32mPush to osc v5-master\033[0m"

echo -e "\033[32mPush to Gitee v5-master\033[0m"
git push osc v5-master

echo -e "\033[32mPush to Gitcode v5-master\033[0m"
git push gitcode v5-master
1 change: 1 addition & 0 deletions bin/sync.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
git checkout v5-dev
git pull osc v5-dev
git pull origin v5-dev
git pull gitcode v5-dev
2 changes: 1 addition & 1 deletion bin/version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5.8.34
5.8.35
2 changes: 1 addition & 1 deletion docs/js/version.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
var version = '5.8.34'
var version = '5.8.35'
2 changes: 1 addition & 1 deletion hutool-all/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<parent>
<groupId>cn.hutool</groupId>
<artifactId>hutool-parent</artifactId>
<version>5.8.34</version>
<version>5.8.35</version>
</parent>

<artifactId>hutool-all</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion hutool-aop/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<parent>
<groupId>cn.hutool</groupId>
<artifactId>hutool-parent</artifactId>
<version>5.8.34</version>
<version>5.8.35</version>
</parent>

<artifactId>hutool-aop</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion hutool-bloomFilter/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<parent>
<groupId>cn.hutool</groupId>
<artifactId>hutool-parent</artifactId>
<version>5.8.34</version>
<version>5.8.35</version>
</parent>

<artifactId>hutool-bloomFilter</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion hutool-bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<parent>
<groupId>cn.hutool</groupId>
<artifactId>hutool-parent</artifactId>
<version>5.8.34</version>
<version>5.8.35</version>
</parent>

<artifactId>hutool-bom</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion hutool-cache/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<parent>
<groupId>cn.hutool</groupId>
<artifactId>hutool-parent</artifactId>
<version>5.8.34</version>
<version>5.8.35</version>
</parent>

<artifactId>hutool-cache</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* @param <V> 值类型
* @author Looly
*/
public class FIFOCache<K, V> extends StampedCache<K, V> {
public class FIFOCache<K, V> extends ReentrantCache<K, V> {
private static final long serialVersionUID = 1L;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* @param <K> 键类型
* @param <V> 值类型
*/
public class LFUCache<K, V> extends StampedCache<K, V> {
public class LFUCache<K, V> extends ReentrantCache<K, V> {
private static final long serialVersionUID = 1L;

/**
Expand Down
29 changes: 25 additions & 4 deletions hutool-cache/src/main/java/cn/hutool/cache/impl/StampedCache.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@
* @param <V> 值类型
* @author looly
* @since 5.7.15
* @deprecated Map使用StampedLock可能造成数据不一致甚至Map循环调用,此缓存废弃
*/
@Deprecated
public abstract class StampedCache<K, V> extends AbstractCache<K, V> {
private static final long serialVersionUID = 1L;

Expand Down Expand Up @@ -88,7 +90,12 @@ public void clear() {
}

/**
* 获取值
* 获取值,使用乐观锁,但是此方法可能导致读取脏数据,但对于缓存业务可容忍。情况如下:
* <pre>
* 1. 读取时无写入,不冲突,直接获取值
* 2. 读取时无写入,但是乐观读时触发了并发异常,此时获取同步锁,获取新值
* 4. 读取时有写入,此时获取同步锁,获取新值
* </pre>
*
* @param key 键
* @param isUpdateLastAccess 是否更新最后修改时间
Expand All @@ -97,10 +104,24 @@ public void clear() {
*/
private V get(K key, boolean isUpdateLastAccess, boolean isUpdateCount) {
// 尝试读取缓存,使用乐观读锁
CacheObj<K, V> co = null;
long stamp = lock.tryOptimisticRead();
CacheObj<K, V> co = getWithoutLock(key);
if (false == lock.validate(stamp)) {
// 有写线程修改了此对象,悲观读
boolean isReadError = true;
if(lock.validate(stamp)){
try{
// 乐观读,可能读取脏数据,在缓存中可容忍,分两种情况
// 1. 读取时无线程写入
// 2. 读取时有线程写入,导致数据不一致,此时读取未更新的缓存值
co = getWithoutLock(key);
isReadError = false;
} catch (final Exception ignore){
// ignore
}
}

if(isReadError){
// 转换为悲观读
// 原因可能为无锁读时触发并发异常,或者锁被占(正在写)
stamp = lock.readLock();
try {
co = getWithoutLock(key);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* @param <K> 键类型
* @param <V> 值类型
*/
public class TimedCache<K, V> extends StampedCache<K, V> {
public class TimedCache<K, V> extends ReentrantCache<K, V> {
private static final long serialVersionUID = 1L;

/** 正在执行的定时任务 */
Expand Down
2 changes: 1 addition & 1 deletion hutool-captcha/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<parent>
<groupId>cn.hutool</groupId>
<artifactId>hutool-parent</artifactId>
<version>5.8.34</version>
<version>5.8.35</version>
</parent>

<artifactId>hutool-captcha</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,7 @@ public GifCaptcha setQuality(int quality) {
* @return this
*/
public GifCaptcha setRepeat(int repeat) {
if (repeat >= 0) {
this.repeat = repeat;
}
this.repeat = Math.max(repeat, 0);
return this;
}

Expand Down
Loading

0 comments on commit ced8bf8

Please sign in to comment.