Source:
<code>protected Map<KOut, VOut> executeHelper(String resultCache) throws NullPointerException, CacheException { ensureAccessPermissions(cache); if (mapper == null) throw new NullPointerException("A valid reference of Mapper is not set " + mapper); if (reducer == null) throw new NullPointerException("A valid reference of Reducer is not set " + reducer); Map<KOut,VOut> result = null; if(!isLocalOnly && distributeReducePhase()){ boolean useCompositeKeys = useIntermediateSharedCache(); try { executeTaskInit(getIntermediateCacheName()); } catch (Exception e){ throw new CacheException(e); } Set<KOut> allMapPhasesResponses = null; try { allMapPhasesResponses = executeMapPhase(useCompositeKeys); result = executeReducePhase(resultCache, allMapPhasesResponses, useCompositeKeys); } catch (Exception cause){ throw new CacheException(cause); } finally { EmbeddedCacheManager cm = cache.getCacheManager(); String intermediateCache = getIntermediateCacheName(); if (useIntermediatePerTaskCache()) { cm.removeCache(intermediateCache); } else { Cache<KOut, VOut> sharedTmpCache = cm.getCache(intermediateCache); if (sharedTmpCache != null && allMapPhasesResponses != null) { for (KOut k : allMapPhasesResponses) { <START> sharedTmpCache.remove(new IntermediateCompositeKey<KOut>(taskId.toString(), k)); <END> } } } } } else { try { if(resultCache == null || resultCache.isEmpty()){ result = new HashMap<KOut, VOut>(); executeMapPhaseWithLocalReduction(result); } else { EmbeddedCacheManager cm = cache.getCacheManager(); Cache<KOut, VOut> c = cm.getCache(resultCache); executeMapPhaseWithLocalReduction(c); } } catch (Exception cause){ throw new CacheException(cause); } } return result; }</code><technical_language>removeAsync? need wait reply right</technical_language>

Target:
protected Map<KOut, VOut> executeHelper(String resultCache) throws NullPointerException, CacheException { ensureAccessPermissions(cache); if (mapper == null) throw new NullPointerException("A valid reference of Mapper is not set " + mapper); if (reducer == null) throw new NullPointerException("A valid reference of Reducer is not set " + reducer); Map<KOut,VOut> result = null; if(!isLocalOnly && distributeReducePhase()){ boolean useCompositeKeys = useIntermediateSharedCache(); try { executeTaskInit(getIntermediateCacheName()); } catch (Exception e){ throw new CacheException(e); } Set<KOut> allMapPhasesResponses = null; try { allMapPhasesResponses = executeMapPhase(useCompositeKeys); result = executeReducePhase(resultCache, allMapPhasesResponses, useCompositeKeys); } catch (Exception cause){ throw new CacheException(cause); } finally { EmbeddedCacheManager cm = cache.getCacheManager(); String intermediateCache = getIntermediateCacheName(); if (useIntermediatePerTaskCache()) { cm.removeCache(intermediateCache); } else { Cache<KOut, VOut> sharedTmpCache = cm.getCache(intermediateCache); if (sharedTmpCache != null && allMapPhasesResponses != null) { for (KOut k : allMapPhasesResponses) { sharedTmpCache.removeAsync(new IntermediateCompositeKey<KOut>(taskId.toString(), k)); } } } } } else { try { if(resultCache == null || resultCache.isEmpty()){ result = new HashMap<KOut, VOut>(); executeMapPhaseWithLocalReduction(result); } else { EmbeddedCacheManager cm = cache.getCacheManager(); Cache<KOut, VOut> c = cm.getCache(resultCache); executeMapPhaseWithLocalReduction(c); } } catch (Exception cause){ throw new CacheException(cause); } } return result; }