Java DTV API 1.3
18-Nov-2009

com.sun.dtv.resources
Interface ScarceResourceListener


public interface ScarceResourceListener

Listener to be notified about release status of a given scarce resource.

When calling any methods of this interface, certain platforms may define a timespan until when those methods are expected to return. If they do not return within that timeframe, the implementation must behave as if the method returned. This mechanism allows to avoid that applications block those methods unnecessarily.


Method Summary
 void released(ScarceResource resource)
          Reports that resource has been released by the implementation and is available for a new reservation.
 void releaseForced(ScarceResource resource)
          Reports that resource is being aggressively requested by another application and gives the current owner the chance to close his task.
 boolean releaseRequested(ScarceResource resource)
          Reports that resource is being requested by another application.
 

Method Detail

releaseRequested

boolean releaseRequested(ScarceResource resource)
Reports that resource is being requested by another application. The current owner is free to decide whether it can and want to release that given resource to its competitor.

If this method returns false, the implementation understands that the current owner wants to keep the resource and that it is therefore not available to the competitor.

On the other hand, returning true tells the platform that the current owner is ready to release its resource. In this case the implementation must release itself the given resource. This in turn will trigger a released event on this interface.

When supported, in case where this method does not return within a given timeframe, the implementation must behave as if the method returned true.

Parameters:
resource - The instance of the scarce resource that is requested to be released.
Returns:
A boolean indicating whether the current application and the owner no longer needs the resource.

releaseForced

void releaseForced(ScarceResource resource)
Reports that resource is being aggressively requested by another application and gives the current owner the chance to close his task. On return of this call, the implementation must release this resource. This in turn will trigger a released event on this interface.

Parameters:
resource - The instance of the scarce resource that is required to be released.

released

void released(ScarceResource resource)
Reports that resource has been released by the implementation and is available for a new reservation. This method is called by the implementation subsequently to a ScarceResource.release() or after the releaseForced() or releaseRequested() events.

When the implementation calls this method, the object will have been invalidated, i.e. the application that owned this resource is no more able to interact with the given resource: calls are ignored and methods may throw an IllegalStateException.

Parameters:
resource - The instance of the scarce resource that has been released.

Java DTV API 1.3
18-Nov-2009

Copyright © 2008-2009 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, California 95054, U.S.A. All rights reserved.

U.S. Government Rights - Commercial software. Government users are subject to the Sun Microsystems, Inc. standard license agreement and applicable provisions of the FAR and its supplements. Sun, Sun Microsystems, the Sun logo and Java are trademarks or registered trademarks of Sun Microsystems, Inc. in the U.S. and other countries.Products covered by and information contained in this service manual are controlled by U.S. Export Control laws and may be subject to the export or import laws in other countries. Nuclear, missile, chemical biological weapons or nuclear maritime end uses or end users, whether direct or indirect, are strictly prohibited. Export or reexport to countries subject to U.S. embargo or to entities identified on U.S. export exclusion lists, including, but not limited to, the denied persons and specially designated nationals lists is strictly prohibited.

DOCUMENTATION IS PROVIDED AS IS AND ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE DISCLAIMED, EXCEPT TO THE EXTENT THAT SUCH DISCLAIMERS ARE HELD TO BE LEGALLY INVALID.

Use of this document is subject to license terms.