List of usage examples for org.springframework.scheduling.concurrent CustomizableThreadFactory setThreadPriority
public void setThreadPriority(int threadPriority)
From source file:com.crossbusiness.resiliency.aspect.AbstractTimeoutAspect.java
private ThreadFactory threadFactory() { CustomizableThreadFactory tf = new CustomizableThreadFactory("sumo-timeout-"); tf.setThreadPriority(Thread.MAX_PRIORITY); tf.setDaemon(true);//from w w w.j a v a2 s. c o m tf.setThreadGroupName("resiliency"); return tf; }
From source file:org.geowebcache.georss.GeoRSSPoller.java
/** * Upon instantiation, spawns out a thread after #{@code startUpDelaySecs} seconds that * periodically (at least every each layer's {@link GeoRSSFeedDefinition#getPollInterval() poll * interval} polls the layers feed for change sets and if changes are found spawns a reseed * process on the tiles affected by the change set. * //from www. j a v a 2s. c o m * @param seeder * @param startUpDelaySecs * seconds to wait before start polling the layers */ public GeoRSSPoller(final TileBreeder seeder, final int startUpDelaySecs) { this.seeder = seeder; this.scheduledPolls = new ArrayList<PollDef>(); this.scheduledTasks = new ArrayList<GeoRSSPollTask>(); final int corePoolSize = 1; CustomizableThreadFactory tf = new CustomizableThreadFactory("GWC GeoRSS Poll Tasks-"); tf.setDaemon(true); tf.setThreadPriority(Thread.MIN_PRIORITY + 1); schedulingPollExecutorService = Executors.newScheduledThreadPool(corePoolSize, tf); schedulingPollExecutorService.submit(new Runnable() { public void run() { logger.info("Initializing GeoRSS poller in a background job..."); findEnabledPolls(); if (pollCount() > 0) { final TimeUnit seconds = TimeUnit.SECONDS; for (PollDef poll : scheduledPolls) { GeoRSSPollTask command = new GeoRSSPollTask(poll, seeder); GeoRSSFeedDefinition pollDef = poll.getPollDef(); long period = pollDef.getPollInterval(); logger.info("Scheduling layer " + poll.getLayer().getName() + " to poll the GeoRSS feed " + pollDef.getFeedUrl() + " every " + pollDef.getPollIntervalStr()); schedulingPollExecutorService.scheduleAtFixedRate(command, startUpDelaySecs, period, seconds); scheduledTasks.add(command); } logger.info("Will wait " + startUpDelaySecs + " seconds before launching the " + pollCount() + " GeoRSS polls found"); } else { logger.info("No enabled GeoRSS feeds found, poller will not run."); } } }); }
From source file:org.geowebcache.diskquota.DiskQuotaMonitor.java
private ScheduledExecutorService createCleanUpExecutor() { final int numCleaningThreads = quotaConfig.getMaxConcurrentCleanUps(); log.info("Setting up disk quota periodic enforcement task"); CustomizableThreadFactory tf = new CustomizableThreadFactory("GWC DiskQuota clean up thread-"); tf.setThreadPriority(1 + (Thread.MAX_PRIORITY - Thread.MIN_PRIORITY) / 5); ScheduledExecutorService executorService = Executors.newScheduledThreadPool(numCleaningThreads, tf); return executorService; }
From source file:org.geowebcache.storage.blobstore.file.FileBlobStore.java
private void createDeleteExecutorService() { CustomizableThreadFactory tf;//from w w w . ja v a2 s. c o m tf = new CustomizableThreadFactory("GWC FileStore delete directory thread-"); tf.setDaemon(true); tf.setThreadPriority(Thread.MIN_PRIORITY); deleteExecutorService = Executors.newFixedThreadPool(1); }