类 Entry
java.lang.Object
com.alibaba.csp.sentinel.Entry
- 所有已实现的接口:
AutoCloseable
- 直接已知子类:
AsyncEntry
Each
SphU#entry() will return an Entry. This class holds information of current invocation:- createTime, the create time of this entry, using for rt statistics.
- current
Node, that is statistics of the resource in current context. - origin
Node, that is statistics for the specific origin. Usually the origin could be the Service Consumer's app name, seeContextUtil.enter(String name, String origin) ResourceWrapper, that is resource name.
A invocation tree will be created if we invoke SphU#entry() multi times in the same Context,
so parent or child entry may be held by this to form the tree. Since Context always holds
the current entry in the invocation tree, every exit() call should modify
Context.setCurEntry(Entry) as parent entry of this.
- 作者:
- qinan.qn, jialiang.linjl, leyou(lihao), Eric Zhao
- 另请参阅:
-
字段概要
字段修饰符和类型字段说明protected final Object[]protected final intprotected static final Object[]protected final ResourceWrapper -
构造器概要
构造器构造器说明Entry(ResourceWrapper resourceWrapper) Entry(ResourceWrapper resourceWrapper, int count, Object[] args) -
方法概要
修饰符和类型方法说明voidclose()Equivalent toexit().voidexit()Complete the current resource entry and restore the entry stack in context.voidexit(int count) abstract voidExit this entry.longlonggetError()abstract NodesetBlockError(BlockException blockError) setCompleteTimestamp(long completeTimestamp) voidsetCurNode(Node node) voidvoidsetOriginNode(Node originNode) protected abstract EntryExit this entry.abstract voidwhenTerminate(BiConsumer<Context, Entry> handler) LikeCompletableFuturesince JDK 8, it guarantees specified handler is invoked when this entry terminated (exited), no matter it's blocked or permitted.
-
字段详细资料
-
OBJECTS0
-
resourceWrapper
-
count
protected final int count -
args
-
-
构造器详细资料
-
Entry
-
Entry
-
-
方法详细资料
-
getResourceWrapper
-
exit
Complete the current resource entry and restore the entry stack in context. Do not need to carry count or args parameter, initialization does- 抛出:
ErrorEntryFreeException- if entry in current context does not match current entry
-
exit
-
close
public void close()Equivalent toexit(). Support try-with-resources since JDK 1.7.- 指定者:
close在接口中AutoCloseable- 从以下版本开始:
- 1.5.0
-
exit
Exit this entry. This method should invoke if and only if once at the end of the resource protection.- 参数:
count- tokens to release.args- extra parameters- 抛出:
ErrorEntryFreeException
-
trueExit
Exit this entry.- 参数:
count- tokens to release.args- extra parameters- 返回:
- next available entry after exit, that is the parent entry.
- 抛出:
ErrorEntryFreeException
-
getLastNode
- 返回:
-
getCreateTimestamp
public long getCreateTimestamp() -
getCompleteTimestamp
public long getCompleteTimestamp() -
setCompleteTimestamp
-
getCurNode
-
setCurNode
-
getBlockError
-
setBlockError
-
getError
-
setError
-
getOriginNode
- 返回:
- origin
Nodeof the thisEntry, may be null if no origin specified byContextUtil.enter(String name, String origin).
-
setOriginNode
-
whenTerminate
LikeCompletableFuturesince JDK 8, it guarantees specified handler is invoked when this entry terminated (exited), no matter it's blocked or permitted. Use it when you did some STATEFUL operations on entries.- 参数:
handler- handler function on the invocation terminates- 从以下版本开始:
- 1.8.0
-