aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/database/CommandsManager.java
diff options
context:
space:
mode:
authorAbyss777 <abyss@fox5.ru>2018-04-28 16:14:24 +0500
committerAbyss777 <abyss@fox5.ru>2018-04-28 16:14:24 +0500
commit94f87ea207558f6b03eeaf49dd2527dcfe0472ba (patch)
tree7eb9734abf93f6e9b230bc39002bfa46bc38ac6e /src/org/traccar/database/CommandsManager.java
parentc763c6c688a2148e46c951c9fc33c09e640bcd9d (diff)
downloadtrackermap-server-94f87ea207558f6b03eeaf49dd2527dcfe0472ba.tar.gz
trackermap-server-94f87ea207558f6b03eeaf49dd2527dcfe0472ba.tar.bz2
trackermap-server-94f87ea207558f6b03eeaf49dd2527dcfe0472ba.zip
Make Commands queueing switchable
Diffstat (limited to 'src/org/traccar/database/CommandsManager.java')
-rw-r--r--src/org/traccar/database/CommandsManager.java7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/org/traccar/database/CommandsManager.java b/src/org/traccar/database/CommandsManager.java
index 9ceb995ef..e59762d10 100644
--- a/src/org/traccar/database/CommandsManager.java
+++ b/src/org/traccar/database/CommandsManager.java
@@ -37,8 +37,11 @@ public class CommandsManager extends ExtendedObjectManager<Command> {
private final Map<Long, Queue<Command>> deviceQueues = new ConcurrentHashMap<>();
- public CommandsManager(DataManager dataManager) {
+ private boolean queueing;
+
+ public CommandsManager(DataManager dataManager, boolean queueing) {
super(dataManager, Command.class);
+ this.queueing = queueing;
}
public boolean checkDeviceCommand(long deviceId, long commandId) {
@@ -70,6 +73,8 @@ public class CommandsManager extends ExtendedObjectManager<Command> {
ActiveDevice activeDevice = Context.getConnectionManager().getActiveDevice(deviceId);
if (activeDevice != null) {
activeDevice.sendCommand(command);
+ } else if (!queueing) {
+ throw new RuntimeException("Commands queueing is not enabled");
} else {
getDeviceQueue(deviceId).add(command);
return false;