Class MutableHandlerRegistry
java.lang.Object
io.grpc.HandlerRegistry
io.grpc.util.MutableHandlerRegistry
Default implementation of
HandlerRegistry.
Uses ConcurrentHashMap to avoid service registration excessively
blocking method lookup.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddService(BindableService bindableService) Registers a service.addService(ServerServiceDefinition service) Registers a service.Note: This does not necessarily return a consistent view of the map.lookupMethod(String methodName, String authority) Note: This does not actually honor the authority provided.booleanremoveService(ServerServiceDefinition service) Removes a registered service.Methods inherited from class HandlerRegistry
lookupMethod
-
Field Details
-
services
-
-
Constructor Details
-
MutableHandlerRegistry
public MutableHandlerRegistry()
-
-
Method Details
-
addService
Registers a service.- Returns:
- the previously registered service with the same service descriptor name if exists,
otherwise
null.
-
addService
Registers a service.- Returns:
- the previously registered service with the same service descriptor name if exists,
otherwise
null.
-
removeService
Removes a registered service.- Returns:
- true if the service was found to be removed.
-
getServices
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/2222") public List<ServerServiceDefinition> getServices()Note: This does not necessarily return a consistent view of the map.- Overrides:
getServicesin classHandlerRegistry
-
lookupMethod
@Nullable public ServerMethodDefinition<?,?> lookupMethod(String methodName, @Nullable String authority) Note: This does not actually honor the authority provided. It will, eventually in the future.- Specified by:
lookupMethodin classHandlerRegistry- Parameters:
methodName- to lookupServerMethodDefinitionfor.authority- the authority for the desired method (to do virtual hosting). Ifnullthe first matching method will be returned.- Returns:
- the resolved method or
nullif no method for that name exists.
-