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 associatedNamedCacheandBinaryconverters.- 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_asyncNamedCacheTheAsyncNamedCachethat the request executes against.protected Supplier<NamedCache<?,?>>f_cacheSupplierTheSupplierto 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)BinaryconvertKeyDown(com.google.protobuf.ByteString bytes)Convert theByteStringdata serialized in the request format to aBinarykey serialized in the cache's serialization format.BinaryconvertKeyDown(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 theAsyncNamedCachethat the request executes on.NamedCache<Binary,Binary>getCache()Obtain theNamedCachethat the request executes on.StringgetCacheName()Obtain the cache name.SerializergetCacheSerializer()Obtain the cache'sSerializer.<K,V>
NamedCache<K,V>getNonPassThruCache()Obtain theNamedCachethat the request executes on.<T> CompletionStage<CacheRequestHolder<Req,T>>runAsync(CompletionStage<T> stage)Return aCompletionStagethat will complete with a value of aRequestHolderwith 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
TheAsyncNamedCachethat the request executes against.
-
f_cacheSupplier
protected final Supplier<NamedCache<?,?>> f_cacheSupplier
TheSupplierto 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-throughAsyncNamedCachethat the request executes againstcacheSupplier- theSupplierto use to obtain a non-pass-through cachesFormat- the name of the serializer used to serialize the request payloadsserializer- theSerializerused 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 theAsyncNamedCachethat the request executes on.- Returns:
- the
AsyncNamedCachethat the request executes on
-
getCache
public NamedCache<Binary,Binary> getCache()
Obtain theNamedCachethat the request executes on.- Returns:
- the
NamedCachethat the request executes on
-
getNonPassThruCache
public <K,V> NamedCache<K,V> getNonPassThruCache()
Obtain theNamedCachethat the request executes on.- Type Parameters:
K- the key typeV- the value type- Returns:
- the
NamedCachethat 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 theByteStringdata serialized in the request format to aBinarykey serialized in the cache's serialization format.- Parameters:
bytes- theByteStringto convert- Returns:
- a
Binarykey in the cache's serialization format
-
ensureConverterKeyDown
public Converter<Binary,Binary> ensureConverterKeyDown()
Obtain theConverterused to convert between the request format keys and the cache format keys; creating theConverterif required.- Returns:
- the
Converterused 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:
createConverterDownin classRequestHolder<Req,Res>- Returns:
- the
Converterto use to convert from Object form to internalBinaryform
-
runAsync
public <T> CompletionStage<CacheRequestHolder<Req,T>> runAsync(CompletionStage<T> stage)
Return aCompletionStagethat will complete with a value of aRequestHolderwith a result value that is the result of the completion of the specifiedCompletionStage.- Type Parameters:
T- the type of theCompletionStagevalue- Parameters:
stage- that stage that will provide the value for theRequestHolder- Returns:
- a
CompletionStagethat completes with aRequestHolder
-
entryConsumer
public Consumer<Map.Entry<? extends Binary,? extends Binary>> entryConsumer(io.grpc.stub.StreamObserver<com.oracle.coherence.grpc.Entry> observer)
-
-