diff --git a/sentinel-core/src/main/java/com/alibaba/csp/sentinel/CtSph.java b/sentinel-core/src/main/java/com/alibaba/csp/sentinel/CtSph.java index fcd8df6d..0bb9c411 100755 --- a/sentinel-core/src/main/java/com/alibaba/csp/sentinel/CtSph.java +++ b/sentinel-core/src/main/java/com/alibaba/csp/sentinel/CtSph.java @@ -109,7 +109,8 @@ public class CtSph implements Sph { return asyncEntry; } - private AsyncEntry asyncEntryInternal(ResourceWrapper resourceWrapper, int count, Object... args) throws BlockException { + private AsyncEntry asyncEntryInternal(ResourceWrapper resourceWrapper, int count, Object... args) + throws BlockException { return asyncEntryWithPriorityInternal(resourceWrapper, count, false, args); } @@ -321,4 +322,11 @@ public class CtSph implements Sph { StringResourceWrapper resource = new StringResourceWrapper(name, type); return entryWithPriority(resource, count, prioritized); } + + @Override + public Entry entryWithPriority(String name, EntryType type, int count, boolean prioritized, Object... args) + throws BlockException { + StringResourceWrapper resource = new StringResourceWrapper(name, type); + return entryWithPriority(resource, count, prioritized, args); + } } diff --git a/sentinel-core/src/main/java/com/alibaba/csp/sentinel/Sph.java b/sentinel-core/src/main/java/com/alibaba/csp/sentinel/Sph.java index 7e1f2a90..bedbd33b 100755 --- a/sentinel-core/src/main/java/com/alibaba/csp/sentinel/Sph.java +++ b/sentinel-core/src/main/java/com/alibaba/csp/sentinel/Sph.java @@ -169,4 +169,21 @@ public interface Sph { * @since 1.4.0 */ Entry entryWithPriority(String name, EntryType type, int count, boolean prioritized) throws BlockException; + + /** + * Create a protected resource with priority. + * + * @param name the unique name for the protected resource + * @param type the resource is an inbound or an outbound method. This is used + * to mark whether it can be blocked when the system is unstable + * @param count the count that the resource requires + * @param prioritized whether the entry is prioritized + * @param args the parameters of the method. It can also be counted by setting hot parameter + * rule + * @return entry get + * @throws BlockException if the block criteria is met + * @since 1.5.0 + */ + Entry entryWithPriority(String name, EntryType type, int count, boolean prioritized, Object... args) + throws BlockException; }