简体   繁体   English

使用Phonegap / WebWorks的Blackberry中的线程过多

[英]Too many threads in Blackberry using Phonegap/WebWorks

I am developing a Blackberry app using Cordova/PhoneGap . 我正在使用Cordova / PhoneGap开发Blackberry应用程序。 I am fetching several images (map tiles) from a server. 我正在从服务器获取多个图像(地图图块)。 Also, every 60 seconds I send position information to it. 而且,每60秒我就会向其发送一次位置信息。

However, every now and then either when I fetch the images or send information, I get an error. 但是,时不时地获取图像或发送信息时,都会出现错误。 If I am on a simulator (BB 9930, OS 7.0.0.318), I get an AppError 104: Too many threads message and my app crashes. 如果我使用的是模拟器(BB 9930,操作系统7.0.0.318), AppError 104: Too many threads收到AppError 104: Too many threads消息,并且我的应用程序崩溃。 When I test my app on a device (BB 8520, OS 5.0.0.592) not only does the app crashes, but makes the BB reset. 当我在设备(BB 8520,操作系统5.0.0.592)上测试我的应用程序时,不仅该应用程序崩溃,而且使BB重置。

I have seen other posts with the same issue (like this one , this one or this one ). 我看过其他发布了相同问题的帖子(例如本篇本篇本篇 )。 However, I haven't found a solution when building the app using Cordova/PhoneGap (JavaScript). 但是,使用Cordova / PhoneGap(JavaScript)构建应用程序时,我还没有找到解决方案。

Thanks! 谢谢!

This may not be related, but I did have a similar problem when doing a lot of request from a native app on a BB Bold. 这可能没有关系,但是当从BB Bold上的本机应用程序执行大量请求时,我确实遇到了类似的问题。 The connection thread was not closed properly after receiving the answer. 收到答案后,连接线程未正确关闭。

try the following: 尝试以下方法:

  • change GET <-> POST. 更改GET <-> POST。
  • change HTTP <-> HTTPS. 更改HTTP <-> HTTPS。

if the server is yours, evaluate changing the API to return all the images as one and use an offset/clipping when displaying them. 如果服务器是您的服务器,请评估更改API以将所有图像作为一个图像返回,并在显示它们时使用偏移/剪切。 You will save bandwidth and open less connections. 您将节省带宽并减少连接。 your app will load faster. 您的应用将加载得更快。

eg: http://www.ibloomstudios.com/articles/misunderstood_css_clip/ 例如: http : //www.ibloomstudios.com/articles/misunderstood_css_clip/

I doubt if the phoneGap API is causing this as it is basically a layer. 我怀疑phoneGap API是否会造成这种情况,因为它基本上是一层。 Possibly you have an issue with the simulator? 可能您的模拟器有问题?

Since you are also testing on Blackberry 8520, It is recommended that you keep the MAX number of threads - running concurrently- at any point of time in your application - less than 12 由于您还在Blackberry 8520上进行测试,因此建议您在应用程序中的任何时间点将同时运行的最大线程数保持在少于12个

Since you are using Phonegap, chances are that it may be initiating those threads for your application. 由于您正在使用Phonegap,因此很有可能会为您的应用程序启动那些线程。

If the device is connected to your system, connect it to Blackberry JDE and see, which threads are active to analyse if you can reschedule your tasks. 如果设备已连接至系统,则将其连接至Blackberry JDE,然后查看哪些线程处于活动状态以分析您是否可以重新安排任务的时间。

Are you using AJAX to get the map tiles and send location to your server? 您是否正在使用AJAX获取地图图块并将位置发送到服务器?

If you are using AJAX, then you can keep a counter in JavaScript to keep a check on the requests. 如果您使用的是AJAX,则可以在JavaScript中保留一个计数器来检查请求。

Also, have you tried WebWorkers , they would enable you to do all of them within single thread itself. 另外,如果您尝试过WebWorkers ,他们将使您能够在单个线程本身中完成所有这些任务。

If all fails, you can also develop your custom Phonegap plugin to do similar things with a Java Script interface API. 如果全部失败,您还可以开发自定义的Phonegap插件,以使用Java Script接口API进行类似的操作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM