Package org.asynchttpclient.filter

Examples of org.asynchttpclient.filter.FilterException


            long startOfWait = System.currentTimeMillis();
            attemptConcurrencyPermitAcquistion(ctx);

            attemptRateLimitedPermitAcquistion(ctx, startOfWait);
        } catch (InterruptedException e) {
            throw new FilterException(String.format("Interrupted Request %s with AsyncHandler %s", ctx.getRequest(), ctx.getAsyncHandler()));
        }

        return new FilterContext.FilterContextBuilder<T>(ctx).asyncHandler(new AsyncHandlerWrapper<T>(ctx.getAsyncHandler(), available))
                .build();
    }
View Full Code Here


    private <T> void attemptRateLimitedPermitAcquistion(FilterContext<T> ctx, long startOfWait) throws FilterException {
        long wait = getMillisRemainingInMaxWait(startOfWait);

        if (!rateLimiter.tryAcquire(wait, TimeUnit.MILLISECONDS)) {
            throw new FilterException(String.format("Wait for rate limit exceeded during processing Request %s with AsyncHandler %s",
                    ctx.getRequest(), ctx.getAsyncHandler()));
        }
    }
View Full Code Here

        }
    }

    private <T> void attemptConcurrencyPermitAcquistion(FilterContext<T> ctx) throws InterruptedException, FilterException {
        if (!available.tryAcquire(maxWaitMs, TimeUnit.MILLISECONDS)) {
            throw new FilterException(String.format("No slot available for processing Request %s with AsyncHandler %s", ctx.getRequest(),
                    ctx.getAsyncHandler()));
        }
    }
View Full Code Here

        try {
            if (logger.isDebugEnabled()) {
                logger.debug("Current Throttling Status {}", available.availablePermits());
            }
            if (!available.tryAcquire(maxWait, TimeUnit.MILLISECONDS)) {
                throw new FilterException(String.format("No slot available for processing Request %s with AsyncHandler %s",
                        ctx.getRequest(), ctx.getAsyncHandler()));
            }
        } catch (InterruptedException e) {
            throw new FilterException(String.format("Interrupted Request %s with AsyncHandler %s", ctx.getRequest(), ctx.getAsyncHandler()));
        }

        return new FilterContext.FilterContextBuilder<T>(ctx).asyncHandler(new AsyncHandlerWrapper<T>(ctx.getAsyncHandler(), available))
                .build();
    }
View Full Code Here

TOP

Related Classes of org.asynchttpclient.filter.FilterException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.