|
SunSPOT API V3.0 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface IResource
This interface must be implemented by any object that is to be a shared resource.
Only objects that implement this interface can be registered with the resource registry.
To make a shared resource available it must be registered in every isolate in which it
is to be available using IResourceRegistry.register(String, IResource)
.
When access to a resource is requested using IResourceRegistry.getResource(String, ResourceSharingScheme)
the registry will check across all isolates that the requested access is compatible with the current
locks and if so it will call getHandle(ResourceSharingScheme, boolean)
.
SimpleResource
is an implementation of this interface that can used for simple cases, or extended
for more complex ones.
Method Summary | |
---|---|
IResourceHandle |
getHandle(ResourceSharingScheme scheme,
boolean isLockedInADifferentIsolate)
Generate a handle for this resource. |
String |
getResourceName()
|
IResourceHandle |
lockAdjusted(IResourceHandle handle,
ResourceSharingScheme oldScheme,
ResourceSharingScheme newScheme)
A previously generated handle is adjusting its ResourceSharingScheme. |
void |
unlocked(IResourceHandle handle)
A previously generated handle has been unlocked, and the handle can be reused. |
Method Detail |
---|
IResourceHandle getHandle(ResourceSharingScheme scheme, boolean isLockedInADifferentIsolate) throws ResourceSharingException, ResourceUnavailableException
scheme
- The scheme that the requestor intends to follow for this handleisLockedInADifferentIsolate
- true if a lock for this resource already exists in another isolate
ResourceSharingException
- if the scheme is not supported or there is some other problem
ResourceUnavailableException
- if, despite the checks already performed by the registry, the
resource still thinks the handle shouldn't be generated because it would conflict with other usagevoid unlocked(IResourceHandle handle) throws ResourceSharingException
handle
- The handle that has been unlocked.
ResourceSharingException
- if the handle is not recognised or there is some other problemString getResourceName()
IResourceHandle lockAdjusted(IResourceHandle handle, ResourceSharingScheme oldScheme, ResourceSharingScheme newScheme) throws ResourceSharingException, ResourceUnavailableException
handle
- oldScheme
- newScheme
-
ResourceSharingException
- if the scheme is not supported or there is some other problem
ResourceUnavailableException
- if, despite the checks already performed by the registry, the
resource still thinks the scheme shouldn't be adjusted because it would conflict with other usage
|
SunSPOT API V3.0 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |