Source:
private void updateConfig() { int n = 0; ArrayList<VdcActionType> actionTypes = new ArrayList<VdcActionType>(); ArrayList<VdcActionParametersBase> parameters = new ArrayList<VdcActionParametersBase>(); IFrontendActionAsyncCallback[] callbacks; final GlusterVolumeGeoReplicationSessionConfigModel geoRepConfigModel = (GlusterVolumeGeoReplicationSessionConfigModel) getWindow(); LinkedHashMap<String, String> oldConfigs = geoRepConfigModel.getConfigs(); geoRepConfigModel.startProgress(null); for (EntityModel<Pair<Boolean, GlusterGeoRepSessionConfiguration>> newConfigEntity : geoRepConfigModel.getConfigsModel() .getItems()) { Pair<Boolean, GlusterGeoRepSessionConfiguration> newConfigPair = newConfigEntity.getEntity(); GlusterGeoRepSessionConfiguration newConfig = newConfigPair.getSecond(); if (newConfigPair.getFirst()) { actionTypes.add(VdcActionType.ResetDefaultGeoRepConfig); parameters.add(geoRepConfigModel.formGeoRepConfigParameters(newConfig)); } else if (!newConfig.getValue().equals(oldConfigs.get(newConfig.getKey()))) { actionTypes.add(VdcActionType.SetGeoRepConfig); parameters.add(geoRepConfigModel.formGeoRepConfigParameters(newConfig)); } } n = parameters.size(); callbacks = new IFrontendActionAsyncCallback[n]; callbacks[n - 1] = new IFrontendActionAsyncCallback() { @Override public void executed(FrontendActionAsyncResult result) { geoRepConfigModel.stopProgress(); closeWindow(); } }; Frontend.getInstance().runMultipleActions(actionTypes, parameters, Arrays.asList(callbacks), new IFrontendActionAsyncCallback() { @Override public void executed(FrontendActionAsyncResult result) { fetchConfigForSession(geoRepConfigModel.getGeoRepSession()); } }, this); }

Target:
private void updateConfig() { ArrayList<VdcActionType> actionTypes = new ArrayList<VdcActionType>(); ArrayList<VdcActionParametersBase> parameters = new ArrayList<VdcActionParametersBase>(); IFrontendActionAsyncCallback[] callbacks; final GlusterVolumeGeoReplicationSessionConfigModel geoRepConfigModel = (GlusterVolumeGeoReplicationSessionConfigModel) getWindow(); LinkedHashMap<String, String> oldConfigs = geoRepConfigModel.getConfigs(); geoRepConfigModel.startProgress(null); for (EntityModel<Pair<Boolean, GlusterGeoRepSessionConfiguration>> newConfigEntity : geoRepConfigModel.getConfigsModel() .getItems()) { Pair<Boolean, GlusterGeoRepSessionConfiguration> newConfigPair = newConfigEntity.getEntity(); GlusterGeoRepSessionConfiguration newConfig = newConfigPair.getSecond(); if (newConfigPair.getFirst()) { actionTypes.add(VdcActionType.ResetDefaultGeoRepConfig); parameters.add(geoRepConfigModel.formGeoRepConfigParameters(newConfig)); } else if (!newConfig.getValue().equals(oldConfigs.get(newConfig.getKey()))) { actionTypes.add(VdcActionType.SetGeoRepConfig); parameters.add(geoRepConfigModel.formGeoRepConfigParameters(newConfig)); } } int numberOfConfigUpdates = parameters.size(); callbacks = new IFrontendActionAsyncCallback[numberOfConfigUpdates]; callbacks[numberOfConfigUpdates - 1] = new IFrontendActionAsyncCallback() { @Override public void executed(FrontendActionAsyncResult result) { geoRepConfigModel.stopProgress(); closeWindow(); } }; Frontend.getInstance().runMultipleActions(actionTypes, parameters, Arrays.asList(callbacks), new IFrontendActionAsyncCallback() { @Override public void executed(FrontendActionAsyncResult result) { fetchConfigForSession(geoRepConfigModel.getGeoRepSession()); } }, this); }