Jadex 0.96-beta1

jadex.util.concurrent
Class ThreadPool

java.lang.Object
  extended by jadex.util.concurrent.ThreadPool
All Implemented Interfaces:
IThreadPool, Runnable

public class ThreadPool
extends Object
implements IThreadPool, Runnable

A thread pool manages pool and saves resources and time by precreating and reusing pool.


Nested Class Summary
 class ThreadPool.ServiceThread
          A service thread executes tasks.
 
Constructor Summary
ThreadPool()
          Default constructor, called by the factory.
 
Method Summary
 void dispose()
          Shutdown the task pool
 void execute(Runnable task)
          Execute a task in its own thread.
 Runnable getTask(Thread thread)
          The task for a given thread.
 Thread getThread(Runnable task)
          Get a thread for a task.
static void main(String[] args)
          Main for testing.
 void run()
          The observer thread.
 String toString()
          Get the string representation.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ThreadPool

public ThreadPool()
Default constructor, called by the factory.

Method Detail

execute

public void execute(Runnable task)
Execute a task in its own thread.

Specified by:
execute in interface IThreadPool
Parameters:
task - The task to execute.

dispose

public void dispose()
Shutdown the task pool

Specified by:
dispose in interface IThreadPool

main

public static void main(String[] args)
Main for testing.

Parameters:
args - The arguments.

toString

public String toString()
Get the string representation.

Overrides:
toString in class Object
Returns:
The string representation.

getThread

public Thread getThread(Runnable task)
Get a thread for a task.


getTask

public Runnable getTask(Thread thread)
The task for a given thread.


run

public void run()
The observer thread.

Specified by:
run in interface Runnable

Jadex 0.96-beta1

Submit a bug or feature
For further API reference and developer documentation, see the Jadex User Guide and the Jadex Tutorial. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, and working code examples.

Copyright (C) 2002-2007 Lars Braubach, Alexander Pokahr - University of Hamburg. Use is subject to license terms.