com.photoviewer.client.util
Class CommandRunner

java.lang.Object
  |
  +--com.photoviewer.client.util.CommandRunner

public class CommandRunner
extends java.lang.Object

This class is somewhat like a thread pool that has one thread in it. It is used to start executing user requests, however, if a 2nd user request comes in while there is a request running, this class will cleanly stop the running task, and then start the new task (thread).

Author:
John De Regnaucourt

Constructor Summary
CommandRunner()
          Construct the CommandRunner.
 
Method Summary
 void execute(Killable target)
          Main external API.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CommandRunner

public CommandRunner()
Construct the CommandRunner. Initialize the single thread-pool like thread that executes Runnables.
Method Detail

execute

public void execute(Killable target)
Main external API. Executes the passed in Killable (Runnable). Before the Runnable is executed, the currently running Killable is stopped (by calling .stop() and interrupting the main thread running the Killable).
Parameters:
target - Killable (Runnable) to run