in aws-iot-device-sdk-java/src/main/java/com/amazonaws/services/iot/client/shadow/AbstractAwsIotDevice.java [219:248]
protected void startSync() {
// don't start the publish task if no properties are to be published
if (reportedProperties.isEmpty() || reportInterval <= 0) {
return;
}
syncTask = client.scheduleRoutineTask(new Runnable() {
@Override
public void run() {
if (!isCommandReady(Command.UPDATE)) {
LOGGER.fine("Device not ready for reporting");
return;
}
long reportVersion = localVersion.get();
if (enableVersioning && reportVersion < 0) {
// if versioning is enabled, synchronize the version first
LOGGER.fine("Starting version sync");
startVersionSync();
return;
}
String jsonState = onDeviceReport();
if (jsonState != null) {
LOGGER.fine("Sending device report");
sendDeviceReport(reportVersion, jsonState);
}
}
}, 0l, reportInterval);
}