Skip to content

Commit 400c0f7

Browse files
committed
完整下注释
1 parent 76d87e7 commit 400c0f7

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

sandbox-core/src/main/java/com/alibaba/jvm/sandbox/core/enhance/weaver/EventListenerHandler.java

+11-4
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ private Spy.Ret handleEvent(final int listenerId,
155155

156156
// 如果是在BEFORE中立即返回,则后续不会再有RETURN事件产生
157157
// 这里需要主动对齐堆栈
158-
if(event.type == Event.Type.BEFORE) {
158+
if (event.type == Event.Type.BEFORE) {
159159
process.popInvokeId();
160160
}
161161

@@ -181,7 +181,7 @@ private Spy.Ret handleEvent(final int listenerId,
181181

182182
// 如果是在BEFORE中立即抛出,则后续不会再有THROWS事件产生
183183
// 这里需要主动对齐堆栈
184-
if(event.type == Event.Type.BEFORE) {
184+
if (event.type == Event.Type.BEFORE) {
185185
process.popInvokeId();
186186
}
187187

@@ -246,17 +246,24 @@ private void compensateProcessControlEvent(ProcessControlException pce, EventPro
246246
final InvokeEvent iEvent = (InvokeEvent) event;
247247
final Event compensateEvent;
248248

249+
// 补偿立即返回事件
249250
if (pce.getState() == ProcessControlException.State.RETURN_IMMEDIATELY
250251
&& contains(processor.eventTypes, IMMEDIATELY_RETURN)) {
251252
compensateEvent = process
252253
.getEventFactory()
253254
.makeImmediatelyReturnEvent(iEvent.processId, iEvent.invokeId, pce.getRespond());
254-
} else if (pce.getState() == ProcessControlException.State.THROWS_IMMEDIATELY
255+
}
256+
257+
// 补偿立即抛出事件
258+
else if (pce.getState() == ProcessControlException.State.THROWS_IMMEDIATELY
255259
&& contains(processor.eventTypes, IMMEDIATELY_THROWS)) {
256260
compensateEvent = process
257261
.getEventFactory()
258262
.makeImmediatelyThrowsEvent(iEvent.processId, iEvent.invokeId, (Throwable) pce.getRespond());
259-
} else {
263+
}
264+
265+
// 异常情况不补偿
266+
else {
260267
return;
261268
}
262269

0 commit comments

Comments
 (0)