All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.vrap.rmf.base.client.http.QueueRequestMiddleware Maven / Gradle / Ivy

There is a newer version: 17.17.0
Show newest version

package io.vrap.rmf.base.client.http;

import java.time.Duration;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.ScheduledExecutorService;

import dev.failsafe.spi.Scheduler;

/**
 * Middleware to limit the number of concurrent request using a Queue
 *
 * @include.example io.vrap.rmf.base.client.QueueMiddlewareTest#queueConfiguration()
 *
 * @deprecated use {@link PolicyMiddleware} instead
 */
@Deprecated
public interface QueueRequestMiddleware extends Middleware {
    public static QueueRequestMiddleware of(final ExecutorService executorService, final int maxRequests,
            final Duration maxWaitTime) {
        return new QueueMiddleware(executorService, maxRequests, maxWaitTime);
    }

    public static QueueRequestMiddleware of(final ScheduledExecutorService executorService, final int maxRequests,
            final Duration maxWaitTime) {
        return new QueueMiddleware(executorService, maxRequests, maxWaitTime);
    }

    public static QueueRequestMiddleware of(final Scheduler scheduler, final int maxRequests,
            final Duration maxWaitTime) {
        return new QueueMiddleware(scheduler, maxRequests, maxWaitTime);
    }

    public static QueueRequestMiddleware of(final int maxRequests, final Duration maxWaitTime) {
        return new QueueMiddleware(maxRequests, maxWaitTime);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy