Tabnine Logo
ForkJoinPool.tryTerminate
Code IndexAdd Tabnine to your IDE (free)

How to use
tryTerminate
method
in
jsr166y.ForkJoinPool

Best Java code snippets using jsr166y.ForkJoinPool.tryTerminate (Showing top 10 results out of 315)

origin: h2oai/h2o-2

/**
 * Initiates an orderly shutdown in which previously submitted
 * tasks are executed, but no new tasks will be accepted.
 * Invocation has no additional effect if already shut down.
 * Tasks that are in the process of being submitted concurrently
 * during the course of this method may or may not be rejected.
 *
 * @throws SecurityException if a security manager exists and
 *         the caller is not permitted to modify threads
 *         because it does not hold {@link
 *         java.lang.RuntimePermission}{@code ("modifyThread")}
 */
public void shutdown() {
  checkPermission();
  tryTerminate(false, true);
}
origin: h2oai/h2o-2

/**
 * Attempts to cancel and/or stop all tasks, and reject all
 * subsequently submitted tasks.  Tasks that are in the process of
 * being submitted or executed concurrently during the course of
 * this method may or may not be rejected. This method cancels
 * both existing and unexecuted tasks, in order to permit
 * termination in the presence of task dependencies. So the method
 * always returns an empty list (unlike the case for some other
 * Executors).
 *
 * @return an empty list
 * @throws SecurityException if a security manager exists and
 *         the caller is not permitted to modify threads
 *         because it does not hold {@link
 *         java.lang.RuntimePermission}{@code ("modifyThread")}
 */
public List<Runnable> shutdownNow() {
  checkPermission();
  tryTerminate(true, true);
  return Collections.emptyList();
}
origin: h2oai/h2o-2

if (w.eventCount < 0 && !tryTerminate(false, false) &&
  (int)prevCtl != 0 && !hasQueuedSubmissions() && ctl == currentCtl) {
  Thread wt = Thread.currentThread();
origin: h2oai/h2o-2

                  (c & ~(AC_MASK|TC_MASK)))));
if (!tryTerminate(false, false) && w != null) {
origin: org.codehaus.jsr166-mirror/jsr166y

/**
 * Initiates an orderly shutdown in which previously submitted
 * tasks are executed, but no new tasks will be accepted.
 * Invocation has no additional effect if already shut down.
 * Tasks that are in the process of being submitted concurrently
 * during the course of this method may or may not be rejected.
 *
 * @throws SecurityException if a security manager exists and
 *         the caller is not permitted to modify threads
 *         because it does not hold {@link
 *         java.lang.RuntimePermission}{@code ("modifyThread")}
 */
public void shutdown() {
  checkPermission();
  shutdown = true;
  tryTerminate(false);
}
origin: org.codehaus.jsr166-mirror/jsr166y

/**
 * Attempts to cancel and/or stop all tasks, and reject all
 * subsequently submitted tasks.  Tasks that are in the process of
 * being submitted or executed concurrently during the course of
 * this method may or may not be rejected. This method cancels
 * both existing and unexecuted tasks, in order to permit
 * termination in the presence of task dependencies. So the method
 * always returns an empty list (unlike the case for some other
 * Executors).
 *
 * @return an empty list
 * @throws SecurityException if a security manager exists and
 *         the caller is not permitted to modify threads
 *         because it does not hold {@link
 *         java.lang.RuntimePermission}{@code ("modifyThread")}
 */
public List<Runnable> shutdownNow() {
  checkPermission();
  shutdown = true;
  tryTerminate(true);
  return Collections.emptyList();
}
origin: org.codehaus.jsr166-mirror/jsr166y

if (w.eventCount == v) {
  if (shutdown)
    tryTerminate(false);
origin: org.codehaus.jsr166-mirror/jsr166y

/**
 * Tries to create and start a worker; minimally rolls back counts
 * on failure.
 */
private void addWorker() {
  Throwable ex = null;
  ForkJoinWorkerThread t = null;
  try {
    t = factory.newThread(this);
  } catch (Throwable e) {
    ex = e;
  }
  if (t == null) {  // null or exceptional factory return
    long c;       // adjust counts
    do {} while (!UNSAFE.compareAndSwapLong
           (this, ctlOffset, c = ctl,
           (((c - AC_UNIT) & AC_MASK) |
            ((c - TC_UNIT) & TC_MASK) |
            (c & ~(AC_MASK|TC_MASK)))));
    // Propagate exception if originating from an external caller
    if (!tryTerminate(false) && ex != null &&
      !(Thread.currentThread() instanceof ForkJoinWorkerThread))
      UNSAFE.throwException(ex);
  }
  else
    t.start();
}
origin: org.codehaus.jsr166-mirror/jsr166y

    sc = 0;
} while (steps != 2 || sc != 0);
if (!tryTerminate(false)) {
  if (ex != null)   // possibly replace if died abnormally
    signalWork();
origin: org.codehaus.jsr166-mirror/jsr166y

    return true;                      // update next time
if ((!shutdown || !tryTerminate(false)) &&
  (int)c != 0 && parallelism + (int)(nc >> AC_SHIFT) == 0 &&
  blockedCount == 0 && quiescerCount == 0)
jsr166yForkJoinPooltryTerminate

Javadoc

Possibly initiates and/or completes termination.

Popular methods of ForkJoinPool

  • invoke
    Performs the given task, returning its result upon completion. If the computation encounters an unch
  • <init>
    Creates a ForkJoinPool with the given parameters.
  • execute
    Arranges for (asynchronous) execution of the given task.
  • addWorker
    Tries to create and start a worker; minimally rolls back counts on failure.
  • checkPermission
    If there is a security manager, makes sure caller has permission to modify threads.
  • deregisterWorker
    Final callback from terminating worker. Removes record of worker from array, and adjusts counts. If
  • getParallelism
    Returns the targeted parallelism level of this pool.
  • getPoolSize
    Returns the number of worker threads that have started but not yet terminated. The result returned b
  • idleAwaitWork
    If inactivating worker w has caused pool to become quiescent, check for pool termination, and wait f
  • idlePerActive
    Returns the approximate (non-atomic) number of idle threads per active thread.
  • isTerminated
    Returns true if all tasks have completed following shut down.
  • managedBlock
    Blocks in accord with the given blocker. If the current thread is a ForkJoinWorkerThread, this metho
  • isTerminated,
  • managedBlock,
  • nextWorkerName,
  • registerWorker,
  • scan,
  • signalWork,
  • addActiveCount,
  • addQuiescerCount,
  • addSubmission

Popular in Java

  • Running tasks concurrently on multiple threads
  • scheduleAtFixedRate (ScheduledExecutorService)
  • setScale (BigDecimal)
  • getResourceAsStream (ClassLoader)
  • ObjectMapper (com.fasterxml.jackson.databind)
    ObjectMapper provides functionality for reading and writing JSON, either to and from basic POJOs (Pl
  • RandomAccessFile (java.io)
    Allows reading from and writing to a file in a random-access manner. This is different from the uni-
  • Collection (java.util)
    Collection is the root of the collection hierarchy. It defines operations on data collections and t
  • SortedSet (java.util)
    SortedSet is a Set which iterates over its elements in a sorted order. The order is determined eithe
  • Filter (javax.servlet)
    A filter is an object that performs filtering tasks on either the request to a resource (a servlet o
  • Logger (org.slf4j)
    The org.slf4j.Logger interface is the main user entry point of SLF4J API. It is expected that loggin
  • Best IntelliJ plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now