james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Joachim Draeger (JIRA)" <server-...@james.apache.org>
Subject [jira] Created: (JAMES-734) Let MailboxManager return Lists that could be backed lazyly
Date Tue, 12 Dec 2006 10:34:21 GMT
Let MailboxManager return Lists that could be backed lazyly
-----------------------------------------------------------

                 Key: JAMES-734
                 URL: http://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.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


Mime
View raw message