Class BaseGrpcServiceImpl
java.lang.Object
com.oracle.coherence.grpc.proxy.common.BaseGrpcServiceImpl
- All Implemented Interfaces:
 GrpcService
- Direct Known Subclasses:
 BaseNamedCacheServiceImpl,ProxyServiceGrpcImpl
A base class for gRPC services.
 
 The asynchronous processing of CompletionStages is done using an DaemonPoolExecutor
 so as not to consume or block threads in the Fork Join Pool. The DaemonPoolExecutor is
 configurable so that its thread counts can be controlled.
- Since:
 - 23.03
 - Author:
 - Jonathan Knight 2023.02.03
 
- 
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classThe defaultBaseGrpcServiceImpl.Dependenciesimplementation.static interfaceThe dependencies to configure aBaseGrpcServiceImpl. - 
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final longThe default transfer threshold.protected final Function<String, ConfigurableCacheFactory> The function used to obtain ConfigurableCacheFactory instances for a given scope name.protected final BaseGrpcServiceImpl.DependenciesThe serviceBaseGrpcServiceImpl.Dependencies.protected final ExecutorTheExecutorto use to hand off asynchronous tasks.protected final GrpcProxyMetricsThe proxy service metrics.protected final NamedSerializerFactoryThe factory to use to lookup namedSerializerinstances.static final StringError message used when the cache name is missing for a request.protected longThe transfer threshold used for paged requests.protected static final VoidAVoidvalue to make it obvious the return value in Void methods. - 
Constructor Summary
ConstructorsConstructorDescriptionBaseGrpcServiceImpl(BaseGrpcServiceImpl.Dependencies dependencies, String sMBeanName, String sPoolName) Create aBaseGrpcServiceImpl. - 
Method Summary
Modifier and TypeMethodDescriptionprotected static ExecutorcreateDefaultExecutor(String sName) Create the defaultExecutor.protected NamedCache<Binary, Binary> Obtain anNamedCache.Return theConfigurableCacheFactoryfor the specified scope name.Return the service dependencies.Return theExecutorthis service is using for async-requests.Obtain the gRPC metrics instance for this service.protected NamedCache<Binary, Binary> getPassThroughCache(String scope, String cacheName) Obtain anNamedCache.getSerializer(String sFormat, ClassLoader loader) Return a named serializer.protected SerializergetSerializer(String sFormatRequest, String sFormatProxy, Supplier<Serializer> supplierSerializer, Supplier<ClassLoader> supplierLoader) longReturn the transfer threshold. 
- 
Field Details
- 
VOID
AVoidvalue to make it obvious the return value in Void methods. - 
DEFAULT_TRANSFER_THRESHOLD
public static final long DEFAULT_TRANSFER_THRESHOLDThe default transfer threshold.- See Also:
 
 - 
INVALID_CACHE_NAME_MESSAGE
Error message used when the cache name is missing for a request.- See Also:
 
 - 
f_dependencies
The serviceBaseGrpcServiceImpl.Dependencies. - 
f_cacheFactorySupplier
The function used to obtain ConfigurableCacheFactory instances for a given scope name. - 
f_serializerProducer
The factory to use to lookup namedSerializerinstances. - 
f_executor
TheExecutorto use to hand off asynchronous tasks. - 
f_metrics
The proxy service metrics. - 
transferThreshold
protected long transferThresholdThe transfer threshold used for paged requests. 
 - 
 - 
Constructor Details
- 
BaseGrpcServiceImpl
public BaseGrpcServiceImpl(BaseGrpcServiceImpl.Dependencies dependencies, String sMBeanName, String sPoolName) Create aBaseGrpcServiceImpl.- Parameters:
 dependencies- theBaseGrpcServiceImpl.Dependenciesto use to configure the service
 
 - 
 - 
Method Details
- 
getDependencies
Return the service dependencies.- Specified by:
 getDependenciesin interfaceGrpcService- Returns:
 - the service dependencies
 
 - 
getMetrics
Obtain the gRPC metrics instance for this service.- Returns:
 - the gRPC metrics instance for this service
 
 - 
getExecutor
Return theExecutorthis service is using for async-requests.- Returns:
 - the 
Executorthis service is using for async-requests 
 - 
getTransferThreshold
public long getTransferThreshold()Return the transfer threshold.- Returns:
 - the 
transferThreshold 
 - 
getCCF
Return theConfigurableCacheFactoryfor the specified scope name.- Specified by:
 getCCFin interfaceGrpcService- Parameters:
 sScope- the scope name for theConfigurableCacheFactoryto find- Returns:
 - the 
ConfigurableCacheFactorywith the specified scope name 
 - 
getPassThroughCache
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 
NamedCachewith the specified name 
 - 
getCache
Obtain anNamedCache.- Parameters:
 sScope- the scope name to use to obtain the CCF to get the cache fromsCacheName- the name of the cachefPassThru-trueto use a binary pass-thru cache- Returns:
 - the 
NamedCachewith the specified name 
 - 
createDefaultExecutor
Create the defaultExecutor.- Returns:
 - the default 
Executor 
 - 
getSerializer
protected Serializer getSerializer(String sFormatRequest, String sFormatProxy, Supplier<Serializer> supplierSerializer, Supplier<ClassLoader> supplierLoader)  - 
getSerializer
Return a named serializer.- Specified by:
 getSerializerin interfaceGrpcService- Parameters:
 sFormat- the name of the serializerloader- the class loader to use to create the serializer- Returns:
 - a named serializer
 - Throws:
 io.grpc.StatusRuntimeException- if no serializer is configured with the specified name
 
 -