|
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 |
public interface ResourceRegistry
A ResourceRegistry
is a registry and owner of strongly typed and explicitly named resources.
When a resource is registered with a ResourceRegistry
, the ResourceRegistry
assumes ownership of the said resource, up until at which point the ResourceRegistry
is disposed
.
Important: Although a ResourceRegistry
manages resources in a thread-safe manner, it is possible for a thread calling ResourceResolver.getResource(Class, String)
to receive a null
return value while another thread is registering a resource.
Nested Class Summary | |
---|---|
static interface |
ResourceRegistry.ResourceLifecycleObserver The ResourceRegistry.ResourceLifecycleObserver interface defines lifecycle handlers for resources registered with a ResourceRegistry . |
Field Summary | |
---|---|
static java.lang.String |
DEFAULT_NAME The name to use for the registration of a singleton and thus default resource. |
Method Summary | |
---|---|
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. |
Methods inherited from interface com.tangosol.util.ResourceResolver |
---|
getResource, getResource |
Methods inherited from interface com.oracle.common.base.Disposable |
---|
dispose |
Field Detail |
---|
static final java.lang.String DEFAULT_NAME
Method Detail |
---|
java.lang.String registerResource(java.lang.Class clzResource, java.lang.Object resource) throws java.lang.IllegalArgumentException
ResourceResolver.getResource(Class)
.
Notes:
registerResource(Class, String, Object)
Disposable
will be disposed when the ResourceRegistry
is disposed.clzResource
- the class of the resourceresource
- the resourcejava.lang.IllegalArgumentException
- if a resource of the same specified type is already registeredjava.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.clzResource
- the class of the resourceresource
- the resourcesResourceName
- the proposed name of the resourcejava.lang.IllegalArgumentException
- if a resource of the same specified type and name is already registeredjava.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:
registerResource(Class, String, Builder, RegistrationBehavior, ResourceLifecycleObserver)
Disposable
will be disposed when the ResourceRegistry
is disposed.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
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.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
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.
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 |