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 2022/03/22 02:01:47 UTC
[james-project] 16/29: JAMES-3715 Avoid creating a CONTINUATION REQUEST on each IMAP request
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 69aa3169fdea63c392426bcd1b72f2114b0fd0ea
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Fri Mar 11 09:57:25 2022 +0700
JAMES-3715 Avoid creating a CONTINUATION REQUEST on each IMAP request
This field can be static, not modifiable. Creating it was taking up to
1.7% of CPU decoding time
---
.../james/imapserver/netty/AbstractNettyImapRequestLineReader.java | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/server/protocols/protocols-imap4/src/main/java/org/apache/james/imapserver/netty/AbstractNettyImapRequestLineReader.java b/server/protocols/protocols-imap4/src/main/java/org/apache/james/imapserver/netty/AbstractNettyImapRequestLineReader.java
index a3f6c6a..9230b50 100644
--- a/server/protocols/protocols-imap4/src/main/java/org/apache/james/imapserver/netty/AbstractNettyImapRequestLineReader.java
+++ b/server/protocols/protocols-imap4/src/main/java/org/apache/james/imapserver/netty/AbstractNettyImapRequestLineReader.java
@@ -18,6 +18,8 @@
****************************************************************/
package org.apache.james.imapserver.netty;
+import java.nio.charset.StandardCharsets;
+
import org.apache.james.imap.decode.ImapRequestLineReader;
import io.netty.buffer.ByteBuf;
@@ -25,8 +27,9 @@ import io.netty.buffer.Unpooled;
import io.netty.channel.Channel;
public abstract class AbstractNettyImapRequestLineReader extends ImapRequestLineReader {
+ private static final ByteBuf CONTINUATION_REQUEST = Unpooled.wrappedUnmodifiableBuffer(Unpooled.wrappedBuffer("+ Ok\r\n".getBytes(StandardCharsets.US_ASCII)));
+
private final Channel channel;
- private final ByteBuf cRequest = Unpooled.wrappedBuffer("+ Ok\r\n".getBytes());
private final boolean retry;
public AbstractNettyImapRequestLineReader(Channel channel, boolean retry) {
@@ -41,7 +44,7 @@ public abstract class AbstractNettyImapRequestLineReader extends ImapRequestLine
// request..
if (!retry) {
- channel.writeAndFlush(cRequest);
+ channel.writeAndFlush(CONTINUATION_REQUEST);
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org