[ 
https://issues.apache.org/jira/browse/JAMES-734?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12541303
 ] 

Robert Burrell Donkin commented on JAMES-734:
---------------------------------------------

Consensus seems to be that Iterators are the best choice. All arrays and lists 
in the MailboxAPI should be replaced by Iterators,

> Let MailboxManager return Lists that could be backed lazyly
> -----------------------------------------------------------
>
>                 Key: JAMES-734
>                 URL: https://issues.apache.org/jira/browse/JAMES-734
>             Project: James
>          Issue Type: Improvement
>          Components: IMAPServer
>    Affects Versions: Trunk
>            Reporter: Joachim Draeger
>            Priority: Minor
>
> At the moment MailboxManager uses arrays which is IMO the most clearest and 
> easiest way.
> I still follow the idea of requesting exactly the needed data to reduce the 
> count of queries to e.g. a RDBMS.
> But for example requesting a bunch of headers from a mailbox that could have 
> 10000 msgs by a modem-user could cost a lot of memory for a longer period.
> Future implementations could decide to back the list lazily (at least the 
> Iterator) by chunks of 500 msgs.
> So using the Iterator would be best practice. 
> Why not use just Iterator?    
>  - convenient use of the list methods (toArray, size(), get(i))
>  - possible optimization like "select count(*)" for size()
>  - today's implementation could just use an ArrayList
>  - future implementations will not be too complicated by using wrappers
>    and AbstractList/AbstractSequentialList
> Well, one pitfall are intermediate deletions of results. When the size() has 
> been requested by the client, the list could contain nulls.
> To fulfill the List contract the Iterator has to do the same.
> Saying: "If you didn't call size() before, you don't need to care about null 
> results" would be bad.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to