aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/database/NotificationManager.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2022-06-09 18:03:52 -0700
committerAnton Tananaev <anton@traccar.org>2022-06-09 18:03:52 -0700
commit336d6c4353fd77ad268aaf5cfe9c0296edfb0201 (patch)
tree1c89b1a3de09c051e305386cf3ba8dbef458cb5a /src/main/java/org/traccar/database/NotificationManager.java
parentadafc5f6130854dd88c191dd04489073419ee41d (diff)
downloadtrackermap-server-336d6c4353fd77ad268aaf5cfe9c0296edfb0201.tar.gz
trackermap-server-336d6c4353fd77ad268aaf5cfe9c0296edfb0201.tar.bz2
trackermap-server-336d6c4353fd77ad268aaf5cfe9c0296edfb0201.zip
Remove more from context
Diffstat (limited to 'src/main/java/org/traccar/database/NotificationManager.java')
-rw-r--r--src/main/java/org/traccar/database/NotificationManager.java8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/main/java/org/traccar/database/NotificationManager.java b/src/main/java/org/traccar/database/NotificationManager.java
index fcefb54f0..eddd7e2b4 100644
--- a/src/main/java/org/traccar/database/NotificationManager.java
+++ b/src/main/java/org/traccar/database/NotificationManager.java
@@ -37,6 +37,7 @@ import org.traccar.model.Position;
import org.traccar.model.Typed;
import org.traccar.model.User;
import org.traccar.notification.MessageException;
+import org.traccar.notification.NotificatorManager;
import org.traccar.session.cache.CacheManager;
import org.traccar.storage.StorageException;
@@ -45,12 +46,15 @@ public class NotificationManager extends ExtendedObjectManager<Notification> {
private static final Logger LOGGER = LoggerFactory.getLogger(NotificationManager.class);
private final CacheManager cacheManager;
+ private final NotificatorManager notificatorManager;
private final boolean geocodeOnRequest;
- public NotificationManager(DataManager dataManager, CacheManager cacheManager) {
+ public NotificationManager(
+ DataManager dataManager, CacheManager cacheManager, NotificatorManager notificatorManager) {
super(dataManager, Notification.class);
this.cacheManager = cacheManager;
+ this.notificatorManager = notificatorManager;
geocodeOnRequest = Context.getConfig().getBoolean(Keys.GEOCODER_ON_REQUEST);
}
@@ -116,7 +120,7 @@ public class NotificationManager extends ExtendedObjectManager<Notification> {
new Thread(() -> {
for (String notificator : notificators) {
try {
- Context.getNotificatorManager().getNotificator(notificator).send(user, event, position);
+ notificatorManager.getNotificator(notificator).send(user, event, position);
} catch (MessageException | InterruptedException exception) {
LOGGER.warn("Notification failed", exception);
}