Package com.tangosol.util
Class NullImplementation.NullResourceRegistry
- java.lang.Object
-
- com.tangosol.util.NullImplementation.NullResourceRegistry
-
- All Implemented Interfaces:
Disposable,ResourceRegistry,ResourceResolver,AutoCloseable
- Enclosing class:
- NullImplementation
public static class NullImplementation.NullResourceRegistry extends Object implements ResourceRegistry
AResourceRegistryimplementation that does nothing.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.tangosol.util.ResourceRegistry
ResourceRegistry.ResourceLifecycleObserver<R>
-
-
Field Summary
Fields Modifier and Type Field Description static NullImplementation.NullResourceRegistryINSTANCESingleton instance of a NullResourceRegistry.-
Fields inherited from interface com.tangosol.util.ResourceRegistry
DEFAULT_NAME
-
-
Constructor Summary
Constructors Constructor Description NullResourceRegistry()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddispose()Invoked when all resources owned by the implementer can safely be released.<R> RgetResource(Class<R> clsResource)Attempts to retrieve the resource that was registered with the specified class.<R> RgetResource(Class<R> clsResource, String sResourceName)Attempts to retrieve the resource that was registered with the specified class and name.<R> StringregisterResource(Class<R> clzResource, Builder<? extends R> bldrResource, RegistrationBehavior behavior, ResourceRegistry.ResourceLifecycleObserver<R> observer)Registers a resource according to the specifiedRegistrationBehavior.<R> StringregisterResource(Class<R> clzResource, String sResourceName, Builder<? extends R> bldrResource, RegistrationBehavior behavior, ResourceRegistry.ResourceLifecycleObserver<R> observer)Registers a resource according to the specifiedRegistrationBehavior.<R> StringregisterResource(Class<R> clzResource, String sResourceName, R resource)Registers the resource with the specified name for later retrieval withResourceResolver.getResource(Class, String).<R> StringregisterResource(Class<R> clzResource, R resource)Registers the resource for later retrieval withResourceResolver.getResource(Class).<R> voidunregisterResource(Class<R> clzResource, String sResourceName)Unregisters the resource that was previously registered of the specified class and name.-
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
-
-
-
-
Field Detail
-
INSTANCE
public static final NullImplementation.NullResourceRegistry INSTANCE
Singleton instance of a NullResourceRegistry.
-
-
Method Detail
-
registerResource
public <R> String registerResource(Class<R> clzResource, R resource)
Description copied from interface:ResourceRegistryRegisters the resource for later retrieval withResourceResolver.getResource(Class).Notes:
- Multiple resources for the same class can be registered if each
resource is registered with a unique name via
ResourceRegistry.registerResource(Class, String, Object) - Registration of resources will occur in a thread-safe manner.
- Resources that are
Disposablewill be disposed when theResourceRegistryis disposed.
- Specified by:
registerResourcein interfaceResourceRegistry- Parameters:
clzResource- the class of the resourceresource- the resource- Returns:
- the actual name used to register the resource
- Multiple resources for the same class can be registered if each
resource is registered with a unique name via
-
registerResource
public <R> String registerResource(Class<R> clzResource, String sResourceName, R resource)
Description copied from interface:ResourceRegistryRegisters the resource with the specified name for later retrieval withResourceResolver.getResource(Class, String).Notes:
- Registration of resources will occur in a thread-safe manner.
- Resources that are
Disposablewill be disposed when theResourceRegistryis disposed.
- Specified by:
registerResourcein interfaceResourceRegistry- Parameters:
clzResource- the class of the resourcesResourceName- the proposed name of the resourceresource- the resource- Returns:
- the actual name used to register the resource
-
registerResource
public <R> String registerResource(Class<R> clzResource, Builder<? extends R> bldrResource, RegistrationBehavior behavior, ResourceRegistry.ResourceLifecycleObserver<R> observer)
Description copied from interface:ResourceRegistryRegisters a resource according to the specifiedRegistrationBehavior. If successful the registered resource may later be retrieved using methodResourceResolver.getResource(Class).Notes:
- Multiple resources for the same class can be registered if each
resource is registered with a unique name via
ResourceRegistry.registerResource(Class, String, Builder, RegistrationBehavior, ResourceLifecycleObserver) - Registration of resources will occur in a thread-safe manner.
- Resources that are
Disposablewill be disposed when theResourceRegistryis disposed.
- Specified by:
registerResourcein interfaceResourceRegistry- Type Parameters:
R- the type of the resource- Parameters:
clzResource- the class of the resourcebldrResource- theBuilderto realize the resource to register (if required the specified behavior requires a resource)behavior- theRegistrationBehaviorto useobserver- an optionalResourceRegistry.ResourceLifecycleObserverthat will be called when the resource is being released from theResourceRegistry(may be null)- Returns:
- the actual name used to register the resource
- Multiple resources for the same class can be registered if each
resource is registered with a unique name via
-
registerResource
public <R> String registerResource(Class<R> clzResource, String sResourceName, Builder<? extends R> bldrResource, RegistrationBehavior behavior, ResourceRegistry.ResourceLifecycleObserver<R> observer) throws IllegalArgumentException
Description copied from interface:ResourceRegistryRegisters a resource according to the specifiedRegistrationBehavior. If successful the registered resource may later be retrieved using methodResourceResolver.getResource(Class, String).Notes:
- Registration of resources will occur in a thread-safe manner.
- Resources that are
Disposablewill be disposed when theResourceRegistryis disposed.
- Specified by:
registerResourcein interfaceResourceRegistry- Type Parameters:
R- the type of the resource- Parameters:
clzResource- the class of the resourcesResourceName- the proposed name of the resourcebldrResource- theBuilderto realize the resource to register (if required the specified behavior requires a resource)behavior- theRegistrationBehaviorto useobserver- an optionalResourceRegistry.ResourceLifecycleObserverthat will be called when the resource is being released from theResourceRegistry(may be null)- Returns:
- the actual name used to register the resource
- Throws:
IllegalArgumentException- if a resource with the specified class is already registered with theResourceRegistryand the behavior wasRegistrationBehavior.FAIL
-
unregisterResource
public <R> void unregisterResource(Class<R> clzResource, String sResourceName)
Description copied from interface:ResourceRegistryUnregisters the resource that was previously registered of the specified class and name.Note: Unregistering a resource does not cause it to be disposed, but it does call
ResourceRegistry.ResourceLifecycleObserver.onRelease(Object)if an observer was provided at the time of registration.- Specified by:
unregisterResourcein interfaceResourceRegistry- Type Parameters:
R- the type of the resource- Parameters:
clzResource- the class of the resourcesResourceName- the name of the resource
-
getResource
public <R> R getResource(Class<R> clsResource)
Description copied from interface:ResourceResolverAttempts to retrieve the resource that was registered with the specified class.- Specified by:
getResourcein interfaceResourceResolver- Type Parameters:
R- the type of the resource- Parameters:
clsResource- the class of the resource- Returns:
- the registered resource or
nullif the resource is unknown to theResourceRegistry
-
getResource
public <R> R getResource(Class<R> clsResource, String sResourceName)
Description copied from interface:ResourceResolverAttempts to retrieve the resource that was registered with the specified class and name.- Specified by:
getResourcein interfaceResourceResolver- Type Parameters:
R- the type of the resource- Parameters:
clsResource- the class of the resourcesResourceName- the name of the resource- Returns:
- the registered resource or
nullif the resource is unknown to theResourceRegistry
-
dispose
public void dispose()
Description copied from interface:DisposableInvoked 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:
disposein interfaceDisposable
-
-