expose cron schedule entries in EventManager

This commit is contained in:
Jörg Prante 2024-06-28 19:44:33 +02:00
parent 710733f00d
commit ab2cf01520
3 changed files with 13 additions and 1 deletions

View file

@ -1,5 +1,6 @@
package org.xbib.event.clock;
import java.util.List;
import org.xbib.event.Event;
import org.xbib.event.common.AbstractEventManagerService;
import org.xbib.event.common.EventManager;
@ -15,6 +16,7 @@ import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ThreadFactory;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.xbib.time.schedule.Entry;
public class ClockEventManagerService extends AbstractEventManagerService implements EventManagerService {
@ -75,4 +77,8 @@ public class ClockEventManagerService extends AbstractEventManagerService implem
public void publish(Event event) {
eventManager.publish(event);
}
public List<Entry<Boolean>> getCronScheduleEntries() {
return cronSchedule.getEntries();
}
}

View file

@ -39,6 +39,7 @@ import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.xbib.time.schedule.Entry;
public final class EventManager extends AbstractEventManagerService implements EventManagerService {
@ -196,6 +197,11 @@ public final class EventManager extends AbstractEventManagerService implements E
publish(event);
}
public List<Entry<Boolean>> getCronScheduleEntries() {
ClockEventManagerService clockEventManagerService = getClockEventManagerService();
return clockEventManagerService != null ? clockEventManagerService.getCronScheduleEntries() : List.of();
}
public void shutdown() throws IOException {
for (EventConsumer eventConsumer : builder.eventConsumers) {
if (eventConsumer instanceof Closeable closeable) {

View file

@ -1,3 +1,3 @@
group = org.xbib
name = event
version = 0.3.0
version = 0.4.0