Package au.csiro.pathling.utilities
Class ObjectHolder.KeyedHolder<C extends Serializable,V>
java.lang.Object
au.csiro.pathling.utilities.ObjectHolder.KeyedHolder<C,V>
- Type Parameters:
C- the configuration typeV- the value type
- All Implemented Interfaces:
ObjectHolder<C,,V> Closeable,AutoCloseable
- Enclosing interface:
ObjectHolder<C extends Serializable,V>
public static class ObjectHolder.KeyedHolder<C extends Serializable,V>
extends Object
implements ObjectHolder<C,V>, Closeable
An implementation of
ObjectHolder that memoises one instance per distinct configuration
within the process. Unlike ObjectHolder.SingletonHolder this permits several configurations to
coexist in the same JVM, which is required when a single process legitimately works with more
than one configuration at a time (for example, querying two local terminology stores).-
Nested Class Summary
Nested classes/interfaces inherited from interface au.csiro.pathling.utilities.ObjectHolder
ObjectHolder.KeyedHolder<C extends Serializable,V>, ObjectHolder.SingletonHolder<C extends Serializable, V> -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Closes this holder and releases the system resources associated with every held instance.getOrCreate(C config) Retrieves the instance associated with given configuration and if necessary creates ones.voidreset()Destroys all the instances stored the underlying scope.
-
Method Details
-
getOrCreate
Description copied from interface:ObjectHolderRetrieves the instance associated with given configuration and if necessary creates ones.- Specified by:
getOrCreatein interfaceObjectHolder<C extends Serializable,V> - Parameters:
config- the configuration for the instance.- Returns:
- the instance associated with the holder.
-
reset
public void reset()Description copied from interface:ObjectHolderDestroys all the instances stored the underlying scope.- Specified by:
resetin interfaceObjectHolder<C extends Serializable,V>
-
close
public void close()Closes this holder and releases the system resources associated with every held instance. If the holder is already empty then invoking this method has no effect.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-