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 CompletionStage
s 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 class
The defaultBaseGrpcServiceImpl.Dependencies
implementation.static interface
The dependencies to configure aBaseGrpcServiceImpl
. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final long
The default transfer threshold.protected final Function
<String, ConfigurableCacheFactory> The function used to obtain ConfigurableCacheFactory instances for a given scope name.protected final BaseGrpcServiceImpl.Dependencies
The serviceBaseGrpcServiceImpl.Dependencies
.protected final Executor
TheExecutor
to use to hand off asynchronous tasks.protected final GrpcProxyMetrics
The proxy service metrics.protected final NamedSerializerFactory
The factory to use to lookup namedSerializer
instances.static final String
Error message used when the cache name is missing for a request.protected long
The transfer threshold used for paged requests.protected static final Void
AVoid
value 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 Executor
createDefaultExecutor
(String sName) Create the defaultExecutor
.protected NamedCache
<Binary, Binary> Obtain anNamedCache
.Return theConfigurableCacheFactory
for the specified scope name.Return the service dependencies.Return theExecutor
this 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 Serializer
getSerializer
(String sFormatRequest, String sFormatProxy, Supplier<Serializer> supplierSerializer, Supplier<ClassLoader> supplierLoader) long
Return the transfer threshold.
-
Field Details
-
VOID
AVoid
value 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 namedSerializer
instances. -
f_executor
TheExecutor
to 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.Dependencies
to use to configure the service
-
-
Method Details
-
getDependencies
Return the service dependencies.- Specified by:
getDependencies
in interfaceGrpcService
- Returns:
- the service dependencies
-
getMetrics
Obtain the gRPC metrics instance for this service.- Returns:
- the gRPC metrics instance for this service
-
getExecutor
Return theExecutor
this service is using for async-requests.- Returns:
- the
Executor
this service is using for async-requests
-
getTransferThreshold
public long getTransferThreshold()Return the transfer threshold.- Returns:
- the
transferThreshold
-
getCCF
Return theConfigurableCacheFactory
for the specified scope name.- Specified by:
getCCF
in interfaceGrpcService
- Parameters:
sScope
- the scope name for theConfigurableCacheFactory
to find- Returns:
- the
ConfigurableCacheFactory
with 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
NamedCache
with 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
-true
to use a binary pass-thru cache- Returns:
- the
NamedCache
with 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:
getSerializer
in 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
-