Spring Framework CustomizableThreadFactory - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Spring Framework CustomizableThreadFactory class.

This code example shows how to use the following methods:
 
public class SeederThreadPoolExecutor extends ThreadPoolExecutor implements DisposableBean {
 
    private static final Log log = LogFactory.getLog(SeederThreadPoolExecutor.class);
 
    private static final ThreadFactory tf = new CustomizableThreadFactory("GWC Seeder Thread-");
 
    public SeederThreadPoolExecutor(int corePoolSize, int maxPoolSize) {
        super(corePoolSize, maxPoolSize, 60, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>(),
                tf);
    } 
 
    /** 
     * Destroy method called by the application context at shutdown, needed to gracefully shutdown 
     * this thread pool executor and any running thread 
     *  
     * @see org.springframework.beans.factory.DisposableBean#destroy() 
     */ 
    public void destroy() throws Exception {
        log.info("Initiating shut down for running and pending seed tasks...");
5
CodeRank
This code example shows how to use the following methods:
 
public class QuotaUpdatesMonitor { 
 
    private static final Log log = LogFactory.getLog(QuotaUpdatesMonitor.class);
 
    private static final CustomizableThreadFactory tf = new CustomizableThreadFactory(
            "GWC DiskQuota Updates Gathering Thread-"); 
 
    private final DiskQuotaConfig quotaConfig;
 
    private final StorageBroker storageBroker;
 
    private final QuotaStore quotaStore;
 
    private ExecutorService executorService;
 
    private BlockingQueue<QuotaUpdate> sharedQueue;
 
    private QueuedQuotaUpdatesProducer quotaDiffsProducer;
 
4
CodeRank
This code example shows how to use the following methods:
	public void setExecutorThreadPoolSize(int value) {
		executorThreadPoolSize = value;
	} 
 
	public void afterPropertiesSet() throws Exception {
		SHAREDOBJECT_EXECUTOR = Executors.newFixedThreadPool(executorThreadPoolSize, new CustomizableThreadFactory("SharedObjectExecutor-"));
	} 
 
	/** 
	 * Setter for persistence class name. 
	 *  
	 * @param name Setter for persistence class name 
	 */ 
	public void setPersistenceClassName(String name) {
		persistenceClassName = name;
	} 
 
	/** 
	 * Return scope store 
	 *  
4
CodeRank
This code example shows how to use the following methods:setDaemon, setThreadPriority
                pendingDeleteDirectory));
    } 
 
    private void createDeleteExecutorService() { 
        CustomizableThreadFactory tf;
        tf = new CustomizableThreadFactory("GWC FileStore delete directory thread-");
        tf.setDaemon(true);
        tf.setThreadPriority(Thread.MIN_PRIORITY);
        deleteExecutorService = Executors.newFixedThreadPool(1);
    } 
 
    /** 
     * Destroy method for Spring 
     */ 
    public void destroy() { 
        deleteExecutorService.shutdownNow();
    } 
 
    private static class DefferredDirectoryDeleteTask implements Runnable {
 
4
CodeRank
This code example shows how to use the following methods:
	@ManagedOperation 
	public void shutDown() throws Exception {
 
		stop(); 
 
		ExecutorService executorService = Executors.newFixedThreadPool(1, new CustomizableThreadFactory("shell-"));
		executorService.submit(new Runnable() {
			public void run() { 
				try { 
					try { 
						Thread.sleep(5000);
					} catch (InterruptedException e) {}
					System.exit(0);
				} catch(Exception e) {}
			} 
		}); 
	} 
} 
3
CodeRank