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