Skip to content

Commit e5144fa

Browse files
committed
see 07/23 log
1 parent 7f247e7 commit e5144fa

File tree

10 files changed

+41
-19
lines changed

10 files changed

+41
-19
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1+
* `19/07/23` [fix] ThreadUtils of cache pool. Publish v1.25.1.
12
* `19/07/18` [add] README of ApiUtils and BusUtils.
23
* `19/07/15` [add] Publish v1.25.0.
34
* `19/07/14` [upd] Bus plugin for use BusUtils. Publish bus plugin v2.0.
45
* `19/07/13` [add] Api plugin for use ApiUtils. Publish api plugin v1.0.
56
* `19/07/09` [upd] The frame of project.
67
* `19/07/06` [upd] BusUtils which behave same as EventBus.
78
* `19/07/03` [add] ApiUtils which decoupling modules.
8-
* `19/06/30` [add] LanguageUtils support activity's class name. Publish v1.25.0.
9+
* `19/06/30` [add] LanguageUtils support activity's class name.
910
* `19/06/29` [add] ClickUtils#OnMultiClickListener, and remove dangerous function. Publish v1.24.6.
1011
* `19/06/28` [add] LanguageUtils. Publish v1.24.5.
1112
* `19/06/20` [fix] BusUtils' permission. Publish v1.24.4.

README-CN.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545

4646
[frame]: https://raw.githubusercontent.com/Blankj/AndroidUtilCode/master/art/auc_frame.png
4747

48-
[aucSvg]: https://img.shields.io/badge/AndroidUtilCode-v1.25.0-brightgreen.svg
48+
[aucSvg]: https://img.shields.io/badge/AndroidUtilCode-v1.25.1-brightgreen.svg
4949
[auc]: https://github.com/Blankj/AndroidUtilCode
5050

5151
[apiSvg]: https://img.shields.io/badge/API-14+-brightgreen.svg

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ If this project helps you a lot and you want to support the project's developmen
4545

4646
[frame]: https://raw.githubusercontent.com/Blankj/AndroidUtilCode/master/art/auc_frame.png
4747

48-
[aucSvg]: https://img.shields.io/badge/AndroidUtilCode-v1.25.0-brightgreen.svg
48+
[aucSvg]: https://img.shields.io/badge/AndroidUtilCode-v1.25.1-brightgreen.svg
4949
[auc]: https://github.com/Blankj/AndroidUtilCode
5050

5151
[apiSvg]: https://img.shields.io/badge/API-14+-brightgreen.svg

