com.iparelan.util
Class ConcurrencyTools.ThreadPoolProxyThreadFactory

java.lang.Object
  extended by com.iparelan.util.ConcurrencyTools.ThreadPoolProxyThreadFactory
All Implemented Interfaces:
ThreadFactory
Enclosing class:
ConcurrencyTools

private static final class ConcurrencyTools.ThreadPoolProxyThreadFactory
extends Object
implements ThreadFactory

The default thread factory


Field Summary
private  AtomicInteger nextSequenceNumber
           
private  String poolName
           
 
Constructor Summary
ConcurrencyTools.ThreadPoolProxyThreadFactory(String poolName)
          Creates a ThreadPoolProxyThreadFactory.
 
Method Summary
 Thread newThread(Runnable runnable)
          Produces a new Thread.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

poolName

private final String poolName

nextSequenceNumber

private final AtomicInteger nextSequenceNumber
Constructor Detail

ConcurrencyTools.ThreadPoolProxyThreadFactory

ConcurrencyTools.ThreadPoolProxyThreadFactory(String poolName)
Creates a ThreadPoolProxyThreadFactory.

Parameters:
poolName - The name of the thread pool. May be neither null nor the empty string.
Throws:
ValidationException - Iff poolName is either null or the empty string.
Method Detail

newThread

public Thread newThread(Runnable runnable)
Produces a new Thread.

Specified by:
newThread in interface ThreadFactory
Parameters:
runnable - Defines the work to be done by the new Thread. May not be null.
Returns:
A new Thread. Never null.
To Do:
  • Consider setDaemon(true) for thread pool threads. Obviates need to shutdown() explicitly? better/easily resource management? could cause some final operations to be abandoned silently before completed...


Copyright © 2008 Iparelan Solutions, LLC. All rights reserved.