Class MinuteTimer
java.lang.Object
io.openems.backend.alerting.scheduler.MinuteTimer
- All Implemented Interfaces:
TimedExecutor
- Direct Known Subclasses:
MinuteTimerAsync
Executes subscriber every full Minute or once after a specified time of
Minutes. Starts and stops itself, depending on whether subscribers are
present.
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.openems.backend.alerting.scheduler.TimedExecutor
TimedExecutor.TimedTask
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Cancel task.protected void
cycle()
int
now()
schedule
(ZonedDateTime at, Consumer<ZonedDateTime> task) Execute the given task at the given dateTime to the minute.protected void
start()
protected void
stop()
void
subscribe
(Consumer<ZonedDateTime> sub) Add subscriber for every minute execution.void
unsubscribe
(Consumer<ZonedDateTime> sub) Remove subscriber from every minute execution.
-
Constructor Details
-
MinuteTimer
Create MinuteTimer with given clock.- Parameters:
clock
- to use for timing
-
-
Method Details
-
subscribe
Add subscriber for every minute execution.- Parameters:
sub
- to add
-
unsubscribe
Remove subscriber from every minute execution.- Parameters:
sub
- to remove
-
schedule
Execute the given task at the given dateTime to the minute.- Specified by:
schedule
in interfaceTimedExecutor
- Parameters:
at
- time to execute attask
- task to execute- Returns:
- reference to Task. Can be used to cancel the task.
-
cancel
Cancel task.- Specified by:
cancel
in interfaceTimedExecutor
- Parameters:
task
- to remove
-
start
protected void start() -
cycle
protected void cycle() -
stop
protected void stop() -
getSubscriberCount
public int getSubscriberCount() -
now
- Specified by:
now
in interfaceTimedExecutor
- Returns:
ZonedDateTime
now
-