@ThreadSafe @ExperimentalApi(value="https://github.com/grpc/grpc-java/issues/933") public final class MutableHandlerRegistry extends HandlerRegistry
MutableHandlerRegistry
.
Uses ConcurrentHashMap
to avoid service registration excessively
blocking method lookup.
Constructor and Description |
---|
MutableHandlerRegistry() |
Modifier and Type | Method and Description |
---|---|
ServerServiceDefinition |
addService(BindableService bindableService)
Registers a service.
|
ServerServiceDefinition |
addService(ServerServiceDefinition service)
Registers a service.
|
List<ServerServiceDefinition> |
getServices()
Note: This does not necessarily return a consistent view of the map.
|
ServerMethodDefinition<?,?> |
lookupMethod(String methodName,
String authority)
Note: This does not actually honor the authority provided.
|
boolean |
removeService(ServerServiceDefinition service)
Removes a registered service
|
lookupMethod
@Nullable public ServerServiceDefinition addService(ServerServiceDefinition service)
null
.@Nullable public ServerServiceDefinition addService(BindableService bindableService)
null
.public boolean removeService(ServerServiceDefinition service)
@ExperimentalApi(value="https://github.com/grpc/grpc-java/issues/2222") public List<ServerServiceDefinition> getServices()
getServices
in class HandlerRegistry
@Nullable public ServerMethodDefinition<?,?> lookupMethod(String methodName, @Nullable String authority)
lookupMethod
in class HandlerRegistry
methodName
- to lookup ServerMethodDefinition
for.authority
- the authority for the desired method (to do virtual hosting). If null
the first matching method will be returned.null
if no method for that name exists.