add simple constructors

This commit is contained in:
Jörg Prante 2023-10-01 16:02:42 +02:00
parent 1873883284
commit 94f4e92081
3 changed files with 15 additions and 2 deletions

View file

@ -9,12 +9,13 @@ module org.xbib.event {
exports org.xbib.event.io;
exports org.xbib.event.loop;
exports org.xbib.event.loop.selector;
exports org.xbib.event.util;
requires org.xbib.datastructures.api;
requires org.xbib.datastructures.common;
requires org.xbib.datastructures.json.tiny;
requires transitive org.xbib.settings.api;
requires org.xbib.settings.api;
requires org.xbib.time;
requires org.xbib.net;
requires transitive org.reactivestreams;
requires org.reactivestreams;
requires java.logging;
}

View file

@ -1,5 +1,6 @@
package org.xbib.event.clock;
import org.xbib.event.bus.AsyncEventBus;
import org.xbib.event.bus.EventBus;
import org.xbib.settings.Settings;
import org.xbib.time.schedule.CronExpression;
@ -19,6 +20,10 @@ public class ClockEventManager implements Closeable {
private final CronSchedule<Integer> cronSchedule;
public ClockEventManager(Settings settings) {
this(settings, new AsyncEventBus(Executors.newSingleThreadExecutor()), ClockEventManager.class.getClassLoader());
}
public ClockEventManager(Settings settings,
EventBus eventBus,
ClassLoader classLoader) {

View file

@ -1,5 +1,6 @@
package org.xbib.event.timer;
import org.xbib.event.bus.AsyncEventBus;
import org.xbib.event.bus.EventBus;
import org.xbib.event.persistence.FilePersistenceStore;
import org.xbib.event.persistence.PersistenceStore;
@ -15,6 +16,7 @@ import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.concurrent.Executors;
import java.util.logging.Level;
import java.util.logging.Logger;
@ -24,6 +26,11 @@ public class TimerEventManager implements Closeable {
private final Map<String, TimerEventService> services;
public TimerEventManager(Settings settings) {
this(settings, new AsyncEventBus(Executors.newSingleThreadExecutor()),
TimerEventManager.class.getClassLoader(), ZoneId.systemDefault());
}
@SuppressWarnings("unchecked")
public TimerEventManager(Settings settings,
EventBus eventBus,