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

com.parse.ParseExecutors Maven / Gradle / Ivy

Go to download

A library that gives you access to the powerful Parse cloud platform from your Android app.

There is a newer version: 1.17.3
Show newest version
/*
 * Copyright (c) 2015-present, Parse, LLC.
 * All rights reserved.
 *
 * This source code is licensed under the BSD-style license found in the
 * LICENSE file in the root directory of this source tree. An additional grant
 * of patent rights can be found in the PATENTS file in the same directory.
 */
package com.parse;

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

import bolts.Task;

/** package */ class ParseExecutors {

  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