类 CtSph

java.lang.Object
com.alibaba.csp.sentinel.CtSph
所有已实现的接口:
Sph, SphResourceTypeSupport

public class CtSph extends Object implements Sph
作者:
jialiang.linjl, leyou(lihao), Eric Zhao
另请参阅:
  • 构造器详细资料

    • CtSph

      public CtSph()
  • 方法详细资料

    • entry

      public Entry entry(ResourceWrapper resourceWrapper, int count, Object... args) throws BlockException
      Do all 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 name
      count - tokens needed
      args - arguments of user method call
      返回:
      Entry represents this call
      抛出:
      BlockException - if any rule's threshold is exceeded
    • entrySize

      public static int entrySize()
      Get current size of created slot chains.
      返回:
      size of created slot chains
      从以下版本开始:
      0.2.0
    • entry

      public Entry entry(String name) throws BlockException
      从接口复制的说明: Sph
      Record statistics and perform rule checking for the given resource.
      指定者:
      entry 在接口中 Sph
      参数:
      name - the unique name of the protected resource
      返回:
      the Entry of this invocation (used for mark the invocation complete and get context data).
      抛出:
      BlockException - if the block criteria is met
    • entry

      public Entry entry(Method method) throws BlockException
      从接口复制的说明: Sph
      Record statistics and perform rule checking for the given method.
      指定者:
      entry 在接口中 Sph
      参数:
      method - the protected method
      返回:
      the Entry of this invocation (used for mark the invocation complete and get context data).
      抛出:
      BlockException - if the block criteria is met
    • entry

      public Entry entry(Method method, EntryType type) throws BlockException
      从接口复制的说明: Sph
      Record statistics and perform rule checking for the given method.
      指定者:
      entry 在接口中 Sph
      参数:
      method - the protected method
      type - 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 SystemRule
      返回:
      the Entry of this invocation (used for mark the invocation complete and get context data).
      抛出:
      BlockException - if the block criteria is met
    • entry

      public Entry entry(String name, EntryType type) throws BlockException
      从接口复制的说明: Sph
      Record statistics and perform rule checking for the given resource.
      指定者:
      entry 在接口中 Sph
      参数:
      name - the unique name for the protected resource
      type - 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 SystemRule
      返回:
      the Entry of this invocation (used for mark the invocation complete and get context data).
      抛出:
      BlockException - if the block criteria is met
    • entry

      public Entry entry(Method method, EntryType type, int count) throws BlockException
      从接口复制的说明: Sph
      Record statistics and perform rule checking for the given method.
      指定者:
      entry 在接口中 Sph
      参数:
      method - the protected method
      type - 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 SystemRule
      count - the amount of calls within the invocation (e.g. batchCount=2 means request for 2 tokens)
      返回:
      the Entry of this invocation (used for mark the invocation complete and get context data).
      抛出:
      BlockException - if the block criteria is met
    • entry

      public Entry entry(String name, EntryType type, int count) throws BlockException
      从接口复制的说明: Sph
      Record statistics and perform rule checking for the given resource.
      指定者:
      entry 在接口中 Sph
      参数:
      name - the unique name for the protected resource
      type - 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 SystemRule
      count - the amount of calls within the invocation (e.g. batchCount=2 means request for 2 tokens)
      返回:
      the Entry of this invocation (used for mark the invocation complete and get context data).
      抛出:
      BlockException - if the block criteria is met
    • entry

      public Entry entry(Method method, int count) throws BlockException
      从接口复制的说明: Sph
      Record statistics and perform rule checking for the given method.
      指定者:
      entry 在接口中 Sph
      参数:
      method - the protected method
      count - the amount of calls within the invocation (e.g. batchCount=2 means request for 2 tokens)
      返回:
      the Entry of this invocation (used for mark the invocation complete and get context data).
      抛出:
      BlockException - if the block criteria is met
    • entry

      public Entry entry(String name, int count) throws BlockException
      从接口复制的说明: Sph
      Record statistics and perform rule checking for the given resource.
      指定者:
      entry 在接口中 Sph
      参数:
      name - the unique string for the resource
      count - the amount of calls within the invocation (e.g. batchCount=2 means request for 2 tokens)
      返回:
      the Entry of this invocation (used for mark the invocation complete and get context data).
      抛出:
      BlockException - if the block criteria is met
    • entry

      public Entry entry(Method method, EntryType type, int count, Object... args) throws BlockException
      从接口复制的说明: Sph
      Record statistics and perform rule checking for the given resource.
      指定者:
      entry 在接口中 Sph
      参数:
      method - the protected method
      type - 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 SystemRule
      count - 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 slots
      返回:
      the Entry of this invocation (used for mark the invocation complete and get context data).
      抛出:
      BlockException - if the block criteria is met
    • entry

      public Entry entry(String name, EntryType type, int count, Object... args) throws BlockException
      从接口复制的说明: Sph
      Record statistics and perform rule checking for the given resource.
      指定者:
      entry 在接口中 Sph
      参数:
      name - the unique name for the protected resource
      type - 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 SystemRule
      count - the amount of calls within the invocation (e.g. batchCount=2 means request for 2 tokens)
      args - args for parameter flow control or customized slots
      返回:
      the Entry of this invocation (used for mark the invocation complete and get context data)
      抛出:
      BlockException - if the block criteria is met
    • asyncEntry

      public AsyncEntry asyncEntry(String name, EntryType type, int count, Object... args) throws BlockException
      从接口复制的说明: Sph
      Create a protected asynchronous resource.
      指定者:
      asyncEntry 在接口中 Sph
      参数:
      name - the unique name for the protected resource
      type - 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 SystemRule
      count - the amount of calls within the invocation (e.g. batchCount=2 means request for 2 tokens)
      args - args for parameter flow control or customized slots
      返回:
      created asynchronous entry
      抛出:
      BlockException - if the block criteria is met
    • entryWithPriority

      public Entry entryWithPriority(String name, EntryType type, int count, boolean prioritized) throws BlockException
      从接口复制的说明: Sph
      Create a protected resource with priority.
      指定者:
      entryWithPriority 在接口中 Sph
      参数:
      name - the unique name for the protected resource
      type - 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 SystemRule
      count - the amount of calls within the invocation (e.g. batchCount=2 means request for 2 tokens)
      prioritized - whether the entry is prioritized
      返回:
      the Entry of this invocation (used for mark the invocation complete and get context data)
      抛出:
      BlockException - if the block criteria is met
    • entryWithPriority

      public Entry entryWithPriority(String name, EntryType type, int count, boolean prioritized, Object... args) throws BlockException
      从接口复制的说明: Sph
      Create a protected resource with priority.
      指定者:
      entryWithPriority 在接口中 Sph
      参数:
      name - the unique name for the protected resource
      type - 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 SystemRule
      count - the amount of calls within the invocation (e.g. batchCount=2 means request for 2 tokens)
      prioritized - whether the entry is prioritized
      args - args for parameter flow control or customized slots
      返回:
      the Entry of this invocation (used for mark the invocation complete and get context data)
      抛出:
      BlockException - if the block criteria is met
    • entryWithType

      public Entry entryWithType(String name, int resourceType, EntryType entryType, int count, Object[] args) throws BlockException
      从接口复制的说明: SphResourceTypeSupport
      Record statistics and perform rule checking for the given resource with provided classification.
      指定者:
      entryWithType 在接口中 SphResourceTypeSupport
      参数:
      name - the unique name of the protected resource
      resourceType - the classification of the resource
      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 SystemRule
      count - the amount of calls within the invocation (e.g. batchCount=2 means request for 2 tokens)
      args - args for parameter flow control or customized slots
      返回:
      the Entry of this invocation (used for mark the invocation complete and get context data)
      抛出:
      BlockException - if the block criteria is met
    • entryWithType

      public Entry entryWithType(String name, int resourceType, EntryType entryType, int count, boolean prioritized, Object[] args) throws BlockException
      从接口复制的说明: SphResourceTypeSupport
      Record statistics and perform rule checking for the given resource with the provided classification.
      指定者:
      entryWithType 在接口中 SphResourceTypeSupport
      参数:
      name - the unique name of the protected resource
      resourceType - 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 SystemRule
      count - the amount of calls within the invocation (e.g. batchCount=2 means request for 2 tokens)
      prioritized - whether the entry is prioritized
      args - args for parameter flow control or customized slots
      返回:
      the Entry of this invocation (used for mark the invocation complete and get context data)
      抛出:
      BlockException - if the block criteria is met
    • asyncEntryWithType

      public AsyncEntry asyncEntryWithType(String name, int resourceType, EntryType entryType, int count, boolean prioritized, Object[] args) throws BlockException
      从接口复制的说明: SphResourceTypeSupport
      Record statistics and perform rule checking for the given resource that indicates an async invocation.
      指定者:
      asyncEntryWithType 在接口中 SphResourceTypeSupport
      参数:
      name - the unique name for the protected resource
      resourceType - 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 SystemRule
      count - the amount of calls within the invocation (e.g. batchCount=2 means request for 2 tokens)
      prioritized - whether the entry is prioritized
      args - args for parameter flow control or customized slots
      返回:
      the Entry of this invocation (used for mark the invocation complete and get context data)
      抛出:
      BlockException - if the block criteria is met