/** @see java.lang.Runnable#run() */
  public void run() {
    // Perform random actions to the message store every three seconds
    MessageListDemoStore messageStore = MessageListDemoStore.getInstance();
    while (_keepRunning) {
      try {
        synchronized (messageStore) {
          performAction(messageStore);
        }
      } catch (Exception e) {

      }
      try {
        synchronized (this) {
          wait(300000);
        }
      } catch (final InterruptedException e) {
        UiApplication.getUiApplication()
            .invokeLater(
                new Runnable() {
                  public void run() {
                    Dialog.alert("Thread#wait(long) threw " + e.toString());
                  }
                });

        return;
      }
    }
  }
  /**
   * Adds a predefined message to the specified message store
   *
   * @param messageStore The message store to add the message to
   * @param inserted
   */
  private void addInboxMessage(MessageListDemoStore messageStore) {
    DemoMessage message = new DemoMessage();
    String name = "Matt Loves Lauren";
    message.setSender(name);
    int insertedplus1 = (inserted + 1);
    message.setSubject("Love Message " + insertedplus1);
    message.setMessage(baseUrl + messageUrl + Integer.toString(inserted) + bisAddition);
    message.setReceivedTime(System.currentTimeMillis());

    // Assign random preview picture
    message.setPreviewPicture(getRandomPhotoImage());

    // Store message
    messageStore.addInboxMessage(message);

    // Notify folder
    messageStore.getInboxFolder().fireElementAdded(message);
    inserted++;
  }