Skip to content

Commit

Permalink
0.9.53
Browse files Browse the repository at this point in the history
  • Loading branch information
landawn committed Mar 1, 2017
1 parent 11084c6 commit e8470ba
Show file tree
Hide file tree
Showing 9 changed files with 334 additions and 98 deletions.
6 changes: 2 additions & 4 deletions CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,9 @@

1, Improve Pair/Triple/Tuple...

2, Add firstResult/firstSuccessResult/lastResult/lastSuccessResult/parallelGet to CompletableFuture.
2, Refactoring CompletableFuture/AsyncExecutor to keep consistent with CompletableFuture in JDK 8.

3, Refactoring CompletableFuture/AsyncExecutor to keep consistent with CompletableFuture in JDK 8.

4, Improvements and bug fix.
3, Improvements and bug fix.


========Changes in 0.9.52=========================================================================
Expand Down
Binary file modified lib/abacus-util-0.9.53.jar
Binary file not shown.
Binary file modified lib/abacus-util-all-0.9.53.jar
Binary file not shown.
16 changes: 10 additions & 6 deletions src/com/landawn/abacus/android/util/AsyncExecutor.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@
*/
public class AsyncExecutor {

static final UIExecutor UI_EXECUTOR = new UIExecutor();
static final Executor SERIAL_EXECUTOR = AsyncTask.SERIAL_EXECUTOR;
static final Executor THREAD_POOL_EXECUTOR = AsyncTask.THREAD_POOL_EXECUTOR;
public static final UIExecutor UI_EXECUTOR = new UIExecutor();
public static final Executor SERIAL_EXECUTOR = AsyncTask.SERIAL_EXECUTOR;
public static final Executor TP_EXECUTOR = AsyncTask.THREAD_POOL_EXECUTOR;

private AsyncExecutor() {
// Singleton
Expand Down Expand Up @@ -100,7 +100,7 @@ public T call() throws Exception {
* @return
*/
public static CompletableFuture<Void> executeWithThreadPool(final Runnable action) {
return execute(new FutureTask<Void>(action, null), THREAD_POOL_EXECUTOR);
return execute(new FutureTask<Void>(action, null), TP_EXECUTOR);
}

public static CompletableFuture<Void> executeWithThreadPool(final Runnable action, final int retryTimes, final long retryInterval,
Expand All @@ -120,7 +120,7 @@ public void run() {
* @return
*/
public static <T> CompletableFuture<T> executeWithThreadPool(final Callable<T> action) {
return execute(new FutureTask<>(action), THREAD_POOL_EXECUTOR);
return execute(new FutureTask<>(action), TP_EXECUTOR);
}

public static <T> CompletableFuture<T> executeWithThreadPool(final Callable<T> action, final int retryTimes, final long retryInterval,
Expand Down Expand Up @@ -209,9 +209,13 @@ private static <T> CompletableFuture<T> execute(final FutureTask<T> futureTask,
return new CompletableFuture<>(futureTask, executor);
}

static final class UIExecutor implements Executor {
public static final class UIExecutor implements Executor {
private static final Handler HANDLER = new Handler(Looper.getMainLooper());

private UIExecutor() {
// Singleton.
}

@Override
public void execute(Runnable command) {
HANDLER.post(command);
Expand Down
Loading

0 comments on commit e8470ba

Please sign in to comment.