提交 fdad02a3 编写于 作者: B Blankj

see 05/31 log

上级 6e835ae9
......@@ -7,12 +7,12 @@ gradle.ext {
compileSdkVersion = 27
minSdkVersion = 14
targetSdkVersion = 27
versionCode = 1_023_007
versionName = '1.23.7'// E.g. 1.9.72 => 1,009,072
versionCode = 1_023_008
versionName = '1.23.8'// E.g. 1.9.72 => 1,009,072
bus = [
isPublish: false,
isDebug : false,
isDebug : true,
version : '1.7',
group : 'com.blankj'
]
......@@ -185,4 +185,4 @@ class ModuleConfig {
" }\n"
}
}
//./gradlew clean utilcode-lib:bintrayUpload
\ No newline at end of file
//./gradlew clean :utilcode:lib:bintrayUpload
\ No newline at end of file
......@@ -58,6 +58,7 @@ public final class BusUtils {
public static <T> T postStatic(final String name, final Object... objects) {
if (name == null || name.length() == 0) return null;
Object o = injectShell(name, objects);
com.blankj.utilcode.util.LogUtils.e("BusUtils");
if (NULL.equals(o)) {
com.blankj.utilcode.util.LogUtils.e("BusUtils", "static bus of <" + name + "> didn\'t exist.");
return null;
......
......@@ -12,7 +12,6 @@ import org.robolectric.shadows.ShadowLog;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.Executor;
import java.util.concurrent.TimeUnit;
/**
* <pre>
......@@ -39,65 +38,39 @@ public class BaseTest {
@Test
public void test() throws Exception {
ThreadUtils.Task<Void> task = new ThreadUtils.Task<Void>() {
@Override
public Void doInBackground() throws Throwable {
System.out.println("haha");
return null;
}
@Override
public void onSuccess(Void result) {
System.out.println("onSuccess");
}
@Override
public void onCancel() {
System.out.println("onCancel");
}
@Override
public void onFail(Throwable t) {
System.out.println(t.toString());
}
};
ThreadUtils.executeBySingleAtFixRate(task, 1, 1, TimeUnit.SECONDS);
final CountDownLatch countDownLatch = new CountDownLatch(1);
//// for (int i = 0; i < 100; i++) {
//// final int finalI = i;
// ThreadUtils.Task<Void> task = new ThreadUtils.Task<Void>() {
//
// @Override
// public Void doInBackground() throws Throwable {
// for (int j = 0; j < 10000; j++) {
// Thread.sleep(100);
// System.out.println(j);
// }
// return null;
// }
//
// @Override
// public void onSuccess(@Nullable Void result) {
// System.out.println(Thread.currentThread().getName());
// }
//
// @Override
// public void onCancel() {
// System.out.println("onCancel");
// }
//
// @Override
// public void onFail(Throwable t) {
// System.out.println(t + "onFail");
// }
// };
// ThreadUtils.executeBySingle(task);
//
//// }
Thread.sleep(100);
task.cancel();
for (int i = 0; i < 100; i++) {
final int finalI = i;
ThreadUtils.Task<Void> task = new ThreadUtils.Task<Void>() {
@Override
public Void doInBackground() throws Throwable {
for (int j = 0; j < 10000; j++) {
Thread.sleep(100);
System.out.println(j);
}
return null;
}
@Override
public void onSuccess(Void result) {
System.out.println(finalI + Thread.currentThread().getName());
}
@Override
public void onCancel() {
System.out.println(finalI + "onCancel");
}
@Override
public void onFail(Throwable t) {
System.out.println(finalI + "onFail" + t);
}
};
ThreadUtils.executeBySingle(task);
Thread.sleep(100);
task.cancel();
}
countDownLatch.countDown();
countDownLatch.await();
......@@ -228,8 +201,8 @@ public class BaseTest {
static class Person implements Comparable<Person> {
String name;
int age;
int time;
int age;
int time;
public Person(String name) {
this.name = name;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册