Skip to content

Commit

Permalink
add some javadoc
Browse files Browse the repository at this point in the history
  • Loading branch information
yjfnypeu committed Jul 19, 2017
1 parent 2a7fb11 commit f6b23b9
Showing 1 changed file with 17 additions and 13 deletions.
30 changes: 17 additions & 13 deletions easythread/src/main/java/com/lzh/easythread/EasyThread.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@
import android.os.Handler;
import android.os.Looper;

import com.sun.istack.internal.NotNull;

import java.util.concurrent.Callable;
import java.util.concurrent.Executor;
import java.util.concurrent.ExecutorService;
Expand All @@ -31,12 +29,12 @@

public final class EasyThread implements Executor{
private ExecutorService pool;
private String defName;
private Callback defCallback;
private String defName;// default thread name.
private Callback defCallback;// default thread callback.

private String name;
private Callback callback;
private long delay;
private String name;// a temp thread name. just used for current task.
private Callback callback;// a temp thread callback. just used for current task.
private long delay;// the delay time for current task. only the task is created with type of scheduled. it will be worked.

private EasyThread(int type, int size, int priority, String name, Callback callback) {
this.pool = createPool(type, size, priority);
Expand Down Expand Up @@ -191,29 +189,35 @@ private Builder(int size, int type) {
}

/**
* create a cacheable thread manager to used
* @return Builder instance
* Create a cacheable thread manager to used:<b>Executors.newCachedThreadPool()</b>
* @return Builder itself
*/
public static Builder cacheable () {
return new Builder(0, TYPE_CACHEABLE);
}

/**
* create a thread manager with a limit size to used
* Create a thread manager with a limit size to used:<b>Executors.newFixedThreadPool()</b>
* @param size size
* @return Builder instance
* @return Builder itself
*/
public static Builder fixed (int size) {
return new Builder(size, TYPE_FIXED);
}

/**
* Create a thread manager with a scheduled thread pool: <b>Executors.newScheduledThreadPool()</b>
* @param size Thread size.
* @return Builder itself
*/
public static Builder scheduled (int size) {
return new Builder(size, TYPE_SCHEDULED);
}

/**
* create a thread manager with single thread to used
* @return Builder instance
*
* @return Builder itself
*/
public static Builder single () {
return new Builder(0, TYPE_SINGLE);
Expand All @@ -222,7 +226,7 @@ public static Builder single () {
/**
* Set a default name for thread manager to used
* @param name The thread name.
* @return itself
* @return Builder itself
*/
public Builder name (String name) {
if (!Tools.isEmpty(name)) {
Expand Down

0 comments on commit f6b23b9

Please sign in to comment.