Class PartitionAwareClusterPublisherManager<K,V>
- java.lang.Object
-
- org.infinispan.reactive.publisher.impl.ClusterPublisherManagerImpl<K,V>
-
- org.infinispan.reactive.publisher.impl.PartitionAwareClusterPublisherManager<K,V>
-
- All Implemented Interfaces:
ClusterPublisherManager<K,V>
public class PartitionAwareClusterPublisherManager<K,V> extends ClusterPublisherManagerImpl<K,V>
Cluster stream manager that also pays attention to partition status and properly closes iterators and throws exceptions when the availability mode changes.
-
-
Field Summary
Fields Modifier and Type Field Description protected ComponentRef<Cache<?,?>>cacheprotected org.infinispan.reactive.publisher.impl.PartitionAwareClusterPublisherManager.PartitionListenerlistener-
Fields inherited from class org.infinispan.reactive.publisher.impl.ClusterPublisherManagerImpl
log, rpcOptions, trace
-
-
Constructor Summary
Constructors Constructor Description PartitionAwareClusterPublisherManager()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <R> SegmentCompletionPublisher<R>entryPublisher(org.infinispan.commons.util.IntSet segments, Set<K> keysToInclude, InvocationContext invocationContext, boolean includeLoader, DeliveryGuarantee deliveryGuarantee, int batchSize, Function<? super org.reactivestreams.Publisher<CacheEntry<K,V>>,? extends org.reactivestreams.Publisher<R>> transformer)Performs the given transformer on data in the cache, resulting in multiple values.<R> CompletionStage<R>entryReduction(boolean parallelPublisher, org.infinispan.commons.util.IntSet segments, Set<K> keysToInclude, InvocationContext ctx, boolean includeLoader, DeliveryGuarantee deliveryGuarantee, Function<? super org.reactivestreams.Publisher<CacheEntry<K,V>>,? extends CompletionStage<R>> transformer, Function<? super org.reactivestreams.Publisher<R>,? extends CompletionStage<R>> finalizer)Performs the given transformer and finalizer on data in the cache, resulting in a single value.<R> SegmentCompletionPublisher<R>keyPublisher(org.infinispan.commons.util.IntSet segments, Set<K> keysToInclude, InvocationContext invocationContext, boolean includeLoader, DeliveryGuarantee deliveryGuarantee, int batchSize, Function<? super org.reactivestreams.Publisher<K>,? extends org.reactivestreams.Publisher<R>> transformer)Same asClusterPublisherManager.entryPublisher(IntSet, Set, InvocationContext, boolean, DeliveryGuarantee, int, Function)except that the source publisher provided to the transformer is made up of keys only.<R> CompletionStage<R>keyReduction(boolean parallelPublisher, org.infinispan.commons.util.IntSet segments, Set<K> keysToInclude, InvocationContext ctx, boolean includeLoader, DeliveryGuarantee deliveryGuarantee, Function<? super org.reactivestreams.Publisher<K>,? extends CompletionStage<R>> transformer, Function<? super org.reactivestreams.Publisher<R>,? extends CompletionStage<R>> finalizer)Same asClusterPublisherManager.entryReduction(boolean, IntSet, Set, InvocationContext, boolean, DeliveryGuarantee, Function, Function)except that the source publisher provided to the transformer is made up of keys only.voidstart()
-
-
-
Field Detail
-
listener
protected final org.infinispan.reactive.publisher.impl.PartitionAwareClusterPublisherManager.PartitionListener listener
-
cache
protected ComponentRef<Cache<?,?>> cache
-
-
Method Detail
-
start
public void start()
- Overrides:
startin classClusterPublisherManagerImpl<K,V>
-
keyReduction
public <R> CompletionStage<R> keyReduction(boolean parallelPublisher, org.infinispan.commons.util.IntSet segments, Set<K> keysToInclude, InvocationContext ctx, boolean includeLoader, DeliveryGuarantee deliveryGuarantee, Function<? super org.reactivestreams.Publisher<K>,? extends CompletionStage<R>> transformer, Function<? super org.reactivestreams.Publisher<R>,? extends CompletionStage<R>> finalizer)
Description copied from interface:ClusterPublisherManagerSame asClusterPublisherManager.entryReduction(boolean, IntSet, Set, InvocationContext, boolean, DeliveryGuarantee, Function, Function)except that the source publisher provided to the transformer is made up of keys only.- Specified by:
keyReductionin interfaceClusterPublisherManager<K,V>- Overrides:
keyReductionin classClusterPublisherManagerImpl<K,V>- Type Parameters:
R- return value type- Returns:
- CompletionStage that contains the resulting value when complete
-
entryReduction
public <R> CompletionStage<R> entryReduction(boolean parallelPublisher, org.infinispan.commons.util.IntSet segments, Set<K> keysToInclude, InvocationContext ctx, boolean includeLoader, DeliveryGuarantee deliveryGuarantee, Function<? super org.reactivestreams.Publisher<CacheEntry<K,V>>,? extends CompletionStage<R>> transformer, Function<? super org.reactivestreams.Publisher<R>,? extends CompletionStage<R>> finalizer)
Description copied from interface:ClusterPublisherManagerPerforms the given transformer and finalizer on data in the cache, resulting in a single value. Depending on the deliveryGuarantee the transformer may be invoked 1..numSegments times. It could be that the transformer is invoked for every segment and produces a result. All of these results are then fed into the finalizer to produce a final result. If publisher is parallel the finalizer will be invoked on each node to ensure there is only a single result per node.- Specified by:
entryReductionin interfaceClusterPublisherManager<K,V>- Overrides:
entryReductionin classClusterPublisherManagerImpl<K,V>- Type Parameters:
R- return value type- Parameters:
parallelPublisher- Whether on each node the publisher should be parallelized remotely and locallysegments- determines what entries should be evaluated by only using ones that map to the given segments (if null assumes all segments)keysToInclude- set of keys that should only be used (if null all entries for the given segments will be evaluated)ctx- context of the invoking operation, context entries override the values in the cache (may be null)includeLoader- whether to include entries from the underlying cache loader if anydeliveryGuarantee- delivery guarantee for given entriestransformer- reduces the given publisher of data eventually into a single value. Must not be null.finalizer- reduces all of the single values produced by the transformer or this finalizer into one final value. Must not be null.- Returns:
- CompletionStage that contains the resulting value when complete
-
keyPublisher
public <R> SegmentCompletionPublisher<R> keyPublisher(org.infinispan.commons.util.IntSet segments, Set<K> keysToInclude, InvocationContext invocationContext, boolean includeLoader, DeliveryGuarantee deliveryGuarantee, int batchSize, Function<? super org.reactivestreams.Publisher<K>,? extends org.reactivestreams.Publisher<R>> transformer)
Description copied from interface:ClusterPublisherManagerSame asClusterPublisherManager.entryPublisher(IntSet, Set, InvocationContext, boolean, DeliveryGuarantee, int, Function)except that the source publisher provided to the transformer is made up of keys only.- Specified by:
keyPublisherin interfaceClusterPublisherManager<K,V>- Overrides:
keyPublisherin classClusterPublisherManagerImpl<K,V>- Type Parameters:
R- return value type- Returns:
- Publisher that when subscribed to will return the results and notify of segment completion if necessary
-
entryPublisher
public <R> SegmentCompletionPublisher<R> entryPublisher(org.infinispan.commons.util.IntSet segments, Set<K> keysToInclude, InvocationContext invocationContext, boolean includeLoader, DeliveryGuarantee deliveryGuarantee, int batchSize, Function<? super org.reactivestreams.Publisher<CacheEntry<K,V>>,? extends org.reactivestreams.Publisher<R>> transformer)
Description copied from interface:ClusterPublisherManagerPerforms the given transformer on data in the cache, resulting in multiple values. If a single value is desired, the user should useClusterPublisherManager.entryReduction(boolean, IntSet, Set, InvocationContext, boolean, DeliveryGuarantee, Function, Function)instead as it can optimize some things. Depending on the deliveryGuarantee the transformer may be invoked 1..numSegments times per node. Results from a given node will retrieve values up tobatchSizevalues until some are consumed.- Specified by:
entryPublisherin interfaceClusterPublisherManager<K,V>- Overrides:
entryPublisherin classClusterPublisherManagerImpl<K,V>- Type Parameters:
R- return value type- Parameters:
segments- determines what entries should be evaluated by only using ones that map to the given segments (if null assumes all segments)keysToInclude- set of keys that should only be used (if null all entries for the given segments will be evaluated)invocationContext- context of the invoking operation, context entries override the values in the cache (may be null)includeLoader- whether to include entries from the underlying cache loader if anydeliveryGuarantee- delivery guarantee for given entriesbatchSize- how many entries to be returned at a given timetransformer- transform the given stream of data into something else (requires non null)- Returns:
- Publisher that when subscribed to will return the results and notify of segment completion if necessary
-
-