return;
}
logInfo("Downloading %s update (from v%s to v%s)...", updateType, installed, available);
DownloadHandle downloadHandle = updateHandler.getDownloadHandle(available, false /* fixPackage */);
Future<DownloadResult> future = downloadHandle.start(new DownloadProgressListener() {
@Override
public void progress(long bytesRead) {
logInfo("Download progress: %d bytes read...", bytesRead);
}
});
// Block until the download is complete...
DownloadResult result = future.get();
// Download is complete, ask the user once more if we're allowed to install the update...
if (m_agentUser.installAvailableUpdate(updateType, getAgentId(), installed, available)) {
logInfo("Installing %s update (from v%s to v%s)...", updateType, installed, available);
// We've confirmation that we can install this update...
updateHandler.install(result.getInputStream());
}
// Throw away downloaded packages...
downloadHandle.discard();
}
}
catch (Exception exception) {
logWarning("%s update failed with %s.", exception, updateType, exception.getMessage());
exception.printStackTrace(System.out);