buildSrc/src/main/groovy/Config.groovy

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ class Config {
1414
static compileSdkVersion = 27
1515
static minSdkVersion = 14
1616
static targetSdkVersion = 27
17-
static versionCode = 1_025_000
18-
static versionName = '1.25.0'// E.g. 1.9.72 => 1,009,072
17+
static versionCode = 1_025_001
18+
static versionName = '1.25.1'// E.g. 1.9.72 => 1,009,072
1919

2020
// lib version
2121
static kotlin_version = '1.3.10'

lib/utilcode/README-CN.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
Gradle:
44
```groovy
5-
implementation 'com.blankj:utilcode:1.25.0'
5+
implementation 'com.blankj:utilcode:1.25.1'
66
77
// if u use AndroidX, use the following
8-
implementation 'com.blankj:utilcodex:1.25.0'
8+
implementation 'com.blankj:utilcodex:1.25.1'
99
```
1010

1111

lib/utilcode/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
Gradle:
44
```groovy
5-
implementation 'com.blankj:utilcode:1.25.0'
5+
implementation 'com.blankj:utilcode:1.25.1'
66
77
// if u use AndroidX, use the following
8-
implementation 'com.blankj:utilcodex:1.25.0'
8+
implementation 'com.blankj:utilcodex:1.25.1'
99
```
1010

1111

lib/utilcode/src/main/java/com/blankj/utilcode/util/ThreadUtils.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -976,17 +976,17 @@ private static ExecutorService createPool(final int type, final int priority) {
976976
case TYPE_CACHED:
977977
return new ThreadPoolExecutor4Util(0, 128,
978978
60L, TimeUnit.SECONDS,
979-
new LinkedBlockingQueue4Util(),
979+
new LinkedBlockingQueue4Util(true),
980980
new UtilsThreadFactory("cached", priority)
981981
);
982982
case TYPE_IO:
983-
return new ThreadPoolExecutor4Util(0, 2 * CPU_COUNT + 1,
983+
return new ThreadPoolExecutor4Util(2 * CPU_COUNT + 1, 2 * CPU_COUNT + 1,
984984
30, TimeUnit.SECONDS,
985985
new LinkedBlockingQueue4Util(),
986986
new UtilsThreadFactory("io", priority)
987987
);
988988
case TYPE_CPU:
989-
return new ThreadPoolExecutor4Util(CPU_COUNT + 1, 2 * CPU_COUNT + 1,
989+
return new ThreadPoolExecutor4Util(CPU_COUNT + 1, CPU_COUNT + 1,
990990
30, TimeUnit.SECONDS,
991991
new LinkedBlockingQueue4Util(),
992992
new UtilsThreadFactory("cpu", priority)
@@ -1046,20 +1046,20 @@ private static final class LinkedBlockingQueue4Util extends LinkedBlockingQueue<
10461046

10471047
private volatile ThreadPoolExecutor4Util mPool;
10481048

1049-
private int mCapacity = Integer.MAX_VALUE;
1049+
private boolean mIsAddSubThreadFirstThenAddQueue = false;
10501050

10511051
LinkedBlockingQueue4Util() {
10521052
super();
10531053
}
10541054

1055-
LinkedBlockingQueue4Util(int capacity) {
1055+
LinkedBlockingQueue4Util(boolean isAddSubThreadFirstThenAddQueue) {
10561056
super();
1057-
mCapacity = capacity;
1057+
mIsAddSubThreadFirstThenAddQueue = isAddSubThreadFirstThenAddQueue;
10581058
}
10591059

10601060
@Override
10611061
public boolean offer(@NonNull Runnable runnable) {
1062-
if (mCapacity <= size() &&
1062+
if (mIsAddSubThreadFirstThenAddQueue &&
10631063
mPool != null && mPool.getPoolSize() < mPool.getMaximumPoolSize()) {
10641064
// create a non-core thread
10651065
return false;

lib/utilcode/src/test/java/com/blankj/utilcode/util/BaseTest.java

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@
1010
import org.robolectric.annotation.Config;
1111
import org.robolectric.shadows.ShadowLog;
1212

13+
import java.util.concurrent.CountDownLatch;
1314
import java.util.concurrent.Executor;
15+
import java.util.concurrent.TimeUnit;
1416

1517
/**
1618
* <pre>
@@ -37,6 +39,25 @@ public void execute(@NonNull Runnable command) {
3739

3840
@Test
3941
public void test() throws Exception {
40-
42+
CountDownLatch latch = new CountDownLatch(1);
43+
44+
for (int i = 0; i < 100; i++) {
45+
final int finalI = i;
46+
ThreadUtils.executeByCpu(new ThreadUtils.SimpleTask<Void>() {
47+
@Override
48+
public Void doInBackground() throws Throwable {
49+
System.out.println("" + Thread.currentThread() + finalI);
50+
Thread.sleep(100);
51+
return null;
52+
}
53+
54+
@Override
55+
public void onSuccess(Void result) {
56+
57+
}
58+
});
59+
}
60+
61+
latch.await(1, TimeUnit.SECONDS);
4162
}
4263
}

plugin/api-gradle-plugin/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ apply plugin: "com.blankj.api"
4242
给你的项目添加 **[AndroidUtilCode](https://github.com/Blankj/AndroidUtilCode)** 依赖:
4343

4444
```groovy
45-
api "com.blankj:utilcode:1.25.0"
45+
api "com.blankj:utilcode:latest_version"
4646
```
4747

4848
如果你单纯只想引入 `ApiUtils` 也是可以的,需要你自己拷贝一份这个类放到你工程里,然后在 app 下的 `build.gradle` 中 配置 api 的 SDL 域如下所示:

plugin/bus-gradle-plugin/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ apply plugin: "com.blankj.bus"
3333
给你的项目添加 [AndroidUtilCode](https://github.com/Blankj/AndroidUtilCode) 依赖:
3434

3535
```groovy
36-
api "com.blankj:utilcode:1.25.0"
36+
api "com.blankj:utilcode:latest_version
3737
```
3838

3939
如果你单纯只想引入 `BusUtils` 也是可以的,需要你自己拷贝一份这个类放到你工程里,记得还要拷贝 `ThreadUtils` 哦,然后在 app 下的 `build.gradle` 中 配置 bus 的 SDL 域如下所示:

0 commit comments

Comments
 (0)