Class MessageScheduler<T extends Message>
java.lang.Object
io.openems.backend.alerting.scheduler.MessageScheduler<T>
- Type Parameters:
T
- type of Message
Schedules one or more
Message
for type MessageScheduler
to a specific time.
After the specified time is reached, the scheduler sends the Messages to
their Handler
and removes them from itself.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
handle
(ZonedDateTime now) Transfer the messages due to their handler.boolean
Check if this MessageScheduler handles messages for given handler.boolean
isScheduled
(Message msg) Get if given message is scheduled.boolean
isScheduled
(Predicate<T> find) Get if a message fitting thePredicate
is scheduled.Remove message from scheduler.void
Add message to scheduler.int
size()
Get amount of scheduled messages.
-
Constructor Details
-
MessageScheduler
-
-
Method Details
-
schedule
Add message to scheduler.- Parameters:
msg
- to add
-
remove
Remove message from scheduler.- Parameters:
msgId
- for message to remove- Returns:
- the removed Message or null, if none was found
-
isScheduled
Get if given message is scheduled.- Parameters:
msg
- to check for- Returns:
- true if is scheduled
-
isScheduled
Get if a message fitting thePredicate
is scheduled.- Parameters:
find
- ;filter to use- Returns:
- true if is scheduled
-
getGeneric
-
size
public int size()Get amount of scheduled messages.- Returns:
- size of message queue
-
handle
Transfer the messages due to their handler.- Parameters:
now
- TimeStamp on call
-
isFor
Check if this MessageScheduler handles messages for given handler.- Parameters:
handler
- to check for- Returns:
- true if this MessageScheduler handles messages for given handler
-