}
StringBuilder sb = new StringBuilder();
switch (mode) {
case DUMPKEYS: {
for (Cache<?, ?> cache : all ? getAllCaches(session) : Collections.singletonList(session.getCache(cacheName))) {
RollingUpgradeManager upgradeManager = cache.getAdvancedCache().getComponentRegistry().getComponent(RollingUpgradeManager.class);
upgradeManager.recordKnownGlobalKeyset();
sb.append(MSG.dumpedKeys(cache.getName()));
sb.append("\n");
}
break;
}
case SYNCHRONIZE: {
for (Cache<?, ?> cache : all ? getAllCaches(session) : Collections.singletonList(session.getCache(cacheName))) {
RollingUpgradeManager upgradeManager = cache.getAdvancedCache().getComponentRegistry().getComponent(RollingUpgradeManager.class);
try {
long count = upgradeManager.synchronizeData(migratorName);
sb.append(MSG.synchronizedEntries(count, migratorName, cache.getName()));
sb.append("\n");
} catch (Exception e) {
throw log.dataSynchronizationError(e, migratorName, cache.getName());
}
}
break;
}
case DISCONNECTSOURCE: {
for (Cache<?, ?> cache : all ? getAllCaches(session) : Collections.singletonList(session.getCache(cacheName))) {
RollingUpgradeManager upgradeManager = cache.getAdvancedCache().getComponentRegistry().getComponent(RollingUpgradeManager.class);
try {
upgradeManager.disconnectSource(migratorName);
sb.append(MSG.disonnectedSource(migratorName, cache.getName()));
sb.append("\n");
} catch (Exception e) {
throw log.sourceDisconnectionError(e, migratorName, cache.getName());
}