Skip to content

Commit 192c316

Browse files
committed
Fix bug with calculation of serial remaining delay
1 parent dd05c05 commit 192c316

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

  • AndroidAnnotations/androidannotations-core/androidannotations-api/src/main/java/org/androidannotations/api

‎AndroidAnnotations/androidannotations-core/androidannotations-api/src/main/java/org/androidannotations/api/BackgroundExecutor.java‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ private BackgroundExecutor() {
9393
* if the current executor set by {@link #setExecutor(Executor)}
9494
* does not support scheduling
9595
*/
96-
private static Future<?> directExecute(Runnable runnable, int delay) {
96+
private static Future<?> directExecute(Runnable runnable, long delay) {
9797
Future<?> future = null;
9898
if (delay > 0) {
9999
/* no serial, but a delay: schedule the task */
@@ -360,7 +360,7 @@ private static Task take(String serial) {
360360
public static abstract class Task implements Runnable {
361361

362362
private String id;
363-
private int remainingDelay;
363+
private long remainingDelay;
364364
private long targetTimeMillis; /* since epoch */
365365
private String serial;
366366
private boolean executionAsked;
@@ -426,7 +426,7 @@ private void postExecute() {
426426
if (next != null) {
427427
if (next.remainingDelay != 0) {
428428
/* the delay may not have elapsed yet */
429-
next.remainingDelay = Math.max(0, (int) (targetTimeMillis - System.currentTimeMillis()));
429+
next.remainingDelay = Math.max(0L, targetTimeMillis - System.currentTimeMillis());
430430
}
431431
/* a task having the same serial was queued, execute it */
432432
BackgroundExecutor.execute(next);

0 commit comments

Comments
 (0)