Set proper random generation.
Signed-off-by: Kai Zimmermann <kai.zimmermann@bosch-si.com>
This commit is contained in:
@@ -62,8 +62,9 @@ public class DeviceSimulatorUpdater {
|
|||||||
device.setProgress(0.0);
|
device.setProgress(0.0);
|
||||||
device.setSwversion(swVersion);
|
device.setSwversion(swVersion);
|
||||||
eventbus.post(new InitUpdate(device));
|
eventbus.post(new InitUpdate(device));
|
||||||
|
|
||||||
threadPool.schedule(new DeviceSimulatorUpdateThread(device, spSenderService, actionId, eventbus, callback),
|
threadPool.schedule(new DeviceSimulatorUpdateThread(device, spSenderService, actionId, eventbus, callback),
|
||||||
(new Random().nextInt(10_000) + 2000), TimeUnit.MILLISECONDS);
|
2_000, TimeUnit.MILLISECONDS);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final class DeviceSimulatorUpdateThread implements Runnable {
|
private static final class DeviceSimulatorUpdateThread implements Runnable {
|
||||||
@@ -91,7 +92,7 @@ public class DeviceSimulatorUpdater {
|
|||||||
if (newProgress < 1.0) {
|
if (newProgress < 1.0) {
|
||||||
threadPool.schedule(
|
threadPool.schedule(
|
||||||
new DeviceSimulatorUpdateThread(device, spSenderService, actionId, eventbus, callback),
|
new DeviceSimulatorUpdateThread(device, spSenderService, actionId, eventbus, callback),
|
||||||
rndSleep.nextInt(3000), TimeUnit.MILLISECONDS);
|
rndSleep.nextInt(5_000), TimeUnit.MILLISECONDS);
|
||||||
} else {
|
} else {
|
||||||
callback.updateFinished(device, actionId);
|
callback.updateFinished(device, actionId);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user