commit | author | age
|
a18bfa
|
1 |
package com.codingapi.tx.aop.bean; |
Z |
2 |
|
|
3 |
/** |
|
4 |
* 分布式事务远程调用控制对象 |
|
5 |
* Created by lorne on 2017/6/5. |
|
6 |
*/ |
|
7 |
public class TxCompensateLocal { |
|
8 |
|
|
9 |
private final static ThreadLocal<TxCompensateLocal> currentLocal = new InheritableThreadLocal<TxCompensateLocal>(); |
|
10 |
|
|
11 |
private String groupId; |
|
12 |
|
|
13 |
private String type; |
|
14 |
|
|
15 |
private int startState; |
|
16 |
|
|
17 |
|
|
18 |
public int getStartState() { |
|
19 |
return startState; |
|
20 |
} |
|
21 |
|
|
22 |
public void setStartState(int startState) { |
|
23 |
this.startState = startState; |
|
24 |
} |
|
25 |
|
|
26 |
public String getGroupId() { |
|
27 |
return groupId; |
|
28 |
} |
|
29 |
|
|
30 |
public void setGroupId(String groupId) { |
|
31 |
this.groupId = groupId; |
|
32 |
} |
|
33 |
|
|
34 |
public String getType() { |
|
35 |
return type; |
|
36 |
} |
|
37 |
|
|
38 |
public void setType(String type) { |
|
39 |
this.type = type; |
|
40 |
} |
|
41 |
|
|
42 |
public static TxCompensateLocal current() { |
|
43 |
return currentLocal.get(); |
|
44 |
} |
|
45 |
|
|
46 |
public static void setCurrent(TxCompensateLocal current) { |
|
47 |
currentLocal.set(current); |
|
48 |
} |
|
49 |
|
|
50 |
public static void clear(){ |
|
51 |
currentLocal.set(null); |
|
52 |
} |
|
53 |
} |