提交 e5144fa4 编写于 作者: B Blankj

see 07/23 log

上级 7f247e7e
* `19/07/23` [fix] ThreadUtils of cache pool. Publish v1.25.1.
* `19/07/18` [add] README of ApiUtils and BusUtils.
* `19/07/15` [add] Publish v1.25.0.
* `19/07/14` [upd] Bus plugin for use BusUtils. Publish bus plugin v2.0.
......@@ -5,7 +6,7 @@
* `19/07/09` [upd] The frame of project.
* `19/07/06` [upd] BusUtils which behave same as EventBus.
* `19/07/03` [add] ApiUtils which decoupling modules.
* `19/06/30` [add] LanguageUtils support activity's class name. Publish v1.25.0.
* `19/06/30` [add] LanguageUtils support activity's class name.
* `19/06/29` [add] ClickUtils#OnMultiClickListener, and remove dangerous function. Publish v1.24.6.
* `19/06/28` [add] LanguageUtils. Publish v1.24.5.
* `19/06/20` [fix] BusUtils' permission. Publish v1.24.4.
......
......@@ -45,7 +45,7 @@
[frame]: https://raw.githubusercontent.com/Blankj/AndroidUtilCode/master/art/auc_frame.png
[aucSvg]: https://img.shields.io/badge/AndroidUtilCode-v1.25.0-brightgreen.svg
[aucSvg]: https://img.shields.io/badge/AndroidUtilCode-v1.25.1-brightgreen.svg
[auc]: https://github.com/Blankj/AndroidUtilCode
[apiSvg]: https://img.shields.io/badge/API-14+-brightgreen.svg
......
......@@ -45,7 +45,7 @@ If this project helps you a lot and you want to support the project's developmen
[frame]: https://raw.githubusercontent.com/Blankj/AndroidUtilCode/master/art/auc_frame.png
[aucSvg]: https://img.shields.io/badge/AndroidUtilCode-v1.25.0-brightgreen.svg
[aucSvg]: https://img.shields.io/badge/AndroidUtilCode-v1.25.1-brightgreen.svg
[auc]: https://github.com/Blankj/AndroidUtilCode
[apiSvg]: https://img.shields.io/badge/API-14+-brightgreen.svg
......
......@@ -14,8 +14,8 @@ class Config {
static compileSdkVersion = 27
static minSdkVersion = 14
static targetSdkVersion = 27
static versionCode = 1_025_000
static versionName = '1.25.0'// E.g. 1.9.72 => 1,009,072
static versionCode = 1_025_001
static versionName = '1.25.1'// E.g. 1.9.72 => 1,009,072
// lib version
static kotlin_version = '1.3.10'
......
......@@ -2,10 +2,10 @@
Gradle:
```groovy
implementation 'com.blankj:utilcode:1.25.0'
implementation 'com.blankj:utilcode:1.25.1'
// if u use AndroidX, use the following
implementation 'com.blankj:utilcodex:1.25.0'
implementation 'com.blankj:utilcodex:1.25.1'
```
......
......@@ -2,10 +2,10 @@
Gradle:
```groovy
implementation 'com.blankj:utilcode:1.25.0'
implementation 'com.blankj:utilcode:1.25.1'
// if u use AndroidX, use the following
implementation 'com.blankj:utilcodex:1.25.0'
implementation 'com.blankj:utilcodex:1.25.1'
```
......
......@@ -976,17 +976,17 @@ public final class ThreadUtils {
case TYPE_CACHED:
return new ThreadPoolExecutor4Util(0, 128,
60L, TimeUnit.SECONDS,
new LinkedBlockingQueue4Util(),
new LinkedBlockingQueue4Util(true),
new UtilsThreadFactory("cached", priority)
);
case TYPE_IO:
return new ThreadPoolExecutor4Util(0, 2 * CPU_COUNT + 1,
return new ThreadPoolExecutor4Util(2 * CPU_COUNT + 1, 2 * CPU_COUNT + 1,
30, TimeUnit.SECONDS,
new LinkedBlockingQueue4Util(),
new UtilsThreadFactory("io", priority)
);
case TYPE_CPU:
return new ThreadPoolExecutor4Util(CPU_COUNT + 1, 2 * CPU_COUNT + 1,
return new ThreadPoolExecutor4Util(CPU_COUNT + 1, CPU_COUNT + 1,
30, TimeUnit.SECONDS,
new LinkedBlockingQueue4Util(),
new UtilsThreadFactory("cpu", priority)
......@@ -1046,20 +1046,20 @@ public final class ThreadUtils {
private volatile ThreadPoolExecutor4Util mPool;
private int mCapacity = Integer.MAX_VALUE;
private boolean mIsAddSubThreadFirstThenAddQueue = false;
LinkedBlockingQueue4Util() {
super();
}
LinkedBlockingQueue4Util(int capacity) {
LinkedBlockingQueue4Util(boolean isAddSubThreadFirstThenAddQueue) {
super();
mCapacity = capacity;
mIsAddSubThreadFirstThenAddQueue = isAddSubThreadFirstThenAddQueue;
}
@Override
public boolean offer(@NonNull Runnable runnable) {
if (mCapacity <= size() &&
if (mIsAddSubThreadFirstThenAddQueue &&
mPool != null && mPool.getPoolSize() < mPool.getMaximumPoolSize()) {
// create a non-core thread
return false;
......
......@@ -10,7 +10,9 @@ import org.robolectric.RuntimeEnvironment;
import org.robolectric.annotation.Config;
import org.robolectric.shadows.ShadowLog;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.Executor;
import java.util.concurrent.TimeUnit;
/**
* <pre>
......@@ -37,6 +39,25 @@ public class BaseTest {
@Test
public void test() throws Exception {
CountDownLatch latch = new CountDownLatch(1);
for (int i = 0; i < 100; i++) {
final int finalI = i;
ThreadUtils.executeByCpu(new ThreadUtils.SimpleTask<Void>() {
@Override
public Void doInBackground() throws Throwable {
System.out.println("" + Thread.currentThread() + finalI);
Thread.sleep(100);
return null;
}
@Override
public void onSuccess(Void result) {
}
});
}
latch.await(1, TimeUnit.SECONDS);
}
}
......@@ -42,7 +42,7 @@ apply plugin: "com.blankj.api"
给你的项目添加 **[AndroidUtilCode](https://github.com/Blankj/AndroidUtilCode)** 依赖:
```groovy
api "com.blankj:utilcode:1.25.0"
api "com.blankj:utilcode:latest_version"
```
如果你单纯只想引入 `ApiUtils` 也是可以的,需要你自己拷贝一份这个类放到你工程里,然后在 app 下的 `build.gradle` 中 配置 api 的 SDL 域如下所示:
......
......@@ -33,7 +33,7 @@ apply plugin: "com.blankj.bus"
给你的项目添加 [AndroidUtilCode](https://github.com/Blankj/AndroidUtilCode) 依赖:
```groovy
api "com.blankj:utilcode:1.25.0"
api "com.blankj:utilcode:latest_version
```
如果你单纯只想引入 `BusUtils` 也是可以的,需要你自己拷贝一份这个类放到你工程里,记得还要拷贝 `ThreadUtils` 哦,然后在 app 下的 `build.gradle` 中 配置 bus 的 SDL 域如下所示:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册