ModeShape Distribution 3.5.0.Final

org.modeshape.jcr
Class InfinispanUtil

java.lang.Object
  extended by org.modeshape.jcr.InfinispanUtil

public class InfinispanUtil
extends Object

A set of utility methods for Infinispan caches.


Nested Class Summary
static interface InfinispanUtil.Combiner<T>
          The interface that defines how the results should be merged
protected static class InfinispanUtil.GetAllKeys<K,V>
          A DistributedCallable implementation that returns the set of keys in an Infinispan cache which are stored in memory.
protected static class InfinispanUtil.GetAllMemoryKeys<K,V>
          A DistributedCallable implementation that returns the set of keys in an Infinispan cache.
protected static class InfinispanUtil.KeyMerger<K>
          Since keys can appear more than one time e.g. multiple owners in a distributed cache, they all must be merged into a Set.
static class InfinispanUtil.Location
           
static interface InfinispanUtil.Sequence<T>
          A sequence of values.
 
Field Summary
protected static Logger LOGGER
           
 
Method Summary
static
<K,V,T> T
execute(org.infinispan.Cache<K,V> cache, InfinispanUtil.Location location, org.infinispan.distexec.DistributedCallable<K,V,T> callable, InfinispanUtil.Combiner<T> combiner)
          Utility to run the supplied callable in all the processes where the cache is being run.
static
<K,V> InfinispanUtil.Sequence<K>
getAllKeys(org.infinispan.Cache<K,V> cache)
          Get all of the keys in the cache.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOGGER

protected static final Logger LOGGER
Method Detail

execute

public static <K,V,T> T execute(org.infinispan.Cache<K,V> cache,
                                InfinispanUtil.Location location,
                                org.infinispan.distexec.DistributedCallable<K,V,T> callable,
                                InfinispanUtil.Combiner<T> combiner)
                 throws InterruptedException,
                        ExecutionException
Utility to run the supplied callable in all the processes where the cache is being run.

Type Parameters:
K - the type of key used in the cache
V - the type of value used in the cache
T - the type of result
Parameters:
cache - the cache
location - the location where the callable should be run; if null, InfinispanUtil.Location.LOCALLY is used
callable - the callable
combiner - the component that can combine multiple results of type T into a single result
Returns:
the result of the operation
Throws:
InterruptedException - if the process is interrupted
ExecutionException - if there is an error while getting executing the operation

getAllKeys

public static <K,V> InfinispanUtil.Sequence<K> getAllKeys(org.infinispan.Cache<K,V> cache)
                                             throws org.infinispan.loaders.CacheLoaderException,
                                                    InterruptedException,
                                                    ExecutionException
Get all of the keys in the cache.

Type Parameters:
K - the type of key
V - the type of value
Parameters:
cache - the cache
Returns:
the sequence that can be used to obtain the keys; never null
Throws:
org.infinispan.loaders.CacheLoaderException - if there is an error within the cache loader
InterruptedException - if the process is interrupted
ExecutionException - if there is an error while getting all keys

ModeShape Distribution 3.5.0.Final

Copyright © 2008-2013 JBoss, a division of Red Hat. All Rights Reserved.