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)
Create an asynchronous resource with provided classification.
|
Entry |
entry(Method method)
Create a protected method.
|
Entry |
entry(Method method,
EntryType type)
Create a protected method.
|
Entry |
entry(Method method,
EntryType type,
int count)
Create a protected method.
|
Entry |
entry(Method method,
EntryType type,
int count,
Object... args)
Create a protected resource.
|
Entry |
entry(Method method,
int count)
Create a protected method.
|
Entry |
entry(ResourceWrapper resourceWrapper,
int count,
Object... args)
Do all
Rules checking about the resource. |
Entry |
entry(String name)
Create a protected resource.
|
Entry |
entry(String name,
EntryType type)
Create a protected resource.
|
Entry |
entry(String name,
EntryType type,
int count)
Create a protected resource.
|
Entry |
entry(String name,
EntryType type,
int count,
Object... args)
Create a protected resource.
|
Entry |
entry(String name,
int count)
Create a protected 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)
Create a protected resource with provided classification.
|
Entry |
entryWithType(String name,
int resourceType,
EntryType entryType,
int count,
Object[] args)
Create a protected 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 resourceBlockException - if the block criteria is metpublic Entry entry(Method method) throws BlockException
Sphentry in interface Sphmethod - the protected methodBlockException - if the block criteria is metpublic Entry entry(Method method, EntryType type) throws BlockException
Sphentry in interface Sphmethod - the protected methodtype - the resource is an inbound or an outbound method. This is used
to mark whether it can be blocked when the system is unstableBlockException - 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 resource is an inbound or an outbound method. This is used
to mark whether it can be blocked when the system is unstableBlockException - if the block criteria is metpublic Entry entry(Method method, EntryType type, int count) throws BlockException
Sphentry in interface Sphmethod - the protected methodtype - the resource is an inbound or an outbound method. This is used
to mark whether it can be blocked when the system is unstablecount - the count that the resource requiresBlockException - 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 resource is an inbound or an outbound method. This is used
to mark whether it can be blocked when the system is unstablecount - the count that the resource requiresBlockException - if the block criteria is metpublic Entry entry(Method method, int count) throws BlockException
Sphentry in interface Sphmethod - the protected methodcount - the count that the resource requiresBlockException - 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 count that the resource requiresBlockException - 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 resource is an inbound or an outbound method. This is used
to mark whether it can be blocked when the system is unstablecount - the count that the resource requiresargs - the parameters of the method. It can also be counted by setting
hot parameter ruleBlockException - 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 resource is an inbound or an outbound method. This is used
to mark whether it can be blocked when the system is unstablecount - the count that the resource requiresargs - the parameters of the method. It can also be counted by setting hot parameter ruleBlockException - 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 resource is an inbound or an outbound method. This is used
to mark whether it can be blocked when the system is unstablecount - the count that the resource requiresargs - the parameters of the method. It can also be counted by setting hot parameter ruleBlockException - 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 resource is an inbound or an outbound method. This is used
to mark whether it can be blocked when the system is unstablecount - the count that the resource requiresprioritized - whether the entry is prioritizedBlockException - 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 resource is an inbound or an outbound method. This is used
to mark whether it can be blocked when the system is unstablecount - the count that the resource requiresprioritized - whether the entry is prioritizedargs - the parameters of the method. It can also be counted by setting hot parameter
ruleBlockException - 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 entry type (IN/OUT) of the resourcecount - tokens requiredargs - extra parametersBlockException - 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 - the classification of the resourceentryType - the traffic entry type (IN/OUT) of the resourcecount - tokens requiredprioritized - whether the entry is prioritizedargs - extra parametersBlockException - 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 of the protected resourceresourceType - the classification of the resourceentryType - the traffic entry type (IN/OUT) of the resourcecount - tokens requiredprioritized - whether the entry is prioritizedargs - extra parametersBlockException - if the block criteria is metCopyright © 2019 Alibaba Group. All rights reserved.