Removed sleep.

Signed-off-by: Kai Zimmermann <kai.zimmermann@bosch-si.com>
This commit is contained in:
Kai Zimmermann
2016-03-01 17:12:59 +01:00
parent 07bf7e65bb
commit 031cca7c1c

View File

@@ -13,7 +13,6 @@ import java.util.Map;
import org.eclipse.hawkbit.dmf.amqp.api.EventTopic; import org.eclipse.hawkbit.dmf.amqp.api.EventTopic;
import org.eclipse.hawkbit.dmf.amqp.api.MessageHeaderKey; import org.eclipse.hawkbit.dmf.amqp.api.MessageHeaderKey;
import org.eclipse.hawkbit.dmf.amqp.api.MessageType; import org.eclipse.hawkbit.dmf.amqp.api.MessageType;
import org.eclipse.hawkbit.dmf.json.model.ActionStatus;
import org.eclipse.hawkbit.dmf.json.model.DownloadAndUpdateRequest; import org.eclipse.hawkbit.dmf.json.model.DownloadAndUpdateRequest;
import org.eclipse.hawkbit.simulator.AbstractSimulatedDevice; import org.eclipse.hawkbit.simulator.AbstractSimulatedDevice;
import org.eclipse.hawkbit.simulator.DeviceSimulatorUpdater; import org.eclipse.hawkbit.simulator.DeviceSimulatorUpdater;
@@ -139,26 +138,20 @@ public class SpReceiverService extends ReceiverService {
DownloadAndUpdateRequest.class); DownloadAndUpdateRequest.class);
final Long actionId = downloadAndUpdateRequest.getActionId(); final Long actionId = downloadAndUpdateRequest.getActionId();
try { deviceUpdater.startUpdate(tenant, thingId, actionId,
Thread.sleep(1_000); downloadAndUpdateRequest.getSoftwareModules().get(0).getModuleVersion(), new UpdaterCallback() {
} catch (final InterruptedException e) {
LOGGER.error("Sleep interrupted", e);
}
spSenderService.sendActionStatusMessage(tenant, ActionStatus.RUNNING,
"device Simulator retrieved update request. proceeding with simulation.", actionId);
deviceUpdater.startUpdate(tenant, thingId, actionId, downloadAndUpdateRequest.getSoftwareModules().get(0)
.getModuleVersion(), new UpdaterCallback() {
@Override @Override
public void updateFinished(final AbstractSimulatedDevice device, final Long actionId) { public void updateFinished(final AbstractSimulatedDevice device, final Long actionId) {
switch (device.getResponseStatus()) { switch (device.getResponseStatus()) {
case SUCCESSFUL: case SUCCESSFUL:
spSenderService.finishUpdateProcess(new SimulatedUpdate(device.getTenant(), device.getId(), spSenderService.finishUpdateProcess(
actionId), "Simulation complete!"); new SimulatedUpdate(device.getTenant(), device.getId(), actionId),
"Simulation complete!");
break; break;
case ERROR: case ERROR:
spSenderService.finishUpdateProcessWithError(new SimulatedUpdate(device.getTenant(), spSenderService.finishUpdateProcessWithError(
device.getId(), actionId), "Simulation complete with error!"); new SimulatedUpdate(device.getTenant(), device.getId(), actionId),
"Simulation complete with error!");
break; break;
default: default:
break; break;