You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@james.apache.org by bt...@apache.org on 2023/04/13 07:23:07 UTC

[james-project] 03/07: [ENHANCEMENT] NettyStreamImapRequestLineReader: Buffer command parsing

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 f71681a87c491fda6a47db6949a5c2e7043303af
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Wed Apr 12 13:43:25 2023 +0700

    [ENHANCEMENT] NettyStreamImapRequestLineReader: Buffer command parsing
    
    The first line of the IMAP request is parsed char by char. This generates uneeded
    small operations on the file system when parsing the first line of the APPEND command.
    Buffer it instead.
---
 .../james/imapserver/netty/NettyStreamImapRequestLineReader.java       | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/server/protocols/protocols-imap4/src/main/java/org/apache/james/imapserver/netty/NettyStreamImapRequestLineReader.java b/server/protocols/protocols-imap4/src/main/java/org/apache/james/imapserver/netty/NettyStreamImapRequestLineReader.java
index a5b189dab5..67f922c7c4 100644
--- a/server/protocols/protocols-imap4/src/main/java/org/apache/james/imapserver/netty/NettyStreamImapRequestLineReader.java
+++ b/server/protocols/protocols-imap4/src/main/java/org/apache/james/imapserver/netty/NettyStreamImapRequestLineReader.java
@@ -30,6 +30,7 @@ import org.apache.james.imap.api.display.HumanReadableText;
 import org.apache.james.imap.decode.DecodingException;
 import org.apache.james.imap.message.Literal;
 import org.apache.james.imap.utils.EolInputStream;
+import org.apache.james.util.io.UnsynchronizedBufferedInputStream;
 
 import com.github.fge.lambdas.Throwing;
 import com.google.common.io.ByteStreams;
@@ -87,7 +88,7 @@ public class NettyStreamImapRequestLineReader extends AbstractNettyImapRequestLi
         super(channel, retry);
         this.backingFile = file;
         try {
-            this.in = new CountingInputStream(new FileInputStream(file));
+            this.in = new CountingInputStream(new UnsynchronizedBufferedInputStream(new FileInputStream(file)));
         } catch (FileNotFoundException e) {
             throw new RuntimeException(e);
         }


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org