com.tagtraum.perf.threads
Class Runner

java.lang.Object
  |
  +--com.tagtraum.perf.threads.Runner

public class Runner
extends java.lang.Object

Instances of this class are able to execute the run() method of a given Runnable in a thread. Threads are pooled and reused.

Version:
$Id: $
Author:
Hendrik Schreiber

Constructor Summary
Runner(int capacity)
           
 
Method Summary
 void clear()
          Stops and dereferences all RunnerThreads.
 void destroy()
          Stops and dereferences all RunnerThreads and marks this Runner as destroyed.
protected  void finalize()
           
 int getCapacity()
          Number of RunnerThreads that the pool can hold.
protected  com.tagtraum.perf.threads.RunnerThread getRunnerThread(java.lang.Runnable runnable)
           
 java.lang.Class getRunnerThreadClass()
          RunnerThread class.
 boolean isDestroyed()
          Indicates whether this Runner is destroyed.
protected  com.tagtraum.perf.threads.RunnerThread newRunnerThread()
           
 void run(java.lang.Runnable runnable)
          Runs the runnable in a thread.
protected  void setRunnerThreadClass(java.lang.Class runnerThreadClass)
           
 int size()
          Number of RunnerThreads currently in the pool.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Runner

public Runner(int capacity)
Method Detail

run

public void run(java.lang.Runnable runnable)
Runs the runnable in a thread.

Parameters:
runnable - a runnable that shall be run

getRunnerThread

protected com.tagtraum.perf.threads.RunnerThread getRunnerThread(java.lang.Runnable runnable)

newRunnerThread

protected com.tagtraum.perf.threads.RunnerThread newRunnerThread()

getRunnerThreadClass

public java.lang.Class getRunnerThreadClass()
RunnerThread class.


setRunnerThreadClass

protected void setRunnerThreadClass(java.lang.Class runnerThreadClass)

getCapacity

public int getCapacity()
Number of RunnerThreads that the pool can hold.


size

public int size()
Number of RunnerThreads currently in the pool.


toString

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

isDestroyed

public boolean isDestroyed()
Indicates whether this Runner is destroyed.


destroy

public void destroy()
Stops and dereferences all RunnerThreads and marks this Runner as destroyed.


clear

public void clear()
Stops and dereferences all RunnerThreads.


finalize

protected void finalize()
                 throws java.lang.Throwable
Overrides:
finalize in class java.lang.Object
java.lang.Throwable


Copyright © 2002 Hendrik Schreiber
http://www.tagtraum.com/performance/
This software can be distributed under LGPL