|
Oracle® Coherence Java API Reference Release 12.1.2.0.3 E26043-02 |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object
com.tangosol.util.SimpleResourceRegistry
public class SimpleResourceRegistry
A SimpleResourceRegistry
is a basic implementation of a ResourceRegistry
.
Nested Class Summary | |
---|---|
protected class |
SimpleResourceRegistry.RegistryKey Key class for a registered resource. |
protected class |
SimpleResourceRegistry.RegistryValue A holder for resource objects and their (optional) respective ResourceLifecycleObservers . |
Nested classes/interfaces inherited from interface com.tangosol.util.ResourceRegistry |
---|
ResourceRegistry.ResourceLifecycleObserver |
Field Summary |
---|
Fields inherited from interface com.tangosol.util.ResourceRegistry |
---|
DEFAULT_NAME |
Constructor Summary | |
---|---|
SimpleResourceRegistry() Construct a SimpleResourceRegistry . |
Method Summary | |
---|---|
void |
dispose() |
java.lang.Object |
getResource(java.lang.Class clzResource) Attempts to retrieve the resource that was registered with the specified class. |
java.lang.Object |
getResource(java.lang.Class clzResource, java.lang.String sResourceName) Attempts to retrieve the resource that was registered with the specified class and name. |
boolean |
isEmpty() Determine if the ResourceRegistry is empty (contains no resource registrations). |
java.lang.String |
registerResource(java.lang.Class clzResource, Builder bldrResource, RegistrationBehavior behavior, ResourceRegistry.ResourceLifecycleObserver observer) Registers a resource according to the specified RegistrationBehavior . |
java.lang.String |
registerResource(java.lang.Class clzResource, java.lang.Object resource) Registers the resource for later retrieval with ResourceResolver.getResource(Class) . |
java.lang.String |
registerResource(java.lang.Class clzResource, java.lang.String sResourceName, Builder bldrResource, RegistrationBehavior behavior, ResourceRegistry.ResourceLifecycleObserver observer) Registers a resource according to the specified RegistrationBehavior . |
java.lang.String |
registerResource(java.lang.Class clzResource, java.lang.String sResourceName, java.lang.Object resource) Registers the resource with the specified name for later retrieval with ResourceResolver.getResource(Class, String) . |
void |
unregisterResource(java.lang.Class clzResource, java.lang.String sResourceName) Unregisters the resource that was previously registered of the specified class and name. |
Constructor Detail |
---|
public SimpleResourceRegistry()
SimpleResourceRegistry
.Method Detail |
---|
public boolean isEmpty()
ResourceRegistry
is empty (contains no resource registrations).public void dispose()
dispose
in interface com.oracle.common.base.Disposable
public java.lang.Object getResource(java.lang.Class clzResource)
getResource
in interface ResourceResolver
clzResource
- the class of the resourcenull
if the resource is unknown to the ResourceRegistry
public java.lang.Object getResource(java.lang.Class clzResource, java.lang.String sResourceName)
getResource
in interface ResourceResolver
clzResource
- the class of the resourcesResourceName
- the name of the resourcenull
if the resource is unknown to the ResourceRegistry
public java.lang.String registerResource(java.lang.Class clzResource, java.lang.Object resource) throws java.lang.IllegalArgumentException
ResourceResolver.getResource(Class)
.
Notes:
ResourceRegistry.registerResource(Class, String, Object)
Disposable
will be disposed when the ResourceRegistry
is disposed.registerResource
in interface ResourceRegistry
clzResource
- the class of the resourceresource
- the resourcejava.lang.IllegalArgumentException
- if a resource of the same specified type is already registeredpublic java.lang.String registerResource(java.lang.Class clzResource, java.lang.String sResourceName, java.lang.Object resource) throws java.lang.IllegalArgumentException
ResourceResolver.getResource(Class, String)
.
Notes:
Disposable
will be disposed when the ResourceRegistry
is disposed.registerResource
in interface ResourceRegistry
clzResource
- the class of the resourcesResourceName
- the proposed name of the resourceresource
- the resourcejava.lang.IllegalArgumentException
- if a resource of the same specified type and name is already registeredpublic java.lang.String registerResource(java.lang.Class clzResource, Builder bldrResource, RegistrationBehavior behavior, ResourceRegistry.ResourceLifecycleObserver observer) throws java.lang.IllegalArgumentException
RegistrationBehavior
. If successful the registered resource may later be retrieved using method ResourceResolver.getResource(Class)
.
Notes:
ResourceRegistry.registerResource(Class, String, Builder, RegistrationBehavior, ResourceLifecycleObserver)
Disposable
will be disposed when the ResourceRegistry
is disposed.registerResource
in interface ResourceRegistry
clzResource
- the class of the resourcebldrResource
- the Builder
to realize the resource to register (if required the specified behavior requires a resource)behavior
- the RegistrationBehavior
to useobserver
- an optional ResourceRegistry.ResourceLifecycleObserver
that will be called when the resource is being released from the ResourceRegistry
(may be null)java.lang.IllegalArgumentException
- if a resource with the specified class is already registered with the ResourceRegistry
and the behavior was RegistrationBehavior.FAIL
public java.lang.String registerResource(java.lang.Class clzResource, java.lang.String sResourceName, Builder bldrResource, RegistrationBehavior behavior, ResourceRegistry.ResourceLifecycleObserver observer) throws java.lang.IllegalArgumentException
RegistrationBehavior
. If successful the registered resource may later be retrieved using method ResourceResolver.getResource(Class, String)
.
Notes:
Disposable
will be disposed when the ResourceRegistry
is disposed.registerResource
in interface ResourceRegistry
clzResource
- the class of the resourcesResourceName
- the proposed name of the resourcebldrResource
- the Builder
to realize the resource to register (if required the specified behavior requires a resource)behavior
- the RegistrationBehavior
to useobserver
- an optional ResourceRegistry.ResourceLifecycleObserver
that will be called when the resource is being released from the ResourceRegistry
(may be null)java.lang.IllegalArgumentException
- if a resource with the specified class is already registered with the ResourceRegistry
and the behavior was RegistrationBehavior.FAIL
public void unregisterResource(java.lang.Class clzResource, java.lang.String sResourceName)
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.
unregisterResource
in interface ResourceRegistry
clzResource
- the class of the resourcesResourceName
- the name of the resource
|
Oracle® Coherence Java API Reference Release 12.1.2.0.3 E26043-02 |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |