I'm having the problem that the maximum pool size of a SingleThreadModel
servlet is on Tomcat 5.5 limited to 20 instances. I do not know where to configure it in Tomcat 5.开发者_开发技巧5.
My HTTP connector is declared as follows:
<Connector port="8090" maxHttpHeaderSize="8192"
maxThreads="150" minSpareThreads="25" maxSpareThreads="100"
enableLookups="false" redirectPort="8443" acceptCount="100"
connectionTimeout="20000" disableUploadTimeout="true" />
Do you know where I could configure this?
This is as far as I see not configureable by XML.
It's however programmatically configureable by StandardWrapper#setMaxInstances()
. You could do this in the init()
method of your servlet implementing SingleThreadModel
. I tested it here on Tomcat 7 and it works fine.
@Override
public void init() throws ServletException {
try {
Field wrappedConfig = StandardWrapperFacade.class.getDeclaredField("config");
wrappedConfig.setAccessible(true);
StandardWrapper standardWrapper = (StandardWrapper) wrappedConfig.get(getServletConfig());
standardWrapper.setMaxInstances(100);
} catch (Exception e) {
throw new ServletException("Failed to increment max instances", e);
}
}
This would in theory only not work on a Tomcat instance which is outside your control and might have some restrictive access policy on the particular classes.
精彩评论