ThreadFactory with max priority

Change-Id: I0f220276734e845b282e6ed88975cb85563853e9
This commit is contained in:
Yuta HIGUCHI 2016-12-19 14:19:11 -08:00 committed by Jonathan Hart
parent 4c7fcdff5f
commit a2a11cd9b5

View File

@ -138,6 +138,19 @@ public abstract class Tools {
.build();
}
/**
* Returns a thread factory that produces threads with MAX_PRIORITY.
*
* @param factory backing ThreadFactory
* @return thread factory
*/
public static ThreadFactory maxPriority(ThreadFactory factory) {
return new ThreadFactoryBuilder()
.setThreadFactory(factory)
.setPriority(Thread.MAX_PRIORITY)
.build();
}
/**
* Returns true if the collection is null or is empty.
*