1
2
3
4
5
6
7 package org.mule.util.concurrent;
8
9 import org.mule.api.MuleContext;
10 import org.mule.util.StringUtils;
11
12
13
14
15 public class ThreadNameHelper
16 {
17
18 private ThreadNameHelper()
19 {
20
21 }
22
23 public static String receiver(MuleContext muleContext, String connectorName)
24 {
25 return String.format("%s%s.receiver", getPrefix(muleContext), connectorName);
26 }
27
28 public static String dispatcher(MuleContext muleContext, String connectorName)
29 {
30 return String.format("%s%s.dispatcher", getPrefix(muleContext), connectorName);
31 }
32
33 public static String requester(MuleContext muleContext, String connectorName)
34 {
35 return String.format("%s%s.requester", getPrefix(muleContext), connectorName);
36 }
37
38 public static String asyncProcessor(MuleContext muleContext, String mpName)
39 {
40 return String.format("%s%s.processor.async", getPrefix(muleContext), mpName);
41 }
42
43 public static String sedaService(MuleContext muleContext, String name)
44 {
45 return String.format("%sseda.%s", getPrefix(muleContext), name);
46 }
47
48 public static String flow(MuleContext muleContext, String name)
49 {
50 return String.format("%sflow.%s", getPrefix(muleContext), name);
51
52 }
53
54
55
56
57
58
59 public static String getPrefix(MuleContext muleContext)
60 {
61 final boolean containerMode = muleContext.getConfiguration().isContainerMode();
62 final String id = muleContext.getConfiguration().getId();
63
64 return containerMode ? String.format("[%s].", id) : StringUtils.EMPTY;
65 }
66 }