Package com.tangosol.util
Class SimpleResourceRegistry.RegistryValue
- java.lang.Object
-
- com.tangosol.util.SimpleResourceRegistry.RegistryValue
-
- All Implemented Interfaces:
Disposable
,AutoCloseable
- Enclosing class:
- SimpleResourceRegistry
protected class SimpleResourceRegistry.RegistryValue extends Object implements Disposable
A holder for resource objects and their (optional) respectiveResourceLifecycleObservers
. TheResourceRegistry.ResourceLifecycleObserver.onRelease(Object)
method will be invoked whendispose()
is invoked on this object. Furthermore, if the provided resource implementsDisposable
, itsdispose()
method will be invoked.
-
-
Constructor Summary
Constructors Constructor Description RegistryValue(Object oResource, ResourceRegistry.ResourceLifecycleObserver<Object> observer)
Construct aSimpleResourceRegistry.RegistryValue
object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
dispose()
Invoked when all resources owned by the implementer can safely be released.ResourceRegistry.ResourceLifecycleObserver<Object>
getObserver()
Return the lifecycle observer for the registered resource.Object
getResource()
Return the registered resource.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.oracle.coherence.common.base.Disposable
close
-
-
-
-
Constructor Detail
-
RegistryValue
public RegistryValue(Object oResource, ResourceRegistry.ResourceLifecycleObserver<Object> observer)
Construct aSimpleResourceRegistry.RegistryValue
object.- Parameters:
oResource
- the registered resourceobserver
- the lifecycle observer
-
-
Method Detail
-
getResource
public Object getResource()
Return the registered resource.- Returns:
- the registered resource
-
getObserver
public ResourceRegistry.ResourceLifecycleObserver<Object> getObserver()
Return the lifecycle observer for the registered resource.- Returns:
- the lifecycle observer for the registered resource (may be null)
-
dispose
public void dispose()
Invoked when all resources owned by the implementer can safely be released.Once disposed of the object should no longer be considered to be usable.
Note the Disposable interface is compatible with try-with-resources which will automatically invoke this method.
- Specified by:
dispose
in interfaceDisposable
-
-