03-30-2011 02:20 PM
I'm making an app that used the Blackberry Player library, and I run it on a seperate thread. I also do HTTP requests within my app for different things. My problem is that even though the player is on its own thread, it blocks all my HTTP requests, so the program will hang until the song ends (if the user tries to access a different screen that uses a new HTTP request). Anyone any idea why? I use the Blackberry Simulator with the MDS simulator. Unfortunately I can't try it on my phone, but I can't see why that'd make a difference.
03-30-2011 02:30 PM
Are the HTTP requets also in a separate thread (not the event thread)?
03-30-2011 02:32 PM
They're in the event thread. Is that a problem?
03-30-2011 02:42 PM
You should never put a HttpConnection in the event thread because it will block everything until it completes. Try putting all of them in their own threads and see if that fixes your problem.
03-31-2011 09:10 AM
The problem is not that the UI freezes until it completes, rather that the request never completes (though it would were the player thread not running). I've moved the HTTP request to a separate thread but it still does the same thing. Any more ideas? It's like theres a limit to one HTTP request thread or something.
03-31-2011 09:13 AM
Make sure the server you connect to is actually available.
button to give kudos if I helped you 03-31-2011 09:14 AM
Can you let us see how you're creating these calls?
03-31-2011 09:19 AM
I'm doing:
player = Manager.createPlayer(url);
In a method in a PlayerThread, which does this when it is started.
And for the actual HTTP request (which is definitely connectable, as it works as soon as the song finishes):
c = HttpUtils.makeHttpConnection(url, null, null, 0);
Which is also in it's own thread.
03-31-2011 09:22 AM
There isn't a HttpUtils class. Tell us what does HttpUtils.makeHttpConnection do?
button to give kudos if I helped you 03-31-2011 10:17 AM
To answer an earlier question, connection limits are documented here:
I would recommend a download server, a single Thread than handles all the downloads, rather than initiating a Thread for each download.