Package com.oracle.coherence.grpc
Class CacheRequestHolder<Req,Res>
- java.lang.Object
-
- com.oracle.coherence.grpc.RequestHolder<Req,Res>
-
- com.oracle.coherence.grpc.CacheRequestHolder<Req,Res>
-
- Type Parameters:
Req
- the type of the requestRes
- the result type
public class CacheRequestHolder<Req,Res> extends RequestHolder<Req,Res>
A class that holds a gRPC request, an associatedNamedCache
andBinary
converters.- Since:
- 20.06
- Author:
- Jonathan Knight 2019.11.21
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.oracle.coherence.grpc.RequestHolder
RequestHolder.DownConverter, RequestHolder.ErrorHandlingConverter<F,T>, RequestHolder.UpConverter
-
-
Field Summary
Fields Modifier and Type Field Description protected AsyncNamedCache<Binary,Binary>
f_asyncNamedCache
TheAsyncNamedCache
that the request executes against.protected Supplier<NamedCache<?,?>>
f_cacheSupplier
TheSupplier
to use to obtain a non-pass-through cache.protected Converter<Binary,Binary>
m_converterKeyDown
-
Fields inherited from class com.oracle.coherence.grpc.RequestHolder
f_executor, f_request, f_serializer, f_service, f_sFormat, m_converterDown, m_converterUp, m_result
-
-
Constructor Summary
Constructors Constructor Description CacheRequestHolder(Req request, AsyncNamedCache<Binary,Binary> cache, Supplier<NamedCache<?,?>> cacheSupplier, String sFormat, Serializer serializer, Executor executor)
Create aCacheRequestHolder
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Consumer<Binary>
binaryConsumer(io.grpc.stub.StreamObserver<com.google.protobuf.BytesValue> observer)
Binary
convertKeyDown(com.google.protobuf.ByteString bytes)
Convert theByteString
data serialized in the request format to aBinary
key serialized in the cache's serialization format.Binary
convertKeyDown(Binary binary)
protected Converter<Object,Binary>
createConverterDown()
Converter<Binary,Binary>
ensureConverterKeyDown()
Consumer<Map.Entry<? extends Binary,? extends Binary>>
entryConsumer(io.grpc.stub.StreamObserver<com.oracle.coherence.grpc.Entry> observer)
AsyncNamedCache<Binary,Binary>
getAsyncCache()
Obtain theAsyncNamedCache
that the request executes on.NamedCache<Binary,Binary>
getCache()
Obtain theNamedCache
that the request executes on.String
getCacheName()
Obtain the cache name.Serializer
getCacheSerializer()
Obtain the cache'sSerializer
.<K,V>
NamedCache<K,V>getNonPassThruCache()
Obtain theNamedCache
that the request executes on.<T> CompletionStage<CacheRequestHolder<Req,T>>
runAsync(CompletionStage<T> stage)
Return aCompletionStage
that will complete with a value of aRequestHolder
with a result value that is the result of the completion of the specifiedCompletionStage
.-
Methods inherited from class com.oracle.coherence.grpc.RequestHolder
convertDown, convertDown, convertDown, convertUp, deserialize, deserializeRequest, deserializeToBytesValue, ensureConverterDown, ensureConverterUp, fromBinary, getCacheFormat, getDeserializedResult, getRequest, getResult, getSerializer, getServiceSerializer, setResult, toByteString, toBytesValue, toEntry, toEntryResult, toOptionalValue
-
-
-
-
Field Detail
-
f_asyncNamedCache
protected final AsyncNamedCache<Binary,Binary> f_asyncNamedCache
TheAsyncNamedCache
that the request executes against.
-
f_cacheSupplier
protected final Supplier<NamedCache<?,?>> f_cacheSupplier
TheSupplier
to use to obtain a non-pass-through cache.
-
-
Constructor Detail
-
CacheRequestHolder
public CacheRequestHolder(Req request, AsyncNamedCache<Binary,Binary> cache, Supplier<NamedCache<?,?>> cacheSupplier, String sFormat, Serializer serializer, Executor executor)
Create aCacheRequestHolder
.- Parameters:
request
- the cache requestcache
- the pass-throughAsyncNamedCache
that the request executes againstcacheSupplier
- theSupplier
to use to obtain a non-pass-through cachesFormat
- the name of the serializer used to serialize the request payloadsserializer
- theSerializer
used by the requestexecutor
- the executor for asynchronous processing
-
-
Method Detail
-
getCacheName
public String getCacheName()
Obtain the cache name.- Returns:
- the cache name
-
getAsyncCache
public AsyncNamedCache<Binary,Binary> getAsyncCache()
Obtain theAsyncNamedCache
that the request executes on.- Returns:
- the
AsyncNamedCache
that the request executes on
-
getCache
public NamedCache<Binary,Binary> getCache()
Obtain theNamedCache
that the request executes on.- Returns:
- the
NamedCache
that the request executes on
-
getNonPassThruCache
public <K,V> NamedCache<K,V> getNonPassThruCache()
Obtain theNamedCache
that the request executes on.- Type Parameters:
K
- the key typeV
- the value type- Returns:
- the
NamedCache
that the request executes on
-
getCacheSerializer
public Serializer getCacheSerializer()
Obtain the cache'sSerializer
.- Returns:
- the cache's
Serializer
-
convertKeyDown
public Binary convertKeyDown(com.google.protobuf.ByteString bytes)
Convert theByteString
data serialized in the request format to aBinary
key serialized in the cache's serialization format.- Parameters:
bytes
- theByteString
to convert- Returns:
- a
Binary
key in the cache's serialization format
-
ensureConverterKeyDown
public Converter<Binary,Binary> ensureConverterKeyDown()
Obtain theConverter
used to convert between the request format keys and the cache format keys; creating theConverter
if required.- Returns:
- the
Converter
used to convert between the request format keys and the cache format keys
-
createConverterDown
protected Converter<Object,Binary> createConverterDown()
Description copied from class:RequestHolder
- Specified by:
createConverterDown
in classRequestHolder<Req,Res>
- Returns:
- the
Converter
to use to convert from Object form to internalBinary
form
-
runAsync
public <T> CompletionStage<CacheRequestHolder<Req,T>> runAsync(CompletionStage<T> stage)
Return aCompletionStage
that will complete with a value of aRequestHolder
with a result value that is the result of the completion of the specifiedCompletionStage
.- Type Parameters:
T
- the type of theCompletionStage
value- Parameters:
stage
- that stage that will provide the value for theRequestHolder
- Returns:
- a
CompletionStage
that completes with aRequestHolder
-
entryConsumer
public Consumer<Map.Entry<? extends Binary,? extends Binary>> entryConsumer(io.grpc.stub.StreamObserver<com.oracle.coherence.grpc.Entry> observer)
-
-