forked from alibaba/jvm-sandbox-repeater
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Invocation.java
242 lines (190 loc) · 5.4 KB
/
Invocation.java
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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
package com.alibaba.jvm.sandbox.repeater.plugin.domain;
/**
* {@link Invocation} 描述一次调用
*
* <p>
* {@link Invocation} 调用信息抽象;一次完整的{@link RecordModel} 由一次入口{@link RecordModel#entranceInvocation}和若干次子{@link RecordModel#subInvocations}组装
*
* {@link Invocation} 主要记录了调用时的入参、返回值、调用顺序等信息,用于回放流量的发起和子调用的Mock还原
* </p>
*
* @author zhaoyb1990
*/
public class Invocation implements java.io.Serializable {
/**
* 调用类型
*
* @see com.alibaba.jvm.sandbox.repeater.plugin.domain.InvokeType
*/
private InvokeType type;
/**
* @see com.alibaba.jvm.sandbox.api.event.InvokeEvent#invokeId
*/
private int invokeId;
/**
* @see com.alibaba.jvm.sandbox.api.event.InvokeEvent#processId
*/
private int processId;
/**
* 链路跟踪ID(仅应用内部,对于分布式系统需要自己重新定义)
*/
private String traceId;
/**
* 调用的身份识别
*
* @see com.alibaba.jvm.sandbox.repeater.plugin.domain.Identity
*/
private Identity identity;
/**
* 调用发生在应用内部的sequence序号
*/
private Integer index;
/**
* 是否是入口调用类型(类似 HTTP/DUBBO)
*/
private boolean entrance;
/**
* 请求参数 - snapshot 不做传输使用,传输需要序列化值
*
* @see Invocation#requestSerialized
*/
private transient Object[] request;
/**
* 序列化之后的请求值,录制时候作为{@link Invocation#request}的载体传输;回放时候需要还原成{@link Invocation#request}
*/
private String requestSerialized;
/**
* 返回结果 - snapshot 不做传输使用
*/
private transient Object response;
/**
* 序列化之后的请求值,录制时候作为{@link Invocation#response}的载体传输;回放时候需要还原成{@link Invocation#response}
*/
private String responseSerialized;
/**
* 异常信息 - snapshot 不做传输使用
*/
private transient Throwable throwable;
/**
* 序列化之后的请求值,录制时候作为{@link Invocation#throwable}的载体传输;回放时候需要还原成{@link Invocation#throwable}
*/
private String throwableSerialized;
/**
* 调用开始时间
*/
private Long start;
/**
* 调用结束时间
*/
private Long end;
/**
* 序列化token
*/
private String serializeToken;
/**
* 目标调用的类加载(透传不做传输)
*/
private transient ClassLoader classLoader;
public InvokeType getType() {
return type;
}
public void setType(InvokeType type) {
this.type = type;
}
public int getInvokeId() {
return invokeId;
}
public void setInvokeId(int invokeId) {
this.invokeId = invokeId;
}
public int getProcessId() {
return processId;
}
public void setProcessId(int processId) {
this.processId = processId;
}
public String getTraceId() {
return traceId;
}
public void setTraceId(String traceId) {
this.traceId = traceId;
}
public Identity getIdentity() {
return identity;
}
public void setIdentity(Identity identity) {
this.identity = identity;
}
public Integer getIndex() {
return index;
}
public void setIndex(Integer index) {
this.index = index;
}
public boolean isEntrance() {
return entrance;
}
public void setEntrance(boolean entrance) {
this.entrance = entrance;
}
public Object[] getRequest() {
return request;
}
public void setRequest(Object[] request) {
this.request = request;
}
public String getRequestSerialized() {
return requestSerialized;
}
public void setRequestSerialized(String requestSerialized) {
this.requestSerialized = requestSerialized;
}
public Object getResponse() {
return response;
}
public void setResponse(Object response) {
this.response = response;
}
public String getResponseSerialized() {
return responseSerialized;
}
public void setResponseSerialized(String responseSerialized) {
this.responseSerialized = responseSerialized;
}
public Throwable getThrowable() {
return throwable;
}
public void setThrowable(Throwable throwable) {
this.throwable = throwable;
}
public String getThrowableSerialized() {
return throwableSerialized;
}
public void setThrowableSerialized(String throwableSerialized) {
this.throwableSerialized = throwableSerialized;
}
public Long getStart() {
return start;
}
public void setStart(Long start) {
this.start = start;
}
public Long getEnd() {
return end;
}
public void setEnd(Long end) {
this.end = end;
}
public String getSerializeToken() {
return serializeToken;
}
public void setSerializeToken(String serializeToken) {
this.serializeToken = serializeToken;
}
public ClassLoader getClassLoader() {
return classLoader;
}
public void setClassLoader(ClassLoader classLoader) {
this.classLoader = classLoader;
}
}