Package com.networknt.limit
Class LimitHandler
- java.lang.Object
-
- com.networknt.limit.LimitHandler
-
- All Implemented Interfaces:
com.networknt.handler.LightHttpHandler,com.networknt.handler.MiddlewareHandler,io.undertow.server.HttpHandler
public class LimitHandler extends Object implements com.networknt.handler.MiddlewareHandler
A handler which limits the maximum number of concurrent requests. Requests beyond the limit will be queued with limited size of queue. If the queue is full, then request will be dropped.- Author:
- Steve Hu
-
-
Constructor Summary
Constructors Constructor Description LimitHandler()LimitHandler(LimitConfig cfg)Deprecated.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description io.undertow.server.HttpHandlergetNext()voidhandleRequest(io.undertow.server.HttpServerExchange exchange)booleanisEnabled()voidregister()voidreload()com.networknt.handler.MiddlewareHandlersetNext(io.undertow.server.HttpHandler next)-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
-
-
Constructor Detail
-
LimitHandler
@Deprecated public LimitHandler(LimitConfig cfg) throws Exception
Deprecated.This is a constructor for test cases only. Please don't use it.- Parameters:
cfg- limit config- Throws:
Exception- thrown when config is wrong.
-
-
Method Detail
-
handleRequest
public void handleRequest(io.undertow.server.HttpServerExchange exchange) throws Exception- Specified by:
handleRequestin interfaceio.undertow.server.HttpHandler- Throws:
Exception
-
getNext
public io.undertow.server.HttpHandler getNext()
- Specified by:
getNextin interfacecom.networknt.handler.MiddlewareHandler
-
setNext
public com.networknt.handler.MiddlewareHandler setNext(io.undertow.server.HttpHandler next)
- Specified by:
setNextin interfacecom.networknt.handler.MiddlewareHandler
-
isEnabled
public boolean isEnabled()
- Specified by:
isEnabledin interfacecom.networknt.handler.MiddlewareHandler
-
register
public void register()
- Specified by:
registerin interfacecom.networknt.handler.MiddlewareHandler
-
reload
public void reload()
- Specified by:
reloadin interfacecom.networknt.handler.MiddlewareHandler
-
-