Class ConstantGlobalPoolStrategy
- java.lang.Object
- 
- jadex.platform.service.globalservicepool.ConstantGlobalPoolStrategy
 
- 
- All Implemented Interfaces:
- IGlobalPoolStrategy
 
 public class ConstantGlobalPoolStrategy extends java.lang.Object implements IGlobalPoolStrategy Simple strategy that demands a constant number of workers from the pool.
- 
- 
Field SummaryFields Modifier and Type Field Description protected intmaxcntThe max number of workers.protected longtimeoutThe worker timeout.protected java.util.Set<IComponentIdentifier>workersThe worker platforms.protected intwppThe worker per proxy count.
 - 
Constructor SummaryConstructors Constructor Description ConstantGlobalPoolStrategy()Create a new constant strategy.ConstantGlobalPoolStrategy(long timeout, int maxcnt, int wpp)Create a new constant strategy.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetDesiredWorkerCount()Get the desired worker cnt.intgetWorkerCount()Get the worker cnt.intgetWorkersPerProxy()Get the number of workers that should be used by each proxy.longgetWorkerTimeout()Get the component timeout.booleanisCreateWorkerOn(IComponentIdentifier cid)Ask strategy if a new worker should be added on a platform.voidworkersAdded(IComponentIdentifier... workers)Called when a new worker was added proactively to the pool.voidworkersRemoved(IComponentIdentifier... workers)Called when workers have been removed.booleanworkerTimeoutOccurred(IComponentIdentifier worker)Notify the strategy that a timeout for a worker component has occurred, i.e.
 
- 
- 
- 
Field Detail- 
workersprotected java.util.Set<IComponentIdentifier> workers The worker platforms.
 - 
timeoutprotected long timeout The worker timeout.
 - 
maxcntprotected int maxcnt The max number of workers.
 - 
wppprotected int wpp The worker per proxy count.
 
- 
 - 
Method Detail- 
workersAddedpublic void workersAdded(IComponentIdentifier... workers) Called when a new worker was added proactively to the pool.- Specified by:
- workersAddedin interface- IGlobalPoolStrategy
- Parameters:
- cnt- The number of new workers.
 
 - 
workersRemovedpublic void workersRemoved(IComponentIdentifier... workers) Called when workers have been removed.- Specified by:
- workersRemovedin interface- IGlobalPoolStrategy
- Parameters:
- workers- The workers.
 
 - 
workerTimeoutOccurredpublic boolean workerTimeoutOccurred(IComponentIdentifier worker) Notify the strategy that a timeout for a worker component has occurred, i.e. it was not needed for serving some worker.- Specified by:
- workerTimeoutOccurredin interface- IGlobalPoolStrategy
- Returns:
- True, if the component be excluded from the pool.
 
 - 
getWorkerTimeoutpublic long getWorkerTimeout() Get the component timeout.- Specified by:
- getWorkerTimeoutin interface- IGlobalPoolStrategy
- Returns:
- The timeout for the component to wait for new workers in the pool.
 
 - 
getWorkerCountpublic int getWorkerCount() Get the worker cnt.- Specified by:
- getWorkerCountin interface- IGlobalPoolStrategy
 
 - 
getDesiredWorkerCountpublic int getDesiredWorkerCount() Get the desired worker cnt.- Specified by:
- getDesiredWorkerCountin interface- IGlobalPoolStrategy
 
 - 
isCreateWorkerOnpublic boolean isCreateWorkerOn(IComponentIdentifier cid) Ask strategy if a new worker should be added on a platform.- Specified by:
- isCreateWorkerOnin interface- IGlobalPoolStrategy
- Parameters:
- cid- The platform.
- Returns:
- True, if worker should be created.
 
 - 
getWorkersPerProxypublic int getWorkersPerProxy() Get the number of workers that should be used by each proxy.- Specified by:
- getWorkersPerProxyin interface- IGlobalPoolStrategy
- Returns:
- The number of workers used by each proxy.
 
 
- 
 
-