当前位置: 首页>>代码示例>>Java>>正文


Java ScheduledThreadPoolExecutor.setExecuteExistingDelayedTasksAfterShutdownPolicy方法代码示例

本文整理汇总了Java中java.util.concurrent.ScheduledThreadPoolExecutor.setExecuteExistingDelayedTasksAfterShutdownPolicy方法的典型用法代码示例。如果您正苦于以下问题:Java ScheduledThreadPoolExecutor.setExecuteExistingDelayedTasksAfterShutdownPolicy方法的具体用法?Java ScheduledThreadPoolExecutor.setExecuteExistingDelayedTasksAfterShutdownPolicy怎么用?Java ScheduledThreadPoolExecutor.setExecuteExistingDelayedTasksAfterShutdownPolicy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.util.concurrent.ScheduledThreadPoolExecutor的用法示例。


在下文中一共展示了ScheduledThreadPoolExecutor.setExecuteExistingDelayedTasksAfterShutdownPolicy方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getScheduledThreadPoolExecutor

import java.util.concurrent.ScheduledThreadPoolExecutor; //导入方法依赖的package包/类
/**
 * Have shutdown actually means shutdown. Tasks that need to complete should use
 * futures.
 */
public static ScheduledThreadPoolExecutor getScheduledThreadPoolExecutor(String name, UncaughtExceptionHandler handler, int poolSize, int stackSize) {
    // HACK: ScheduledThreadPoolExecutor won't let use the handler so
    // if we're using ExceptionHandlingRunnable then we'll be able to 
    // pick up the exceptions
    Thread.setDefaultUncaughtExceptionHandler(handler);
    
    ThreadFactory factory = getThreadFactory(name, handler);
    ScheduledThreadPoolExecutor executor = new ScheduledThreadPoolExecutor(poolSize, factory);
    executor.setContinueExistingPeriodicTasksAfterShutdownPolicy(false);
    executor.setExecuteExistingDelayedTasksAfterShutdownPolicy(false);
    return executor;
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:17,代码来源:ThreadUtil.java

示例2: newScheduler

import java.util.concurrent.ScheduledThreadPoolExecutor; //导入方法依赖的package包/类
private static ListeningScheduledExecutorService newScheduler() {
    final ScheduledThreadPoolExecutor scheduler = new ScheduledThreadPoolExecutor(1);
    scheduler.setContinueExistingPeriodicTasksAfterShutdownPolicy(false);
    scheduler.setExecuteExistingDelayedTasksAfterShutdownPolicy(false);
    scheduler.setRemoveOnCancelPolicy(true);
    return MoreExecutors.listeningDecorator(scheduler);
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:8,代码来源:MatchRealtimeScheduler.java

示例3: createThreadPoolFromCacheConfig

import java.util.concurrent.ScheduledThreadPoolExecutor; //导入方法依赖的package包/类
private static ScheduledThreadPoolExecutor createThreadPoolFromCacheConfig(
        final CacheConfig cacheConfig) {
    final ScheduledThreadPoolExecutor scheduledThreadPoolExecutor = new ScheduledThreadPoolExecutor(
            cacheConfig.getAsynchronousWorkersMax());
    scheduledThreadPoolExecutor.setExecuteExistingDelayedTasksAfterShutdownPolicy(false);
    return scheduledThreadPoolExecutor;
}
 
开发者ID:mozilla-mobile,项目名称:FirefoxData-android,代码行数:8,代码来源:ExponentialBackOffSchedulingStrategy.java

示例4: GenericConnectionManager

import java.util.concurrent.ScheduledThreadPoolExecutor; //导入方法依赖的package包/类
public GenericConnectionManager(
        TransactionManager transactionManager,
        TransactionSupportLevel transactionSupportLevel,
        SubjectSource subjectSource,
        ClassLoader classLoader,
        ManagedConnectionFactory managedConnectionFactory,
        String name,
        String poolName,
        int minIdle,
        int maxPoolSize,
        long connectionTimeout,
        long idleTimeout,
        long maxLifetime,
        long aliveBypassWindow,
        long houseKeepingPeriod) {

    this.transactionManager = transactionManager;
    this.transactionSupportLevel = transactionSupportLevel;
    this.subjectSource = subjectSource;
    this.classLoader = classLoader;
    this.managedConnectionFactory = managedConnectionFactory;
    this.name = name;
    this.poolName = poolName;
    this.minIdle = minIdle;
    this.maxPoolSize = maxPoolSize;
    this.connectionTimeout = connectionTimeout;
    this.idleTimeout = idleTimeout;
    this.maxLifetime = maxLifetime;
    this.aliveBypassWindow = aliveBypassWindow;
    this.houseKeepingPeriod = houseKeepingPeriod;

    final ScheduledThreadPoolExecutor executor = new ScheduledThreadPoolExecutor(1, new UtilityElf.DefaultThreadFactory(poolName + " housekeeper", true), new ThreadPoolExecutor.DiscardPolicy());
    executor.setExecuteExistingDelayedTasksAfterShutdownPolicy(false);
    executor.setRemoveOnCancelPolicy(true);
    this.houseKeepingExecutorService = executor;

    this.addConnectionExecutor = createThreadPoolExecutor(this.maxPoolSize, poolName + " connection adder", null, new ThreadPoolExecutor.DiscardPolicy());
    this.closeConnectionExecutor = createThreadPoolExecutor(this.maxPoolSize, poolName + " connection closer", null, new ThreadPoolExecutor.CallerRunsPolicy());

    this.houseKeeperTask = this.houseKeepingExecutorService.scheduleWithFixedDelay(this::houseKeep, 100L, this.houseKeepingPeriod, MILLISECONDS);

    if (transactionManager != null && name != null) {
        transactionManager.registerResource(new RecoverableResourceFactoryImpl(managedConnectionFactory, name));
    }
}
 
开发者ID:ops4j,项目名称:org.ops4j.pax.transx,代码行数:46,代码来源:GenericConnectionManager.java

示例5: App

import java.util.concurrent.ScheduledThreadPoolExecutor; //导入方法依赖的package包/类
/**
 * Constructor
 */
public App() {
    super(APP_MAJOR_VERSION, APP_MINOR_VERSION);
    _doDataMaintenanceExecutor = new ScheduledThreadPoolExecutor(1, new DoDataMaintenanceExecutorThreadFactory());
    _doDataMaintenanceExecutor.setExecuteExistingDelayedTasksAfterShutdownPolicy(false);
}
 
开发者ID:neeveresearch,项目名称:nvx-apps,代码行数:9,代码来源:App.java


注:本文中的java.util.concurrent.ScheduledThreadPoolExecutor.setExecuteExistingDelayedTasksAfterShutdownPolicy方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。