Package gda.rcp.views
Interface ReservableControl
- All Known Implementing Classes:
ReservedControl
public interface ReservableControl
This interface allows an object to reserve a resource for itself.
Having multiple objects are competing for the same resource, this interface allows a controller to restrict some
operations only to the object owning the resource. An example could be a controller exposing an instance of this
interface so other objects can reserve the controller for them self.
As the reservation is done using
Object, can act simply as validator irrespective of the class type, and this
is further stressed by the fact that the interface does not directly expose the object which reserved the resource.-
Method Summary
Modifier and TypeMethodDescriptionbooleanVerify if an object is the actual owner.booleanVerify if this instance is actually reserved.booleanRelease the instance.booleanReserves the instance, setting the requesting object as owner.
-
Method Details
-
reserve
Reserves the instance, setting the requesting object as owner. The operation fails if the instance is already reserved by another object or the requesting object isnull- Parameters:
owner- the class requesting to reserve the resource- Returns:
trueif the operation succeeded,falseotherwise
-
release
Release the instance. The operation fails if the requesting object is not the actual owner or the requesting object isnull- Parameters:
owner- the class requesting to release the resource- Returns:
trueif the operation succeeded,falseotherwise
-
isOwner
Verify if an object is the actual owner.- Parameters:
owner- the class requesting the validation- Returns:
trueif the requesting object is the same as the actual owner,falseotherwise
-
isReserved
boolean isReserved()Verify if this instance is actually reserved.- Returns:
trueif reserved,falseotherwise
-