org.jaitools
Class DaemonThreadFactory

java.lang.Object
  extended by org.jaitools.DaemonThreadFactory
All Implemented Interfaces:
ThreadFactory

public class DaemonThreadFactory
extends Object
implements ThreadFactory

Simple ThreadFactory implementation to supply daemon threads with specified priority. Used by JAITools classes that run polling services on background threads to avoid blocking application exit.

Since:
1.1
Version:
$Id$
Author:
Michael Bedward

Constructor Summary
DaemonThreadFactory()
          Creates a new factory which will supply daemon threads having normal priority.
DaemonThreadFactory(int priority)
          Creates a new factory which will supply daemon threads to run at the specified priority.
DaemonThreadFactory(int priority, String rootName)
          Creates a new factory which will supply daemon threads to run at the specified priority.
 
Method Summary
 Thread newThread(Runnable r)
          Creates a new daemon thread with name and priority assigned as per the values supplied when creating this thread factory.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DaemonThreadFactory

public DaemonThreadFactory()
Creates a new factory which will supply daemon threads having normal priority.


DaemonThreadFactory

public DaemonThreadFactory(int priority)
Creates a new factory which will supply daemon threads to run at the specified priority.

Parameters:
priority - thread priority

DaemonThreadFactory

public DaemonThreadFactory(int priority,
                           String rootName)
Creates a new factory which will supply daemon threads to run at the specified priority. Threads will be named rootName-n where n is the count of threads produced by all instances of this class.

Parameters:
priority - thread priority
rootName - root name to label threads
Method Detail

newThread

public Thread newThread(Runnable r)
Creates a new daemon thread with name and priority assigned as per the values supplied when creating this thread factory.

Specified by:
newThread in interface ThreadFactory
Parameters:
r - target for the new thread
Returns:
new thread


Copyright © 2009-2013. All Rights Reserved.