|
@@ -18,6 +18,7 @@ package com.alibaba.csp.sentinel.adapter.reactor; |
|
|
import java.util.Arrays; |
|
|
import java.util.Arrays; |
|
|
|
|
|
|
|
|
import com.alibaba.csp.sentinel.EntryType; |
|
|
import com.alibaba.csp.sentinel.EntryType; |
|
|
|
|
|
import com.alibaba.csp.sentinel.ResourceTypeConstants; |
|
|
import com.alibaba.csp.sentinel.util.AssertUtil; |
|
|
import com.alibaba.csp.sentinel.util.AssertUtil; |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
@@ -28,6 +29,8 @@ public class EntryConfig { |
|
|
|
|
|
|
|
|
private final String resourceName; |
|
|
private final String resourceName; |
|
|
private final EntryType entryType; |
|
|
private final EntryType entryType; |
|
|
|
|
|
private final int resourceType; |
|
|
|
|
|
|
|
|
private final int acquireCount; |
|
|
private final int acquireCount; |
|
|
private final Object[] args; |
|
|
private final Object[] args; |
|
|
private final ContextConfig contextConfig; |
|
|
private final ContextConfig contextConfig; |
|
@@ -50,11 +53,21 @@ public class EntryConfig { |
|
|
|
|
|
|
|
|
public EntryConfig(String resourceName, EntryType entryType, int acquireCount, Object[] args, |
|
|
public EntryConfig(String resourceName, EntryType entryType, int acquireCount, Object[] args, |
|
|
ContextConfig contextConfig) { |
|
|
ContextConfig contextConfig) { |
|
|
|
|
|
this(resourceName, ResourceTypeConstants.COMMON, entryType, acquireCount, args, contextConfig); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public EntryConfig(String resourceName, int resourceType, EntryType entryType, int acquireCount, Object[] args) { |
|
|
|
|
|
this(resourceName, resourceType, entryType, acquireCount, args, null); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public EntryConfig(String resourceName, int resourceType, EntryType entryType, int acquireCount, Object[] args, |
|
|
|
|
|
ContextConfig contextConfig) { |
|
|
AssertUtil.assertNotBlank(resourceName, "resourceName cannot be blank"); |
|
|
AssertUtil.assertNotBlank(resourceName, "resourceName cannot be blank"); |
|
|
AssertUtil.notNull(entryType, "entryType cannot be null"); |
|
|
AssertUtil.notNull(entryType, "entryType cannot be null"); |
|
|
AssertUtil.isTrue(acquireCount > 0, "acquireCount should be positive"); |
|
|
AssertUtil.isTrue(acquireCount > 0, "acquireCount should be positive"); |
|
|
this.resourceName = resourceName; |
|
|
this.resourceName = resourceName; |
|
|
this.entryType = entryType; |
|
|
this.entryType = entryType; |
|
|
|
|
|
this.resourceType = resourceType; |
|
|
this.acquireCount = acquireCount; |
|
|
this.acquireCount = acquireCount; |
|
|
this.args = args; |
|
|
this.args = args; |
|
|
// Constructed ContextConfig should be valid here. Null is allowed here. |
|
|
// Constructed ContextConfig should be valid here. Null is allowed here. |
|
@@ -81,11 +94,19 @@ public class EntryConfig { |
|
|
return contextConfig; |
|
|
return contextConfig; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* @since 1.7.0 |
|
|
|
|
|
*/ |
|
|
|
|
|
public int getResourceType() { |
|
|
|
|
|
return resourceType; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public String toString() { |
|
|
public String toString() { |
|
|
return "EntryConfig{" + |
|
|
return "EntryConfig{" + |
|
|
"resourceName='" + resourceName + '\'' + |
|
|
"resourceName='" + resourceName + '\'' + |
|
|
", entryType=" + entryType + |
|
|
", entryType=" + entryType + |
|
|
|
|
|
", resourceType=" + resourceType + |
|
|
", acquireCount=" + acquireCount + |
|
|
", acquireCount=" + acquireCount + |
|
|
", args=" + Arrays.toString(args) + |
|
|
", args=" + Arrays.toString(args) + |
|
|
", contextConfig=" + contextConfig + |
|
|
", contextConfig=" + contextConfig + |
|
|