
public class HjSearchEurekaImpl<T> extends Object implements HjSearchEureka<T>
| Modifier and Type | Field and Description |
|---|---|
protected AtomicBoolean |
eurekaTracker
Keep track of whether the eureka has been updated
|
protected T |
initialValue
Initial value of the eureka
|
protected AtomicReference<T> |
wrappedObj
The eureka result
|
| Constructor and Description |
|---|
HjSearchEurekaImpl()
No args constructor.
|
HjSearchEurekaImpl(T initialValue)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
check(Object 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() |
protected final AtomicReference<T> wrappedObj
protected final AtomicBoolean eurekaTracker
protected final T initialValue
public HjSearchEurekaImpl()
public HjSearchEurekaImpl(T initialValue)
initialValue - The initial value of the eureka.public void onRegistration()
onRegistration in interface HjEureka<T,Object,T>public void onCleanup()
public boolean resolved()
public boolean shouldAbortOnOffer(boolean offerResult)
shouldAbortOnOffer in interface HjEureka<T,Object,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,Object,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(Object localValue, boolean triggerAbort) throws SuspendableException
check in interface HjEureka<T,Object,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.