Jadex 0.941

jadex.util.concurrent
Class ThreadPool

java.lang.Object
  extended byjadex.util.concurrent.ThreadPool
All Implemented Interfaces:
Runnable

public class ThreadPool
extends Object
implements 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.
 
Method Summary
 void dispose()
          Shutdown the task pool
 void execute(Runnable task)
          Execute a task in its own thread.
static ThreadPool getInstance()
          Get a thread pool singleton.
 ThreadPool.ServiceThread 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
 

Method Detail

getInstance

public static ThreadPool getInstance()
Get a thread pool singleton.

Returns:
The thread pool.

execute

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

Parameters:
task - The task to execute.

dispose

public void dispose()
Shutdown the task pool


main

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

Parameters:
args - The arguments.

toString

public String toString()
Get the string representation.

Returns:
The string representation.

getThread

public ThreadPool.ServiceThread getThread(Runnable task)
Get a thread for a task.


run

public void run()
The observer thread.

Specified by:
run in interface Runnable

Jadex 0.941

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-2005 Lars Braubach, Alexander Pokahr, Andrzej Walczak - University of Hamburg. Use is subject to license terms.