| | | 1 | | // Copyright (c) ZeroC, Inc. |
| | | 2 | | |
| | | 3 | | namespace Ice.Internal; |
| | | 4 | | |
| | | 5 | | public sealed class Util |
| | | 6 | | { |
| | 1 | 7 | | public static Instance getInstance(Ice.Communicator communicator) => communicator.instance; |
| | | 8 | | |
| | | 9 | | public static ThreadPriority getThreadPriorityProperty(Ice.Properties properties, string prefix) |
| | | 10 | | { |
| | 1 | 11 | | string propertyName = prefix + ".ThreadPriority"; |
| | 1 | 12 | | string s = properties.getProperty(propertyName); |
| | 1 | 13 | | if (string.IsNullOrEmpty(s)) |
| | | 14 | | { |
| | 1 | 15 | | return ThreadPriority.Normal; |
| | | 16 | | } |
| | 1 | 17 | | string value = s.StartsWith("ThreadPriority.", StringComparison.Ordinal) ? |
| | 1 | 18 | | s["ThreadPriority.".Length..] : s; |
| | 1 | 19 | | return value switch |
| | 1 | 20 | | { |
| | 0 | 21 | | "Lowest" => ThreadPriority.Lowest, |
| | 0 | 22 | | "BelowNormal" => ThreadPriority.BelowNormal, |
| | 0 | 23 | | "Normal" => ThreadPriority.Normal, |
| | 1 | 24 | | "AboveNormal" => ThreadPriority.AboveNormal, |
| | 0 | 25 | | "Highest" => ThreadPriority.Highest, |
| | 1 | 26 | | _ => throw new PropertyException($"property '{propertyName}' has an invalid value: '{s}'"), |
| | 1 | 27 | | }; |
| | | 28 | | } |
| | | 29 | | } |