diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/SchedulingPolicy.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/SchedulingPolicy.java index 9a9be8c10c3..c91bc5c85f8 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/SchedulingPolicy.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/SchedulingPolicy.java @@ -33,6 +33,11 @@ import java.util.Comparator; import java.util.concurrent.ConcurrentHashMap; +/** + * The scheduling policy for a queue. + * It determines the strategy to share resources between the + * running applications within this queue. + */ @Public @Evolving public abstract class SchedulingPolicy { @@ -41,11 +46,16 @@ public static final SchedulingPolicy DEFAULT_POLICY = getInstance(FairSharePolicy.class); - + /** - * Returns a {@link SchedulingPolicy} instance corresponding to the passed clazz + * Returns a {@link SchedulingPolicy} instance corresponding + * to the passed clazz. + * + * @param clazz a class that extends {@link SchedulingPolicy} + * @return a {@link SchedulingPolicy} instance */ - public static SchedulingPolicy getInstance(Class clazz) { + public static SchedulingPolicy getInstance( + Class clazz) { SchedulingPolicy policy = ReflectionUtils.newInstance(clazz, null); SchedulingPolicy policyRet = instances.putIfAbsent(clazz, policy); if(policyRet != null) { @@ -63,7 +73,9 @@ public static SchedulingPolicy getInstance(Class cla * canonical class name of the {@link SchedulingPolicy}. * * @param policy canonical class name or "drf" or "fair" or "fifo" + * @return a {@link SchedulingPolicy} instance parsed from given policy * @throws AllocationConfigurationException + * */ @SuppressWarnings("unchecked") public static SchedulingPolicy parse(String policy) @@ -94,7 +106,7 @@ public static SchedulingPolicy parse(String policy) /** * Initialize the scheduling policy with cluster resources. - * @deprecated Since it doesn't track cluster resource changes, replaced by + * @deprecated Since it doesn't track cluster resource changes, replaced by * {@link #initialize(FSContext)}. * * @param clusterCapacity cluster resources @@ -158,7 +170,7 @@ public abstract void computeSteadyShares( Collection queues, Resource totalResources); /** - * Check if the resource usage is over the fair share under this policy + * Check if the resource usage is over the fair share under this policy. * * @param usage {@link Resource} the resource usage * @param fairShare {@link Resource} the fair share @@ -168,10 +180,10 @@ public abstract boolean checkIfUsageOverFairShare( Resource usage, Resource fairShare); /** - * Get headroom by calculating the min of clusterAvailable and - * (queueFairShare - queueUsage) resources that are + * Get headroom by calculating the min of {@code clusterAvailable} and + * ({@code queueFairShare} - {@code queueUsage}) resources that are * applicable to this policy. For eg if only memory then leave other - * resources such as CPU to same as clusterAvailable. + * resources such as CPU to same as {@code clusterAvailable}. * * @param queueFairShare fairshare in the queue * @param queueUsage resources used in the queue