KEYTYPE
- unique ID key typeDATATYPE
- data typepublic class ModelFarmTick<KEYTYPE,DATATYPE,ROWDATAMANAGERTYPE extends RowDataManager<KEYTYPE,DATATYPE>> extends ModelFarmBase<KEYTYPE,DATATYPE,ROWDATAMANAGERTYPE>
This is useful for executing against historical data at a regular interval.
ModelFarmBase.GetDataLockType, ModelFarmBase.State
dataManager, model
Constructor and Description |
---|
ModelFarmTick(int nThreads,
Model<DATATYPE> model,
ROWDATAMANAGERTYPE dataManager,
int queueSize)
Create a multithreaded resource to execute data driven models.
|
Modifier and Type | Method and Description |
---|---|
protected void |
execute()
Executes the next task in the work queue.
|
protected boolean |
isQueueEmpty()
Returns true if the model farm queue is empty and false if the queue contains elements to execute.
|
protected void |
onDataUpdate(Index added,
Index removed,
Index modified)
Process a change to the data table.
|
awaitTermination, awaitTermination, getMostRecentDataFactory, getState, shutdown, shutdownAndAwaitTermination, shutdownAndAwaitTermination, start, terminate
public ModelFarmTick(int nThreads, Model<DATATYPE> model, ROWDATAMANAGERTYPE dataManager, int queueSize)
nThreads
- number of worker threads.model
- model to execute.dataManager
- interface for accessing and querying data contained in rows of a dynamic table.queueSize
- number of elements in the work queue backlog before the blocking new updates.protected void onDataUpdate(Index added, Index removed, Index modified)
ModelFarmBase
onDataUpdate
in class ModelFarmBase<KEYTYPE,DATATYPE,ROWDATAMANAGERTYPE extends RowDataManager<KEYTYPE,DATATYPE>>
added
- new indexes added to the data tableremoved
- indexes removed from the data tablemodified
- indexes modified in the data table.protected boolean isQueueEmpty()
ModelFarmBase
isQueueEmpty
in class ModelFarmBase<KEYTYPE,DATATYPE,ROWDATAMANAGERTYPE extends RowDataManager<KEYTYPE,DATATYPE>>
protected void execute() throws InterruptedException
ModelFarmBase
execute
in class ModelFarmBase<KEYTYPE,DATATYPE,ROWDATAMANAGERTYPE extends RowDataManager<KEYTYPE,DATATYPE>>
InterruptedException
- if interrupted while executing