public class GrpcClient extends Object
| Modifier and Type | Class and Description |
|---|---|
static interface |
GrpcClient.AuthProvider |
static interface |
GrpcClient.ResilientResponseObserver<ReqT,RespT> |
static interface |
GrpcClient.RetryDecision<ReqT> |
| Modifier and Type | Field and Description |
|---|---|
protected com.google.common.util.concurrent.RateLimiter |
immediateRetryLimiter |
protected Condition |
isEventThread |
protected boolean |
sendViaEventLoop |
protected com.google.common.util.concurrent.ListeningScheduledExecutorService |
ses |
protected Executor |
userExecutor |
| Constructor and Description |
|---|
GrpcClient(io.grpc.ManagedChannel channel,
GrpcClient.AuthProvider authProvider,
ScheduledExecutorService executor,
Condition isEventThread,
Executor userExecutor,
boolean sendViaEventLoop,
long defaultTimeoutMs) |
GrpcClient(io.grpc.ManagedChannel channel,
com.google.common.base.Predicate<Throwable> reauthRequired,
Supplier<io.grpc.CallCredentials> credsSupplier,
ScheduledExecutorService executor,
Condition isEventThread,
Executor userExecutor,
boolean sendViaEventLoop,
long defaultTimeoutMs)
Deprecated.
use other constructor
|
| Modifier and Type | Method and Description |
|---|---|
void |
authenticateNow() |
<ReqT,R> com.google.common.util.concurrent.ListenableFuture<R> |
call(io.grpc.MethodDescriptor<ReqT,R> method,
Condition precondition,
ReqT request,
Executor executor,
GrpcClient.RetryDecision<ReqT> retry,
boolean backoff,
io.grpc.Deadline deadline,
long timeoutMs) |
<ReqT,R> com.google.common.util.concurrent.ListenableFuture<R> |
call(io.grpc.MethodDescriptor<ReqT,R> method,
ReqT request,
boolean idempotent) |
<ReqT,R> com.google.common.util.concurrent.ListenableFuture<R> |
call(io.grpc.MethodDescriptor<ReqT,R> method,
ReqT request,
boolean idempotent,
long timeoutMillis,
Executor executor) |
<ReqT,RespT> |
callStream(io.grpc.MethodDescriptor<ReqT,RespT> method,
GrpcClient.ResilientResponseObserver<ReqT,RespT> respStream) |
<ReqT,RespT> |
callStream(io.grpc.MethodDescriptor<ReqT,RespT> method,
GrpcClient.ResilientResponseObserver<ReqT,RespT> respStream,
Executor responseExecutor) |
static boolean |
causedBy(Throwable t,
Class<? extends Throwable> exClass) |
protected static void |
closeStream(io.grpc.stub.StreamObserver<?> stream,
Throwable err) |
static io.grpc.Status.Code |
codeFromThrowable(Throwable t) |
protected static <T> com.google.common.base.Predicate<T> |
constantPredicate(boolean val) |
protected static boolean |
contains(String str,
String subStr) |
protected static <ReqT> io.grpc.stub.StreamObserver<ReqT> |
emptyStream() |
protected static <T> com.google.common.util.concurrent.ListenableFuture<T> |
failInExecutor(Throwable t,
Executor executor) |
protected <ReqT,R> com.google.common.util.concurrent.ListenableFuture<R> |
fuCall(io.grpc.MethodDescriptor<ReqT,R> method,
ReqT request,
io.grpc.CallOptions callOptions) |
protected <ReqT,R> com.google.common.util.concurrent.ListenableFuture<R> |
fuCall(io.grpc.MethodDescriptor<ReqT,R> method,
ReqT request,
io.grpc.CallOptions callOptions,
long timeoutMs) |
protected io.grpc.CallOptions |
getCallOptions() |
ScheduledExecutorService |
getExecutor()
Deprecated.
|
ScheduledExecutorService |
getInternalExecutor()
Care should be taken not to use this executor for any blocking
or CPU intensive tasks.
|
Executor |
getResponseExecutor() |
static boolean |
isConnectException(Throwable t) |
protected boolean |
reauthIfRequired(Throwable error,
io.grpc.CallOptions callOpts) |
protected boolean |
retryableStreamError(Throwable error) |
static <R> GrpcClient.RetryDecision<R> |
retryDecision(boolean idempotent) |
static <I> I |
sentinel(Class<I> intface) |
static Executor |
serialized(Executor parent) |
static Executor |
serialized(Executor parent,
int bufferSize) |
static <T> T |
waitFor(Function<Executor,Future<T>> asyncCall) |
static <T> T |
waitFor(Function<Executor,Future<T>> asyncCall,
Executor fallbackExecutor) |
static <T> T |
waitFor(Future<T> fut) |
static <T> T |
waitFor(Future<T> fut,
long timeoutMillis) |
<T> T |
waitForCall(Function<Executor,Future<T>> asyncCall) |
protected final com.google.common.util.concurrent.ListeningScheduledExecutorService ses
protected final Executor userExecutor
protected final Condition isEventThread
protected final boolean sendViaEventLoop
protected final com.google.common.util.concurrent.RateLimiter immediateRetryLimiter
@Deprecated public GrpcClient(io.grpc.ManagedChannel channel, com.google.common.base.Predicate<Throwable> reauthRequired, Supplier<io.grpc.CallCredentials> credsSupplier, ScheduledExecutorService executor, Condition isEventThread, Executor userExecutor, boolean sendViaEventLoop, long defaultTimeoutMs)
public GrpcClient(io.grpc.ManagedChannel channel,
GrpcClient.AuthProvider authProvider,
ScheduledExecutorService executor,
Condition isEventThread,
Executor userExecutor,
boolean sendViaEventLoop,
long defaultTimeoutMs)
@Deprecated public ScheduledExecutorService getExecutor()
getInternalExecutor()public ScheduledExecutorService getInternalExecutor()
public Executor getResponseExecutor()
public void authenticateNow()
protected io.grpc.CallOptions getCallOptions()
public static <R> GrpcClient.RetryDecision<R> retryDecision(boolean idempotent)
public <ReqT,R> com.google.common.util.concurrent.ListenableFuture<R> call(io.grpc.MethodDescriptor<ReqT,R> method,
ReqT request,
boolean idempotent)
public <ReqT,R> com.google.common.util.concurrent.ListenableFuture<R> call(io.grpc.MethodDescriptor<ReqT,R> method,
ReqT request,
boolean idempotent,
long timeoutMillis,
Executor executor)
public <ReqT,R> com.google.common.util.concurrent.ListenableFuture<R> call(io.grpc.MethodDescriptor<ReqT,R> method,
Condition precondition,
ReqT request,
Executor executor,
GrpcClient.RetryDecision<ReqT> retry,
boolean backoff,
io.grpc.Deadline deadline,
long timeoutMs)
protected static <T> com.google.common.util.concurrent.ListenableFuture<T> failInExecutor(Throwable t, Executor executor)
protected <ReqT,R> com.google.common.util.concurrent.ListenableFuture<R> fuCall(io.grpc.MethodDescriptor<ReqT,R> method,
ReqT request,
io.grpc.CallOptions callOptions,
long timeoutMs)
protected <ReqT,R> com.google.common.util.concurrent.ListenableFuture<R> fuCall(io.grpc.MethodDescriptor<ReqT,R> method,
ReqT request,
io.grpc.CallOptions callOptions)
protected boolean retryableStreamError(Throwable error)
protected boolean reauthIfRequired(Throwable error, io.grpc.CallOptions callOpts)
public static boolean isConnectException(Throwable t)
public static io.grpc.Status.Code codeFromThrowable(Throwable t)
public <ReqT,RespT> io.grpc.stub.StreamObserver<ReqT> callStream(io.grpc.MethodDescriptor<ReqT,RespT> method,
GrpcClient.ResilientResponseObserver<ReqT,RespT> respStream)
public <ReqT,RespT> io.grpc.stub.StreamObserver<ReqT> callStream(io.grpc.MethodDescriptor<ReqT,RespT> method,
GrpcClient.ResilientResponseObserver<ReqT,RespT> respStream,
Executor responseExecutor)
public static <T> T waitFor(Future<T> fut)
public static <T> T waitFor(Future<T> fut, long timeoutMillis)
public static <T> T waitFor(Function<Executor,Future<T>> asyncCall, Executor fallbackExecutor)
protected static void closeStream(io.grpc.stub.StreamObserver<?> stream,
Throwable err)
protected static <ReqT> io.grpc.stub.StreamObserver<ReqT> emptyStream()
protected static <T> com.google.common.base.Predicate<T> constantPredicate(boolean val)
public static <I> I sentinel(Class<I> intface)
Copyright © 2023. All rights reserved.