aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/database
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2022-06-07 07:07:25 -0700
committerAnton Tananaev <anton@traccar.org>2022-06-07 07:07:25 -0700
commit65f9e253171dc6805127e5279b97fad05f8c4b9f (patch)
treefc3968d7c5c5c07118d4e153ece5af31371e90a5 /src/main/java/org/traccar/database
parent8eecfdcf5c59f92158a6c339d1622e0e9d67968c (diff)
downloadtrackermap-server-65f9e253171dc6805127e5279b97fad05f8c4b9f.tar.gz
trackermap-server-65f9e253171dc6805127e5279b97fad05f8c4b9f.tar.bz2
trackermap-server-65f9e253171dc6805127e5279b97fad05f8c4b9f.zip
Remove async methods
Diffstat (limited to 'src/main/java/org/traccar/database')
-rw-r--r--src/main/java/org/traccar/database/CommandsManager.java2
-rw-r--r--src/main/java/org/traccar/database/NotificationManager.java13
2 files changed, 11 insertions, 4 deletions
diff --git a/src/main/java/org/traccar/database/CommandsManager.java b/src/main/java/org/traccar/database/CommandsManager.java
index d440755f7..8dd2ba8b7 100644
--- a/src/main/java/org/traccar/database/CommandsManager.java
+++ b/src/main/java/org/traccar/database/CommandsManager.java
@@ -79,7 +79,7 @@ public class CommandsManager {
BaseProtocol protocol = serverManager.getProtocol(position.getProtocol());
protocol.sendTextCommand(device.getPhone(), command);
} else if (command.getType().equals(Command.TYPE_CUSTOM)) {
- smsManager.sendMessageSync(device.getPhone(), command.getString(Command.KEY_DATA), true);
+ smsManager.sendMessage(device.getPhone(), command.getString(Command.KEY_DATA), true);
} else {
throw new RuntimeException("Command " + command.getType() + " is not supported");
}
diff --git a/src/main/java/org/traccar/database/NotificationManager.java b/src/main/java/org/traccar/database/NotificationManager.java
index f88b3b18c..2f912fff1 100644
--- a/src/main/java/org/traccar/database/NotificationManager.java
+++ b/src/main/java/org/traccar/database/NotificationManager.java
@@ -36,6 +36,7 @@ import org.traccar.model.Notification;
import org.traccar.model.Position;
import org.traccar.model.Typed;
import org.traccar.model.User;
+import org.traccar.notification.MessageException;
import org.traccar.storage.StorageException;
public class NotificationManager extends ExtendedObjectManager<Notification> {
@@ -108,9 +109,15 @@ public class NotificationManager extends ExtendedObjectManager<Notification> {
}
User user = Context.getUsersManager().getById(userId);
- for (String notificator : notificators) {
- Context.getNotificatorManager().getNotificator(notificator).sendAsync(user, event, position);
- }
+ new Thread(() -> {
+ for (String notificator : notificators) {
+ try {
+ Context.getNotificatorManager().getNotificator(notificator).send(user, event, position);
+ } catch (MessageException | InterruptedException exception) {
+ LOGGER.warn("Notification failed", exception);
+ }
+ }
+ }).start();
}
if (Context.getEventForwarder() != null) {
Context.getEventForwarder().forwardEvent(event, position, usersToForward);