public class ThrottleFilter extends GenericFilter
503 (Service Unavailable)
,
if there are more than a given number of concurrent
requests, to avoid large backlogs. The number of concurrent requests and the
response messages sent to the user agent, is configurable from the web
descriptor.setMaxConcurrentThreadCount(java.lang.String)
,
setResponseMessages(java.lang.String)
,
Serialized FormModifier and Type | Field and Description |
---|---|
protected static String |
DEFAULT_TYPE
Default response content type
|
protected static String |
DEFUALT_RESPONSE_MESSAGE
Default response message sent to user agents, if the request is rejected
|
protected int |
maxConcurrentThreadCount
Minimum free thread count, defaults to
10 |
oncePerRequest
Constructor and Description |
---|
ThrottleFilter() |
Modifier and Type | Method and Description |
---|---|
protected void |
doFilterImpl(javax.servlet.ServletRequest pRequest,
javax.servlet.ServletResponse pResponse,
javax.servlet.FilterChain pChain)
Invoked once, or each time a request/response pair is passed through the
chain, depending on the
GenericFilter.oncePerRequest member variable. |
void |
setMaxConcurrentThreadCount(String pMaxConcurrentThreadCount)
Sets the minimum free thread count.
|
void |
setResponseMessages(String pResponseMessages)
Sets the response message sent to the user agent, if the request is
rejected.
|
destroy, doFilter, getFilterConfig, getFilterName, getInitParameter, getInitParameterNames, getServletContext, init, init, log, log, setFilterConfig, setOncePerRequest
protected int maxConcurrentThreadCount
10
protected static final String DEFUALT_RESPONSE_MESSAGE
protected static final String DEFAULT_TYPE
public void setMaxConcurrentThreadCount(String pMaxConcurrentThreadCount)
pMaxConcurrentThreadCount
- public void setResponseMessages(String pResponseMessages)
<mime-type>=<filename>,
<mime-type>=<filename>
.
<text/vnd.wap.wmlgt;=</errors/503.wml>,
<text/html>=</errors/503.html>
pResponseMessages
- protected void doFilterImpl(javax.servlet.ServletRequest pRequest, javax.servlet.ServletResponse pResponse, javax.servlet.FilterChain pChain) throws IOException, javax.servlet.ServletException
GenericFilter
GenericFilter.oncePerRequest
member variable.doFilterImpl
in class GenericFilter
pRequest
- pResponse
- pChain
- IOException
javax.servlet.ServletException
GenericFilter.oncePerRequest
,
doFilter
,
Filter.doFilter
Copyright © 2017. All rights reserved.