ThreadFactory with max priority
Change-Id: I0f220276734e845b282e6ed88975cb85563853e9
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 25c0213..6df74b0 100644
--- a/utils/misc/src/main/java/org/onlab/util/Tools.java
+++ b/utils/misc/src/main/java/org/onlab/util/Tools.java
@@ -139,6 +139,19 @@
}
/**
+ * 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.
*
* @param collection collection to test