示例#1
0
 /** Clears the pending images list. */
 public void reset() {
   synchronized (mPending) {
     mPending.clear();
     mThumbelina.mReadyProgress.setValue(0);
     mPending.notify();
   }
 }
示例#2
0
 /**
  * Signals the control thread to shut down. Pending actions will be discarded. This call returns
  * immediately without waiting for the thread to terminate.
  */
 public void finish() {
   // Debug.trace();
   synchronized (jobQueue) {
     finish = true;
     jobQueue.notify();
   }
 }
 /**
  * Adds message to the list.
  *
  * @param message new message.
  */
 protected final void addMessage(final Message message) {
   synchronized (messageList) {
     if (message != null) {
       messageList.add(message);
       messageList.notify();
     }
   }
 }
示例#4
0
 /**
  * Adds an action to the tail of the action queue, and signals the thread.
  *
  * @param action - action to be performed
  */
 public void add(Action action) {
   // Debug.trace(action.toString());
   synchronized (jobQueue) {
     jobQueue.add(action);
     // Debug.trace("queue size="+jobQueue.size());
     jobQueue.notify();
   }
 }
示例#5
0
  /**
   * Add an image to the panel.
   *
   * @param image The image to add.
   * @param url The url the image came from.
   * @param background If <code>true</code>, just add to pending list.
   */
  public void add(final Image image, final URL url, final boolean background) {
    Picture picture;
    int size;

    picture = new Picture();
    picture.setImage(image);
    picture.setURL(url);
    if (background)
      synchronized (mPending) {
        mPending.add(picture);
        size = mPending.size();
        if (mThumbelina.mReadyProgress.getMaximum() < size)
          mThumbelina.mReadyProgress.setMaximum(size);
        mThumbelina.mReadyProgress.setValue(size);
        mPending.notify();
      }
    else place(picture, false);
  }
 public void publishEvent(Priority prio, String text) {
   synchronized (evts) {
     evts.add(new EventBufferElement(prio, text));
     if (triggerPrio != null && prio.isGreaterOrEqual(triggerPrio)) evts.notify();
   }
 }
示例#7
0
文件: Main.java 项目: Rfinley93/DDP2P
 /** Interface for communication with main system: to send, simply call enqueue() */
 public static void enqueue(net.ddp2p.common.plugin_data.PluginRequest r) {
   synchronized (queue) {
     queue.add(r);
     queue.notify();
   }
 }
示例#8
0
 public void push(Runnable r) {
   synchronized (mThingsToLoad) {
     mThingsToLoad.add(r);
     mThingsToLoad.notify();
   }
 }