类 Context
java.lang.Object
com.alibaba.csp.sentinel.context.Context
- 直接已知子类:
NullContext
This class holds metadata of current invocation:
- the
EntranceNode: the root of the current invocation tree. - the current
Entry: the current invocation point. - the current
Node: the statistics related to theEntry. - the origin: The origin is useful when we want to control different invoker/consumer separately. Usually the origin could be the Service Consumer's app name or origin IP.
Each SphU#entry() or SphO#entry() should be in a Context,
if we don't invoke ContextUtil#enter() explicitly, DEFAULT context will be used.
A invocation tree will be created if we invoke SphU#entry() multi times in
the same context.
Same resource in different context will count separately, see NodeSelectorSlot.
- 作者:
- jialiang.linjl, leyou(lihao), Eric Zhao
- 另请参阅:
-
构造器概要
构造器构造器说明Context(DefaultNode entranceNode, String name) Context(String name, DefaultNode entranceNode, boolean async) -
方法概要
修饰符和类型方法说明Get the parentNodeof the current.getName()doubledoublelongintdoubledoubledoublelongbooleanisAsync()static ContextnewAsyncContext(DefaultNode entranceNode, String name) Create a new async context.setCurEntry(Entry curEntry) setCurNode(Node node) toString()
-
构造器详细资料
-
Context
-
Context
-
-
方法详细资料
-
newAsyncContext
Create a new async context.- 参数:
entranceNode- entrance node of the contextname- context name- 返回:
- the new created context
- 从以下版本开始:
- 0.2.0
-
isAsync
public boolean isAsync() -
getName
-
getCurNode
-
setCurNode
-
getCurEntry
-
setCurEntry
-
getOrigin
-
setOrigin
-
getOriginTotalQps
public double getOriginTotalQps() -
getOriginBlockQps
public double getOriginBlockQps() -
getOriginPassReqQps
public double getOriginPassReqQps() -
getOriginPassQps
public double getOriginPassQps() -
getOriginTotalRequest
public long getOriginTotalRequest() -
getOriginBlockRequest
public long getOriginBlockRequest() -
getOriginAvgRt
public double getOriginAvgRt() -
getOriginCurThreadNum
public int getOriginCurThreadNum() -
getEntranceNode
-
getLastNode
Get the parentNodeof the current.- 返回:
- the parent node of the current.
-
getOriginNode
-
toString
-