de.flothow.prog3.diningsavages
Class Savage

java.lang.Object
  extended by java.lang.Thread
      extended by de.flothow.prog3.diningsavages.Savage
All Implemented Interfaces:
java.lang.Runnable

public class Savage
extends java.lang.Thread

Implementiert einen Wilden als eigenständigen Thread.

Author:
Sebastian Flothow (sebastian@flothow.de)

Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
Savage(int i, Pot pot)
          Erzeugt einen Wilden, der aus dem angegebenen Topf isst.
 
Method Summary
 void run()
          Isst aus dem Topf.
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Savage

public Savage(int i,
              Pot pot)
Erzeugt einen Wilden, der aus dem angegebenen Topf isst.

Parameters:
i - eindeutige Nummer des Wilden, wird in Ausgaben verwendet
pot - Topf, aus dem der Wilde isst
Method Detail

run

public void run()
Isst aus dem Topf. Nimmt in einer Endlosschleife jeweils eine Portion aus dem Topf und isst sie. Falls eine Exception auftritt wird diese auf stderr ausgegeben und der Thread beendet.

Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread