Monday, March 2, 2009

What Is - Blocking operation not permitted on event dispatch thread


The dispatch thread (or main event thread) processes system messages. Blocking this thread prevents system messages from being processed, which leads to a message queue overflow and termination of the application. To prevent it, BlackBerry Device Software 4.1 and later no longer allow an application to initiate a call to a blocking method from the main event thread.

However, if an application attempts to block on the main event thread, an exception is thrown and the Blocking operation not permitted on event dispatch thread statement appears. To resolve this issue, move any blocking operations into their own threads.

Examples of blocking methods are as follows:

  • the read method of the InputStream class
  • the acceptAndOpen method of the StreamConnectionNotifier interface
  • the doModal method of the Dialog class

No comments:

Post a Comment

Place your comments here...