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