Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
package org.infinispan.atomic.impl;
import java.util.AbstractMap;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CompletionException;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import org.infinispan.Cache;
import org.infinispan.atomic.FineGrainedAtomicMap;
import org.infinispan.commons.CacheException;
import org.infinispan.functional.FunctionalMap;
import org.infinispan.functional.Param;
import org.infinispan.container.EntryFactory;
import org.infinispan.container.entries.CacheEntry;
import org.infinispan.container.entries.ImmortalCacheEntry;
import org.infinispan.context.Flag;
import org.infinispan.context.InvocationContext;
import org.infinispan.context.InvocationContextFactory;
import org.infinispan.functional.impl.FunctionalMapImpl;
import org.infinispan.functional.impl.ReadOnlyMapImpl;
import org.infinispan.functional.impl.ReadWriteMapImpl;
import org.infinispan.util.ByteString;
import org.infinispan.util.logging.Log;
import org.infinispan.util.logging.LogFactory;
/**
* Implementation of {@link FineGrainedAtomicMap} that uses {@link org.infinispan.distribution.group Grouping API}
* to co-locate subkeys on the same node. Therefore the entries in this map are held as regular cache entries, but
* in order to prevent the need for iterating all data in the owning node we also keep a set of keys under the map's
* key.
*
* The implementation requires to be executed on a transactional cache with grouping API enabled. Neither null keys nor
* null values are supported.
*
* This cached set implemented by {@link AtomicKeySetImpl} is accessed using functional API and can be modified without
* acquiring its lock as long as we modify the same keys in that transaction.
*
* Once the map is created or fully read ({@link #size(), {@link #keySet()}, {@link #values()} or {@link #entrySet()}),
* the whole map (both keys and values) is loaded into context to guarantee repeatable reads semantics. {@link #clear()}
* removes only those keys that are known - if the map is read, and another transaction adds a key afterwards, such
* key may not be removed from the map.
*
* The map cannot be safely removed (using {@link org.infinispan.atomic.AtomicMapLookup#removeAtomicMap(Cache, Object)}
* concurrently to another modifications - such operation may result in leaked entries, map being cleared but not
* removed, failures during commit phase or other undefined behaviour.
*/
public class FineGrainedAtomicMapProxyImpl extends AbstractMap implements FineGrainedAtomicMap {
private static Log log = LogFactory.getLog(FineGrainedAtomicMap.class);
private final Cache