Пример #1
0
 /** 启动自动下载数据 */
 public void autoDownLoadDataTask() {
   BackgroundExecutor.execute(
       new BackgroundExecutor.Task("", 500, "") {
         @Override
         public void execute() {
           try {
             getSDCardDataFromCamera();
           } catch (Throwable e) {
             Thread.getDefaultUncaughtExceptionHandler()
                 .uncaughtException(Thread.currentThread(), e);
           }
         }
       });
 }
Пример #2
0
  @Override
  public void loadNewList(final String url) {
    BackgroundExecutor.execute(
        new BackgroundExecutor.Task("", 0, "") {

          @Override
          public void execute() {
            try {
              DianYingFragment_.super.loadNewList(url);
            } catch (Throwable e) {
              Thread.getDefaultUncaughtExceptionHandler()
                  .uncaughtException(Thread.currentThread(), e);
            }
          }
        });
  }
    private void postExecute() {
      if (id == null && serial == null) {
        /* nothing to do */
        return;
      }
      CURRENT_SERIAL.set(null);
      synchronized (BackgroundExecutor.class) {
        /* execution complete */
        TASKS.remove(this);

        if (serial != null) {
          Task next = take(serial);
          if (next != null) {
            if (next.remainingDelay != 0) {
              /* the delay may not have elapsed yet */
              next.remainingDelay =
                  Math.max(0, (int) (targetTimeMillis - System.currentTimeMillis()));
            }
            /* a task having the same serial was queued, execute it */
            BackgroundExecutor.execute(next);
          }
        }
      }
    }