JavaMail, IMAP, performance with large number of folders

后端 未结 1 1731
臣服心动
臣服心动 2021-01-07 02:55

We are developing a java based mail client for IMAP accounts and use latest java mail api (1.5.6). Our customers have mail accounts with more than 400 folders. Users perform

相关标签:
1条回答
  • 2021-01-07 03:03

    Way too many questions for one post. Let me try to answer a few of them...

    After you close a Folder, you shouldn't use any Message objects from the Folder, so only close the Folder when you're done using its Messages.

    If a single user has 400 folders, you can use a single Store connection since each open Folder will get its own connection.

    If you open and close Folders frequently, increasing the connection pool size can help since the connection for a closed Folder will be added to the pool and reused when you open a new Folder, without needing to create a new connection.

    Closing the Store should close all the Folders for that Store, but there's an inherent race condition if multiple threads are involved. Closing the Store is a way to clean up all the connections when you're done using it, not a way to prevent other threads from re-opening Folders.

    Caching Folder objects for closed Folders is not likely to be a big advantage over calling getFolder each time.

    0 讨论(0)
提交回复
热议问题