T
- the type of the value offered to the Eureka object.C
- the type of the value accepted by the Eureka object while checking.V
- the type of the value returned by the Eureka object.public interface HjEureka<T,C,V>
A HjEureka wraps a value of type T. A eureka object must be registered on a finish scope. Once a eureka has been resolved, all other asynchronous tasks executing inside the same finish scope may safely be aborted.
Modifier and Type | Method and Description |
---|---|
default boolean |
check(C localValue)
Checks whether the locally known value can lead to a better estimate than the globally known value.
|
boolean |
check(C localValue,
boolean triggerAbort)
Checks whether the locally known value can lead to a better estimate than the globally known value.
|
V |
get()
Return the value stored in the eureka object.
|
default boolean |
offer(T newValue)
Attempts to update the eureka object with a new value.
|
boolean |
offer(T newValue,
boolean triggerAbort)
Attempts to update the eureka object with a new value.
|
void |
onCleanup()
Invoked by the runtime at the end of the finish scope in which the eureka has been registered.
|
void |
onRegistration()
Invoked by the runtime at the start of the finish scope in which the eureka has been registered.
|
boolean |
resolved()
Return true if the eureka has been resolved.
|
boolean |
shouldAbortOnOffer(boolean offerResult)
Return true if the eureka should abort the current task on a successful update.
|
void onRegistration()
void onCleanup()
boolean resolved()
boolean shouldAbortOnOffer(boolean offerResult)
offerResult
- The result of offer()
if this method is called from inside the offer()
method.V get()
boolean offer(T newValue, boolean triggerAbort) throws SuspendableException
shouldAbortOnOffer()
returns true and
triggerAbort
is true, the task will abort instead of returning true.newValue
- The new value to try and update the eureka object with.triggerAbort
- Boolean value that conmfigures whether task is aborted inside this method call.offer
should trigger task abortion.SuspendableException
- Marker to notify that this method is suspendabledefault boolean offer(T newValue) throws SuspendableException
shouldAbortOnOffer()
returns true and
triggerAbort
is true, the task will abort instead of returning true.newValue
- The new value to try and update the eureka object with.offer
should trigger task abortion.SuspendableException
- Marker to notify that this method is suspendableboolean check(C localValue, boolean triggerAbort) throws SuspendableException
localValue
- The local value used to compare with the globally known eureka valuetriggerAbort
- Boolean value that conmfigures whether task is aborted inside this method call.offer
should trigger task abortion.SuspendableException
- Marker to notify that this method is suspendabledefault boolean check(C localValue) throws SuspendableException
localValue
- The local value used to compare with the globally known eureka valueoffer
should trigger task abortion.SuspendableException
- Marker to notify that this method is suspendableCopyright © 2015 Rice University - Department of Computer Science. All rights reserved.