All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.vip.saturn.job.sharding.TreeCacheThreadFactory Maven / Gradle / Ivy

There is a newer version: 3.5.1
Show newest version
package com.vip.saturn.job.sharding;

import java.util.concurrent.ThreadFactory;

/**
 * zk treecache的线程Factory
 * 
 * @author chembo.huang
 *
 */
public class TreeCacheThreadFactory implements ThreadFactory {

	private String threadName;

	public TreeCacheThreadFactory(String threadName) {
		this.threadName = "treecache-for-" + threadName;
	}

	@Override
	public Thread newThread(Runnable r) {
		Thread t = new Thread(r, threadName);
		if (t.isDaemon()) {
			t.setDaemon(false);
		}
		if (t.getPriority() != Thread.NORM_PRIORITY) {
			t.setPriority(Thread.NORM_PRIORITY);
		}
		return t;
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy