KEYTYPE - unique ID key typeDATATYPE - data typepublic class ModelFarmRealTime<KEYTYPE,DATATYPE,ROWDATAMANAGERTYPE extends RowDataManager<KEYTYPE,DATATYPE>> extends ModelFarmBase<KEYTYPE,DATATYPE,ROWDATAMANAGERTYPE>
This is useful for real-time processing, where executing unique identifiers as fast as possible is desired.
The execution priority is determined by how long it has been since the data changed. The prioritizer can be used to bump a unique identifier to a higher execution priority.
ModelFarmBase.GetDataLockType, ModelFarmBase.StatedataManager, model| Constructor and Description |
|---|
ModelFarmRealTime(int nThreads,
Model<DATATYPE> model,
ROWDATAMANAGERTYPE dataManager,
ExecPrioritizer<KEYTYPE,DATATYPE,ROWDATAMANAGERTYPE> prioritizer)
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, terminatepublic ModelFarmRealTime(int nThreads,
Model<DATATYPE> model,
ROWDATAMANAGERTYPE dataManager,
ExecPrioritizer<KEYTYPE,DATATYPE,ROWDATAMANAGERTYPE> prioritizer)
nThreads - number of worker threads.model - model to execute.dataManager - interface for accessing and querying data contained in rows of a dynamic table.prioritizer - utility for computing the execution priority.protected void onDataUpdate(Index added, Index removed, Index modified)
ModelFarmBaseonDataUpdate 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()
ModelFarmBaseisQueueEmpty in class ModelFarmBase<KEYTYPE,DATATYPE,ROWDATAMANAGERTYPE extends RowDataManager<KEYTYPE,DATATYPE>>protected void execute()
throws InterruptedException
ModelFarmBaseexecute in class ModelFarmBase<KEYTYPE,DATATYPE,ROWDATAMANAGERTYPE extends RowDataManager<KEYTYPE,DATATYPE>>InterruptedException - if interrupted while executing