java.util.concurrent.ForkJoinPool.tryTerminate()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(11.4k)|赞(0)|评价(0)|浏览(110)

本文整理了Java中java.util.concurrent.ForkJoinPool.tryTerminate()方法的一些代码示例,展示了ForkJoinPool.tryTerminate()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ForkJoinPool.tryTerminate()方法的具体详情如下:
包路径:java.util.concurrent.ForkJoinPool
类名称:ForkJoinPool
方法名:tryTerminate

ForkJoinPool.tryTerminate介绍

[英]Possibly initiates and/or completes termination.
[中]可能启动和/或完成终止。

代码示例

代码示例来源:origin: robovm/robovm

/**
 * Possibly initiates an orderly shutdown in which previously
 * submitted tasks are executed, but no new tasks will be
 * accepted. Invocation has no effect on execution state if this
 * is the {@link #commonPool()}, and 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: robovm/robovm

/**
 * Possibly attempts to cancel and/or stop all tasks, and reject
 * all subsequently submitted tasks.  Invocation has no effect on
 * execution state if this is the {@link #commonPool()}, and no
 * additional effect if already shut down. Otherwise, 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
 */
public List<Runnable> shutdownNow() {
  checkPermission();
  tryTerminate(true, true);
  return Collections.emptyList();
}

代码示例来源:origin: robovm/robovm

!tryTerminate(false, false) && (int)prevCtl != 0) {
int dc = -(short)(currentCtl >>> TC_SHIFT);
long parkTime = dc < 0 ? FAST_IDLE_TIMEOUT: (dc + 1) * IDLE_TIMEOUT;

代码示例来源:origin: robovm/robovm

idleAwaitWork(w, nc, c);
else if (w.eventCount < 0 && !tryTerminate(false, false) &&

代码示例来源:origin: robovm/robovm

(c & ~(AC_MASK|TC_MASK)))));
if (!tryTerminate(false, false) && w != null && w.array != null) {

代码示例来源:origin: com.gluonhq/robovm-rt

/**
 * Possibly initiates an orderly shutdown in which previously
 * submitted tasks are executed, but no new tasks will be
 * accepted. Invocation has no effect on execution state if this
 * is the {@link #commonPool()}, and 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: com.gluonhq/robovm-rt

/**
 * Possibly attempts to cancel and/or stop all tasks, and reject
 * all subsequently submitted tasks.  Invocation has no effect on
 * execution state if this is the {@link #commonPool()}, and no
 * additional effect if already shut down. Otherwise, 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
 */
public List<Runnable> shutdownNow() {
  checkPermission();
  tryTerminate(true, true);
  return Collections.emptyList();
}

代码示例来源:origin: ibinti/bugvm

/**
 * Possibly initiates an orderly shutdown in which previously
 * submitted tasks are executed, but no new tasks will be
 * accepted. Invocation has no effect on execution state if this
 * is the {@link #commonPool()}, and 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: MobiVM/robovm

/**
 * Possibly initiates an orderly shutdown in which previously
 * submitted tasks are executed, but no new tasks will be
 * accepted. Invocation has no effect on execution state if this
 * is the {@link #commonPool()}, and 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: org.apidesign.bck2brwsr/emul

/**
 * 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/jsr166

/**
 * 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: com.bugvm/bugvm-rt

/**
 * Possibly initiates an orderly shutdown in which previously
 * submitted tasks are executed, but no new tasks will be
 * accepted. Invocation has no effect on execution state if this
 * is the {@link #commonPool()}, and 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: MobiVM/robovm

/**
 * Possibly attempts to cancel and/or stop all tasks, and reject
 * all subsequently submitted tasks.  Invocation has no effect on
 * execution state if this is the {@link #commonPool()}, and no
 * additional effect if already shut down. Otherwise, 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
 */
public List<Runnable> shutdownNow() {
  checkPermission();
  tryTerminate(true, true);
  return Collections.emptyList();
}

代码示例来源:origin: com.mobidevelop.robovm/robovm-rt

/**
 * Possibly initiates an orderly shutdown in which previously
 * submitted tasks are executed, but no new tasks will be
 * accepted. Invocation has no effect on execution state if this
 * is the {@link #commonPool()}, and 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: jtulach/bck2brwsr

/**
 * 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: com.bugvm/bugvm-rt

/**
 * Possibly attempts to cancel and/or stop all tasks, and reject
 * all subsequently submitted tasks.  Invocation has no effect on
 * execution state if this is the {@link #commonPool()}, and no
 * additional effect if already shut down. Otherwise, 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
 */
public List<Runnable> shutdownNow() {
  checkPermission();
  tryTerminate(true, true);
  return Collections.emptyList();
}

代码示例来源:origin: ibinti/bugvm

/**
 * Possibly attempts to cancel and/or stop all tasks, and reject
 * all subsequently submitted tasks.  Invocation has no effect on
 * execution state if this is the {@link #commonPool()}, and no
 * additional effect if already shut down. Otherwise, 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
 */
public List<Runnable> shutdownNow() {
  checkPermission();
  tryTerminate(true, true);
  return Collections.emptyList();
}

代码示例来源:origin: com.mobidevelop.robovm/robovm-rt

/**
 * Possibly attempts to cancel and/or stop all tasks, and reject
 * all subsequently submitted tasks.  Invocation has no effect on
 * execution state if this is the {@link #commonPool()}, and no
 * additional effect if already shut down. Otherwise, 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
 */
public List<Runnable> shutdownNow() {
  checkPermission();
  tryTerminate(true, true);
  return Collections.emptyList();
}

代码示例来源:origin: FlexoVM/flexovm

/**
 * Possibly initiates an orderly shutdown in which previously
 * submitted tasks are executed, but no new tasks will be
 * accepted. Invocation has no effect on execution state if this
 * is the {@link #commonPool()}, and 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: FlexoVM/flexovm

/**
 * Possibly attempts to cancel and/or stop all tasks, and reject
 * all subsequently submitted tasks.  Invocation has no effect on
 * execution state if this is the {@link #commonPool()}, and no
 * additional effect if already shut down. Otherwise, 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
 */
public List<Runnable> shutdownNow() {
  checkPermission();
  tryTerminate(true, true);
  return Collections.emptyList();
}

相关文章

ForkJoinPool类方法