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:05 UTC
[james-project] 01/07: [FIX] IMAP APPEND file deletion should be done on boundedElastic
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 1eb2f52ded57f6c7e5b45e380483c0f2324baaba
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Wed Apr 12 10:25:49 2023 +0700
[FIX] IMAP APPEND file deletion should be done on boundedElastic
---
.../imapserver/netty/NettyStreamImapRequestLineReader.java | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
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 57069c7576..e0c67c413e 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
@@ -24,19 +24,23 @@ import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
+import java.nio.file.Files;
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 com.github.fge.lambdas.Throwing;
import com.google.common.io.ByteStreams;
import com.google.common.io.CountingInputStream;
import io.netty.channel.Channel;
+import reactor.core.publisher.Mono;
+import reactor.core.scheduler.Schedulers;
public class NettyStreamImapRequestLineReader extends AbstractNettyImapRequestLineReader implements Closeable {
- private class FileLiteral implements Literal, Closeable {
+ private static class FileLiteral implements Literal, Closeable {
private final long offset;
private final int size;
private final boolean extraCRLF;
@@ -53,7 +57,9 @@ public class NettyStreamImapRequestLineReader extends AbstractNettyImapRequestLi
@Override
public void close() {
- file.delete();
+ Mono.fromRunnable(Throwing.runnable(() -> Files.delete(file.toPath())))
+ .subscribeOn(Schedulers.boundedElastic())
+ .subscribe();
}
@Override
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org