23 lines
910 B
Java
23 lines
910 B
Java
package dev.ltms.bridged.placement;
|
|
|
|
/**
|
|
* Backward-compatible placement: an unqualified spawn always resolves to the configured default
|
|
* profile, exactly as {@code CompositePeerLauncher} did before CB-518. This ignores caps and
|
|
* reachability so that a pre-existing config behaves identically after upgrade.
|
|
*/
|
|
final class FixedPlacementPolicy implements PlacementPolicy {
|
|
|
|
@Override
|
|
public PlacementCandidate select(PlacementContext ctx) {
|
|
String d = ctx.defaultProfile();
|
|
if (d != null && !d.isBlank()) {
|
|
return new PlacementCandidate(d, null, 1.0f, null);
|
|
}
|
|
if (!ctx.candidates().isEmpty()) {
|
|
PlacementCandidate first = ctx.candidates().getFirst();
|
|
return new PlacementCandidate(first.profile(), null, first.weight(), first.maxLoad());
|
|
}
|
|
throw new PlacementException("no worker profiles configured");
|
|
}
|
|
}
|