PerThreadSingleton (dom4j 1.6.1 API)

dom4j API


org.dom4j.util Class PerThreadSingleton

java.lang.Object
  extended byorg.dom4j.util.PerThreadSingleton
All Implemented Interfaces:
SingletonStrategy

public class PerThreadSingleton
extends Object
implements SingletonStrategy

PerThreadSingleton is an implementation of the SingletonStrategy used to provide common factory access to a single object instance based on an implementation strategy for one object instance per thread. This is useful in replace of the ThreadLocal usage.

Version:
$Revision: 1.3 $
Author:
David Lucas

Constructor Summary
PerThreadSingleton()
           
 
Method Summary
 Object instance()
          return a singleton instance of the class specified in setSingletonClass
 void reset()
          reset the instance to a new instance for the implemented strategy
 void setSingletonClassName(String singletonClassName)
          set a singleton class name that will be used to create the singleton based on the strategy implementation of this interface.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PerThreadSingleton

public PerThreadSingleton()
Method Detail

reset

public void reset()
Description copied from interface: SingletonStrategy
reset the instance to a new instance for the implemented strategy

Specified by:
reset in interface SingletonStrategy

instance

public Object instance()
Description copied from interface: SingletonStrategy
return a singleton instance of the class specified in setSingletonClass

Specified by:
instance in interface SingletonStrategy

setSingletonClassName

public void setSingletonClassName(String singletonClassName)
Description copied from interface: SingletonStrategy
set a singleton class name that will be used to create the singleton based on the strategy implementation of this interface. The default constructor of the class will be used and must be public.

Specified by:
setSingletonClassName in interface SingletonStrategy


Copyright © 2001-2005 MetaStuff Ltd.. All Rights Reserved.