|
@@ -266,6 +266,16 @@ public class EsExecutors {
|
|
|
return "elasticsearch" + (nodeName.isEmpty() ? "" : "[") + nodeName + (nodeName.isEmpty() ? "" : "]") + "[" + namePrefix + "]";
|
|
|
}
|
|
|
|
|
|
+ public static String executorName(String threadName) {
|
|
|
+ // subtract 2 to avoid the `]` of the thread number part.
|
|
|
+ int executorNameEnd = threadName.lastIndexOf(']', threadName.length() - 2);
|
|
|
+ int executorNameStart = threadName.lastIndexOf('[', executorNameEnd);
|
|
|
+ if (executorNameStart == -1 || executorNameEnd - executorNameStart <= 1) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ return threadName.substring(executorNameStart + 1, executorNameEnd);
|
|
|
+ }
|
|
|
+
|
|
|
public static ThreadFactory daemonThreadFactory(Settings settings, String namePrefix) {
|
|
|
return daemonThreadFactory(threadName(settings, namePrefix));
|
|
|
}
|