aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/database
diff options
context:
space:
mode:
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);