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
A class that holds a gRPC request, an associated
NamedCache
and Binary
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
Modifier and TypeFieldDescriptionprotected final AsyncNamedCache
<Binary, Binary> TheAsyncNamedCache
that the request executes against.protected final Supplier
<NamedCache<?, ?>> TheSupplier
to use to obtain a non-pass-through cache.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
ConstructorDescriptionCacheRequestHolder
(Req request, AsyncNamedCache<Binary, Binary> cache, Supplier<NamedCache<?, ?>> cacheSupplier, String sFormat, Serializer serializer, Executor executor) Create aCacheRequestHolder
. -
Method Summary
Modifier and TypeMethodDescriptionbinaryConsumer
(io.grpc.stub.StreamObserver<com.google.protobuf.BytesValue> observer) convertKeyDown
(com.google.protobuf.ByteString bytes) Convert theByteString
data serialized in the request format to aBinary
key serialized in the cache's serialization format.convertKeyDown
(Binary binary) entryConsumer
(io.grpc.stub.StreamObserver<com.oracle.coherence.grpc.Entry> observer) Obtain theAsyncNamedCache
that the request executes on.getCache()
Obtain theNamedCache
that the request executes on.Obtain the cache name.Obtain the cache'sSerializer
.<K,
V> NamedCache <K, V> 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 Details
-
f_asyncNamedCache
TheAsyncNamedCache
that the request executes against. -
f_cacheSupplier
TheSupplier
to use to obtain a non-pass-through cache. -
m_converterKeyDown
-
-
Constructor Details
-
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 Details
-
getCacheName
Obtain the cache name.- Returns:
- the cache name
-
getAsyncCache
Obtain theAsyncNamedCache
that the request executes on.- Returns:
- the
AsyncNamedCache
that the request executes on
-
getCache
Obtain theNamedCache
that the request executes on.- Returns:
- the
NamedCache
that the request executes on
-
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
Obtain the cache'sSerializer
.- Returns:
- the cache's
Serializer
-
convertKeyDown
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
-
convertKeyDown
-
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
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
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) -
binaryConsumer
-