This is an automated email from the ASF dual-hosted git repository. btellier pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/james-project.git
commit 77f3674cb8834c984b70223e59462a9d420a63b7 Author: Benoit Tellier <[email protected]> AuthorDate: Fri Mar 11 08:43:34 2022 +0700 [PERF] DefaultImapDecoder should avoid needless map writes Most of the time the value is already 0, overwriting it is costly --- .../java/org/apache/james/imap/decode/main/DefaultImapDecoder.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/protocols/imap/src/main/java/org/apache/james/imap/decode/main/DefaultImapDecoder.java b/protocols/imap/src/main/java/org/apache/james/imap/decode/main/DefaultImapDecoder.java index cce1b01..523c626 100644 --- a/protocols/imap/src/main/java/org/apache/james/imap/decode/main/DefaultImapDecoder.java +++ b/protocols/imap/src/main/java/org/apache/james/imap/decode/main/DefaultImapDecoder.java @@ -112,7 +112,10 @@ public class DefaultImapDecoder implements ImapDecoder { return unknownCommand(tag, session); } ImapMessage message = command.parse(request, tag, session); - session.setAttribute(INVALID_COMMAND_COUNT, 0); + Object count = session.getAttribute(INVALID_COMMAND_COUNT); + if (count == null || (int) count > 0) { + session.setAttribute(INVALID_COMMAND_COUNT, 0); + } return message; } } --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
