}
}
private static void updateUsingRollingRestart(CommandCenter center, Collection<String> serverIds, String centerAddress, String version, String appName) {
// get update configuration for updating application with id "lr-demo" to version "ver2"
ConfigurableUpdate update = center.update(appName, version);
// use rolling restart (needs at least 2 servers) with custom timeout
update
// use rolling restart instead of offline restart or hotpaching
.enableRolling()
// seconds - how long to wait for session drain (in production you would probably like to wait about 1h to allow existing users to continue using old version)
.withTimeout(30)
.on(serverIds); // update only given servers - null means all servers
// start update
log.info("Starting to update application '{}' with rolling restart to '{}' - " +
"this takes time proportinally to session drain timeout - to follow the progress, open browser at {}",
appName, version, centerAddress);
update.execute();
log.info("Servers are now updated");
}