I am developing a project for BB. The application works with the network and sends / receives data via HTTP. Now I use the queue and queue manager. The manager starts with a background thread and works in a while (true) loop, checking the queue for new transactions on the server. If the queue is not empty, the transaction is executed, otherwise the manager goes into standby mode for 200 ms.
The transaction process is as follows: - Starts another thread (using Runnable) that opens the connection to the network and the first thread waiting for the background thread or timeout (and for this we need a loop) that we set up. - If the connection is established, then another thread starts (using Runnable), which launches getResponseCode () and the first thread waiting for the background thread or timeout (and for this we need a loop) that we set up.
Before that, we show a pop-up window with the image returned in turn and after it has been deleted. It is synchronized through Application.getEventLock ().
Sometimes I’m unstable, and a sleep stream for a long time ignores the timeout wait loop.
I would like to know how important this approach is, what advice and best practices, what is your experience?
I use 4.5, 4.6, 4.7 and 5.0.
source
share