package edu.calpoly.cpe205.fetter; import javax.swing.*; import java.util.*; import java.io.*; import java.lang.reflect.*; import java.lang.*; import java.awt.*; import javax.swing.event.*; import java.awt.event.*; /** * Instances of this class are returned by the ThreadFreeList so that they * can be assigned a task to perform. After a ReturnThread performs its * assigned task it is recycled by the ThreadFreeList. * @see ThreadFreeList */ // Author: Wes Strickland // Version History // Nov 19, 2000 - comments/pseudocode added // Nov 30, 2000 - (Mike Hebron) class description changed // Jan 17, 2001 - Added calls in run method for Stage One release // Feb 8, 2001 - Moved braces and added comments for Stage Two coding standards public class ReturnThread extends Thread { /** This class executes the run of runnable and adds itself * to the ThreadFreeList for later use *
* Pre-conditions: none
* Post-conditions: a ReturnThread is created and added to the
* ThreadFreeList
*/
public void run()
{
// CALL run of class Runnable
run.run();
// CALL getThreadFreeList of ThreadFreeList
// CALL freeThread with this
// we don't want to put the thread on the list because for some reason the event
// thread will come in here sometimes
//ThreadFreeList.getThreadFreeList().freeThread(this);
}
/**
* Sets the Runnable
*
* Pre-conditions: none
* Post-conditions: Runnable has been set
*/
public void setRunnable(Runnable runner)
{
// SET run to runner
run = runner;
}
protected Runnable run; //Local protected instance of the Runnable class
}