Diego,
I went back and reviewed the thread "FIFO spool manager" from January 24,
2003.
> I thought about making it configurable via something like:
> <config>
> <enforce-fifo>true</enforce-fifo>
> </config>
That would have been a good idea. For each call to accept(), we call
list(). On a system with a large spool queue, we could be expending
considerable additional resources.
Please review the below, which I expect to commit to CVS. It adds an
(undocumented for now) FIFO attribute, e.g.,
<repository destinationURL="file://var/mail/spool/" type="SPOOL"
FIFO="true" />
The default is false.
> I found that the simplest the change would be, the greater its
> chances to get approved.
Not always. :-)
--- Noel
diff -u -r1.20.4.9 AvalonMailRepository.java
--- src/java/org/apache/james/mailrepository/AvalonMailRepository.java 28
Aug 2003 16:32:02 -0000 1.20.4.9
+++ src/java/org/apache/james/mailrepository/AvalonMailRepository.java 24
Sep 2003 14:58:53 -0000
@@ -108,6 +108,7 @@
private ObjectRepository or;
private String destination;
private Set keys;
+ private boolean fifo;
/**
* @see
org.apache.avalon.framework.component.Composable#compose(ComponentManager)
@@ -135,6 +136,7 @@
}
throw new ConfigurationException(exceptionString);
}
+ fifo = conf.getAttributeAsBoolean("FIFO", false);
// ignore model
}
@@ -446,10 +448,11 @@
public Iterator list() {
// Fix ConcurrentModificationException by cloning
// the keyset before getting an iterator
- final Collection clone;
+ final ArrayList clone;
synchronized(keys) {
clone = new ArrayList(keys);
}
+ if (fifo) Collections.sort(clone); // keys is a HashSet; impose
FIFO for apps that need it
return clone.iterator();
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]