- java.lang.Object
-
- com.alibaba.rcm.Constraint
-
public class Constraint extends Object
AConstraintis a pair ofResourceTypeandvalues. The constrained resource and specification of parameter values are documented in enum constants inResourceTypeA
Constraintmust be associated with oneResourceType, so we provide factory methodResourceType.newConstraint(long...)to implement this restriction. For example:Constraint cpuConstraint = ResourceType.CPU_PERCENT.newConstraint(30);
ResourceContainerandConstraintfollow the one-to-many relationship.ResourceContainer.getConstraints()can fetch the Constraint associated with ResourceContainer.
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedConstraint(ResourceType type, long[] values)Constraint should be instantiated byResourceType.newConstraint(long...)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ResourceTypegetResourceType()Returns the currently restricted resource type.long[]getValues()Returns the constraint value of ResourceType described by a long[], which is documented on the ResourceType enums.
-
-
-
Constructor Detail
-
Constraint
protected Constraint(ResourceType type, long[] values)
Constraint should be instantiated byResourceType.newConstraint(long...)
-
-
Method Detail
-
getResourceType
public ResourceType getResourceType()
Returns the currently restricted resource type.- Returns:
- resource type
-
getValues
public long[] getValues()
Returns the constraint value of ResourceType described by a long[], which is documented on the ResourceType enums.The returned value is a copy of the internal storage array to prevent modification.
- Returns:
- constraint values
-
-