POP3 library question / problem

jdonth

Member
Licensed User
Longtime User
I am trying to use the Net/POP3 library functions but am having a problem with needing to wait for function completions. For example, is there a way to evoke the DownloadMessage one-at-a-time?

When my email account has more than 20 messages I am getting the following error:

B4X:
Message count:21
popservice1_pop_listcompleted (B4A line: 75)
POP.DownloadMessage(messages.GetKeyAt(i), False) 'Download all messages and don't delete them
java.util.concurrent.RejectedExecutionException
   at java.util.concurrent.ThreadPoolExecutor$AbortPolicy.rejectedExecution(ThreadPoolExecutor.java:1876)
   at java.util.concurrent.ThreadPoolExecutor.reject(ThreadPoolExecutor.java:774)
   at java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:1295)
   at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:33)
   at anywheresoftware.b4a.B4AThreadPool.submit(B4AThreadPool.java:39)
   at anywheresoftware.b4a.BA.submitRunnable(BA.java:301)
   at anywheresoftware.b4a.net.POPWrapper.DownloadMessage(POPWrapper.java:197)
   at dtg.flagmail.popservice1._pop_listcompleted(popservice1.java:384)
   at java.lang.reflect.Method.invokeNative(Native Method)
   at java.lang.reflect.Method.invoke(Method.java:521)
   at anywheresoftware.b4a.BA.raiseEvent2(BA.java:145)
   at anywheresoftware.b4a.BA$3.run(BA.java:279)
   at android.os.Handler.handleCallback(Handler.java:587)
   at android.os.Handler.dispatchMessage(Handler.java:92)
   at android.os.Looper.loop(Looper.java:123)
   at android.app.ActivityThread.main(ActivityThread.java:4719)
   at java.lang.reflect.Method.invokeNative(Native Method)
   at java.lang.reflect.Method.invoke(Method.java:521)
   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:869)
   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:627)
   at dalvik.system.NativeStart.main(Native Method)
 

jdonth

Member
Licensed User
Longtime User
OK, thanks for the link but I am not deleting the messages from the server so I don't see how I can download them one at a time (not sure how to get to the 21st message for example).

Any thoughts?
 
Upvote 0

jdonth

Member
Licensed User
Longtime User
I solved the async problem by putting the DownloadMessage function in a timer and linked it to the DownloadCompleted function with a busy flag.

It works great and also has the side benefit of allowing code to support multiple email addresses within the same service.

Thanks for your assistance.
 
Upvote 0
Top