赞
踩
I have set MessageCountListener for IMAPFolder. In order to get updates continuously I had to do the following, which is a killer for my app performance wise. It freezes the GUI since it's running for each and every folder.
while (true) {
try {
if (folder != null && folder.isOpen()) {
folder.idle();
} else {
getSyncListenersAttachedFolders().remove(syncFolder.getFolderID());
}
} catch (Exception ex) {
errorLOG.error("IDLE command issue exception.");
getSyncListenersAttachedFolders().remove(syncFolder.getFolderID());
}
}
Is there any better way of issuing idle command which will not run in a while(true) condition.
Expecting a quick response. Thanks in advance.
解决方案
You need to run it in its own thread.
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。