When you develop applications for the BlackBerry smartphone, any network communication or lengthy data processing should be performed in its own thread. This is easy to realize for network input/output (I/O) because network connections must be initiated in their own thread, otherwise a deadlock situation may occur. For more information, see this article.
This is also true when you perform any intensive processing. Lengthy processing should be located in a thread dedicated to this task and should not be performed on the main event thread or a thread that is receiving data.
When an application performs lengthy processing on the main event thread, the BlackBerry smartphone user can perceive the application to be slow because it is unable to process input commands. In an extreme situation, the application can close if it blocks or ties up the main event thread. If an application ties up the main event thread, the system is unable to dispatch messages to it (for example, BlackBerry smartphone user input, UI updates or network I/O). If the application message queue exceeds its limit, the application is terminated with the one of the following errors:
Process [application name] killed due to message queue overflow
Uncaught Exception: [ApplicationName] is not responding; process terminated
If you perform lengthy processing on a thread that is receiving data, a loss of incoming data may occur. When network data arrives on the BlackBerry smartphone, it is received by the operating system (OS) and then passed to the thread that is listening for the incoming data. If the listening thread is busy performing other actions, the OS will queues the data in a finite buffer. Data queued in this buffer can be dropped if the buffer is overflowing. Data stored in this buffer also cannot be passed to the application due to the listening thread performing other processing, or a large amount of data being delivered quickly.
Note: In this situation, all data has been delivered to the BlackBerry smartphone but the application itself is too busy to receive the data; therefore, the data does not arrive in the application.