expose cron schedule entries in EventManager
This commit is contained in:
parent
710733f00d
commit
ab2cf01520
3 changed files with 13 additions and 1 deletions
|
@ -1,5 +1,6 @@
|
||||||
package org.xbib.event.clock;
|
package org.xbib.event.clock;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
import org.xbib.event.Event;
|
import org.xbib.event.Event;
|
||||||
import org.xbib.event.common.AbstractEventManagerService;
|
import org.xbib.event.common.AbstractEventManagerService;
|
||||||
import org.xbib.event.common.EventManager;
|
import org.xbib.event.common.EventManager;
|
||||||
|
@ -15,6 +16,7 @@ import java.util.concurrent.ScheduledExecutorService;
|
||||||
import java.util.concurrent.ThreadFactory;
|
import java.util.concurrent.ThreadFactory;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
import org.xbib.time.schedule.Entry;
|
||||||
|
|
||||||
public class ClockEventManagerService extends AbstractEventManagerService implements EventManagerService {
|
public class ClockEventManagerService extends AbstractEventManagerService implements EventManagerService {
|
||||||
|
|
||||||
|
@ -75,4 +77,8 @@ public class ClockEventManagerService extends AbstractEventManagerService implem
|
||||||
public void publish(Event event) {
|
public void publish(Event event) {
|
||||||
eventManager.publish(event);
|
eventManager.publish(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<Entry<Boolean>> getCronScheduleEntries() {
|
||||||
|
return cronSchedule.getEntries();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,6 +39,7 @@ import java.util.concurrent.ExecutorService;
|
||||||
import java.util.concurrent.Executors;
|
import java.util.concurrent.Executors;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
import org.xbib.time.schedule.Entry;
|
||||||
|
|
||||||
public final class EventManager extends AbstractEventManagerService implements EventManagerService {
|
public final class EventManager extends AbstractEventManagerService implements EventManagerService {
|
||||||
|
|
||||||
|
@ -196,6 +197,11 @@ public final class EventManager extends AbstractEventManagerService implements E
|
||||||
publish(event);
|
publish(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<Entry<Boolean>> getCronScheduleEntries() {
|
||||||
|
ClockEventManagerService clockEventManagerService = getClockEventManagerService();
|
||||||
|
return clockEventManagerService != null ? clockEventManagerService.getCronScheduleEntries() : List.of();
|
||||||
|
}
|
||||||
|
|
||||||
public void shutdown() throws IOException {
|
public void shutdown() throws IOException {
|
||||||
for (EventConsumer eventConsumer : builder.eventConsumers) {
|
for (EventConsumer eventConsumer : builder.eventConsumers) {
|
||||||
if (eventConsumer instanceof Closeable closeable) {
|
if (eventConsumer instanceof Closeable closeable) {
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
group = org.xbib
|
group = org.xbib
|
||||||
name = event
|
name = event
|
||||||
version = 0.3.0
|
version = 0.4.0
|
||||||
|
|
Loading…
Reference in a new issue