Package io.deephaven.modelfarm
Class ModelFarmTick<KEYTYPE,DATATYPE,ROWDATAMANAGERTYPE extends RowDataManager<KEYTYPE,DATATYPE>>
java.lang.Object
io.deephaven.modelfarm.ModelFarmBase<DATATYPE>
io.deephaven.modelfarm.RDMModelFarm<KEYTYPE,DATATYPE,ROWDATAMANAGERTYPE>
io.deephaven.modelfarm.ModelFarmTick<KEYTYPE,DATATYPE,ROWDATAMANAGERTYPE>
- Type Parameters:
KEYTYPE
- unique ID key typeDATATYPE
- data type
- All Implemented Interfaces:
ModelFarm
public class ModelFarmTick<KEYTYPE,DATATYPE,ROWDATAMANAGERTYPE extends RowDataManager<KEYTYPE,DATATYPE>>
extends RDMModelFarm<KEYTYPE,DATATYPE,ROWDATAMANAGERTYPE>
A multithreaded resource to execute data driven models. Every time a row of the data table ticks, the unique
identifier is executed using the data from the tick. Successive executions for a unique identifier are processed in
order.
This is useful for executing against historical data at a regular interval.
-
Nested Class Summary
Nested classes/interfaces inherited from class io.deephaven.modelfarm.ModelFarmBase
ModelFarmBase.GetDataLockType, ModelFarmBase.State
-
Field Summary
Fields inherited from class io.deephaven.modelfarm.RDMModelFarm
dataManager
Fields inherited from class io.deephaven.modelfarm.ModelFarmBase
model
-
Constructor Summary
ConstructorDescriptionModelFarmTick
(int nThreads, Model<DATATYPE> model, ROWDATAMANAGERTYPE dataManager, int maxQueueSize) Create a multithreaded resource to execute data driven models. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
execute()
Executes the next task in the work queue.protected boolean
Returns true if the model farm queue is empty and false if the queue contains elements to execute.protected void
onDataUpdate
(RowSet added, RowSet removed, RowSet modified) Process a change to the data table.Methods inherited from class io.deephaven.modelfarm.RDMModelFarm
getMostRecentDataFactory, modelFarmStarted
Methods inherited from class io.deephaven.modelfarm.ModelFarmBase
awaitTermination, awaitTermination, getDoLockedConsumer, getState, shutdown, shutdownAndAwaitTermination, shutdownAndAwaitTermination, start, terminate, toString
-
Constructor Details
-
ModelFarmTick
public ModelFarmTick(int nThreads, Model<DATATYPE> model, ROWDATAMANAGERTYPE dataManager, int maxQueueSize) Create a multithreaded resource to execute data driven models.- Parameters:
nThreads
- number of worker threads.model
- model to execute.dataManager
- interface for accessing and querying data contained in rows of a dynamic table.maxQueueSize
- number of elements in the work queue backlog before the blocking new updates.
-
-
Method Details
-
onDataUpdate
Description copied from class:RDMModelFarm
Process a change to the data table. If the data table is being accessed, use the protected column source fields.- Specified by:
onDataUpdate
in classRDMModelFarm<KEYTYPE,
DATATYPE, ROWDATAMANAGERTYPE extends RowDataManager<KEYTYPE, DATATYPE>> - Parameters:
added
- new indexes added to the data tableremoved
- indexes removed from the data tablemodified
- indexes modified in the data table.
-
isQueueEmpty
protected boolean isQueueEmpty()Description copied from class:ModelFarmBase
Returns true if the model farm queue is empty and false if the queue contains elements to execute.- Specified by:
isQueueEmpty
in classModelFarmBase<DATATYPE>
- Returns:
- true if the model farm queue is empty and false if the queue contains elements to execute.
-
execute
Description copied from class:ModelFarmBase
Executes the next task in the work queue.- Specified by:
execute
in classModelFarmBase<DATATYPE>
- Throws:
InterruptedException
- if interrupted while executing
-