public class SharedCachedRegionProvider<K extends IKey<K>> extends java.lang.Object implements IRegionProvider<K>
| Constructor and Description |
|---|
SharedCachedRegionProvider(IRegionProvider<K> sourceProvider)
Creates a RegionProvider using the given
regionFactory and maxCacheSize |
| Modifier and Type | Method and Description |
|---|---|
static void |
clearRegions() |
void |
close() |
void |
forAllRegions(CheckedBiConsumer<RegionKey,? super IRegion<K>,java.io.IOException> consumer)
Calls the given consumer for all existing region names.
|
void |
forExistingRegion(K key,
CheckedConsumer<? super IRegion<K>,java.io.IOException> cons)
Calls the given function with region at that location and returns value from that function..
|
void |
forRegion(K key,
CheckedConsumer<? super IRegion<K>,java.io.IOException> cons)
Calls the given consumer with region at that location.
|
<R> java.util.Optional<R> |
fromExistingRegion(K key,
CheckedFunction<? super IRegion<K>,R,java.io.IOException> func)
Calls the given consumer with region at that location.
|
<R> R |
fromRegion(K key,
CheckedFunction<? super IRegion<K>,R,java.io.IOException> func)
Calls the given function with region at that location and returns value from that function.
|
<R> java.util.Optional<R> |
fromRegion(K location,
CheckedFunction<? super IRegion<K>,R,java.io.IOException> func,
boolean canCreate) |
java.util.Optional<IRegion<K>> |
getExistingRegion(K key)
Gets an IRegion at a given region key, creates new one if it doesn't exist.
|
IRegion<K> |
getRegion(K key)
Gets an IRegion at a given region key, or create one if it does not exist.
|
public SharedCachedRegionProvider(IRegionProvider<K> sourceProvider)
regionFactory and maxCacheSizesourceProvider - provider used as source of regionspublic <R> java.util.Optional<R> fromExistingRegion(K key, CheckedFunction<? super IRegion<K>,R,java.io.IOException> func) throws java.io.IOException
IRegionProviderfromExistingRegion in interface IRegionProvider<K extends IKey<K>>key - The key for the IRegionregionKey if it existsjava.io.IOExceptionpublic <R> R fromRegion(K key, CheckedFunction<? super IRegion<K>,R,java.io.IOException> func) throws java.io.IOException
IRegionProviderfromRegion in interface IRegionProvider<K extends IKey<K>>key - The key for the IRegionjava.io.IOExceptionpublic void forRegion(K key, CheckedConsumer<? super IRegion<K>,java.io.IOException> cons) throws java.io.IOException
IRegionProviderforRegion in interface IRegionProvider<K extends IKey<K>>key - The key for the IRegioncons - Consumer that accepts the IRegionjava.io.IOExceptionpublic void forExistingRegion(K key, CheckedConsumer<? super IRegion<K>,java.io.IOException> cons) throws java.io.IOException
IRegionProviderforExistingRegion in interface IRegionProvider<K extends IKey<K>>key - The key for the IRegioncons - Accepts the given region, if it already existsjava.io.IOExceptionpublic IRegion<K> getRegion(K key) throws java.io.IOException
IRegionProvidergetRegion in interface IRegionProvider<K extends IKey<K>>key - The key for the IRegionregionKeyjava.io.IOExceptionpublic java.util.Optional<IRegion<K>> getExistingRegion(K key) throws java.io.IOException
IRegionProvidergetExistingRegion in interface IRegionProvider<K extends IKey<K>>key - The key for the IRegionregionKey if it existsjava.io.IOExceptionpublic void forAllRegions(CheckedBiConsumer<RegionKey,? super IRegion<K>,java.io.IOException> consumer) throws java.io.IOException
IRegionProviderforAllRegions in interface IRegionProvider<K extends IKey<K>>java.io.IOExceptionpublic void close()
throws java.io.IOException
close in interface java.io.Closeableclose in interface java.lang.AutoCloseablejava.io.IOExceptionpublic <R> java.util.Optional<R> fromRegion(K location, CheckedFunction<? super IRegion<K>,R,java.io.IOException> func, boolean canCreate) throws java.io.IOException
java.io.IOExceptionpublic static void clearRegions()
throws java.io.IOException
java.io.IOException