All Downloads are FREE. Search and download functionalities are using the official Maven repository.

co.easimart.EasimartExecutors Maven / Gradle / Ivy

package co.easimart;

import java.util.concurrent.Executor;
import java.util.concurrent.ScheduledExecutorService;

import bolts.Task;

/** package */ class EasimartExecutors {

  private static ScheduledExecutorService scheduledExecutor;
  private static final Object SCHEDULED_EXECUTOR_LOCK = new Object();
  /**
   * Long running operations should NOT be put onto SCHEDULED_EXECUTOR.
   */
  /* package */ static ScheduledExecutorService scheduled() {
    synchronized (SCHEDULED_EXECUTOR_LOCK) {
      if (scheduledExecutor == null) {
        scheduledExecutor = java.util.concurrent.Executors.newScheduledThreadPool(1);
      }
    }
    return scheduledExecutor;
  }

  /* package */ static Executor main() {
    return Task.UI_THREAD_EXECUTOR;
  }

  /* package */ static Executor io() {
    return Task.BACKGROUND_EXECUTOR;
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy