public static Priority getPriority(int val) {
        for (Priority pri : Priority.values()) {
            if (val == pri.val) {
                return pri;
            }
        }
        throw new IllegalArgumentException("Unknown priority: " + val);
    }
Get a priority enum instance by its value.

@param val the value of the priority to return
@return the priority enum instance
@throws IllegalArgumentException if the priority value is unknown
documentapi/src/main/java/com/yahoo/documentapi/messagebus/protocol/DocumentProtocol.java