minor changes

This commit is contained in:
Jörg Prante 2024-01-25 17:23:23 +01:00
parent b96466515c
commit 1c1290de0b

View file

@ -29,7 +29,6 @@ public class TimerEventManagerService implements EventManagerService {
public TimerEventManagerService() {
}
@SuppressWarnings("unchecked")
@Override
public TimerEventManagerService init(EventManager eventManager) {
Settings settings = eventManager.getSettings();
@ -50,22 +49,22 @@ public class TimerEventManagerService implements EventManagerService {
return this;
}
public boolean publish(String service,
public boolean publish(String name,
String timeSpec,
Payload payload) throws ParseException, IOException {
if (services.containsKey(service)) {
if (services.containsKey(name)) {
Span span = Chronic.parse(timeSpec);
if (span != null) {
ZonedDateTime zonedDateTime = span.getBeginCalendar();
services.get(service).schedule(zonedDateTime.toInstant(), payload);
services.get(name).schedule(zonedDateTime.toInstant(), payload);
logger.log(Level.INFO, "scheduled to " + zonedDateTime);
} else {
logger.log(Level.INFO, "timer event key " + service + ": can not understand time spec " + timeSpec);
logger.log(Level.INFO, "timer event key " + name + ": can not understand time spec " + timeSpec);
return false;
}
return true;
} else {
logger.log(Level.SEVERE, "unknown timer event key: " + service);
logger.log(Level.SEVERE, "unknown timer event key: " + name);
}
return false;
}