|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.opensaml.xml.util.AbstractSingletonFactory<Input,Output> org.opensaml.xml.util.AbstractSimpleSingletonFactory<Input,Output>
Input
- the factory input class typeOutput
- the factory output class typepublic abstract class AbstractSimpleSingletonFactory<Input,Output>
A simple implementation of SingletonFactory
.
A WeakHashMap
is used as the underlying store. This ensures that if the input class
instance become otherwise unused (weakly reachable), the input class instance key used
within the factory will not prevent the input class instance from being garbage-collected,
thereby preventing a memory leak.
NOTE: If the output class instance holds a strong or soft reference to the input class,
do not use this factory. See instead AbstractWrappedSingletonFactory
. Usage of this
class in that scenario will result in a memory leak, as the input class instance will never
become weakly reachable and therefore never garbage collected.
Field Summary | |
---|---|
private WeakHashMap<Input,Output> |
map
Storage for the factory. |
Constructor Summary | |
---|---|
AbstractSimpleSingletonFactory()
Constructor. |
Method Summary | |
---|---|
protected Output |
get(Input input)
Get the output instance currently associated with the input instance. |
protected void |
put(Input input,
Output output)
Store the input and output instance association. |
Methods inherited from class org.opensaml.xml.util.AbstractSingletonFactory |
---|
createNewInstance, getInstance |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private WeakHashMap<Input,Output> map
Constructor Detail |
---|
public AbstractSimpleSingletonFactory()
Method Detail |
---|
protected Output get(Input input)
get
in class AbstractSingletonFactory<Input,Output>
input
- the input instance key
protected void put(Input input, Output output)
put
in class AbstractSingletonFactory<Input,Output>
input
- the input instance keyoutput
- the output instance value
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |