Source:
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(); if (numberOfConfigUpdates == 0) { geoRepConfigModel.stopProgress(); closeWindow(); return; } callbacks = new IFrontendActionAsyncCallback[numberOfConfigUpdates]; callbacks[numberOfConfigUpdates - 1] = new IFrontendActionAsyncCallback() { @Override public void executed(FrontendActionAsyncResult result) { geoRepConfigModel.stopProgress(); closeWindow(); } }; Frontend.getInstance().runMultipleActions(actionTypes, parameters, new ArrayList<>(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>(); List<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(); if (numberOfConfigUpdates == 0) { geoRepConfigModel.stopProgress(); closeWindow(); return; } callbacks = new ArrayList<>(numberOfConfigUpdates); callbacks.set(numberOfConfigUpdates - 1, new IFrontendActionAsyncCallback() { @Override public void executed(FrontendActionAsyncResult result) { geoRepConfigModel.stopProgress(); closeWindow(); } }); Frontend.getInstance().runMultipleActions(actionTypes, parameters, callbacks, new IFrontendActionAsyncCallback() { @Override public void executed(FrontendActionAsyncResult result) { fetchConfigForSession(geoRepConfigModel.getGeoRepSession()); } }, this); }