Details
-
Bug
-
Status: Open
-
Minor
-
Resolution: Unresolved
-
3.4.0
-
None
-
None
Description
In the old implementation (James 2.3.x) of iterating over the MX records and resolving their hosts, e.g. used by MailetContext.getSMTPHostAddresses(), it purposely did the lookups lazily, i.e. the hosts for each record were looked up only when it was reached by the iteration. The current implementation does all the lookups for all records up front and then returns them one by one.
I don't know if there was a reason for this change or if it was introduced by mistake, but it seems reasonable that since these hosts are used to try and send messages to the domain, and once it succeeds there is usually no need to continue the iteration, that the old behavior would be much more efficient and trigger many fewer DNS lookups on average.
If there is a good reason for the change, it should be documented in the iterator, otherwise please return the previous behavior.