SunSPOT API V3.0


com.sun.spot.resourcesharing
Class ResourceRegistryChild

java.lang.Object
  extended by com.sun.spot.resourcesharing.ResourceRegistryChild
All Implemented Interfaces:
IResourceRegistry

public class ResourceRegistryChild
extends Object
implements IResourceRegistry


Constructor Summary
ResourceRegistryChild(int isolateId, com.sun.spot.resourcesharing.IResourceRegistryMaster masterRegistry)
           
 
Method Summary
 IResourceHandle adjustLock(IResourceHandle handle, ResourceSharingScheme newScheme)
          Attempt to change the ResourceSharingScheme associated with the handle.
 IResourceHandle getResource(String resourceName, ResourceSharingScheme scheme)
          Request access to a resource.
 String[] getResourceNames()
           
 void register(String resourceName, IResource resource)
          Inform the registry of a resource that is available for sharing.
 void unlock(IResourceHandle handle)
          Notify the registry that that access to the resource, as defined by the specified handle, is no longer required.
 void unlockAllResourcesHeldByIsolate(int isolateId)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ResourceRegistryChild

public ResourceRegistryChild(int isolateId,
                             com.sun.spot.resourcesharing.IResourceRegistryMaster masterRegistry)
Method Detail

getResource

public IResourceHandle getResource(String resourceName,
                                   ResourceSharingScheme scheme)
                            throws ResourceUnavailableException
Description copied from interface: IResourceRegistry
Request access to a resource. The caller intends to use the resource in accordance with the scheme specified in the request.

Specified by:
getResource in interface IResourceRegistry
Parameters:
resourceName - The name of the resource.
scheme - The scheme that defines the intended or required usage.
Returns:
A handle that provides access to the resource.
Throws:
ResourceUnavailableException - If the resource is currently unavailable

getResourceNames

public String[] getResourceNames()
Specified by:
getResourceNames in interface IResourceRegistry
Returns:
An array of the names of the resources available to be shared.

register

public void register(String resourceName,
                     IResource resource)
              throws ResourceSharingException
Description copied from interface: IResourceRegistry
Inform the registry of a resource that is available for sharing. Note that this call must be made in the same isolate in which users of the resource reside. If a resource is to be available in multiple isolates then this call must be made - using the same resource name - in each isolate.

Specified by:
register in interface IResourceRegistry
Parameters:
resourceName - The name of the resource
resource - The resource object
Throws:
ResourceSharingException - If the resource has already been registered.

unlock

public void unlock(IResourceHandle handle)
            throws ResourceSharingException
Description copied from interface: IResourceRegistry
Notify the registry that that access to the resource, as defined by the specified handle, is no longer required.

Specified by:
unlock in interface IResourceRegistry
Parameters:
handle - The handle being unlocked
Throws:
ResourceSharingException

unlockAllResourcesHeldByIsolate

public void unlockAllResourcesHeldByIsolate(int isolateId)

adjustLock

public IResourceHandle adjustLock(IResourceHandle handle,
                                  ResourceSharingScheme newScheme)
                           throws ResourceUnavailableException
Description copied from interface: IResourceRegistry
Attempt to change the ResourceSharingScheme associated with the handle. Returns a handle that has the new lock status (which might or might not be the same handle passed as the input parameter). If the existence of other locks make the change impossible, throw ResourceUnavailableException.

Specified by:
adjustLock in interface IResourceRegistry
Parameters:
handle - The handle to adjust the lock of
newScheme - The required resource sharing scheme
Returns:
the handle that reflects the adjusted lock
Throws:
ResourceUnavailableException

SunSPOT API V3.0


Copyright © 2006, 2007 Sun Microsystems, Inc. All Rights Reserved.