List of usage examples for org.springframework.scheduling.concurrent CustomizableThreadFactory CustomizableThreadFactory
public CustomizableThreadFactory(String threadNamePrefix)
From source file:com.nebhale.cyclinglibrary.util.UtilConfiguration.java
@Bean
ScheduledExecutorService executorService() {
return Executors.newScheduledThreadPool(5, new CustomizableThreadFactory("point-augmenter-"));
}
From source file:nblair.pipeline.PipelineThreadPoolExecutor.java
/** * Calls the superclass' constructor passing in the queueCapacity, * 1 Minute keep alive time, a bounded {@link LinkedBlockingQueue}, * a {@link CustomizableThreadFactory}, and an {@link OfferRejectedExecutionHandler}. * //from www. j a v a2s . com * @see LinkedBlockingQueue * @see ThreadPoolExecutor * @see CustomizableThreadFactory * @param queueCapacity the capacity of the work queue * @param namePrefix the thread name prefix */ public PipelineThreadPoolExecutor(int queueCapacity, String namePrefix) { super(queueCapacity, queueCapacity, 1, TimeUnit.MINUTES, new LinkedBlockingQueue<Runnable>(queueCapacity), new CustomizableThreadFactory(namePrefix), new OfferRejectedExecutionHandler()); }
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 ww w.jav a2s . 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:io.pivotal.receptor.events.EventDispatcher.java
public EventDispatcher(String url) { Assert.hasText(url, "URL is required"); this.url = url; this.backgroundExecutor = Executors .newSingleThreadExecutor(new CustomizableThreadFactory("receptor-event-subscriber-")); this.dispatchingExecutor = Executors .newCachedThreadPool(new CustomizableThreadFactory("receptor-event-dispatcher-")); }
From source file:me.adaptive.services.notification.NotificationSender.java
@PostConstruct void init() {//www. j a v a 2 s .c o m LOGGER.info("Initializing"); if (!CollectionUtils.isEmpty(services)) { executorService = Executors.newFixedThreadPool(services.size(), new CustomizableThreadFactory("NOTIFICATION-")); for (NotificationService service : services) { if (!notificationServices.containsKey(service.getChannel())) { notificationServices.put(service.getChannel(), new HashSet<>()); } notificationServices.get(service.getChannel()).add(service); } } LOGGER.info("NotificationSender initialized with {} NotificationServices with the Channels {}", services.size(), Arrays.toString(notificationServices.keySet().stream().map(Enum::toString).toArray())); }
From source file:com.opengamma.language.connector.ClientContextFactoryBean.java
private void setDefaults() { setFudgeContext(FudgeContext.GLOBAL_DEFAULT); setHousekeepingScheduler(/* w w w . j a va2 s.co m*/ Executors.newSingleThreadScheduledExecutor(new CustomizableThreadFactory("Scheduler-"))); setMessageTimeout(3000); setHeartbeatTimeout(4000); setTerminationTimeout(30000); setMaxThreadsPerClient(Math.max(2, Runtime.getRuntime().availableProcessors())); setMaxClientThreads(Integer.MAX_VALUE); // messageHandler defaults to null and must be set }
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 .ja v a 2 s .c o m tf.setThreadGroupName("resiliency"); return tf; }
From source file:org.geowebcache.storage.blobstore.file.FileBlobStore.java
private void createDeleteExecutorService() { CustomizableThreadFactory tf;/*ww w. j a va2s .c o m*/ tf = new CustomizableThreadFactory("GWC FileStore delete directory thread-"); tf.setDaemon(true); tf.setThreadPriority(Thread.MIN_PRIORITY); deleteExecutorService = Executors.newFixedThreadPool(1); }