Package au.csiro.pathling.utilities
Class ObjectHolder.SingletonHolder<C extends Serializable,V>
java.lang.Object
au.csiro.pathling.utilities.ObjectHolder.SingletonHolder<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.SingletonHolder<C extends Serializable,V>
extends Object
implements ObjectHolder<C,V>, Closeable
A singleton implementation of ObjectHolder that holds a single instance of something.
-
Nested Class Summary
Nested classes/interfaces inherited from interface au.csiro.pathling.utilities.ObjectHolder
ObjectHolder.SingletonHolder<C extends Serializable,V> -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intThe default priority of the shutdown hook. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Closes this singleton and releases any system resources associated with it.getOrCreate(C config) Retrieves the instance associated with given configuration and if necessary creates ones.voidreset()Destroys all the instances stored the underlying scope.
-
Field Details
-
DEFAULT_SHUTDOWN_HOOK_PRIORITY
public static final int DEFAULT_SHUTDOWN_HOOK_PRIORITYThe default priority of the shutdown hook. This is set to be executed after the SparkContext shutdown hook (which has priority 50) and before temporary dirs are cleaned up (priority 25). SeeShutdownHookManagerfor more info on Spark related shutdown hooks.- See Also:
-
-
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 singleton and releases any system resources associated with it. If the singleton is already closed then invoking this method has no effect.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-