public abstract class SimpleCacheResolver
extends java.lang.Object
SimpleCacheResolver
abstract class contains utility functions for resolving Apache Geode
GemFireCache
instances, such as a ClientCache
or a peer Cache
.Cache
,
CacheFactory
,
GemFireCache
,
RegionService
,
ClientCache
,
ClientCacheFactory
Constructor and Description |
---|
SimpleCacheResolver() |
Modifier and Type | Method and Description |
---|---|
static SimpleCacheResolver |
getInstance()
Lazily constructs and gets an instance to the
SimpleCacheResolver , as needed. |
<T extends org.apache.geode.cache.GemFireCache> |
require()
Requires an instance of either a
ClientCache or a peer Cache . |
<T extends org.apache.geode.cache.GemFireCache> |
resolve()
The resolution algorithm first tries to resolve an
Optional ClientCache instance
then a peer Cache instance if a ClientCache is not present. |
java.util.Optional<org.apache.geode.cache.client.ClientCache> |
resolveClientCache()
Attempts to resolve an
Optional ClientCache instance. |
java.util.Optional<org.apache.geode.cache.Cache> |
resolvePeerCache()
Attempts to resolve an
Optional Cache instance. |
public static SimpleCacheResolver getInstance()
SimpleCacheResolver
, as needed.SimpleCacheResolver
.newSimpleCacheResolver()
public <T extends org.apache.geode.cache.GemFireCache> java.util.Optional<T> resolve()
Optional
ClientCache
instance
then a peer Cache
instance if a ClientCache
is not present.
If neither a ClientCache
or peer Cache
is available, then Optional.empty()
is returned. No Exception
is thrown.T
- subclass
of GemFireCache
.ClientCache
or then a peer Cache
instance if present.ClientCache
,
Cache
,
Optional
,
resolveClientCache()
,
resolvePeerCache()
public java.util.Optional<org.apache.geode.cache.client.ClientCache> resolveClientCache()
Optional
ClientCache
instance.Optional
ClientCache
instance.CacheUtils.isClientCache(RegionService)
,
ClientCacheFactory.getAnyInstance()
,
ClientCache
,
Optional
public java.util.Optional<org.apache.geode.cache.Cache> resolvePeerCache()
Optional
Cache
instance.Optional
Cache
instance.CacheUtils.isPeerCache(RegionService)
,
CacheFactory.getAnyInstance()
,
Cache
,
Optional
public <T extends org.apache.geode.cache.GemFireCache> T require()
ClientCache
or a peer Cache
.T
- subclass
of GemFireCache
to resolve.ClientCache
or a peer Cache
.java.lang.IllegalStateException
- if a cache instance cannot be resolved.ClientCache
,
Cache
,
GemFireCache
,
resolve()