public class CtSph extends Object implements Sph
Sph| Constructor and Description |
|---|
CtSph() |
| Modifier and Type | Method and Description |
|---|---|
AsyncEntry |
asyncEntry(String name,
EntryType type,
int count,
Object... args)
Create a protected asynchronous resource.
|
AsyncEntry |
asyncEntryWithType(String name,
int resourceType,
EntryType entryType,
int count,
boolean prioritized,
Object[] args)
Record statistics and perform rule checking for the given resource that indicates an async invocation.
|
Entry |
entry(Method method)
Record statistics and perform rule checking for the given method.
|
Entry |
entry(Method method,
EntryType type)
Record statistics and perform rule checking for the given method.
|
Entry |
entry(Method method,
EntryType type,
int count)
Record statistics and perform rule checking for the given method.
|
Entry |
entry(Method method,
EntryType type,
int count,
Object... args)
Record statistics and perform rule checking for the given resource.
|
Entry |
entry(Method method,
int count)
Record statistics and perform rule checking for the given method.
|
Entry |
entry(ResourceWrapper resourceWrapper,
int count,
Object... args)
Do all
Rules checking about the resource. |
Entry |
entry(String name)
Record statistics and perform rule checking for the given resource.
|
Entry |
entry(String name,
EntryType type)
Record statistics and perform rule checking for the given resource.
|
Entry |
entry(String name,
EntryType type,
int count)
Record statistics and perform rule checking for the given resource.
|
Entry |
entry(String name,
EntryType type,
int count,
Object... args)
Record statistics and perform rule checking for the given resource.
|
Entry |
entry(String name,
int count)
Record statistics and perform rule checking for the given resource.
|
static int |
entrySize()
Get current size of created slot chains.
|
Entry |
entryWithPriority(String name,
EntryType type,
int count,
boolean prioritized)
Create a protected resource with priority.
|
Entry |
entryWithPriority(String name,
EntryType type,
int count,
boolean prioritized,
Object... args)
Create a protected resource with priority.
|
Entry |
entryWithType(String name,
int resourceType,
EntryType entryType,
int count,
boolean prioritized,
Object[] args)
Record statistics and perform rule checking for the given resource with the provided classification.
|
Entry |
entryWithType(String name,
int resourceType,
EntryType entryType,
int count,
Object[] args)
Record statistics and perform rule checking for the given resource with provided classification.
|
public Entry entry(ResourceWrapper resourceWrapper, int count, Object... args) throws BlockException
Rules checking about the resource.
Each distinct resource will use a ProcessorSlot to do rules checking. Same resource will use
same ProcessorSlot globally.
Note that total ProcessorSlot count must not exceed Constants.MAX_SLOT_CHAIN_SIZE,
otherwise no rules checking will do. In this condition, all requests will pass directly, with no checking
or exception.
resourceWrapper - resource namecount - tokens neededargs - arguments of user method callEntry represents this callBlockException - if any rule's threshold is exceededpublic static int entrySize()
public Entry entry(String name) throws BlockException
Sphentry in interface Sphname - the unique name of the protected resourceEntry of this invocation (used for mark the invocation complete and get context data).BlockException - if the block criteria is metpublic Entry entry(Method method) throws BlockException
Sphentry in interface Sphmethod - the protected methodEntry of this invocation (used for mark the invocation complete and get context data).BlockException - if the block criteria is metpublic Entry entry(Method method, EntryType type) throws BlockException
Sphentry in interface Sphmethod - the protected methodtype - the traffic type (inbound, outbound or internal). This is used
to mark whether it can be blocked when the system is unstable,
only inbound traffic could be blocked by SystemRuleEntry of this invocation (used for mark the invocation complete and get context data).BlockException - if the block criteria is metpublic Entry entry(String name, EntryType type) throws BlockException
Sphentry in interface Sphname - the unique name for the protected resourcetype - the traffic type (inbound, outbound or internal). This is used
to mark whether it can be blocked when the system is unstable,
only inbound traffic could be blocked by SystemRuleEntry of this invocation (used for mark the invocation complete and get context data).BlockException - if the block criteria is metpublic Entry entry(Method method, EntryType type, int count) throws BlockException
Sphentry in interface Sphmethod - the protected methodtype - the traffic type (inbound, outbound or internal). This is used
to mark whether it can be blocked when the system is unstable,
only inbound traffic could be blocked by SystemRulecount - the amount of calls within the invocation (e.g. batchCount=2 means request for 2 tokens)Entry of this invocation (used for mark the invocation complete and get context data).BlockException - if the block criteria is metpublic Entry entry(String name, EntryType type, int count) throws BlockException
Sphentry in interface Sphname - the unique name for the protected resourcetype - the traffic type (inbound, outbound or internal). This is used
to mark whether it can be blocked when the system is unstable,
only inbound traffic could be blocked by SystemRulecount - the amount of calls within the invocation (e.g. batchCount=2 means request for 2 tokens)Entry of this invocation (used for mark the invocation complete and get context data).BlockException - if the block criteria is metpublic Entry entry(Method method, int count) throws BlockException
Sphentry in interface Sphmethod - the protected methodcount - the amount of calls within the invocation (e.g. batchCount=2 means request for 2 tokens)Entry of this invocation (used for mark the invocation complete and get context data).BlockException - if the block criteria is metpublic Entry entry(String name, int count) throws BlockException
Sphentry in interface Sphname - the unique string for the resourcecount - the amount of calls within the invocation (e.g. batchCount=2 means request for 2 tokens)Entry of this invocation (used for mark the invocation complete and get context data).BlockException - if the block criteria is metpublic Entry entry(Method method, EntryType type, int count, Object... args) throws BlockException
Sphentry in interface Sphmethod - the protected methodtype - the traffic type (inbound, outbound or internal). This is used
to mark whether it can be blocked when the system is unstable,
only inbound traffic could be blocked by SystemRulecount - the amount of calls within the invocation (e.g. batchCount=2 means request for 2 tokens)args - parameters of the method for flow control or customized slotsEntry of this invocation (used for mark the invocation complete and get context data).BlockException - if the block criteria is metpublic Entry entry(String name, EntryType type, int count, Object... args) throws BlockException
Sphentry in interface Sphname - the unique name for the protected resourcetype - the traffic type (inbound, outbound or internal). This is used
to mark whether it can be blocked when the system is unstable,
only inbound traffic could be blocked by SystemRulecount - the amount of calls within the invocation (e.g. batchCount=2 means request for 2 tokens)args - args for parameter flow control or customized slotsEntry of this invocation (used for mark the invocation complete and get context data)BlockException - if the block criteria is metpublic AsyncEntry asyncEntry(String name, EntryType type, int count, Object... args) throws BlockException
SphasyncEntry in interface Sphname - the unique name for the protected resourcetype - the traffic type (inbound, outbound or internal). This is used
to mark whether it can be blocked when the system is unstable,
only inbound traffic could be blocked by SystemRulecount - the amount of calls within the invocation (e.g. batchCount=2 means request for 2 tokens)args - args for parameter flow control or customized slotsBlockException - if the block criteria is metpublic Entry entryWithPriority(String name, EntryType type, int count, boolean prioritized) throws BlockException
SphentryWithPriority in interface Sphname - the unique name for the protected resourcetype - the traffic type (inbound, outbound or internal). This is used
to mark whether it can be blocked when the system is unstable,
only inbound traffic could be blocked by SystemRulecount - the amount of calls within the invocation (e.g. batchCount=2 means request for 2 tokens)prioritized - whether the entry is prioritizedEntry of this invocation (used for mark the invocation complete and get context data)BlockException - if the block criteria is metpublic Entry entryWithPriority(String name, EntryType type, int count, boolean prioritized, Object... args) throws BlockException
SphentryWithPriority in interface Sphname - the unique name for the protected resourcetype - the traffic type (inbound, outbound or internal). This is used
to mark whether it can be blocked when the system is unstable,
only inbound traffic could be blocked by SystemRulecount - the amount of calls within the invocation (e.g. batchCount=2 means request for 2 tokens)prioritized - whether the entry is prioritizedargs - args for parameter flow control or customized slotsEntry of this invocation (used for mark the invocation complete and get context data)BlockException - if the block criteria is metpublic Entry entryWithType(String name, int resourceType, EntryType entryType, int count, Object[] args) throws BlockException
SphResourceTypeSupportentryWithType in interface SphResourceTypeSupportname - the unique name of the protected resourceresourceType - the classification of the resourceentryType - the traffic type (inbound, outbound or internal). This is used
to mark whether it can be blocked when the system is unstable,
only inbound traffic could be blocked by SystemRulecount - the amount of calls within the invocation (e.g. batchCount=2 means request for 2 tokens)args - args for parameter flow control or customized slotsEntry of this invocation (used for mark the invocation complete and get context data)BlockException - if the block criteria is metpublic Entry entryWithType(String name, int resourceType, EntryType entryType, int count, boolean prioritized, Object[] args) throws BlockException
SphResourceTypeSupportentryWithType in interface SphResourceTypeSupportname - the unique name of the protected resourceresourceType - classification of the resource (e.g. Web or RPC)entryType - the traffic type (inbound, outbound or internal). This is used
to mark whether it can be blocked when the system is unstable,
only inbound traffic could be blocked by SystemRulecount - the amount of calls within the invocation (e.g. batchCount=2 means request for 2 tokens)prioritized - whether the entry is prioritizedargs - args for parameter flow control or customized slotsEntry of this invocation (used for mark the invocation complete and get context data)BlockException - if the block criteria is metpublic AsyncEntry asyncEntryWithType(String name, int resourceType, EntryType entryType, int count, boolean prioritized, Object[] args) throws BlockException
SphResourceTypeSupportasyncEntryWithType in interface SphResourceTypeSupportname - the unique name for the protected resourceresourceType - classification of the resource (e.g. Web or RPC)entryType - the traffic type (inbound, outbound or internal). This is used
to mark whether it can be blocked when the system is unstable,
only inbound traffic could be blocked by SystemRulecount - the amount of calls within the invocation (e.g. batchCount=2 means request for 2 tokens)prioritized - whether the entry is prioritizedargs - args for parameter flow control or customized slotsEntry of this invocation (used for mark the invocation complete and get context data)BlockException - if the block criteria is metCopyright © 2021 Alibaba Group. All rights reserved.