|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.gcube.vremanagement.resourcebroker.impl.support.types.SortableElement<java.lang.Long,PlanBuilderIdentifier>
org.gcube.vremanagement.resourcebroker.impl.support.types.GHNReservation
public class GHNReservation
To keep track of the GHNs that have been reserved during
a PlanBuilderWorkflow session, to each workflow is
associated, in a persistent way, a GHNReservation.
The reservation essentially consists of an expiration time
and a list of GHNDescriptor elements that have
been reserved for that session.
Once the reservation time expires, or a feedback is received
from the caller, all the reserved GHNDescriptor are
restored and made available for further reuse.
This solution ensures that until the Reservation is alive all
the GHNs assigned to it are not available to other
PlanBuilderWorkflow sessions.
A reservation is supposed to be sorted on the expiration time
(a Long) and identified by the unique PlanBuilderIdentifier
of the PlanBuilderWorkflow it is involved in.
Two GHNReservation assigned to the same PlanBuilderIdentifier
are assumed to be equals, namely for each PlanBuilderWorkflow a single
reservation can be done.
Once created a reservation, the GHNDescriptor can be inserted inside it.
To each PlanBuilderElem of a PlanBuilderWorkflow a GHNReservation
is automatically assigned.
| Constructor Summary | |
|---|---|
GHNReservation(PlanBuilderIdentifier wfID,
long ttl)
Builds a GHNReservation to assign to a
PlanBuilderWorkflow session uniquely identified by
its PlanBuilderIdentifier. |
|
| Method Summary | |
|---|---|
void |
addGHN(GHNDescriptor ghn)
Stores a new GHNDescriptor in the list of
reserved GHNs in this reservation context. |
boolean |
equals(java.lang.Object obj)
Allows to compare a GHNReservation with both another
GHNReservation or a GHNDescriptor. |
java.util.List<GHNDescriptor> |
getGHNsForScope(GCUBEScope scope)
|
int |
hashCode()
|
boolean |
isExpired()
|
void |
lock()
Deprecated. This method should be only accessed by feedback handling function. |
void |
revoke()
|
void |
unlock()
Deprecated. This method should be only accessed by feedback handling function. |
| Methods inherited from class org.gcube.vremanagement.resourcebroker.impl.support.types.SortableElement |
|---|
compareTo, getElement, getSortIndex, toString |
| Methods inherited from class java.lang.Object |
|---|
getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public GHNReservation(PlanBuilderIdentifier wfID,
long ttl)
GHNReservation to assign to a
PlanBuilderWorkflow session uniquely identified by
its PlanBuilderIdentifier.
The SortableElement.getElement() will return the
PlanBuilderIdentifier passed at construction phase
and is the key element to use for equals.
Once created the reservation stores the creation timestamp
that can be acceded through SortableElement.getSortIndex()
method.
ttl - the time to live for the reservation expressed in mills.wfID - the PlanBuilderIdentifier workflow session.| Method Detail |
|---|
public final boolean isExpired()
public final boolean equals(java.lang.Object obj)
GHNReservation with both another
GHNReservation or a GHNDescriptor.
The comparison is done on the GHN unique ID.
This method is used to discover GHNDescriptor
that have been moved inside a private queue of reserved
GHNDescriptor owned by a workflow.
equals in class java.lang.Objectpublic final int hashCode()
hashCode in class java.lang.Object
public final void addGHN(GHNDescriptor ghn)
throws GCUBEFault
GHNDescriptor in the list of
reserved GHNs in this reservation context.
ghn -
GCUBEFaultpublic final void revoke()
public final java.util.List<GHNDescriptor> getGHNsForScope(GCUBEScope scope)
throws GCUBEFault
GCUBEFault
public final void lock()
throws java.lang.InterruptedException
java.lang.InterruptedExceptionpublic final void unlock()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||