@ Override public Map < K , ValueHolder < V > > bulkCompute ( final Set < ? extends K > keys , final Function < Iterable < ? extends Map . Entry < ? extends K , ? extends V > > , Iterable < ? extends Map . Entry < ? extends K , ? extends V > > > remappingFunction ) throws StoreAccessException { Map < K , ValueHolder < V > > valueHolderMap = new HashMap <> ( ) ; if ( remappingFunction instanceof Ehcache . PutAllFunction ) { Ehcache . PutAllFunction < K , V > putAllFunction = ( Ehcache . PutAllFunction < K , V > ) remappingFunction ; Map < K , V > entriesToRemap = putAllFunction . getEntriesToRemap ( ) ; for ( Map . Entry < K , V > entry : entriesToRemap . entrySet ( ) ) { PutStatus putStatus = silentPut ( entry . getKey ( ) , entry . getValue ( ) ) ; if ( putStatus == PutStatus . PUT ) { putAllFunction . getActualPutCount ( ) . incrementAndGet ( ) ; valueHolderMap . put ( entry . getKey ( ) , new ClusteredValueHolder <> ( entry . getValue ( ) ) ) ; } } } else if ( remappingFunction instanceof Ehcache . RemoveAllFunction ) { Ehcache . RemoveAllFunction < K , V > removeAllFunction = ( Ehcache . RemoveAllFunction < K , V > ) remappingFunction ; for ( K key : keys ) { boolean removed = silentRemove ( key ) ; if ( removed ) { removeAllFunction . getActualRemoveCount ( ) . incrementAndGet ( ) ; } } } else { throw new UnsupportedOperationException ( "This bulkCompute method is not yet capable of handling generic computation functions" ) ; } return valueHolderMap ; }
The assumption is that this method will be invoked only by cache . putAll and cache . removeAll methods .