Class NamedCacheServiceImpl
- java.lang.Object
-
- com.oracle.coherence.grpc.proxy.BaseGrpcServiceImpl
-
- com.oracle.coherence.grpc.proxy.NamedCacheServiceImpl
-
- All Implemented Interfaces:
GrpcProxyService
,NamedCacheService
public class NamedCacheServiceImpl extends BaseGrpcServiceImpl implements NamedCacheService
A gRPC NamedCache service.This class uses
AsyncNamedCache
and asynchronousCompletionStage
wherever possible. This makes the code more complex but the advantages of not blocking the gRPC request thread or the Coherence service thread will outweigh the downside of complexity.The asynchronous processing of
CompletionStage
s is done using anDaemonPoolExecutor
so as not to consume or block threads in the Fork Join Pool. TheDaemonPoolExecutor
is configurable so that its thread counts can be controlled.- Since:
- 20.06
- Author:
- Jonathan Knight 2020.09.22
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.oracle.coherence.grpc.proxy.BaseGrpcServiceImpl
BaseGrpcServiceImpl.DefaultDependencies, BaseGrpcServiceImpl.Dependencies
-
Nested classes/interfaces inherited from interface com.oracle.coherence.grpc.proxy.NamedCacheService
NamedCacheService.DefaultDependencies, NamedCacheService.Dependencies
-
-
Field Summary
Fields Modifier and Type Field Description static String
MBEAN_NAME
The name to use for the management MBean.-
Fields inherited from class com.oracle.coherence.grpc.proxy.BaseGrpcServiceImpl
DEFAULT_TRANSFER_THRESHOLD, f_cacheFactorySupplier, f_dependencies, f_executor, f_metrics, f_serializerProducer, transferThreshold, VOID
-
Fields inherited from interface com.oracle.coherence.grpc.proxy.NamedCacheService
SERVICE_NAME
-
-
Constructor Summary
Constructors Constructor Description NamedCacheServiceImpl(NamedCacheService.Dependencies dependencies)
Create aNamedCacheServiceImpl
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description CompletionStage<com.google.protobuf.Empty>
addIndex(com.oracle.coherence.grpc.AddIndexRequest request)
Add an index to a cache.protected com.google.protobuf.Empty
addIndex(CacheRequestHolder<com.oracle.coherence.grpc.AddIndexRequest,Void> holder)
Execute theAddIndexRequest
request.CompletionStage<com.google.protobuf.BytesValue>
aggregate(com.oracle.coherence.grpc.AggregateRequest request)
Execute anAggregateRequest
against a cache and return the result serialized in aBytesValue
.protected CompletionStage<com.google.protobuf.BytesValue>
aggregateWithFilter(com.oracle.coherence.grpc.AggregateRequest request)
Execute the filteredAggregateRequest
request.protected CompletionStage<com.google.protobuf.BytesValue>
aggregateWithFilter(CacheRequestHolder<com.oracle.coherence.grpc.AggregateRequest,Void> holder)
Execute the filteredAggregateRequest
request.protected CompletionStage<com.google.protobuf.BytesValue>
aggregateWithKeys(com.oracle.coherence.grpc.AggregateRequest request)
Execute the key-basedAggregateRequest
request.protected CompletionStage<com.google.protobuf.BytesValue>
aggregateWithKeys(CacheRequestHolder<com.oracle.coherence.grpc.AggregateRequest,Void> holder)
Execute the filteredAggregateRequest
request.protected InvocableMap.EntryProcessor<Binary,Binary,Binary>
castProcessor(InvocableMap.EntryProcessor<Binary,Binary,?> ep)
CompletionStage<com.google.protobuf.Empty>
clear(com.oracle.coherence.grpc.ClearRequest request)
Clear a cache.protected CompletionStage<CacheRequestHolder<com.oracle.coherence.grpc.ContainsEntryRequest,Binary>>
containsEntry(CacheRequestHolder<com.oracle.coherence.grpc.ContainsEntryRequest,Void> holder)
Execute theContainsEntryRequest
request and return aCompletionStage
that will complete when theAsyncNamedCache
request completes and will contain aCacheRequestHolder
holding the result of the contains entry request as a serialized Boolean.CompletionStage<com.google.protobuf.BoolValue>
containsEntry(com.oracle.coherence.grpc.ContainsEntryRequest request)
Returnstrue
if this map contains a mapping for the specified key to the specified value.protected CompletionStage<CacheRequestHolder<com.oracle.coherence.grpc.ContainsKeyRequest,Boolean>>
containsKey(CacheRequestHolder<com.oracle.coherence.grpc.ContainsKeyRequest,Void> holder)
Execute theContainsKeyRequest
request and return aCompletionStage
that will complete when theAsyncNamedCache
request completes and will contain aCacheRequestHolder
holding the result of the contains key request.CompletionStage<com.google.protobuf.BoolValue>
containsKey(com.oracle.coherence.grpc.ContainsKeyRequest request)
Returnstrue
if this map contains a mapping for the specified key.protected CompletionStage<CacheRequestHolder<com.oracle.coherence.grpc.ContainsValueRequest,Integer>>
containsValue(CacheRequestHolder<com.oracle.coherence.grpc.ContainsValueRequest,Void> holder)
Execute theContainsValueRequest
request and return aCompletionStage
that will complete when theAsyncNamedCache
request completes and will contain aCacheRequestHolder
holding the result of the contains value request as a serialized Boolean.CompletionStage<com.google.protobuf.BoolValue>
containsValue(com.oracle.coherence.grpc.ContainsValueRequest request)
Returnstrue
if this map contains a mapping for the specified value.protected CompletionStage<List<Binary>>
convertKeys(CacheRequestHolder<com.oracle.coherence.grpc.GetAllRequest,Void> holder)
Convert the keys for aGetAllRequest
from the request's serialization format to the cache's serialization format.<Req> CompletionStage<CacheRequestHolder<Req,Void>>
createHolderAsync(Req request, String sScope, String sCacheName, String format)
Asynchronously create aCacheRequestHolder
for a given request.<Req> CacheRequestHolder<Req,Void>
createRequestHolder(Req request, String sScope, String sCacheName, String format)
Create aCacheRequestHolder
for a given request.<T> Comparator<T>
deserializeComparator(com.google.protobuf.ByteString bytes, Serializer serializer)
Obtain aComparator
from the serialized data in aByteString
.CompletionStage<com.google.protobuf.Empty>
destroy(com.oracle.coherence.grpc.DestroyRequest request)
Destroy a cache.protected <V> com.google.protobuf.Empty
empty(V value)
A helper method that always returnsEmpty
.<T> Filter<T>
ensureFilter(com.google.protobuf.ByteString bytes, Serializer serializer)
Obtain aFilter
from the serialized data in aByteString
.ValueExtractor<?,?>
ensureValueExtractor(com.google.protobuf.ByteString bytes, Serializer serializer)
Obtain aValueExtractor
from the serialized data in aByteString
.protected Void
entrySet(CacheRequestHolder<com.oracle.coherence.grpc.EntrySetRequest,Void> holder, io.grpc.stub.StreamObserver<com.oracle.coherence.grpc.Entry> observer)
Execute theEntrySetRequest
request and send the results to theStreamObserver
.void
entrySet(com.oracle.coherence.grpc.EntrySetRequest request, io.grpc.stub.StreamObserver<com.oracle.coherence.grpc.Entry> observer)
Stream a set of cache entries to aStreamObserver
.io.grpc.stub.StreamObserver<com.oracle.coherence.grpc.MapListenerRequest>
events(io.grpc.stub.StreamObserver<com.oracle.coherence.grpc.MapListenerResponse> observer)
Add aMapListener
to a cache and stream the events received to theStreamObserver
.protected com.google.protobuf.Empty
execute(Runnable task)
Execute theRunnable
and return anEmpty
instance.protected <T> T
execute(Callable<T> task)
Execute theCallable
and return the result.protected CompletionStage<CacheRequestHolder<com.oracle.coherence.grpc.GetRequest,Binary>>
get(CacheRequestHolder<com.oracle.coherence.grpc.GetRequest,Void> holder)
Execute theGetRequest
request and return aCompletionStage
that will complete when theAsyncNamedCache
request completes and will contain aCacheRequestHolder
holding the result of theGetRequest
request as a serialized Boolean.CompletionStage<com.oracle.coherence.grpc.OptionalValue>
get(com.oracle.coherence.grpc.GetRequest request)
Get a value for a given key from a cache.protected Void
getAll(CacheRequestHolder<com.oracle.coherence.grpc.GetAllRequest,Void> holder, io.grpc.stub.StreamObserver<com.oracle.coherence.grpc.Entry> observer)
Execute theGetAllRequest
request and send the results to theStreamObserver
.void
getAll(com.oracle.coherence.grpc.GetAllRequest request, io.grpc.stub.StreamObserver<com.oracle.coherence.grpc.Entry> observer)
Obtain a stream of mappings of keys to values for all of the specified keys.protected CompletionStage<AsyncNamedCache<Binary,Binary>>
getAsyncCache(String scope, String cacheName)
Obtain anAsyncNamedCache
.protected NamedCache<Binary,Binary>
getCache(String sScope, String sCacheName, boolean fPassThru)
Obtain anNamedCache
.protected ConfigurableCacheFactory
getCCF(String sScope)
<T> Filter<T>
getFilter(com.google.protobuf.ByteString bytes, Serializer serializer)
Obtain aFilter
from the serialized data in aByteString
.protected NamedCache<Binary,Binary>
getPassThroughCache(String scope, String cacheName)
Obtain anNamedCache
.protected CompletionStage<CacheRequestHolder<com.oracle.coherence.grpc.InvokeRequest,Binary>>
invoke(CacheRequestHolder<com.oracle.coherence.grpc.InvokeRequest,Void> holder)
Execute theInvokeRequest
request and return aCompletionStage
that will complete when theAsyncNamedCache
request completes and will contain aCacheRequestHolder
holding the result of theInvokeRequest
request as a serialized Boolean.CompletionStage<com.google.protobuf.BytesValue>
invoke(com.oracle.coherence.grpc.InvokeRequest request)
Invoke anInvocableMap.EntryProcessor
against an entry in a cache.void
invokeAll(com.oracle.coherence.grpc.InvokeAllRequest request, io.grpc.stub.StreamObserver<com.oracle.coherence.grpc.Entry> observer)
Invoke anInvocableMap.EntryProcessor
against multiple entries in a cache.protected CompletionStage<Void>
invokeAllWithFilter(CacheRequestHolder<com.oracle.coherence.grpc.InvokeAllRequest,Void> holder, io.grpc.stub.StreamObserver<com.oracle.coherence.grpc.Entry> observer)
Execute the filteredInvokeAllRequest
request passing the results to the providedStreamObserver
.protected CompletionStage<Void>
invokeAllWithFilter(com.oracle.coherence.grpc.InvokeAllRequest request, io.grpc.stub.StreamObserver<com.oracle.coherence.grpc.Entry> observer)
Execute the filteredInvokeAllRequest
request passing the results to the providedStreamObserver
.protected CompletionStage<Void>
invokeAllWithKeys(CacheRequestHolder<com.oracle.coherence.grpc.InvokeAllRequest,Void> holder, io.grpc.stub.StreamObserver<com.oracle.coherence.grpc.Entry> observer)
Execute the key-basedInvokeAllRequest
request passing the results to the providedStreamObserver
.protected CompletionStage<Void>
invokeAllWithKeys(com.oracle.coherence.grpc.InvokeAllRequest request, io.grpc.stub.StreamObserver<com.oracle.coherence.grpc.Entry> observer)
Execute the key-basedInvokeAllRequest
request passing the results to the providedStreamObserver
.CompletionStage<com.google.protobuf.BoolValue>
isEmpty(com.oracle.coherence.grpc.IsEmptyRequest request)
Determine whether a cache is empty.CompletionStage<com.google.protobuf.BoolValue>
isReady(com.oracle.coherence.grpc.IsReadyRequest request)
Determine whether a cache is Ready.protected Void
keySet(CacheRequestHolder<com.oracle.coherence.grpc.KeySetRequest,Void> holder, io.grpc.stub.StreamObserver<com.google.protobuf.BytesValue> observer)
Execute the key-basedKeySetRequest
request passing the results to the providedStreamObserver
.void
keySet(com.oracle.coherence.grpc.KeySetRequest request, io.grpc.stub.StreamObserver<com.google.protobuf.BytesValue> observer)
Stream a set of cache keys to aStreamObserver
.static NamedCacheServiceImpl
newInstance()
Create an instance ofNamedCacheServiceImpl
using the default dependencies configuration.static NamedCacheServiceImpl
newInstance(NamedCacheService.Dependencies deps)
Create an instance ofNamedCacheServiceImpl
using the default dependencies configuration.void
nextEntrySetPage(com.oracle.coherence.grpc.PageRequest request, io.grpc.stub.StreamObserver<com.oracle.coherence.grpc.EntryResult> observer)
Obtain the next page of a paged entry set request.void
nextKeySetPage(com.oracle.coherence.grpc.PageRequest request, io.grpc.stub.StreamObserver<com.google.protobuf.BytesValue> observer)
Obtain the next page of a paged key set request.protected CompletionStage<com.google.protobuf.Empty>
partitionedPutAll(CacheRequestHolder<com.oracle.coherence.grpc.PutAllRequest,Void> holder, Map<Binary,Binary> map)
Perform aputAll
operation on a partitioned cache.protected CompletionStage<com.google.protobuf.Empty>
plainPutAll(AsyncNamedCache<Binary,Binary> cache, Map<Binary,Binary> map, long cMillis)
Perform aputAll
operation on a partitioned cache.protected CompletionStage<com.google.protobuf.BytesValue>
put(CacheRequestHolder<com.oracle.coherence.grpc.PutRequest,Void> holder)
Execute a put request.CompletionStage<com.google.protobuf.BytesValue>
put(com.oracle.coherence.grpc.PutRequest request)
Associate the specified value with the specified key in this cache.protected CompletionStage<com.google.protobuf.Empty>
putAll(CacheRequestHolder<com.oracle.coherence.grpc.PutAllRequest,Void> holder)
Execute a putAll request.CompletionStage<com.google.protobuf.Empty>
putAll(com.oracle.coherence.grpc.PutAllRequest request)
Add the specified key value pair mappings to this cache.protected CompletableFuture<com.google.protobuf.BytesValue>
putIfAbsent(CacheRequestHolder<com.oracle.coherence.grpc.PutIfAbsentRequest,Void> holder)
Execute aPutIfAbsentRequest
request.CompletionStage<com.google.protobuf.BytesValue>
putIfAbsent(com.oracle.coherence.grpc.PutIfAbsentRequest request)
If the specified key is not already associated with a value (or is mapped tonull
) associate it with the given value and returnsnull
, else return the current value.protected CompletableFuture<Binary>
remove(CacheRequestHolder<com.oracle.coherence.grpc.RemoveRequest,Void> holder)
Execute aRemoveRequest
request.CompletionStage<com.google.protobuf.BytesValue>
remove(com.oracle.coherence.grpc.RemoveRequest request)
Remove the mapping that is associated with the specified key.protected com.google.protobuf.Empty
removeIndex(CacheRequestHolder<com.oracle.coherence.grpc.RemoveIndexRequest,Void> holder)
Execute theRemoveIndexRequest
request.CompletionStage<com.google.protobuf.Empty>
removeIndex(com.oracle.coherence.grpc.RemoveIndexRequest request)
Remove an index from a cache.protected CompletionStage<CacheRequestHolder<com.oracle.coherence.grpc.RemoveMappingRequest,Boolean>>
removeMapping(CacheRequestHolder<com.oracle.coherence.grpc.RemoveMappingRequest,Void> holder)
Execute theRemoveMappingRequest
request and return aCompletionStage
that will complete when theAsyncNamedCache
request completes and will contain aCacheRequestHolder
holding the result of theRemoveMappingRequest
request as a serialized Boolean.CompletionStage<com.google.protobuf.BoolValue>
removeMapping(com.oracle.coherence.grpc.RemoveMappingRequest request)
Remove the mapping that is associated with the specified key only if the mapping exists in the cache.protected CompletableFuture<Binary>
replace(CacheRequestHolder<com.oracle.coherence.grpc.ReplaceRequest,Void> holder)
Execute aReplaceRequest
request.CompletionStage<com.google.protobuf.BytesValue>
replace(com.oracle.coherence.grpc.ReplaceRequest request)
Replace the entry for the specified key only if it is currently mapped to some value.protected CompletableFuture<Binary>
replaceMapping(CacheRequestHolder<com.oracle.coherence.grpc.ReplaceMappingRequest,Void> holder)
Execute aReplaceMappingRequest
request.CompletionStage<com.google.protobuf.BoolValue>
replaceMapping(com.oracle.coherence.grpc.ReplaceMappingRequest request)
Replace the mapping for the specified key only if currently mapped to the specified value.CompletionStage<com.google.protobuf.Int32Value>
size(com.oracle.coherence.grpc.SizeRequest request)
Determine the number of entries in a cache.protected com.google.protobuf.BoolValue
toBoolValue(Binary binary, Serializer serializer)
Deserialize aBinary
to a boolean value.CompletionStage<com.google.protobuf.Empty>
truncate(com.oracle.coherence.grpc.TruncateRequest request)
Removes all mappings from this map.protected Void
values(CacheRequestHolder<com.oracle.coherence.grpc.ValuesRequest,Void> holder, io.grpc.stub.StreamObserver<com.google.protobuf.BytesValue> observer)
Execute theValuesRequest
request passing the results to the providedStreamObserver
.void
values(com.oracle.coherence.grpc.ValuesRequest request, io.grpc.stub.StreamObserver<com.google.protobuf.BytesValue> observer)
Execute theValuesRequest
request passing the results to the providedStreamObserver
.-
Methods inherited from class com.oracle.coherence.grpc.proxy.BaseGrpcServiceImpl
createDefaultExecutor, getMetrics, getSerializer
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.oracle.coherence.grpc.proxy.GrpcProxyService
getMetrics
-
-
-
-
Field Detail
-
MBEAN_NAME
public static final String MBEAN_NAME
The name to use for the management MBean.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
NamedCacheServiceImpl
public NamedCacheServiceImpl(NamedCacheService.Dependencies dependencies)
Create aNamedCacheServiceImpl
.- Parameters:
dependencies
- theNamedCacheService.Dependencies
to use to configure the service
-
-
Method Detail
-
newInstance
public static NamedCacheServiceImpl newInstance(NamedCacheService.Dependencies deps)
Create an instance ofNamedCacheServiceImpl
using the default dependencies configuration.- Parameters:
deps
- theNamedCacheService.Dependencies
to use to create the service- Returns:
- an instance of
NamedCacheServiceImpl
-
newInstance
public static NamedCacheServiceImpl newInstance()
Create an instance ofNamedCacheServiceImpl
using the default dependencies configuration.- Returns:
- an instance of
NamedCacheServiceImpl
-
addIndex
public CompletionStage<com.google.protobuf.Empty> addIndex(com.oracle.coherence.grpc.AddIndexRequest request)
Description copied from interface:NamedCacheService
Add an index to a cache.- Specified by:
addIndex
in interfaceNamedCacheService
- Parameters:
request
- theAddIndexRequest
containing the name of the cache to add the index to, the serializedValueExtractor
to use to create the index and the optional serializedComparator
to sort the index- Returns:
- a
CompletionStage
that will complete when the index is created
-
addIndex
protected com.google.protobuf.Empty addIndex(CacheRequestHolder<com.oracle.coherence.grpc.AddIndexRequest,Void> holder)
Execute theAddIndexRequest
request.- Parameters:
holder
- theCacheRequestHolder
containing theAddIndexRequest
request- Returns:
BinaryHelper.EMPTY
-
aggregate
public CompletionStage<com.google.protobuf.BytesValue> aggregate(com.oracle.coherence.grpc.AggregateRequest request)
Description copied from interface:NamedCacheService
Execute anAggregateRequest
against a cache and return the result serialized in aBytesValue
.- Specified by:
aggregate
in interfaceNamedCacheService
- Parameters:
request
- theAggregateRequest
to execute- Returns:
- the serialized aggregation result
-
aggregateWithFilter
protected CompletionStage<com.google.protobuf.BytesValue> aggregateWithFilter(com.oracle.coherence.grpc.AggregateRequest request)
Execute the filteredAggregateRequest
request.- Parameters:
request
- theAggregateRequest
- Returns:
- a
CompletionStage
that completes with aCacheRequestHolder
containing the serialized result of executing request
-
aggregateWithFilter
protected CompletionStage<com.google.protobuf.BytesValue> aggregateWithFilter(CacheRequestHolder<com.oracle.coherence.grpc.AggregateRequest,Void> holder)
Execute the filteredAggregateRequest
request.- Parameters:
holder
- theCacheRequestHolder
containing theContainsEntryRequest
request- Returns:
- a
CompletionStage
that completes with aCacheRequestHolder
containing the serialized result of executing request
-
aggregateWithKeys
protected CompletionStage<com.google.protobuf.BytesValue> aggregateWithKeys(com.oracle.coherence.grpc.AggregateRequest request)
Execute the key-basedAggregateRequest
request.- Parameters:
request
- theAggregateRequest
- Returns:
- a
CompletionStage
that completes with aCacheRequestHolder
containing the serialized result of executing request
-
aggregateWithKeys
protected CompletionStage<com.google.protobuf.BytesValue> aggregateWithKeys(CacheRequestHolder<com.oracle.coherence.grpc.AggregateRequest,Void> holder)
Execute the filteredAggregateRequest
request.- Parameters:
holder
- theCacheRequestHolder
containing theContainsEntryRequest
request- Returns:
- a
CompletionStage
that completes with aCacheRequestHolder
containing the serialized result of executing request
-
clear
public CompletionStage<com.google.protobuf.Empty> clear(com.oracle.coherence.grpc.ClearRequest request)
Description copied from interface:NamedCacheService
Clear a cache.- Specified by:
clear
in interfaceNamedCacheService
- Parameters:
request
- theClearRequest
to execute- Returns:
- a
CompletionStage
that will complete when the cache has been cleared. - See Also:
NamedMap.clear()
-
containsEntry
public CompletionStage<com.google.protobuf.BoolValue> containsEntry(com.oracle.coherence.grpc.ContainsEntryRequest request)
Description copied from interface:NamedCacheService
Returnstrue
if this map contains a mapping for the specified key to the specified value.- Specified by:
containsEntry
in interfaceNamedCacheService
- Parameters:
request
- the request which contains the key and value whose presence in this map is to be tested- Returns:
- a
CompletionStage
that will complete with {code true} if this map contains a mapping for the specified key to the specified value - See Also:
Map.containsKey(Object)
-
containsEntry
protected CompletionStage<CacheRequestHolder<com.oracle.coherence.grpc.ContainsEntryRequest,Binary>> containsEntry(CacheRequestHolder<com.oracle.coherence.grpc.ContainsEntryRequest,Void> holder)
Execute theContainsEntryRequest
request and return aCompletionStage
that will complete when theAsyncNamedCache
request completes and will contain aCacheRequestHolder
holding the result of the contains entry request as a serialized Boolean.- Parameters:
holder
- theCacheRequestHolder
containing theContainsEntryRequest
request- Returns:
- a
CompletionStage
that completes with aCacheRequestHolder
containing the serialized Boolean result of executing theContainsEntryRequest
request
-
containsKey
public CompletionStage<com.google.protobuf.BoolValue> containsKey(com.oracle.coherence.grpc.ContainsKeyRequest request)
Description copied from interface:NamedCacheService
Returnstrue
if this map contains a mapping for the specified key.- Specified by:
containsKey
in interfaceNamedCacheService
- Parameters:
request
- the request which contains the key whose presence in this map is to be tested- Returns:
- a
CompletionStage
that will complete with {code true} if this map contains a mapping for the specified key - See Also:
Map.containsKey(Object)
-
containsKey
protected CompletionStage<CacheRequestHolder<com.oracle.coherence.grpc.ContainsKeyRequest,Boolean>> containsKey(CacheRequestHolder<com.oracle.coherence.grpc.ContainsKeyRequest,Void> holder)
Execute theContainsKeyRequest
request and return aCompletionStage
that will complete when theAsyncNamedCache
request completes and will contain aCacheRequestHolder
holding the result of the contains key request.- Parameters:
holder
- theCacheRequestHolder
containing theContainsKeyRequest
request- Returns:
- a
CompletionStage
that completes with aCacheRequestHolder
containing the Boolean result of executing theContainsKeyRequest
request
-
containsValue
public CompletionStage<com.google.protobuf.BoolValue> containsValue(com.oracle.coherence.grpc.ContainsValueRequest request)
Description copied from interface:NamedCacheService
Returnstrue
if this map contains a mapping for the specified value.- Specified by:
containsValue
in interfaceNamedCacheService
- Parameters:
request
- the request which contains the value whose presence in this map is to be tested- Returns:
- a
CompletionStage
that will complete with {code true} if this map contains a mapping for the specified value - See Also:
Map.containsKey(Object)
-
containsValue
protected CompletionStage<CacheRequestHolder<com.oracle.coherence.grpc.ContainsValueRequest,Integer>> containsValue(CacheRequestHolder<com.oracle.coherence.grpc.ContainsValueRequest,Void> holder)
Execute theContainsValueRequest
request and return aCompletionStage
that will complete when theAsyncNamedCache
request completes and will contain aCacheRequestHolder
holding the result of the contains value request as a serialized Boolean.- Parameters:
holder
- theCacheRequestHolder
containing theContainsValueRequest
request- Returns:
- a
CompletionStage
that completes with aCacheRequestHolder
containing the serialized Boolean result of executing theContainsValueRequest
request
-
destroy
public CompletionStage<com.google.protobuf.Empty> destroy(com.oracle.coherence.grpc.DestroyRequest request)
Description copied from interface:NamedCacheService
Destroy a cache.- Specified by:
destroy
in interfaceNamedCacheService
- Parameters:
request
- theDestroyRequest
containing the name of the cache to destroy- Returns:
- a
CompletionStage
that will complete when the cache is destroyed
-
entrySet
public void entrySet(com.oracle.coherence.grpc.EntrySetRequest request, io.grpc.stub.StreamObserver<com.oracle.coherence.grpc.Entry> observer)
Description copied from interface:NamedCacheService
Stream a set of cache entries to aStreamObserver
.- Specified by:
entrySet
in interfaceNamedCacheService
- Parameters:
request
- theEntrySetRequest
to executeobserver
- theStreamObserver
to stream the entries to- See Also:
QueryMap.entrySet(com.tangosol.util.Filter)
,QueryMap.entrySet(com.tangosol.util.Filter, java.util.Comparator)
-
entrySet
protected Void entrySet(CacheRequestHolder<com.oracle.coherence.grpc.EntrySetRequest,Void> holder, io.grpc.stub.StreamObserver<com.oracle.coherence.grpc.Entry> observer)
Execute theEntrySetRequest
request and send the results to theStreamObserver
.- Parameters:
holder
- theCacheRequestHolder
containing theEntrySetRequest
requestobserver
- theStreamObserver
which will receive results- Returns:
- always return
Void
-
events
public io.grpc.stub.StreamObserver<com.oracle.coherence.grpc.MapListenerRequest> events(io.grpc.stub.StreamObserver<com.oracle.coherence.grpc.MapListenerResponse> observer)
Description copied from interface:NamedCacheService
Add aMapListener
to a cache and stream the events received to theStreamObserver
.- Specified by:
events
in interfaceNamedCacheService
- Parameters:
observer
- theStreamObserver
to receive events- Returns:
- a
StreamObserver
that will be closed by the client to end event subscription
-
get
public CompletionStage<com.oracle.coherence.grpc.OptionalValue> get(com.oracle.coherence.grpc.GetRequest request)
Description copied from interface:NamedCacheService
Get a value for a given key from a cache.- Specified by:
get
in interfaceNamedCacheService
- Parameters:
request
- theGetRequest
to execute- Returns:
- a
CompletionStage
that will complete with the result of theMap.get(Object)
- See Also:
Map.get(Object)
-
get
protected CompletionStage<CacheRequestHolder<com.oracle.coherence.grpc.GetRequest,Binary>> get(CacheRequestHolder<com.oracle.coherence.grpc.GetRequest,Void> holder)
Execute theGetRequest
request and return aCompletionStage
that will complete when theAsyncNamedCache
request completes and will contain aCacheRequestHolder
holding the result of theGetRequest
request as a serialized Boolean.- Parameters:
holder
- theCacheRequestHolder
containing theGetRequest
request- Returns:
- a
CompletionStage
that completes with aCacheRequestHolder
containing the serialized Binary result of executing theGetRequest
request
-
getAll
public void getAll(com.oracle.coherence.grpc.GetAllRequest request, io.grpc.stub.StreamObserver<com.oracle.coherence.grpc.Entry> observer)
Description copied from interface:NamedCacheService
Obtain a stream of mappings of keys to values for all of the specified keys.- Specified by:
getAll
in interfaceNamedCacheService
- Parameters:
request
- theGetAllRequest
request containing the cache name and collection of keys to obtain the mappings forobserver
- theStreamObserver
to stream the results back to
-
getAll
protected Void getAll(CacheRequestHolder<com.oracle.coherence.grpc.GetAllRequest,Void> holder, io.grpc.stub.StreamObserver<com.oracle.coherence.grpc.Entry> observer)
Execute theGetAllRequest
request and send the results to theStreamObserver
.- Parameters:
holder
- theCacheRequestHolder
containing theGetAllRequest
requestobserver
- theStreamObserver
which will receive results- Returns:
- always return
Void
-
convertKeys
protected CompletionStage<List<Binary>> convertKeys(CacheRequestHolder<com.oracle.coherence.grpc.GetAllRequest,Void> holder)
Convert the keys for aGetAllRequest
from the request's serialization format to the cache's serialization format.- Parameters:
holder
- theCacheRequestHolder
containing theGetAllRequest
containing the keys to convert- Returns:
- A
CompletionStage
that completes with the converted keys
-
invoke
public CompletionStage<com.google.protobuf.BytesValue> invoke(com.oracle.coherence.grpc.InvokeRequest request)
Description copied from interface:NamedCacheService
Invoke anInvocableMap.EntryProcessor
against an entry in a cache.- Specified by:
invoke
in interfaceNamedCacheService
- Parameters:
request
- theInvokeRequest
containing the serialized key of the entry and the serializedInvocableMap.EntryProcessor
- Returns:
- the serialized result of the
InvocableMap.EntryProcessor
invocation
-
invoke
protected CompletionStage<CacheRequestHolder<com.oracle.coherence.grpc.InvokeRequest,Binary>> invoke(CacheRequestHolder<com.oracle.coherence.grpc.InvokeRequest,Void> holder)
Execute theInvokeRequest
request and return aCompletionStage
that will complete when theAsyncNamedCache
request completes and will contain aCacheRequestHolder
holding the result of theInvokeRequest
request as a serialized Boolean.- Parameters:
holder
- theCacheRequestHolder
containing theInvokeRequest
request- Returns:
- a
CompletionStage
that completes with aCacheRequestHolder
containing the serialized Binary result of executing theInvokeRequest
request
-
invokeAll
public void invokeAll(com.oracle.coherence.grpc.InvokeAllRequest request, io.grpc.stub.StreamObserver<com.oracle.coherence.grpc.Entry> observer)
Description copied from interface:NamedCacheService
Invoke anInvocableMap.EntryProcessor
against multiple entries in a cache.- Specified by:
invokeAll
in interfaceNamedCacheService
- Parameters:
request
- theInvokeRequest
containing the serialized keys or serializedFilter
to use to identify the entries and the serializedInvocableMap.EntryProcessor
observer
- theStreamObserver
to observer the invocation results
-
invokeAllWithFilter
protected CompletionStage<Void> invokeAllWithFilter(com.oracle.coherence.grpc.InvokeAllRequest request, io.grpc.stub.StreamObserver<com.oracle.coherence.grpc.Entry> observer)
Execute the filteredInvokeAllRequest
request passing the results to the providedStreamObserver
.- Parameters:
request
- theInvokeAllRequest
observer
- theStreamObserver
which will receive the results- Returns:
- always returns a
CompletionStage
returningVoid
-
invokeAllWithFilter
protected CompletionStage<Void> invokeAllWithFilter(CacheRequestHolder<com.oracle.coherence.grpc.InvokeAllRequest,Void> holder, io.grpc.stub.StreamObserver<com.oracle.coherence.grpc.Entry> observer)
Execute the filteredInvokeAllRequest
request passing the results to the providedStreamObserver
.- Parameters:
holder
- theCacheRequestHolder
containing theInvokeAllRequest
observer
- theStreamObserver
which will receive the results- Returns:
- always returns a
CompletionStage
returningVoid
-
invokeAllWithKeys
protected CompletionStage<Void> invokeAllWithKeys(com.oracle.coherence.grpc.InvokeAllRequest request, io.grpc.stub.StreamObserver<com.oracle.coherence.grpc.Entry> observer)
Execute the key-basedInvokeAllRequest
request passing the results to the providedStreamObserver
.- Parameters:
request
- theInvokeAllRequest
observer
- theStreamObserver
which will receive the results- Returns:
- always returns a
CompletionStage
returningVoid
-
invokeAllWithKeys
protected CompletionStage<Void> invokeAllWithKeys(CacheRequestHolder<com.oracle.coherence.grpc.InvokeAllRequest,Void> holder, io.grpc.stub.StreamObserver<com.oracle.coherence.grpc.Entry> observer)
Execute the key-basedInvokeAllRequest
request passing the results to the providedStreamObserver
.- Parameters:
holder
- theCacheRequestHolder
containing theInvokeAllRequest
observer
- theStreamObserver
which will receive the results- Returns:
- always returns a
CompletionStage
returningVoid
-
isEmpty
public CompletionStage<com.google.protobuf.BoolValue> isEmpty(com.oracle.coherence.grpc.IsEmptyRequest request)
Description copied from interface:NamedCacheService
Determine whether a cache is empty.- Specified by:
isEmpty
in interfaceNamedCacheService
- Parameters:
request
- theIsEmptyRequest
to execute- Returns:
- a
CompletionStage
that will complete with the result of theMap.isEmpty()
- See Also:
Map.isEmpty()
-
isReady
public CompletionStage<com.google.protobuf.BoolValue> isReady(com.oracle.coherence.grpc.IsReadyRequest request)
Description copied from interface:NamedCacheService
Determine whether a cache is Ready.- Specified by:
isReady
in interfaceNamedCacheService
- Parameters:
request
- theIsReadyRequest
to execute- Returns:
- a
CompletionStage
that will complete with the result of theNamedMap.isReady()
- See Also:
NamedMap.isReady()
-
keySet
public void keySet(com.oracle.coherence.grpc.KeySetRequest request, io.grpc.stub.StreamObserver<com.google.protobuf.BytesValue> observer)
Description copied from interface:NamedCacheService
Stream a set of cache keys to aStreamObserver
.- Specified by:
keySet
in interfaceNamedCacheService
- Parameters:
request
- theKeySetRequest
to executeobserver
- theStreamObserver
to stream the keys to- See Also:
QueryMap.keySet(com.tangosol.util.Filter)
-
keySet
protected Void keySet(CacheRequestHolder<com.oracle.coherence.grpc.KeySetRequest,Void> holder, io.grpc.stub.StreamObserver<com.google.protobuf.BytesValue> observer)
Execute the key-basedKeySetRequest
request passing the results to the providedStreamObserver
.- Parameters:
holder
- theCacheRequestHolder
containing theKeySetRequest
observer
- theStreamObserver
which will receive the results- Returns:
- always returns
Void
-
nextKeySetPage
public void nextKeySetPage(com.oracle.coherence.grpc.PageRequest request, io.grpc.stub.StreamObserver<com.google.protobuf.BytesValue> observer)
Description copied from interface:NamedCacheService
Obtain the next page of a paged key set request.- Specified by:
nextKeySetPage
in interfaceNamedCacheService
- Parameters:
request
- thePageRequest
to executeobserver
- theStreamObserver
that will receive the responses
-
nextEntrySetPage
public void nextEntrySetPage(com.oracle.coherence.grpc.PageRequest request, io.grpc.stub.StreamObserver<com.oracle.coherence.grpc.EntryResult> observer)
Description copied from interface:NamedCacheService
Obtain the next page of a paged entry set request.- Specified by:
nextEntrySetPage
in interfaceNamedCacheService
- Parameters:
request
- thePageRequest
to executeobserver
- theStreamObserver
that will receive the responses
-
put
public CompletionStage<com.google.protobuf.BytesValue> put(com.oracle.coherence.grpc.PutRequest request)
Description copied from interface:NamedCacheService
Associate the specified value with the specified key in this cache. If the cache previously contained a mapping for the key, the old value is replaced by the specified value.- Specified by:
put
in interfaceNamedCacheService
- Parameters:
request
- thePutRequest
to execute- Returns:
- a
CompletionStage
that will complete with the result of theMap.put(Object, Object)
- See Also:
Map.put(Object, Object)
-
put
protected CompletionStage<com.google.protobuf.BytesValue> put(CacheRequestHolder<com.oracle.coherence.grpc.PutRequest,Void> holder)
Execute a put request.- Parameters:
holder
- theCacheRequestHolder
containing thePutRequest
request- Returns:
- a
CompletionStage
that completes with aBytesValue
containing the serialized result of executing thePutRequest
request
-
putAll
public CompletionStage<com.google.protobuf.Empty> putAll(com.oracle.coherence.grpc.PutAllRequest request)
Description copied from interface:NamedCacheService
Add the specified key value pair mappings to this cache. If the cache previously contained a mappings for the keys, the old value is replaced by the specified value.- Specified by:
putAll
in interfaceNamedCacheService
- Parameters:
request
- thePutAllRequest
to execute- Returns:
- a
CompletionStage
that will complete with the result of theMap.putAll(java.util.Map)
- See Also:
Map.putAll(java.util.Map)
-
putAll
protected CompletionStage<com.google.protobuf.Empty> putAll(CacheRequestHolder<com.oracle.coherence.grpc.PutAllRequest,Void> holder)
Execute a putAll request.- Parameters:
holder
- theCacheRequestHolder
containing thePutAllRequest
request- Returns:
- a
CompletionStage
that completes after executing thePutAllRequest
request
-
partitionedPutAll
protected CompletionStage<com.google.protobuf.Empty> partitionedPutAll(CacheRequestHolder<com.oracle.coherence.grpc.PutAllRequest,Void> holder, Map<Binary,Binary> map)
Perform aputAll
operation on a partitioned cache.This method will split the map of entries into a map per storage member and execute the putAll invocation for each member separately. This is more efficient than sending the map of entries to all members.
- Parameters:
holder
- theCacheRequestHolder
containing thePutAllRequest
requestmap
- the map ofBinary
keys and values to put into the cache- Returns:
- a
CompletionStage
that completes when the putAll operation completes
-
plainPutAll
protected CompletionStage<com.google.protobuf.Empty> plainPutAll(AsyncNamedCache<Binary,Binary> cache, Map<Binary,Binary> map, long cMillis)
Perform aputAll
operation on a partitioned cache.- Parameters:
cache
- theAsyncNamedCache
to updatemap
- the map ofBinary
keys and values to put into the cachecMillis
- the expiry delay to set on the entries- Returns:
- a
CompletionStage
that completes when theputAll
operation completes
-
putIfAbsent
public CompletionStage<com.google.protobuf.BytesValue> putIfAbsent(com.oracle.coherence.grpc.PutIfAbsentRequest request)
Description copied from interface:NamedCacheService
If the specified key is not already associated with a value (or is mapped tonull
) associate it with the given value and returnsnull
, else return the current value.- Specified by:
putIfAbsent
in interfaceNamedCacheService
- Parameters:
request
- thePutIfAbsentRequest
to execute- Returns:
- a
CompletionStage
that will complete with the previous value associated with the specified key, ornull
if there was no mapping for the key. Anull
return can also indicate that the map previously associatednull
with the key, if the implementation supportsnull
values - See Also:
Map.putIfAbsent(Object, Object)
-
putIfAbsent
protected CompletableFuture<com.google.protobuf.BytesValue> putIfAbsent(CacheRequestHolder<com.oracle.coherence.grpc.PutIfAbsentRequest,Void> holder)
Execute aPutIfAbsentRequest
request.- Parameters:
holder
- theCacheRequestHolder
containing thePutIfAbsentRequest
request- Returns:
- a
CompletionStage
that completes with aBytesValue
containing the serialized result of executing thePutIfAbsentRequest
request
-
remove
public CompletionStage<com.google.protobuf.BytesValue> remove(com.oracle.coherence.grpc.RemoveRequest request)
Description copied from interface:NamedCacheService
Remove the mapping that is associated with the specified key.- Specified by:
remove
in interfaceNamedCacheService
- Parameters:
request
- theRemoveRequest
to execute- Returns:
- a
CompletionStage
that will complete with the previous value associated with specified key, or null if there was no mapping for key. - See Also:
Map.remove(Object)
-
remove
protected CompletableFuture<Binary> remove(CacheRequestHolder<com.oracle.coherence.grpc.RemoveRequest,Void> holder)
Execute aRemoveRequest
request.- Parameters:
holder
- theCacheRequestHolder
containing theRemoveRequest
request- Returns:
- a
CompletionStage
that completes with aBinary
containing the serialized result of executing theRemoveRequest
request
-
removeIndex
public CompletionStage<com.google.protobuf.Empty> removeIndex(com.oracle.coherence.grpc.RemoveIndexRequest request)
Description copied from interface:NamedCacheService
Remove an index from a cache.- Specified by:
removeIndex
in interfaceNamedCacheService
- Parameters:
request
- theRemoveIndexRequest
containing the name of the cache to remove the index from, the serializedValueExtractor
that was used to create the index- Returns:
- a
CompletionStage
that will complete when the index is removed
-
removeIndex
protected com.google.protobuf.Empty removeIndex(CacheRequestHolder<com.oracle.coherence.grpc.RemoveIndexRequest,Void> holder)
Execute theRemoveIndexRequest
request.- Parameters:
holder
- theCacheRequestHolder
containing theRemoveIndexRequest
request- Returns:
BinaryHelper.EMPTY
-
removeMapping
public CompletionStage<com.google.protobuf.BoolValue> removeMapping(com.oracle.coherence.grpc.RemoveMappingRequest request)
Description copied from interface:NamedCacheService
Remove the mapping that is associated with the specified key only if the mapping exists in the cache.- Specified by:
removeMapping
in interfaceNamedCacheService
- Parameters:
request
- theRemoveMappingRequest
to execute- Returns:
- a
CompletionStage
that will complete withtrue
if the removal was successful,false
otherwise - See Also:
Map.remove(Object, Object)
-
removeMapping
protected CompletionStage<CacheRequestHolder<com.oracle.coherence.grpc.RemoveMappingRequest,Boolean>> removeMapping(CacheRequestHolder<com.oracle.coherence.grpc.RemoveMappingRequest,Void> holder)
Execute theRemoveMappingRequest
request and return aCompletionStage
that will complete when theAsyncNamedCache
request completes and will contain aCacheRequestHolder
holding the result of theRemoveMappingRequest
request as a serialized Boolean.- Parameters:
holder
- theCacheRequestHolder
containing theRemoveMappingRequest
request- Returns:
- a
CompletionStage
that completes with aCacheRequestHolder
containing the serialized Binary result of executing theRemoveMappingRequest
request
-
replace
public CompletionStage<com.google.protobuf.BytesValue> replace(com.oracle.coherence.grpc.ReplaceRequest request)
Description copied from interface:NamedCacheService
Replace the entry for the specified key only if it is currently mapped to some value.- Specified by:
replace
in interfaceNamedCacheService
- Parameters:
request
- theReplaceRequest
to execute- Returns:
- a
CompletionStage
that will complete with the previous value associated with specified key, or null if there was no mapping for key. - See Also:
Map.replace(Object, Object)
-
replace
protected CompletableFuture<Binary> replace(CacheRequestHolder<com.oracle.coherence.grpc.ReplaceRequest,Void> holder)
Execute aReplaceRequest
request.- Parameters:
holder
- theCacheRequestHolder
containing theReplaceRequest
request- Returns:
- a
CompletionStage
that completes with aBinary
containing the serialized result of executing theReplaceRequest
request
-
replaceMapping
public CompletionStage<com.google.protobuf.BoolValue> replaceMapping(com.oracle.coherence.grpc.ReplaceMappingRequest request)
Description copied from interface:NamedCacheService
Replace the mapping for the specified key only if currently mapped to the specified value.- Specified by:
replaceMapping
in interfaceNamedCacheService
- Parameters:
request
- theReplaceMappingRequest
to execute- Returns:
- a
CompletionStage
that will complete with the previous value associated with the specified key, ornull
if there was no mapping for the key. Anull
return can also indicate that the map previously associatednull
with the key, if the implementation supports null values - See Also:
Map.replace(Object, Object, Object)
-
replaceMapping
protected CompletableFuture<Binary> replaceMapping(CacheRequestHolder<com.oracle.coherence.grpc.ReplaceMappingRequest,Void> holder)
Execute aReplaceMappingRequest
request.- Parameters:
holder
- theCacheRequestHolder
containing theReplaceMappingRequest
request- Returns:
- a
CompletionStage
that completes with aBinary
containing the serialized result of executing theReplaceMappingRequest
request
-
size
public CompletionStage<com.google.protobuf.Int32Value> size(com.oracle.coherence.grpc.SizeRequest request)
Description copied from interface:NamedCacheService
Determine the number of entries in a cache.- Specified by:
size
in interfaceNamedCacheService
- Parameters:
request
- theSizeRequest
to execute- Returns:
- a
CompletionStage
that will complete with the result of theMap.size()
- See Also:
Map.size()
-
truncate
public CompletionStage<com.google.protobuf.Empty> truncate(com.oracle.coherence.grpc.TruncateRequest request)
Description copied from interface:NamedCacheService
Removes all mappings from this map.Note: the removal of entries caused by this truncate operation will not be observable. This includes any registered
listeners
,triggers
, orinterceptors
. However, aCacheLifecycleEvent
is raised to notify subscribers of the execution of this operation.- Specified by:
truncate
in interfaceNamedCacheService
- Parameters:
request
- theTruncateRequest
containing the name of the cache to truncate- Returns:
- a
CompletionStage
that completes when the truncate operation has completed
-
values
public void values(com.oracle.coherence.grpc.ValuesRequest request, io.grpc.stub.StreamObserver<com.google.protobuf.BytesValue> observer)
Execute theValuesRequest
request passing the results to the providedStreamObserver
.- Specified by:
values
in interfaceNamedCacheService
- Parameters:
request
- theValuesRequest
observer
- theStreamObserver
which will receive the results- See Also:
QueryMap.values(com.tangosol.util.Filter)
,QueryMap.values(com.tangosol.util.Filter, java.util.Comparator)
-
values
protected Void values(CacheRequestHolder<com.oracle.coherence.grpc.ValuesRequest,Void> holder, io.grpc.stub.StreamObserver<com.google.protobuf.BytesValue> observer)
Execute theValuesRequest
request passing the results to the providedStreamObserver
.- Parameters:
holder
- theCacheRequestHolder
containing theValuesRequest
observer
- theStreamObserver
which will receive the results- Returns:
- always returns
Void
-
empty
protected <V> com.google.protobuf.Empty empty(V value)
A helper method that always returnsEmpty
.This method is to make
CompletionStage
handler code a little more elegant as it can use this method as a method reference.- Type Parameters:
V
- the type of the value- Parameters:
value
- the value- Returns:
- an
Empty
instance.
-
execute
protected com.google.protobuf.Empty execute(Runnable task)
Execute theRunnable
and return anEmpty
instance.- Parameters:
task
- the runnable to execute- Returns:
- always returns an
Empty
instance
-
execute
protected <T> T execute(Callable<T> task)
Execute theCallable
and return the result.- Type Parameters:
T
- the result type- Parameters:
task
- the runnable to execute- Returns:
- the result of executing the
Callable
-
toBoolValue
protected com.google.protobuf.BoolValue toBoolValue(Binary binary, Serializer serializer)
Deserialize aBinary
to a boolean value.- Parameters:
binary
- theBinary
to deserializeserializer
- theSerializer
to use- Returns:
- the deserialized boolean value
-
ensureValueExtractor
public ValueExtractor<?,?> ensureValueExtractor(com.google.protobuf.ByteString bytes, Serializer serializer)
Obtain aValueExtractor
from the serialized data in aByteString
.- Parameters:
bytes
- theByteString
containing the serializedValueExtractor
serializer
- the serializer to use- Returns:
- a deserialized
ValueExtractor
- Throws:
io.grpc.StatusRuntimeException
- if theByteString
is null or empty
-
ensureFilter
public <T> Filter<T> ensureFilter(com.google.protobuf.ByteString bytes, Serializer serializer)
Obtain aFilter
from the serialized data in aByteString
.If the
ByteString
isnull
orByteString.EMPTY
then anAlwaysFilter
is returned.- Specified by:
ensureFilter
in interfaceNamedCacheService
- Type Parameters:
T
- theFilter
type- Parameters:
bytes
- theByteString
containing the serializedFilter
serializer
- the serializer to use- Returns:
- a deserialized
Filter
-
getFilter
public <T> Filter<T> getFilter(com.google.protobuf.ByteString bytes, Serializer serializer)
Obtain aFilter
from the serialized data in aByteString
.- Specified by:
getFilter
in interfaceNamedCacheService
- Type Parameters:
T
- theFilter
type- Parameters:
bytes
- theByteString
containing the serializedFilter
serializer
- the serializer to use- Returns:
- a deserialized
Filter
ornull
if no filter is set
-
deserializeComparator
public <T> Comparator<T> deserializeComparator(com.google.protobuf.ByteString bytes, Serializer serializer)
Obtain aComparator
from the serialized data in aByteString
.- Type Parameters:
T
- theComparator
type- Parameters:
bytes
- theByteString
containing the serializedComparator
serializer
- the serializer to use- Returns:
- a deserialized
Comparator
ornull
if theByteString
isnull
orByteString.EMPTY
-
getAsyncCache
protected CompletionStage<AsyncNamedCache<Binary,Binary>> getAsyncCache(String scope, String cacheName)
Obtain anAsyncNamedCache
.- Parameters:
scope
- the scope name to use to obtain the CCF to get the cache fromcacheName
- the name of the cache- Returns:
- the
AsyncNamedCache
with the specified name
-
getPassThroughCache
protected NamedCache<Binary,Binary> getPassThroughCache(String scope, String cacheName)
Obtain anNamedCache
.- Parameters:
scope
- the scope name to use to obtain the CCF to get the cache fromcacheName
- the name of the cache- Returns:
- the
NamedCache
with the specified name
-
getCCF
protected ConfigurableCacheFactory getCCF(String sScope)
-
getCache
protected NamedCache<Binary,Binary> getCache(String sScope, String sCacheName, boolean fPassThru)
Obtain anNamedCache
.- Parameters:
sScope
- the scope name to use to obtain the CCF to get the cache fromsCacheName
- the name of the cachefPassThru
-true
to use a binary pass-thru cache- Returns:
- the
NamedCache
with the specified name
-
castProcessor
protected InvocableMap.EntryProcessor<Binary,Binary,Binary> castProcessor(InvocableMap.EntryProcessor<Binary,Binary,?> ep)
- Parameters:
ep
- theInvocableMap.EntryProcessor
to cast- Returns:
- a
InvocableMap.EntryProcessor
that returns aBinary
result
-
createHolderAsync
public <Req> CompletionStage<CacheRequestHolder<Req,Void>> createHolderAsync(Req request, String sScope, String sCacheName, String format)
Asynchronously create aCacheRequestHolder
for a given request.- Type Parameters:
Req
- the type of the request- Parameters:
request
- the request object to add to the holdersScope
- the scope name to use to identify the CCF to obtain the cache fromsCacheName
- the name of the cache that the request executes againstformat
- the optional serialization format used by requests that contain a payload- Returns:
- a
CompletionStage
that completes when theCacheRequestHolder
has been created
-
createRequestHolder
public <Req> CacheRequestHolder<Req,Void> createRequestHolder(Req request, String sScope, String sCacheName, String format)
Create aCacheRequestHolder
for a given request.- Specified by:
createRequestHolder
in interfaceNamedCacheService
- Type Parameters:
Req
- the type of the request- Parameters:
request
- the request object to add to the holdersScope
- the scope name to use to identify the CCF to obtain the cache fromsCacheName
- the name of the cache that the request executes againstformat
- the optional serialization format used by requests that contain a payload- Returns:
- the
CacheRequestHolder
holding the request
-
-