Class Replayer
java.lang.Object
io.deephaven.engine.table.impl.replay.Replayer
- All Implemented Interfaces:
ReplayerInterface
,Runnable
- Direct Known Subclasses:
DataDrivenReplayer
,FixedStepReplayer
Replay historical data as simulated real-time data.
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionclock()
static Clock
getClock
(ReplayerInterface replayer) Gets a time provider for the replayer.Gets a handle to the replayer.boolean
isDone()
Has the replayer finished replaying all data.void
registerTimeSource
(RowSet rowSet, ColumnSource<Instant> timestampSource) Register the time column and row set from a new table to replay.Prepares a historical table for replaying.replayGrouped
(Table dataSource, String timeColumn, String groupingColumn) Prepares a grouped historical table for replaying.replayGroupedLastBy
(Table dataSource, String timeColumn, String... groupingColumns) Prepares a grouped historical table for replaying as a last-by table.void
run()
Refresh the simulated live tables.void
Schedule a task to execute.void
setTime
(long updatedTime) Sets the current replay time.void
shutdown()
Shuts down the replayer.void
start()
Starts replaying data.void
waitDone
(long maxTimeMillis) Wait a specified interval for the replayer to complete.
-
Field Details
-
startTime
-
endTime
-
-
Constructor Details
-
Replayer
Creates a new replayer.- Parameters:
startTime
- start timeendTime
- end time
-
-
Method Details
-
start
public void start()Starts replaying data.- Specified by:
start
in interfaceReplayerInterface
-
isDone
public boolean isDone()Has the replayer finished replaying all data.- Specified by:
isDone
in interfaceReplayerInterface
- Returns:
- true if the replayer has finished replaying all data; false otherwise.
-
shutdown
public void shutdown()Shuts down the replayer.- Specified by:
shutdown
in interfaceReplayerInterface
-
waitDone
public void waitDone(long maxTimeMillis) Wait a specified interval for the replayer to complete. If the replayer has not completed by the end of the interval, the method returns.- Specified by:
waitDone
in interfaceReplayerInterface
- Parameters:
maxTimeMillis
- maximum number of milliseconds to wait.- Throws:
CancellationException
- thread was interrupted.
-
schedule
Schedule a task to execute.- Specified by:
schedule
in interfaceReplayerInterface
- Parameters:
task
- task to executedelayMillis
- delay in milliseconds before first executing the taskperiodMillis
- frequency in milliseconds to execute the task.
-
getClock
Gets a time provider for the replayer. The time provider returns the current replay time.- Parameters:
replayer
- replayer- Returns:
- time provider that returns the current replay time.
-
setTime
public void setTime(long updatedTime) Sets the current replay time.- Specified by:
setTime
in interfaceReplayerInterface
- Parameters:
updatedTime
- new replay time.
-
replay
Prepares a historical table for replaying.- Specified by:
replay
in interfaceReplayerInterface
- Parameters:
dataSource
- historical table to replaytimeColumn
- column in the table containing timestamps- Returns:
- dynamic, replayed version of the table.
-
replayGrouped
Prepares a grouped historical table for replaying. This method can be faster than the ungrouped replay, but the performance increase comes with a cost. Within a group, the data ordering is maintained. Between groups, data ordering is not maintained for a time interval.- Specified by:
replayGrouped
in interfaceReplayerInterface
- Parameters:
dataSource
- historical table to replaytimeColumn
- column in the table containing timestamps- Returns:
- dynamic, replayed version of the table.
-
replayGroupedLastBy
Prepares a grouped historical table for replaying as a last-by table.- Specified by:
replayGroupedLastBy
in interfaceReplayerInterface
- Parameters:
dataSource
- historical table to replaytimeColumn
- column in the table containing timestampsgroupingColumns
- columns used as the key in computing last-by- Returns:
- dynamic, replayed version of the last-by table.
-
registerTimeSource
Register the time column and row set from a new table to replay. Most users will usereplay
,replayGrouped
, orreplayGroupedLastBy
instead of this function.- Parameters:
rowSet
- table row settimestampSource
- column source containing time information.
-
run
public void run()Refresh the simulated live tables. -
getHandle
Gets a handle to the replayer.- Specified by:
getHandle
in interfaceReplayerInterface
- Returns:
- handle to the replayer.
-
clock
- Specified by:
clock
in interfaceReplayerInterface
-