public class Constraint extends Object
Constraint
is a pair of ResourceType
and values
.
The constrained resource and specification of parameter values are documented
in enums consts in ResourceType
A Constraint
must be associated with one ResourceType
, so we
provide factory method ResourceType.newConstraint(long...)
to implement
this restriction. For example:
Constraint cpuConstraint = ResourceType.CPU_PERCENT.newConstraint(30);
ResourceContainer
and Constraint
follow the one-to-many relationship.
ContainerBuilder
can be used to collect Constraints and create ResourceContainer.
ResourceContainer.getConstraints()
can fetch the Constraint associated with
ResourceContainer.
Modifier and Type | Method and 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.
|
String |
toString() |
public ResourceType getResourceType()
public long[] getValues()
The returned value is a copy of the internal storage array to prevent modification.
"Copyright 2018, Alibaba, Inc."