Commit ed1d63e3 by pye52

所有设备指令执行流程修改,保证指令在执行过程中各缓存不会被更改

parent 29fde031
...@@ -51,17 +51,13 @@ public class LogCommandHandler extends CommandHandler { ...@@ -51,17 +51,13 @@ public class LogCommandHandler extends CommandHandler {
private static LogCommandHandler instance; private static LogCommandHandler instance;
public static LogCommandHandler getInstance(Command command, Gson gson, String deviceSN, CommandProgressCallback callback) { public static synchronized LogCommandHandler getInstance(Command command, Gson gson, String deviceSN, CommandProgressCallback callback) {
if (instance == null) { if (instance == null) {
synchronized (LogCommandHandler.class) { instance = new LogCommandHandler(command, gson, deviceSN, callback);
if (instance == null) {
instance = new LogCommandHandler(command, gson, deviceSN, callback);
} else {
instance.init(command, gson, deviceSN, callback);
}
}
} else { } else {
instance.init(command, gson, deviceSN, callback); if (!instance.start) {
instance.init(command, gson, deviceSN, callback);
}
} }
return instance; return instance;
} }
......
...@@ -53,17 +53,13 @@ public class UpdateCommandHandler extends CommandHandler { ...@@ -53,17 +53,13 @@ public class UpdateCommandHandler extends CommandHandler {
private static UpdateCommandHandler instance; private static UpdateCommandHandler instance;
public static UpdateCommandHandler getInstance(Command command, Gson gson, CommandProgressCallback callback) { public static synchronized UpdateCommandHandler getInstance(Command command, Gson gson, CommandProgressCallback callback) {
if (instance == null) { if (instance == null) {
synchronized (UpdateCommandHandler.class) { instance = new UpdateCommandHandler(command, gson, callback);
if (instance == null) {
instance = new UpdateCommandHandler(command, gson, callback);
} else {
instance.init(command, gson, callback);
}
}
} else { } else {
instance.init(command, gson, callback); if (!instance.start) {
instance.init(command, gson, callback);
}
} }
return instance; return instance;
} }
......
...@@ -19,17 +19,13 @@ public class WifiConfigCommandHandler extends CommandHandler { ...@@ -19,17 +19,13 @@ public class WifiConfigCommandHandler extends CommandHandler {
private volatile boolean start = false; private volatile boolean start = false;
private static WifiConfigCommandHandler instance; private static WifiConfigCommandHandler instance;
public static WifiConfigCommandHandler getInstance(Command command, Gson gson, CommandProgressCallback callback) { public static synchronized WifiConfigCommandHandler getInstance(Command command, Gson gson, CommandProgressCallback callback) {
if (instance == null) { if (instance == null) {
synchronized (WifiConfigCommandHandler.class) { instance = new WifiConfigCommandHandler(command, gson, callback);
if (instance == null) {
instance = new WifiConfigCommandHandler(command, gson, callback);
} else {
instance.init(command, gson, callback);
}
}
} else { } else {
instance.init(command, gson, callback); if (!instance.start) {
instance.init(command, gson, callback);
}
} }
return instance; return instance;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment