class JobQueueScaler extends Object implements Runnable
| Constructor and Description |
|---|
JobQueueScaler(RouterContext context,
JobQueue jobQueue)Create a new JobQueueScaler. |
| Modifier and Type | Method and Description |
|---|---|
int | getCurrentMaxRunners()Get the current maximum runner limit (may be up to 2x configured or RAM-limited). |
(package private) int | getMinRunnersDynamic()Get the minimum number of runners (floor), dynamic - reads property each time. |
boolean | isAlive()Check if the scaler is currently running. |
void | releaseRunners(int count,
String reason)Release previously requested runners. |
void | requestRunners(int count,
String reason,
long autoReleaseMs)Request additional runners for an anticipated burst. |
void | run()Main scaling loop. |
void | shutdown()Shutdown the scaler gracefully. |
void | startup()Start the scaler thread. |
void | updateMaxRunners(int configuredMax)Update the maximum runner limit (called when configuration changes). |
public JobQueueScaler(RouterContext context, JobQueue jobQueue)
context - the router contextjobQueue - the job queue to scalepublic int getCurrentMaxRunners()
int getMinRunnersDynamic()
public boolean isAlive()
public void releaseRunners(int count,
String reason)count - number of runners to releasereason - must match the reason used in requestRunnerspublic void requestRunners(int count,
String reason,
long autoReleaseMs)count - number of additional runners to reservereason - label for tracking and loggingautoReleaseMs - if > 0, auto-decay after this many mspublic void shutdown()
public void startup()
public void updateMaxRunners(int configuredMax)