public final class HjConvergenceEurekaImpl<T> extends Object implements HjConvergenceEureka<T>
Constructor and Description |
---|
HjConvergenceEurekaImpl(T initialValue,
java.util.function.BiPredicate<T,T> checker,
HjProcedure<T> convergenceCallback) |
Modifier and Type | Method and Description |
---|---|
boolean |
check(T localValue,
boolean triggerAbort)
Checks whether the locally known value can lead to a better estimate than the globally known value.
|
T |
get()
Return the value stored in the eureka object.
|
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.
|
String |
toString() |
public HjConvergenceEurekaImpl(T initialValue, java.util.function.BiPredicate<T,T> checker, HjProcedure<T> convergenceCallback)
public void onRegistration()
onRegistration
in interface HjEureka<T,T,T>
public void onCleanup()
public boolean resolved()
public boolean shouldAbortOnOffer(boolean offerResult)
shouldAbortOnOffer
in interface HjEureka<T,T,T>
offerResult
- The result of offer()
if this method is called from inside the offer()
method.public T get()
public boolean offer(T newValue, boolean triggerAbort) throws SuspendableException
shouldAbortOnOffer()
returns true and
triggerAbort
is true, the task will abort instead of returning true.offer
in interface HjEureka<T,T,T>
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 suspendablepublic boolean check(T localValue, boolean triggerAbort) throws SuspendableException
check
in interface HjEureka<T,T,T>
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 suspendableCopyright © 2015 Rice University - Department of Computer Science. All rights reserved.