@ExperimentalApi(value="https://github.com/grpc/grpc-java/issues/1914") public final class CompositeCallCredentials extends CallCredentials
CallCredentials
as if they were one. If the first credential fails, the
second will not be used. Both must succeed to allow the RPC.CallCredentials.MetadataApplier, CallCredentials.RequestInfo
Constructor and Description |
---|
CompositeCallCredentials(CallCredentials creds1,
CallCredentials creds2) |
Modifier and Type | Method and Description |
---|---|
void |
applyRequestMetadata(CallCredentials.RequestInfo requestInfo,
Executor appExecutor,
CallCredentials.MetadataApplier applier)
Pass the credential data to the given
CallCredentials.MetadataApplier , which will
propagate it to the request metadata. |
void |
thisUsesUnstableApi()
Should be a noop but never called; tries to make it clearer to implementors that they may break
in the future.
|
public CompositeCallCredentials(CallCredentials creds1, CallCredentials creds2)
public void applyRequestMetadata(CallCredentials.RequestInfo requestInfo, Executor appExecutor, CallCredentials.MetadataApplier applier)
CallCredentials
CallCredentials.MetadataApplier
, which will
propagate it to the request metadata.
It is called for each individual RPC, within the Context
of the call, before the
stream is about to be created on a transport. Implementations should not block in this
method. If metadata is not immediately available, e.g., needs to be fetched from network, the
implementation may give the applier
to an asynchronous task which will eventually call
the applier
. The RPC proceeds only after the applier
is called.
applyRequestMetadata
in class CallCredentials
requestInfo
- request-related informationappExecutor
- The application thread-pool. It is provided to the implementation in case it
needs to perform blocking operations.applier
- The outlet of the produced headers. It can be called either before or after this
method returns.public void thisUsesUnstableApi()
CallCredentials
thisUsesUnstableApi
in class CallCredentials