Class ResendHistoricDataWorker
java.lang.Object
io.openems.common.worker.AbstractWorker
io.openems.edge.controller.api.backend.ResendHistoricDataWorker
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic final record
protected static enum
-
Field Summary
Modifier and TypeFieldDescriptionprotected static final int
This worker only starts resending data, after it got explicit triggered withAbstractWorker.triggerNextRun()
and also after this delay time.protected final AtomicReference
<ResendHistoricDataWorker.TriggerState> Trigger helper variable to delay execution of the forever method by DELAY_TRIGGER_TIME.Fields inherited from class io.openems.common.worker.AbstractWorker
ALWAYS_WAIT_FOR_TRIGGER_NEXT_RUN, DO_NOT_WAIT, thread
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
bindTimedata
(Timedata timedata) void
Stops the worker thread.protected void
forever()
This method is called in a loop forever until the Thread gets interrupted.protected int
Gets the cycleTime of this worker in [ms].mapResendData
(SortedMap<Long, SortedMap<ChannelAddress, com.google.gson.JsonElement>> resendData) void
void
Allows the next execution of the forever() method.protected void
unbindTimedata
(Timedata timedata) Methods inherited from class io.openems.common.worker.AbstractWorker
activate, activate, modified, modified, setPriority
-
Field Details
-
DELAY_TRIGGER_TIME
protected static final int DELAY_TRIGGER_TIMEThis worker only starts resending data, after it got explicit triggered withAbstractWorker.triggerNextRun()
and also after this delay time.- See Also:
-
triggerState
Trigger helper variable to delay execution of the forever method by DELAY_TRIGGER_TIME. If during the forever method timedata or the configuration is not set the state changes into eitherResendHistoricDataWorker.TriggerState.WAITING_FOR_TIMEDATA
orResendHistoricDataWorker.TriggerState.WAITING_FOR_CONFIG
and continues with the execution when the one missing got set.triggerState = INIT tiggerNextRun(); -> triggerState = AFTER_TRIGGER; -> forever(); -> if(triggerState == 1) triggerState = SKIP_FIRST_FOREVER; -> getCycleTime() = DELAY_TRIGGER_TIME; triggerState = INIT; -> forever();
-
-
Constructor Details
-
ResendHistoricDataWorker
public ResendHistoricDataWorker()
-
-
Method Details
-
deactivate
public void deactivate()Description copied from class:AbstractWorker
Stops the worker thread.- Overrides:
deactivate
in classAbstractWorker
-
forever
Description copied from class:AbstractWorker
This method is called in a loop forever until the Thread gets interrupted.- Specified by:
forever
in classAbstractWorker
- Throws:
Throwable
-
bindTimedata
-
unbindTimedata
-
getCycleTime
protected int getCycleTime()Description copied from class:AbstractWorker
Gets the cycleTime of this worker in [ms].- > 0 sets the minimum execution time of one Cycle
- = 0 never wait between two consecutive executions of forever()
- < 0 causes the Cycle to sleep forever until 'triggerNextRun()' is called
- Specified by:
getCycleTime
in classAbstractWorker
- Returns:
- the cycleTime
-
triggerNextRun
public void triggerNextRun()Description copied from class:AbstractWorker
Allows the next execution of the forever() method.- Overrides:
triggerNextRun
in classAbstractWorker
-
setConfig
-
mapResendData
-