Kirill Barkunov
Kirill Barkunov

Reputation: 113

How to listen a huge number of IMAP folders of differnet accounts in one thread?

Let's say I have an IOS mail client and Java server connected with this IOS app.

And I need to have real time pushes when new message arrives to Inbox folder.

Cycle checking of thousands of accounts is very slow...

But if I try to use IMAP Idle, I face the fact, that I need to keep 2 threads for each account that I'm checking. (One thread sleeps on folder.idle() call. the second one is keep the first one alive, because idle state does not last forever).

It's really huge number of java threads.

Is there any way to manage all idling folder in one thread?

Or even another way to have real time pushes?..

Thanks.

Upvotes: 0

Views: 288

Answers (1)

Bill Shannon
Bill Shannon

Reputation: 29971

Use the JavaMail IdleManager.

Upvotes: 1

Related Questions