/** * Creates an OkHttp client from the given {@link ClientConfiguration}. Note that the configured {@link * ClientConfiguration#uris URIs} are initialized in random order. */ public static OkHttpClient create( ClientConfiguration config, UserAgent userAgent, HostEventsSink hostEventsSink, Class<?> serviceClass) { return createInternal(config, userAgent, hostEventsSink, serviceClass, true /* randomize URLs */); }
/** * Returns async limiter that users can subscribe to be notified when limit permit has been granted. Caller must * notify the listener to release the permit. */ ConcurrencyLimiter acquireLimiter(Request request) { return acquireLimiterInternal(limiterKey(request)); }
@Override public Call clone() { return doClone(); }
RemotingOkHttpCall newCallWithMutableState( Request request, BackoffStrategy backoffStrategy, int maxNumRelocations) { return new RemotingOkHttpCall( getDelegate().newCall(request), backoffStrategy, urls, this, schedulingExecutor, executionExecutor, concurrencyLimiters.acquireLimiter(request), maxNumRelocations); }
synchronized ListenableFuture<Limiter.Listener> acquire() { SettableFuture<Limiter.Listener> future = SettableFuture.create(); addSlowAcquireMarker(future); waitingRequests.add(future); processQueue(); return future; }
private static boolean isWindowReady(ImmutableSampleWindow sample) { return sample.didDrop() || sample.getSampleCount() > WINDOW_SIZE; }
static RoundRobinUrlInterceptor create(UrlSelector urls) { return new RoundRobinUrlInterceptor(urls); }
static ConcurrencyLimiterListener of(SettableFuture<Limiter.Listener> limiterListener) { return ImmutableConcurrencyLimiterListener.of(limiterListener); }
static CurrentUrlInterceptor create(UrlSelector urls) { return new CurrentUrlInterceptor(urls); }
public static UserAgentInterceptor of(UserAgent userAgent) { return new UserAgentInterceptor(userAgent); }
static UrlSelectorImpl create(Collection<String> baseUrls, boolean randomizeOrder) { return createWithFailedUrlCooldown(baseUrls, randomizeOrder, Duration.ZERO); }
private OkHttpClient createRetryingClient(int maxNumRetries, Duration backoffSlotSize) { return createRetryingClient(maxNumRetries, backoffSlotSize, url); }
RemotingOkHttpCall newCallWithMutableState( Request request, BackoffStrategy backoffStrategy, int maxNumRelocations) { return new RemotingOkHttpCall( getDelegate().newCall(request), backoffStrategy, urls, this, schedulingExecutor, executionExecutor, concurrencyLimiters.acquireLimiter(request), maxNumRelocations); }
/** * Returns async limiter that users can subscribe to be notified when limit permit has been granted. Caller must * notify the listener to release the permit. */ ConcurrencyLimiter acquireLimiter(Request request) { return acquireLimiterInternal(limiterKey(request)); }
/** * Creates an OkHttp client from the given {@link ClientConfiguration}. Note that the configured {@link * ClientConfiguration#uris URIs} are initialized in random order. */ public static OkHttpClient create( ClientConfiguration config, UserAgent userAgent, HostEventsSink hostEventsSink, Class<?> serviceClass) { return createInternal(config, userAgent, hostEventsSink, serviceClass, true /* randomize URLs */); }
@Override public Call clone() { return doClone(); }
static RoundRobinUrlInterceptor create(UrlSelector urls) { return new RoundRobinUrlInterceptor(urls); }
static ConcurrencyLimiterListener of(SettableFuture<Limiter.Listener> limiterListener) { return ImmutableConcurrencyLimiterListener.of(limiterListener); }
static CurrentUrlInterceptor create(UrlSelector urls) { return new CurrentUrlInterceptor(urls); }