Jumpi v1.2.0

org.jumpi.impl.threadfactory
Class DaemonThreadFactory

java.lang.Object
  |
  +--org.jumpi.impl.threadfactory.DaemonThreadFactory
All Implemented Interfaces:
Component, Configurable, Manageable, ThreadFactory

public class DaemonThreadFactory
extends java.lang.Object
implements ThreadFactory

A DaemonThreadFactory provides a means of instantiating daemon Threads. Daemon threads left running will not prevent an application terminating. Calling Jumpi.shutdown will normally shutdown internal components. The ThreadFactory does not keep references to it's created Threads. Therefore it is the responsibility of all Jumpi components to allow Threads to terminate once Jumpi.shutdown is called.


Constructor Summary
DaemonThreadFactory()
           
 
Method Summary
 void configure(java.lang.String name, Properties props)
           Configure the DaemonThreadFactory.
 java.lang.String getName()
          Get the fully qualified name of the instance.
 java.lang.Thread getThread(java.lang.Runnable runnable)
          Return a started Thread with the daemon, name and priority attributes as defined in the configuration, for running the provided Runnable instance.
 void manage(Component root, Component parent, java.lang.String operation, java.util.Hashtable parameters)
           Manage the DaemonThreadFactory.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DaemonThreadFactory

public DaemonThreadFactory()
Method Detail

getThread

public java.lang.Thread getThread(java.lang.Runnable runnable)
Return a started Thread with the daemon, name and priority attributes as defined in the configuration, for running the provided Runnable instance.

Specified by:
getThread in interface ThreadFactory
Parameters:
runnable - the Runnable instance to run.
Returns:
the started Thread.
Throws:
java.lang.IllegalArgumentException - when runnable is null.
java.lang.IllegalStateException - when the factory is not started.
See Also:
configure(java.lang.String, org.jumpi.spi.Properties)

getName

public java.lang.String getName()
Get the fully qualified name of the instance. Identical to the name used in configure.

Specified by:
getName in interface Configurable
Returns:
the fully qualified name of the instance.
See Also:
configure(java.lang.String, org.jumpi.spi.Properties)

configure

public void configure(java.lang.String name,
                      Properties props)
               throws java.lang.Exception
Configure the DaemonThreadFactory.

The following configuration attributes are defined:

Specified by:
configure in interface Configurable
Parameters:
name - the fully qualified instance name.
props - the read-only properties to configure the instance with.
Throws:
java.lang.Exception - when configuration is unsuccessful.
java.lang.IllegalArgumentException - if name or props is null or invalid parameters.

manage

public void manage(Component root,
                   Component parent,
                   java.lang.String operation,
                   java.util.Hashtable parameters)
            throws java.lang.Exception

Manage the DaemonThreadFactory.

The following management actions are handled:

Specified by:
manage in interface Manageable
Parameters:
root - the Jumpi instance at the root of the component tree.
parent - the immediate parent of the component.
operation - the operation.
parameters - the operation parameters.
Throws:
java.lang.Exception - if any failure occurs during management.
java.lang.IllegalArgumentException - when parameters are missing.
See Also:
Operation, Parameters

Jumpi v1.2.0

Copyright 2003, Peter Jonathan Klauser.