Package org.springframework.geode.util
Class CacheUtils
java.lang.Object
org.springframework.geode.util.CacheUtils
Abstract utility class for working with Apache Geode cache instances, such as
ClientCache
and peer Cache
instances.- Since:
- 1.3.0
- See Also:
-
Cache
DataPolicy
Region
RegionAttributes
RegionService
ClientCache
Pool
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> Collection<T>
collectValues
(org.apache.geode.cache.Region<?, T> region) Collects allvalues
from the givenRegion
.static boolean
isClientCache
(org.apache.geode.cache.RegionService regionService) Null-safe method to determine whether the givenRegionService
is an instance ofClientCache
.static boolean
isClientRegion
(org.apache.geode.cache.Region<?, ?> region) Null-safe method to determine whether the givenRegion
is a clientRegion
in aClientCache
.static boolean
isPeerCache
(org.apache.geode.cache.RegionService regionService) Null-safe method to determine whether the givenRegionService
is an instance of a peerCache
.static boolean
isPeerRegion
(org.apache.geode.cache.Region<?, ?> region) Null-safe method to determine whether the givenRegion
is a peerRegion
in a peerCache
.static boolean
isProxyRegion
(org.apache.geode.cache.Region<?, ?> region) Null-safe method to determine whether the givenRegion
is a [client] PROXYRegion
.static boolean
isRegionWithPool
(org.apache.geode.cache.Region<?, ?> region) Null-safe method to determine whether the givenRegion
was configured with aPool
.
-
Constructor Details
-
CacheUtils
public CacheUtils()
-
-
Method Details
-
collectValues
Collects allvalues
from the givenRegion
. This method is capable of pullingvalues
from either client or peerRegions
.- Type Parameters:
T
-type
of theRegion
values
.- Parameters:
region
-Region
from which to collect thevalues
.- Returns:
- a
Collection
of allvalues
from the givenRegion
. - Throws:
IllegalArgumentException
- ifRegion
is null.- See Also:
-
Region
Collection
-
isClientCache
public static boolean isClientCache(org.apache.geode.cache.RegionService regionService) Null-safe method to determine whether the givenRegionService
is an instance ofClientCache
. The problem is,GemFireCacheImpl
implements both the (peer)Cache
andClientCache
interfaces. #sigh- Parameters:
regionService
-RegionService
to evaluate.- Returns:
- a boolean value indicating whether the
RegionService
an instance ofClientCache
. - See Also:
-
ClientCache
RegionService
-
isClientRegion
public static boolean isClientRegion(org.apache.geode.cache.Region<?, ?> region) Null-safe method to determine whether the givenRegion
is a clientRegion
in aClientCache
.- Parameters:
region
-Region
to evaluate.- Returns:
- a boolean value indicating whether the given
Region
is a clientRegion
. - See Also:
-
Region
isClientCache(RegionService)
-
isPeerCache
public static boolean isPeerCache(org.apache.geode.cache.RegionService regionService) Null-safe method to determine whether the givenRegionService
is an instance of a peerCache
. The problem is,GemFireCacheImpl
implements both the (peer)Cache
andClientCache
interfaces. #sigh- Parameters:
regionService
-RegionService
to evaluate.- Returns:
- a boolean value indicating whether the
RegionService
is an instance of a peerCache
. - See Also:
-
RegionService
Cache
-
isPeerRegion
public static boolean isPeerRegion(org.apache.geode.cache.Region<?, ?> region) Null-safe method to determine whether the givenRegion
is a peerRegion
in a peerCache
.- Parameters:
region
-Region
to evaluate.- Returns:
- a boolean value indicating whether the given
Region
is a peerRegion
. - See Also:
-
Region
isPeerCache(RegionService)
-
isProxyRegion
public static boolean isProxyRegion(org.apache.geode.cache.Region<?, ?> region) Null-safe method to determine whether the givenRegion
is a [client] PROXYRegion
. TheRegion
is a PROXY if theDataPolicy
isDataPolicy.EMPTY
or theRegion
has a configuredPool
.- Parameters:
region
-Region
to evaluate.- Returns:
- a boolean value to determine whether the
Region
is a [client] PROXYRegion
. - See Also:
-
Region
isRegionWithPool(Region)
-
isRegionWithPool
public static boolean isRegionWithPool(org.apache.geode.cache.Region<?, ?> region) Null-safe method to determine whether the givenRegion
was configured with aPool
. ARegion
configured with aPool
(byname
specified in theRegionAttributes
) is a strong indicator that theRegion
is a clientRegion
.- Parameters:
region
-Region
to evaluate.- Returns:
- a boolean to determine whether the given
Region
was configured with aPool
. - See Also:
-
Pool
Region
-