ehcache

net.sf.ehcache.constructs.nonstop.util
Class CountingThreadFactory

java.lang.Object
  extended by net.sf.ehcache.constructs.nonstop.util.CountingThreadFactory
All Implemented Interfaces:
ThreadFactory

public class CountingThreadFactory
extends Object
implements ThreadFactory

A custom ThreadFactory that maintains a count of how many threads this factory has created

Author:
Abhishek Sanoujam

Constructor Summary
CountingThreadFactory(ThreadFactory actualFactory)
          Constructor accepting the actual thread factory that will create the threads
 
Method Summary
 int getNumberOfThreads()
          Returns the number of threads this factory has created and currently alive
 Thread newThread(Runnable r)
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CountingThreadFactory

public CountingThreadFactory(ThreadFactory actualFactory)
Constructor accepting the actual thread factory that will create the threads

Parameters:
actualFactory - the actual factory
Method Detail

newThread

public Thread newThread(Runnable r)

Specified by:
newThread in interface ThreadFactory

getNumberOfThreads

public int getNumberOfThreads()
Returns the number of threads this factory has created and currently alive

Returns:
Returns the number of threads this factory has created and currently alive

ehcache

Copyright 2001-2014, Terracotta, Inc.