From 94f4e920816059d99d43d908d49c642609034500 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Prante?= Date: Sun, 1 Oct 2023 16:02:42 +0200 Subject: [PATCH] add simple constructors --- src/main/java/module-info.java | 5 +++-- src/main/java/org/xbib/event/clock/ClockEventManager.java | 5 +++++ src/main/java/org/xbib/event/timer/TimerEventManager.java | 7 +++++++ 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/main/java/module-info.java b/src/main/java/module-info.java index 8d0c6a1..44e6665 100644 --- a/src/main/java/module-info.java +++ b/src/main/java/module-info.java @@ -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; } diff --git a/src/main/java/org/xbib/event/clock/ClockEventManager.java b/src/main/java/org/xbib/event/clock/ClockEventManager.java index 301ab5b..6a35539 100644 --- a/src/main/java/org/xbib/event/clock/ClockEventManager.java +++ b/src/main/java/org/xbib/event/clock/ClockEventManager.java @@ -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 cronSchedule; + public ClockEventManager(Settings settings) { + this(settings, new AsyncEventBus(Executors.newSingleThreadExecutor()), ClockEventManager.class.getClassLoader()); + } + public ClockEventManager(Settings settings, EventBus eventBus, ClassLoader classLoader) { diff --git a/src/main/java/org/xbib/event/timer/TimerEventManager.java b/src/main/java/org/xbib/event/timer/TimerEventManager.java index e0e6a1e..0deb0dc 100644 --- a/src/main/java/org/xbib/event/timer/TimerEventManager.java +++ b/src/main/java/org/xbib/event/timer/TimerEventManager.java @@ -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 services; + public TimerEventManager(Settings settings) { + this(settings, new AsyncEventBus(Executors.newSingleThreadExecutor()), + TimerEventManager.class.getClassLoader(), ZoneId.systemDefault()); + } + @SuppressWarnings("unchecked") public TimerEventManager(Settings settings, EventBus eventBus,