当前位置:   article > 正文

idel使用方法java,Javamail:为IMAPFolder发出idle()的正确方法

java imap idle

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.

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/从前慢现在也慢/article/detail/567067
推荐阅读
相关标签
  

闽ICP备14008679号