當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。