[
https://issues.apache.org/jira/browse/JAMES-2298?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16676050#comment-16676050
]
ASF GitHub Bot commented on JAMES-2298:
---------------------------------------
Github user chibenwa commented on a diff in the pull request:
https://github.com/apache/james-project/pull/129#discussion_r230981434
--- Diff:
server/queue/queue-file/src/main/java/org/apache/james/queue/file/FileMailQueue.java
---
@@ -390,26 +410,46 @@ public long clear() throws MailQueueException {
return count;
}
- /**
- * TODO: implement me
- */
@Override
public long remove(Type type, String value) throws MailQueueException {
- switch (type) {
- case Name:
- FileItem item = keyMappings.remove(value);
- if (item != null) {
- item.delete();
- return 1;
- } else {
- return 0;
- }
+ try (IndexReader indexReader = IndexReader.open(indexWriter,
true)) {
+ int maxCount = Math.max(1, indexReader.maxDoc());
+ IndexSearcher searcher = new IndexSearcher(indexReader);
+ MutableLong count = new MutableLong();
+ Term term;
+ Query query;
+
+ switch (type) {
--- End diff --
Can you extract this switch case in a separated method?
(You might want to handle term and query in 2 separate methods)
This would also avoid method re-allocation.
> FileMailQueue do not support remove
> -----------------------------------
>
> Key: JAMES-2298
> URL: https://issues.apache.org/jira/browse/JAMES-2298
> Project: James Server
> Issue Type: Bug
> Components: Queue
> Affects Versions: master
> Reporter: Tellier Benoit
> Priority: Major
>
> An exception is thrown or the code badly modify the state of the queue
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]