UpdateNoArgsThread.java :  » Image » bungee-view » edu » cmu » cs » bungee » javaExtensions » threads » Java Open Source

Java Open Source » Image » bungee view 
bungee view » edu » cmu » cs » bungee » javaExtensions » threads » UpdateNoArgsThread.java
package edu.cmu.cs.bungee.javaExtensions.threads;

import edu.cmu.cs.bungee.javaExtensions.Util;

/**
 * An UpdateThread where process takes no arguments. update just means "make sure to call process when you get a chance".
 * 
 * @author mad
 *
 */
public class UpdateNoArgsThread extends UpdateThread {

  /**
   * @param name useful for debugging
   * @param deltaPriority this thread's priority relative to the caller's priority
   */
  public UpdateNoArgsThread(String name, int deltaPriority) {
    super(name, deltaPriority);
  }

  /**
   * Request that process be called.
   * @return whether the queue was updated (won't be if there's already a request queued).
   */
  final public synchronized boolean update() {
    return add(this);
  }

  @Override
  final public void process(Object ignore) {
    assert Util.ignore(ignore);
    process();
  }

  /**
   * Override this to carry out the queued request.
   */
  public void process() {
    Util.err("Should override UpdateNoArgsThread.process");

  }
}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.