经常调用 IntentService.startService()
我想问一下,当
WakefulIntentService.sendWakefulWork()
或通常
IntentService.startService()
被调用时,是否存在类似意图溢出的情况,而不是等待以前的作业完成。我正在考虑一种情况,由于用户的输入,该作业可能需要 1 分钟,但每 10 秒调用一次。我是否应该实施任何机制来防止开始过多的工作?感谢您的所有回答
I would like to ask if there is something like intent overflow when
WakefulIntentService.sendWakefulWork()
or in general
IntentService.startService()
is called very often not waiting for previous jobs to be finished. I am thinking of a situation that due to user's input it might happen that the job takes 1 minute but it is called every 10 seconds. Should I implement any mechanism to protect from starting too many jobs? Thanks for all answers
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您预计添加的作业会频繁超出已处理的作业,您应该考虑采取一些措施来帮助管理这种情况。虽然我不知道
OutOfMemoryError
之前有一个硬异常 - 除非你有一些相当大的Intent
额外内容,但这里不太可能 - 你的IntentService< /code> 将继续运行、运行、运行。在此过程中,它将消耗 CPU、RAM、可能的带宽(取决于工作内容)以及电池寿命。
If you anticipate frequent stretches where your added jobs exceed the processed jobs, you should consider doing something to help manage that. While I am not aware of a hard exception before
OutOfMemoryError
-- which, unless you have some pretty bigIntent
extras, is rather unlikely here -- yourIntentService
will just keep running and running and running. Along the way, it will be chewing up CPU, RAM, possibly bandwidth (depending on what the work is), and hence battery life.