Jumpi v1.2.0

org.jumpi.spi.component
Interface ThreadFactory

All Superinterfaces:
Component, Configurable, Manageable
All Known Implementing Classes:
DaemonThreadFactory, ThreadFactoryImpl

public interface ThreadFactory
extends Component

A ThreadFactory provides started Threads to the caller to run the provided Runnable instances.

The Jumpi reference implementation provides a reference to a ThreadFactory through Jumpi.getThreadFactory(). This is used by the the TaskScheduler to provide thread pool threads and threads for long running tasks. Any Jumpi component should retrieve threads through the ThreadFactory and not create its own.

ThreadFactory implementation may determine Thread attributes like priority, name and thread group. More importantly, it allows Jumpi implementations to be embedded into other software systems like J2EE application servers which have existing thread management functions. The implementations can delegate the thread management to these systems from a single location.

Threads started by getThread are expected to be 'long-living'. Jumpi reference implementation uses a thread pool to manage short lived tasks with long lived thread pool threads.


Method Summary
 java.lang.Thread getThread(java.lang.Runnable runnable)
          Get and start a Thread to run the Runnable instance provided.
 
Methods inherited from interface org.jumpi.spi.Configurable
configure, getName
 
Methods inherited from interface org.jumpi.spi.Manageable
manage
 

Method Detail

getThread

public java.lang.Thread getThread(java.lang.Runnable runnable)
Get and start a Thread to run the Runnable instance provided.

Parameters:
runnable - the Runnable instance which the thread should run.
Returns:
the started Thread.
Throws:
java.lang.IllegalArgumentException - when runnable is null.
java.lang.RuntimeException - when unable to create or start the thread.

Jumpi v1.2.0

Copyright © 2003, Peter Jonathan Klauser.