public class LocationPreferenceSchedulingStrategy extends Object implements SchedulingStrategy
SchedulingStrategy
which tries to match a slot with its location preferences.Modifier and Type | Method and Description |
---|---|
protected <IN,OUT> OUT |
doFindMatchWithLocality(SlotProfile slotProfile,
java.util.stream.Stream<IN> candidates,
java.util.function.Function<IN,SlotInfo> contextExtractor,
java.util.function.Predicate<IN> additionalRequirementsFilter,
java.util.function.BiFunction<IN,Locality,OUT> resultProducer) |
<IN,OUT> OUT |
findMatchWithLocality(SlotProfile slotProfile,
java.util.function.Supplier<java.util.stream.Stream<IN>> candidates,
java.util.function.Function<IN,SlotInfo> contextExtractor,
java.util.function.Predicate<IN> additionalRequirementsFilter,
java.util.function.BiFunction<IN,Locality,OUT> resultProducer)
This method takes the candidate slots, extracts slot contexts from them, filters them by the profile
requirements and potentially by additional requirements, and produces a result from a match.
|
static LocationPreferenceSchedulingStrategy |
getInstance() |
@Nullable public <IN,OUT> OUT findMatchWithLocality(@Nonnull SlotProfile slotProfile, @Nonnull java.util.function.Supplier<java.util.stream.Stream<IN>> candidates, @Nonnull java.util.function.Function<IN,SlotInfo> contextExtractor, @Nonnull java.util.function.Predicate<IN> additionalRequirementsFilter, @Nonnull java.util.function.BiFunction<IN,Locality,OUT> resultProducer)
SchedulingStrategy
findMatchWithLocality
in interface SchedulingStrategy
IN
- type of the objects against we match the profile.OUT
- type of the produced output from a matching object.slotProfile
- slotProfile for which to find a matching slotcandidates
- stream of candidates to match against.contextExtractor
- function to extract the SlotContext
from the candidates.additionalRequirementsFilter
- predicate to specify additional requirements for each candidate.resultProducer
- function to produce a result from a matching candidate input.@Nullable protected <IN,OUT> OUT doFindMatchWithLocality(@Nonnull SlotProfile slotProfile, @Nonnull java.util.stream.Stream<IN> candidates, @Nonnull java.util.function.Function<IN,SlotInfo> contextExtractor, @Nonnull java.util.function.Predicate<IN> additionalRequirementsFilter, @Nonnull java.util.function.BiFunction<IN,Locality,OUT> resultProducer)
public static LocationPreferenceSchedulingStrategy getInstance()
Copyright © 2014–2020 The Apache Software Foundation. All rights reserved.