List of usage examples for java.util.concurrent Executors newScheduledThreadPool
public static ScheduledExecutorService newScheduledThreadPool(int corePoolSize)
From source file:org.wso2.carbon.suicide.internal.SuicideActivator.java
public void start(BundleContext context) { try {// w w w . j a va 2 s .c om ScheduledExecutorService suicideScheduler = Executors.newScheduledThreadPool(1); suicideScheduler.scheduleWithFixedDelay(new SuicideTask(), 30, 30, TimeUnit.SECONDS); } catch (Throwable e) { log.error("Cannot start SuicideActivator", e); } }
From source file:gov.nih.nci.integration.invoker.ServiceInvokerConfig.java
/** * Creates a thread pool that can schedule commands to run after a given delay * @return Executor that executes submitted Runnable tasks *//* ww w . j av a 2 s .c o m*/ @Bean public Executor executor() { return Executors.newScheduledThreadPool(10); }
From source file:com.mmj.app.lucene.search.build.SearchBuilder.java
@PostConstruct public void cronCache() { ScheduledExecutorService newScheduledThreadPool = Executors.newScheduledThreadPool(1); newScheduledThreadPool.scheduleAtFixedRate(new Runnable() { @Override//from ww w. jav a2 s .c o m public void run() { try { build(SearchTypeEnum.USER, DEFAULT_VERSION, SearchTypeEnum.USER.getDateFetcher(null)); build(SearchTypeEnum.TOPIC, DEFAULT_VERSION, SearchTypeEnum.TOPIC.getDateFetcher(null)); } catch (Throwable e) { logger.error("start searchBuilder error,build search index error!", e); } } }, 1, 24 * 60, TimeUnit.MINUTES); }
From source file:com.mmj.app.common.notify.NotifyService.java
@PostConstruct void init() {// w w w . j a v a2 s .c om Executors.newScheduledThreadPool(corePoolSize).scheduleAtFixedRate(new Runnable() { @Override public void run() { try { // logger.debug("poll the queue..."); fireEvent(); } catch (Throwable e) { logger.error(e.getMessage(), e); } } }, deplaySeconds, fixRate, TimeUnit.MILLISECONDS); }
From source file:io.watchcat.node.Watchcat.java
@Bean public static ScheduledExecutorService scheduledExecutorService() { if (scheduledExecutorService == null) { scheduledExecutorService = Executors.newScheduledThreadPool(Runtime.getRuntime().availableProcessors()); }/*from ww w .j av a 2 s . com*/ return scheduledExecutorService; }
From source file:org.wso2.carbon.identity.provider.openid.replication.AssociationCleanupService.java
public AssociationCleanupService(long initialDelay, long delayBetweenRuns) { this.initialDelay = initialDelay; this.delayBetweenRuns = delayBetweenRuns; this.scheduler = Executors.newScheduledThreadPool(NUM_THREADS); }
From source file:rmblworx.tools.timey.SimpleAlarm.java
/** * Startet die Alarmerkennung./*from w w w.j a v a2 s . c om*/ * * @param delayPerThread * Mazahl fr den Ausfuehrungsintervall * @param timeUnit * Einheit fr den Ausfuehrungsintervall */ public void startAlarmdetection(final int delayPerThread, final TimeUnit timeUnit) { if (delayPerThread < 1) { throw new ValueMinimumArgumentException(); } else if (timeUnit == null) { throw new NullArgumentException(); } final ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(THREAD_POOL_SIZE); final AlarmRunnable alarmDetection = (AlarmRunnable) this.springContext.getBean("alarmRunnable"); scheduler.scheduleAtFixedRate(alarmDetection, 0, delayPerThread, timeUnit); }
From source file:com.omade.monitor.ClientApplication.java
public static void executeFixedRate() { ScheduledExecutorService executor = Executors.newScheduledThreadPool(1); executor.scheduleAtFixedRate(/*from w w w.ja va 2 s . co m*/ new DoTask(config.getProperty("server.url"), config.getProperty("server.port")), 0, 1, TimeUnit.SECONDS); }
From source file:com.linkedhole.platform.infra.config.TaskConfig.java
@Bean(destroyMethod = "shutdown") public Executor taskExecutor() { return Executors.newScheduledThreadPool(100); }
From source file:org.apache.ambari.servicemonitor.utils.KillHungProcess.java
public void start() { ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1); future = scheduler.schedule(this, this.timeoutMilliseconds, TimeUnit.MILLISECONDS); }