Package generic.cache
Class CountingBasicFactory<T>
java.lang.Object
generic.cache.CountingBasicFactory<T>
- All Implemented Interfaces:
BasicFactory<T>
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected AtomicIntegerA counter for tracking the number of items that have been created.protected AtomicInteger -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreate()Creates an instance ofBasicFactory.voidCalled when clients are finished with the given item and it should be disposed.abstract TdoCreate(int itemNumber) The method subclass use to createCountingBasicFactorys.abstract void
-
Field Details
-
counter
A counter for tracking the number of items that have been created. -
disposedCount
-
-
Constructor Details
-
CountingBasicFactory
public CountingBasicFactory()
-
-
Method Details
-
create
Description copied from interface:BasicFactoryCreates an instance ofBasicFactory.- Specified by:
createin interfaceBasicFactory<T>- Returns:
- the new instance of T
- Throws:
Exception- any Exception encountered during creation
-
dispose
Description copied from interface:BasicFactoryCalled when clients are finished with the given item and it should be disposed.- Specified by:
disposein interfaceBasicFactory<T>- Parameters:
t- the item to dispose.
-
doCreate
The method subclass use to createCountingBasicFactorys.- Parameters:
itemNumber- the number of the item being created-- one-based; the first item is item1.- Returns:
- a new instance of
CountingBasicFactory. - Throws:
Exception- any Exception encountered during creation
-
doDispose
-