MessageManager.java
2.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
package com.dianping.cat.message.spi;
import com.dianping.cat.message.Message;
import com.dianping.cat.message.Transaction;
/**
* Message manager to help build CAT message.
* <p>
*
* Notes: This method is reserved for internal usage only. Application developer should never call this method directly.
*/
public interface MessageManager {
public void add(Message message);
/**
* Be triggered when a transaction ends, whatever it's the root transaction or nested transaction. However, if it's
* the root transaction then it will be flushed to back-end CAT server asynchronously.
* <p>
*
* @param transaction
*/
public void end(Transaction transaction);
/**
* Get peek transaction for current thread.
*
* @return peek transaction for current thread, null if no transaction there.
*/
public Transaction getPeekTransaction();
/**
* Get thread local message information.
*
* @return message tree, null means current thread is not setup correctly.
*/
public MessageTree getThreadLocalMessageTree();
/**
* Check if the thread context is setup or not.
*
* @return true if the thread context is setup, false otherwise
*/
public boolean hasContext();
/**
* Check if current context logging is enabled or disabled.
*
* @return true if current context is enabled
*/
public boolean isMessageEnabled();
/**
* Check if CAT logging is enabled or disabled.
*
* @return true if CAT is enabled
*/
public boolean isCatEnabled();
/**
* Check if CAT trace mode is enabled or disabled.
*
* @return true if CAT is trace mode
*/
public boolean isTraceMode();
/**
* Do cleanup for current thread environment in order to release resources in thread local objects.
*/
public void reset();
/**
* Set CAT trace mode.
*
*/
public void setTraceMode(boolean traceMode);
/**
* Do setup for current thread environment in order to prepare thread local objects.
*/
public void setup();
/**
* Be triggered when a new transaction starts, whatever it's the root transaction or nested transaction.
*
* @param transaction
* @param forked
*/
public void start(Transaction transaction, boolean forked);
/**
* Binds the current message tree to the transaction tagged with <code>tag</code>.
*
* @param tag
* tag name of the tagged transaction
* @param title
* title shown in the logview
*/
public void bind(String tag, String title);
/**
* get domain
*
*/
public String getDomain();
}