R
- The type of resource this script is selecting fromC
- The context for resource selection which must extend ResourceSelectionContext
public class ResourceSelectorScript<R,C extends ResourceSelectionContext<R>> extends ManagedScript
Modifier | Constructor and Description |
---|---|
protected |
ResourceSelectorScript(ScriptManager scriptManager,
ManagedScriptBaseProperties properties,
io.micrometer.core.instrument.MeterRegistry registry,
PropertiesMapCache propertyMapCache)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
protected void |
addParametersForScript(java.util.Map<java.lang.String,java.lang.Object> parameters,
C context)
Add any implementation specific parameters to the map of parameters to send to the script.
|
ResourceSelectorScriptResult<R> |
selectResource(C context)
Given the
JobRequest and an associated set of resources which matched the request criteria
invoke the configured script to see if a preferred resource is selected based on the current logic. |
evaluateScript, warmUp
protected ResourceSelectorScript(ScriptManager scriptManager, ManagedScriptBaseProperties properties, io.micrometer.core.instrument.MeterRegistry registry, PropertiesMapCache propertyMapCache)
scriptManager
- The ScriptManager
instance to useproperties
- The ManagedScriptBaseProperties
instance to useregistry
- The MeterRegistry
instance to usepropertyMapCache
- The PropertiesMapCache
instance to usepublic ResourceSelectorScriptResult<R> selectResource(C context) throws ResourceSelectionException
JobRequest
and an associated set of resources which matched the request criteria
invoke the configured script to see if a preferred resource is selected based on the current logic.context
- The ResourceSelectionContext
instance containing information about the context for this
selectionResourceSelectorScriptResult
instanceResourceSelectionException
- If an unexpected error occurs during selectionprotected void addParametersForScript(java.util.Map<java.lang.String,java.lang.Object> parameters, C context)
parameters
- The existing set of parameters for implementations to add tocontext
- The selection context