-
Notifications
You must be signed in to change notification settings - Fork 41.5k
Provide a configuration property for configuring Tomcat's processor cache #15054
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Provide a configuration property for configuring Tomcat's processor cache #15054
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR. I've added a few suggestions to make our code style more explicit.
Please be aware that master
has not switched to 2.2.x
yet so we can't really merge this PR at the moment.
@@ -381,6 +382,19 @@ public Session getSession() { | |||
*/ | |||
private final Resource resource = new Resource(); | |||
|
|||
/** | |||
* Configuring processor cache. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please polish the property description?
/** | ||
* Configuring processor cache. | ||
*/ | ||
private int processorCache = 200; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We try to order things a bit more naturally. This property could be moved below acceptCount
.
*/ | ||
private int processorCache = 200; | ||
|
||
public int getProcessorCache() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The getter/setter pair should be added in the right order (after the one for acceptCount
) rather than adding them where they are now.
@@ -280,6 +280,12 @@ public void testCustomizeMinSpareThreads() { | |||
assertThat(this.serverProperties.getTomcat().getMinSpareThreads()).isEqualTo(10); | |||
} | |||
|
|||
@Test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto. Please add this test after customAcceptCount
@@ -284,6 +284,7 @@ content into your application. Rather, pick only the properties that you need. | |||
server.tomcat.resource.cache-ttl= # Time-to-live of the static resource cache. | |||
server.tomcat.uri-encoding=UTF-8 # Character encoding to use to decode the URI. | |||
server.tomcat.use-relative-redirects= # Whether HTTP 1.1 and later location headers generated by a call to sendRedirect will use relative or absolute redirects. | |||
server.tomcat.processor-cache= # Custom value for Tomcat's processor cache. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Properties are ordered in natural order. This property must be moved.
Also, the field description must match the description here.
@snicoll, thank you for your suggestion, I have updated pull request this suggestions. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the quick feedback. Unfortunately, we're not there yet, I've added two suggestions.
@@ -369,6 +370,15 @@ public Session getSession() { | |||
*/ | |||
private int acceptCount = 100; | |||
|
|||
/** | |||
* The maximum number of idle processors that will be retained in the cache and |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you but we're not there yet. Could you please look at other keys in ServerProperties
for inspiration? Key description does not start with a
or the
and can't contain javadoc tags as these are not processed by the annotation processed. We don't document default value either as the value is already set there and made available in the metadata.
Looking at your update, this looks ideal to me:
Maximum number of idle processors that will be retained in the cache and reused with a subsequent request.
Please note that key descriptions are not meant to copy/paste the official documentation of the thing it's configuring.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, thx for advice
@@ -276,6 +276,7 @@ content into your application. Rather, pick only the properties that you need. | |||
server.tomcat.max-threads=200 # Maximum amount of worker threads. | |||
server.tomcat.min-spare-threads=10 # Minimum amount of worker threads. | |||
server.tomcat.port-header=X-Forwarded-Port # Name of the HTTP header used to override the original port value. | |||
server.tomcat.processor-cache= # The maximum number of idle processors that will be retained in the cache and re-used with a subsequent request. The default is 200. A value of -1 means unlimited. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is still a different description than the field javadoc. As indicated previously, they must be identical.
(When a description is a bit more lengthy than usual, we take the first sentence only but that's not the case here).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, thx for advice
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the super quick update on the suggestions!
… into provide-configuration-processor-cache
… into provide-configuration-processor-cache
* pr/15054: Polish contribution Add configuration property for configuring Tomcat's processor cache
Thanks @ayudovin, I've merged your contribution with a polish commit. |
@snicoll, thank you! |
this enhancement