public class CpuUsageStrategyFactory extends ArrayBasedStrategyFactory
| Modifier and Type | Field and Description |
|---|---|
protected int |
lowCpuUsage
lowCpuUsage ~= zero CPU usage
|
protected int |
sampleCount
This strategy compares number of 'sampleCount' random node.
|
protected Transporter |
transporter |
preferLocalbroker, logger, name| Constructor and Description |
|---|
CpuUsageStrategyFactory()
Constructor that calls for service based primarily on its own (CPU-based)
logic.
|
CpuUsageStrategyFactory(boolean preferLocal)
Constructor that can be configured to use local services if possible.
|
CpuUsageStrategyFactory(boolean preferLocal,
int sampleCount,
int lowCpuUsage) |
| Modifier and Type | Method and Description |
|---|---|
<T extends Endpoint> |
create() |
int |
getLowCpuUsage() |
int |
getSampleCount() |
void |
setLowCpuUsage(int lowCpuUsage) |
void |
setSampleCount(int sampleCount) |
void |
started(ServiceBroker broker)
Initializes strategy instance.
|
isPreferLocal, setPreferLocalgetBroker, getLogger, getName, stoppedprotected int sampleCount
protected int lowCpuUsage
protected Transporter transporter
public CpuUsageStrategyFactory()
public CpuUsageStrategyFactory(boolean preferLocal)
preferLocal - invoke local actions if possiblepublic CpuUsageStrategyFactory(boolean preferLocal,
int sampleCount,
int lowCpuUsage)
public void started(ServiceBroker broker) throws java.lang.Exception
started in interface MoleculerLifecyclestarted in class MoleculerComponentbroker - parent ServiceBrokerjava.lang.Exceptionpublic <T extends Endpoint> Strategy<T> create()
create in class StrategyFactorypublic int getSampleCount()
public void setSampleCount(int sampleCount)
public int getLowCpuUsage()
public void setLowCpuUsage(int lowCpuUsage)