diff --git a/utils/misc/src/main/java/org/onlab/util/Tools.java b/utils/misc/src/main/java/org/onlab/util/Tools.java index 25c0213eab..6df74b05b7 100644 --- a/utils/misc/src/main/java/org/onlab/util/Tools.java +++ b/utils/misc/src/main/java/org/onlab/util/Tools.java @@ -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. *