Package org.opendaylight.yangtools.util
Class RecursiveObjectLeaker
- java.lang.Object
-
- org.opendaylight.yangtools.util.RecursiveObjectLeaker
-
@Beta @Deprecated(forRemoval=true) public final class RecursiveObjectLeaker extends Object
Deprecated, for removal: This API element is subject to removal in a future version.This class is not used anywhere anymore and is scheduled for removal in the next major release.Thread-local hack to make recursive extensions work without too much hassle. The idea is that prior to instantiating an extension, the definition object checks whether it is already present on the stack, recorded object is returned.If it is not, it will push itself to the stack as unresolved and invoke the constructor. The constructor's lowermost class calls to this class and if the topmost entry is not resolved, it will leak itself.
Upon return from the constructor, the topmost entry is removed and if the queue is empty, the thread-local variable will be cleaned up.
WARNING: BE CAREFUL WHEN USING THIS CLASS. IT LEAKS OBJECTS WHICH ARE NOT COMPLETELY INITIALIZED.
WARNING: THIS CLASS LEAVES THREAD-LOCAL RESIDUE. MAKE SURE IT IS OKAY OR CALL
cleanup()
IN APPROPRIATE PLACES.THIS CLASS IS EXTREMELY DANGEROUS (okay, not as much as sun.misc.unsafe). YOU HAVE BEEN WARNED. IF SOMETHING BREAKS IT IS PROBABLY YOUR FAULT AND YOU ARE ON YOUR OWN.
- Author:
- Robert Varga
-
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static void
afterConstructor(Object key)
Deprecated, for removal: This API element is subject to removal in a future version.static void
beforeConstructor(Object key)
Deprecated, for removal: This API element is subject to removal in a future version.static void
cleanup()
Deprecated, for removal: This API element is subject to removal in a future version.static void
inConstructor(Object obj)
Deprecated, for removal: This API element is subject to removal in a future version.static <T> @Nullable T
lookup(Object key, Class<T> requiredClass)
Deprecated, for removal: This API element is subject to removal in a future version.
-
-
-
Method Detail
-
beforeConstructor
public static void beforeConstructor(Object key)
Deprecated, for removal: This API element is subject to removal in a future version.
-
inConstructor
public static void inConstructor(Object obj)
Deprecated, for removal: This API element is subject to removal in a future version.
-
afterConstructor
public static void afterConstructor(Object key)
Deprecated, for removal: This API element is subject to removal in a future version.
-
lookup
public static <T> @Nullable T lookup(Object key, Class<T> requiredClass)
Deprecated, for removal: This API element is subject to removal in a future version.
-
cleanup
public static void cleanup()
Deprecated, for removal: This API element is subject to removal in a future version.
-
-