- java.lang.Object
-
- com.alibaba.rcm.Constraint
-
public class Constraint extends Object
AConstraint
is a pair ofResourceType
andvalues
. The constrained resource and specification of parameter values are documented in enum constants inResourceType
A
Constraint
must be associated with oneResourceType
, so we provide factory methodResourceType.newConstraint(long...)
to implement this restriction. For example:Constraint cpuConstraint = ResourceType.CPU_PERCENT.newConstraint(30);
ResourceContainer
andConstraint
follow the one-to-many relationship.ResourceContainer.getConstraints()
can fetch the Constraint associated with ResourceContainer.
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
Constraint(ResourceType type, long[] values)
Constraint should be instantiated byResourceType.newConstraint(long...)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ResourceType
getResourceType()
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
-
-