You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by mojie wang <lj...@gmail.com> on 2019/06/16 15:59:29 UTC
Why not clear InputStream/OutputStream when recycling the
Request/Response in Http11NioProcessor
I found it when debugging my java web project,cause wanna trace the
HttpResponse obejct. to find where and when it's initialized. Since tomcat
don 't clear InputStream/OutputStream when recycling the Request/Response
in Http11NioProcessor ,so i couldn't figure it out.
There are related codes :
In class org.apache.catalina.connector.Request
if (Globals.IS_SECURITY_ENABLED || Connector.RECYCLE_FACADES) {
if (facade != null) {
facade.clear();
facade = null;
}
if (inputStream != null) {
inputStream.clear();
inputStream = null;
}
if (reader != null) {
reader.clear();
reader = null;
}
}
and in class org.apache.catalina.connector.Connector
/**
* Alternate flag to enable recycling of facades.
*/
public static final boolean RECYCLE_FACADES =
Boolean.parseBoolean(System.getProperty("org.apache.catalina.connector.RECYCLE_FACADES",
"false"));
Whether this design for better performance or other essential reasons? I
don't have much knowledge about tomcat, so any help will be appreciated.