コード例 #1
0
 public synchronized void execute(final Runnable r) {
   mTasks.offer(
       new Runnable() {
         public void run() {
           try {
             r.run();
           } finally {
             scheduleNext();
           }
         }
       });
   if (mActive == null) {
     scheduleNext();
   }
 }
コード例 #2
0
 protected synchronized void scheduleNext() {
   mActive = mReverse ? mTasks.pollLast() : mTasks.poll();
   if (mActive != null) {
     THREAD_POOL_EXECUTOR.execute(mActive);
   }
 }