edu.lmu.liftor
Class Person.Deity

java.lang.Object
  |
  +--edu.lmu.liftor.Person.Deity
All Implemented Interfaces:
java.lang.Runnable
Enclosing class:
Person

public static class Person.Deity
extends java.lang.Object
implements java.lang.Runnable

The Deity class manages the heap of runnable people and tosses them into its private thread pool when they are ready to run.

Each Deity has its own executor that runs the people it pulls from its runQueue. Each person has a deity which they submit to in order to get themselves executed, er, run.


Field Summary
 java.lang.String name
           
 
Method Summary
protected  void abandon(Person p)
          This method is called when a person abandon's their deity.
protected  void convert(Person p)
          Convert the given person to worship this deity.
 int getIdleCount()
           
 int getMaximumPoolSize()
           
 int getPoolSize()
           
 int getPoolUsage()
           
 int getWorshiperCount()
           
 void poke()
          Notifies this deity that there may be a new higher priority supplicant.
 void run()
           
 void start()
          Start the deity (if necessary).
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

name

public final java.lang.String name
Method Detail

getPoolSize

public int getPoolSize()

getIdleCount

public int getIdleCount()

getPoolUsage

public int getPoolUsage()

getMaximumPoolSize

public int getMaximumPoolSize()

getWorshiperCount

public int getWorshiperCount()

convert

protected void convert(Person p)
Convert the given person to worship this deity. Only a person can convert themselves to a deity.


abandon

protected void abandon(Person p)
This method is called when a person abandon's their deity. It is protected so that only a person can abandon their deity.


run

public void run()
Specified by:
run in interface java.lang.Runnable

start

public void start()
Start the deity (if necessary).


poke

public void poke()
Notifies this deity that there may be a new higher priority supplicant. This also creates the deity if he/she/it does not yet exist.


toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object