On 11/6/07, Robert Burrell Donkin <[EMAIL PROTECTED]> wrote: > > https://issues.apache.org/jira/browse/JAMES-734 discusses the general > design of the API > > one major issue for IMAP ATM is that when FETCHing a large quantity of > data, all that data has to be loaded into memory and then the full > result created in a StringBuffer before the output begins. this uses a > lot of memory. > > there are different ways to approach this issue. IMHO using arrays, > lists or iterators is as much a matter of style than substance. > > one approach would be to use result objects which are lazily > populated. this would be reasonably easy for Torque. this would also > mean either adding a close() operation or making the content objects > read-once allowing the result to recycle the memory. > > part of the solution must be to move to a design that allows each line > to be written once out when it has been composed. the interface > changes i've made to the new IMAP implementation are directed at this. > > opinions? > > perferences? > > - robert > >
I would prefer methods which returns List<MessageResult> instead of arrays. Most of the time, the backend will create a list, to aggregate the result, and after can it create an array to return. To optimize further I think, we need an extended Iterator with a size() and release() method, but it's just complicates our life for the start. Zsombor
