|
19 | 19 | import java.lang.annotation.Retention; |
20 | 20 | import java.lang.annotation.RetentionPolicy; |
21 | 21 | import java.lang.annotation.Target; |
22 | | -import java.util.concurrent.Future; |
23 | | -import java.util.concurrent.ScheduledThreadPoolExecutor; |
24 | 22 |
|
25 | 23 | /** |
26 | 24 | * <p> |
|
30 | 28 | * The annotated method MUST return void and MAY contain parameters. |
31 | 29 | * </p> |
32 | 30 | * <p> |
33 | | - * The generated code is based on {@link org.androidannotations.api.BackgroundExecutor} methods. |
| 31 | + * The generated code is based on |
| 32 | + * {@link org.androidannotations.api.BackgroundExecutor BackgroundExecutor} |
| 33 | + * methods. |
34 | 34 | * </p> |
35 | 35 | * |
36 | 36 | * <h2>Cancellation</h2> |
|
66 | 66 | * <b>Note</b>: Cancellation may or may not be successful. If the task wasn't |
67 | 67 | * executed yet, it will be removed from the pool. But it could fail if task has |
68 | 68 | * already completed, has already been cancelled, or could not be cancelled for |
69 | | - * some other reason. See {@link Future#cancel(boolean)} for more information. |
| 69 | + * some other reason. See {@link java.util.concurrent.Future#cancel(boolean) |
| 70 | + * Future#cancel(boolean)} for more information. |
70 | 71 | * </p> |
71 | 72 | * |
72 | 73 | * <h2>Execution flow</h2> |
73 | 74 | * <p> |
74 | | - * By default, all tasks will be put in a {@link ScheduledThreadPoolExecutor} |
75 | | - * with a core pool size of <code>2 * numberOfCpu</code>. Which means that |
76 | | - * background methods will be executed in <b>PARALLEL</b>. You can change this |
77 | | - * by calling <code>BackgroundExecutor.setExecutor(...)</code>. |
| 75 | + * By default, all tasks will be put in a |
| 76 | + * {@link java.util.concurrent.ScheduledThreadPoolExecutor |
| 77 | + * ScheduledThreadPoolExecutor} with a core pool size of |
| 78 | + * <code>2 * numberOfCpu</code>. Which means that background methods will be |
| 79 | + * executed in <b>PARALLEL</b>. You can change this by calling |
| 80 | + * <code>BackgroundExecutor.setExecutor(...)</code>. |
78 | 81 | * </p> |
79 | 82 | * <p> |
80 | 83 | * If you want execute ALL background methods SEQUENTIALLY, the best way is to |
81 | | - * change the executor of {@link org.androidannotations.api.BackgroundExecutor} to a |
82 | | - * {@link ScheduledThreadPoolExecutor} with a core pool size of <code>1</code>. |
| 84 | + * change the executor of {@link org.androidannotations.api.BackgroundExecutor |
| 85 | + * BackgroundExecutor} to a |
| 86 | + * {@link java.util.concurrent.ScheduledThreadPoolExecutor |
| 87 | + * ScheduledThreadPoolExecutor} with a core pool size of <code>1</code>. |
83 | 88 | * </p> |
84 | 89 | * <p> |
85 | 90 | * If you want execute some background methods SEQUENTIALLY, you should simply |
|
146 | 151 | * <b>Example</b> : |
147 | 152 | * |
148 | 153 | * <blockquote> |
| 154 | + * |
149 | 155 | * <pre> |
150 | 156 | * @EBean |
151 | 157 | * public class MyBean { |
|
175 | 181 | * boolean mayInterruptIfRunning = true; |
176 | 182 | * BackgroundExecutor.cancelAll("my_background_id", mayInterruptIfRunning); |
177 | 183 | * </pre> |
178 | | - * |
179 | | - * @return the identifier for task cancellation |
| 184 | + * |
| 185 | + * @return the task id for cancellation |
180 | 186 | **/ |
181 | 187 | String id() default ""; |
182 | 188 |
|
183 | 189 | /** |
184 | 190 | * Minimum delay, in milliseconds, before the background task is executed. |
185 | 191 | * |
186 | | - * @return the minimum delay before execution |
| 192 | + * @return the delay of the execution |
187 | 193 | */ |
188 | 194 | int delay() default 0; |
189 | 195 |
|
|
0 commit comments