public final class PhaserManagerImpl extends Object implements PhaserManager
PhaserManagerImpl class.
Modifier and Type | Class and Description |
---|---|
static class |
PhaserManagerImpl.PhaserEventType |
Constructor and Description |
---|
PhaserManagerImpl(PropertyChangeListener changeListener)
No-args constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
checkPhaserUse(InternalPhaser ph,
HjPhaserMode prm)
Validates the use of a phaser in the current context.
|
protected void |
deregisterPhasers(HabaneroActivity activity)
deregisterPhasers.
|
void |
doNext(HabaneroActivity activity)
Performs a next operation with the given activity.
|
protected int |
doNextSinglePhase1(HabaneroActivity activity,
String loc)
doNextSinglePhase1.
|
protected void |
doNextSinglePhase2(HabaneroActivity activity)
doNextSinglePhase2.
|
void |
doSignal(HabaneroActivity activity,
boolean earlySignal)
Performs a phaser signal operation with the given activity.
|
void |
doSignal(HabaneroActivity activity,
InternalPhaser phaser,
boolean earlySignal,
boolean fromDrop)
Performs a signal operation with the given activity.
|
void |
doWait(HabaneroActivity activity)
Performs a phaser wait operation with the given activity.
|
void |
doWait(HabaneroActivity activity,
InternalPhaser phaser)
Performs a wait operation with the given activity.
|
boolean |
doWaitForNextSinglePhase1(HabaneroActivity activity,
InternalPhaser phaser,
String loc)
Performs the first stage wait operation with the given activity in next-with-signal mode.
|
void |
doWaitForNextSinglePhase2(HabaneroActivity activity,
InternalPhaser phaser)
Performs the second stage wait operation with the given activity in next-with-signal mode.
|
boolean |
dropPhaser(HabaneroActivity activity,
InternalPhaser phaser,
boolean activityEndSignal)
Drops the phaser registered with an activity.
|
int |
getSigPhase(HabaneroActivity activity,
InternalPhaser phaser)
getSigPhase.
|
int |
getWaitPhase(HabaneroActivity activity,
InternalPhaser phaser)
getWaitPhase.
|
void |
inheritPhasers(HabaneroActivity parentActivity,
HabaneroActivity childActivity)
Registers a phaser to the specified activity.
|
<T> void |
onActivityDependenciesReady(HabaneroActivity activity,
List<HjFuture<T>> dependencies)
Callback for the event when all the activities dependencies are ready.
|
void |
onActivityEnd(HabaneroActivity activity,
FinishState finishState,
Throwable throwable)
Callback for when the event ends execution.
|
void |
onActivityResume(HabaneroActivity activity)
Callback for when the event execution is resumed.
|
void |
onActivitySpawn(HabaneroActivity parentActivity,
HabaneroActivity childActivity)
Callback for when the event ends execution.
|
void |
onActivityStart(HabaneroActivity activity)
Callback for when the event starts execution.
|
void |
onActivitySuspend(HabaneroActivity activity)
Callback for when the event execution is suspended.
|
void |
onFinishScopeStart(HabaneroActivity activity,
FinishState finishState) |
void |
onPhaserReady(HabaneroActivity activity,
List<HjPhaserPair> phaserPairList)
Callback for the event when phasers are created
|
void |
onPostFinishScopeEnd(HabaneroActivity activity,
FinishState finishState) |
void |
onPreFinishScopeEnd(HabaneroActivity activity,
FinishState finishState) |
HjPhaserMode |
phaserMode(HabaneroActivity activity,
InternalPhaser phaser)
phaserMode.
|
void |
register(HabaneroActivity parentActivity,
HabaneroActivity childActivity,
InternalPhaser phaser,
HjPhaserMode phaserMode)
register.
|
boolean |
registered(HabaneroActivity activity,
InternalPhaser phaser)
registered.
|
void |
registerPhaserToIEF(HabaneroActivity activity,
InternalPhaser phaser)
Registers a phaser to the immediately enclosing finish defined by the activity.
|
protected void |
resume(HabaneroActivity activity,
InternalPhaser phaser,
boolean newValue)
resume.
|
boolean |
resumed(HabaneroActivity activity,
InternalPhaser phaser)
resumed.
|
protected static void |
throwPhaserException(String message)
Drops all phasers registered with the current finish state. throws
PhaserException
with the specified message |
String |
toString() |
void |
updateActivityFromCompanion(HabaneroActivity activity,
CompanionMetrics companionMetrics) |
void |
updateCompanionFromActivity(HabaneroActivity activity,
CompanionMetrics companionMetrics) |
public PhaserManagerImpl(PropertyChangeListener changeListener)
changeListener
- a PropertyChangeListener
object.public void checkPhaserUse(InternalPhaser ph, HjPhaserMode prm)
PhaserManager
checkPhaserUse
in interface PhaserManager
ph
- The phaserprm
- The phaser modeprotected static void throwPhaserException(String message)
PhaserException
with the specified messagemessage
- The Exception messagePhaserException
- with the specified messagepublic void inheritPhasers(HabaneroActivity parentActivity, HabaneroActivity childActivity)
inheritPhasers
in interface PhaserManager
parentActivity
- The activity to inherit phasers from.childActivity
- The new child activity.public void register(HabaneroActivity parentActivity, HabaneroActivity childActivity, InternalPhaser phaser, HjPhaserMode phaserMode)
register.
register
in interface PhaserManager
parentActivity
- The activity to inherit phasers from.childActivity
- The new child activity.phaser
- The new phaser to inheritphaserMode
- The phaser registration modepublic void registerPhaserToIEF(HabaneroActivity activity, InternalPhaser phaser)
registerPhaserToIEF
in interface PhaserManager
activity
- The activity which determines the IEF.phaser
- The phaser to register to the IEF.public boolean dropPhaser(HabaneroActivity activity, InternalPhaser phaser, boolean activityEndSignal)
dropPhaser
in interface PhaserManager
activity
- The activity from which to drop the phaser.phaser
- The phaser to drop.activityEndSignal
- Whether the phaser is dropped in an activity end eventpublic boolean registered(HabaneroActivity activity, InternalPhaser phaser)
registered.
registered
in interface PhaserManager
activity
- The activity.phaser
- The phaser.public boolean resumed(HabaneroActivity activity, InternalPhaser phaser)
resumed.
resumed
in interface PhaserManager
activity
- The activity.phaser
- The phaser.public HjPhaserMode phaserMode(HabaneroActivity activity, InternalPhaser phaser)
phaserMode.
phaserMode
in interface PhaserManager
activity
- The activity.phaser
- The phaser.public int getSigPhase(HabaneroActivity activity, InternalPhaser phaser)
getSigPhase.
getSigPhase
in interface PhaserManager
activity
- The activity.phaser
- The phaser.public int getWaitPhase(HabaneroActivity activity, InternalPhaser phaser)
getWaitPhase.
getWaitPhase
in interface PhaserManager
activity
- The activity.phaser
- The phaser.public void doNext(HabaneroActivity activity) throws SuspendableException
doNext
in interface PhaserManager
activity
- The activity.SuspendableException
public void doSignal(HabaneroActivity activity, boolean earlySignal)
doSignal
in interface PhaserManager
activity
- The activity.earlySignal
- Flag determining whether this is an eager signalpublic void doSignal(HabaneroActivity activity, InternalPhaser phaser, boolean earlySignal, boolean fromDrop)
doSignal
in interface PhaserManager
activity
- The activity.phaser
- The phaser.earlySignal
- Flag determining whether this is an eager signalfromDrop
- Flag determining whether this signal came from a drop call (to prevent double signal logging)public void doWait(HabaneroActivity activity) throws SuspendableException
doWait
in interface PhaserManager
activity
- The activity.SuspendableException
public void doWait(HabaneroActivity activity, InternalPhaser phaser) throws SuspendableException
doWait
in interface PhaserManager
activity
- The activity.phaser
- The phaser.SuspendableException
public boolean doWaitForNextSinglePhase1(HabaneroActivity activity, InternalPhaser phaser, String loc) throws SuspendableException
doWaitForNextSinglePhase1
in interface PhaserManager
activity
- The activity.phaser
- The phaser.loc
- The location of the next operationSuspendableException
public void doWaitForNextSinglePhase2(HabaneroActivity activity, InternalPhaser phaser) throws SuspendableException
doWaitForNextSinglePhase2
in interface PhaserManager
activity
- The activity.phaser
- The phaser.SuspendableException
public void onActivityStart(HabaneroActivity activity)
onActivityStart
in interface ActivityListeners.ActivityListener
activity
- The activity being started.public void onActivitySuspend(HabaneroActivity activity)
onActivitySuspend
in interface ActivityListeners.ActivityListener
activity
- The activity being suspended.public void onActivityResume(HabaneroActivity activity)
onActivityResume
in interface ActivityListeners.ActivityListener
activity
- The activity being resumed.public void onActivityEnd(HabaneroActivity activity, FinishState finishState, Throwable throwable)
onActivityEnd
in interface ActivityListeners.ActivityListener
activity
- The activity that is ending.finishState
- The root finish state associated with the activitypublic <T> void onActivityDependenciesReady(HabaneroActivity activity, List<HjFuture<T>> dependencies)
onActivityDependenciesReady
in interface ActivityListeners.ActivityListener
activity
- The activity that is ready to execute.dependencies
- The dependencies of the activitypublic void onPhaserReady(HabaneroActivity activity, List<HjPhaserPair> phaserPairList)
ActivityListeners.ActivityListener
onPhaserReady
in interface ActivityListeners.ActivityListener
activity
- The activity that is ready to execute.phaserPairList
- The a list of phasers of HjPhaserPair typepublic void onActivitySpawn(HabaneroActivity parentActivity, HabaneroActivity childActivity)
onActivitySpawn
in interface ActivityListeners.ActivityListener
parentActivity
- The parent activity.childActivity
- The child activity that was spawned.public void onFinishScopeStart(HabaneroActivity activity, FinishState finishState)
onFinishScopeStart
in interface ActivityListeners.ActivityListener
activity
- The activity running the finish scopefinishState
- The finish state associated with the activitypublic void onPreFinishScopeEnd(HabaneroActivity activity, FinishState finishState)
onPreFinishScopeEnd
in interface ActivityListeners.ActivityListener
activity
- The activity that ran the finish scopefinishState
- The finish state associated with the activitypublic void onPostFinishScopeEnd(HabaneroActivity activity, FinishState finishState)
onPostFinishScopeEnd
in interface ActivityListeners.ActivityListener
activity
- The activity that ran the finish scopefinishState
- The finish state associated with the activitypublic void updateCompanionFromActivity(HabaneroActivity activity, CompanionMetrics companionMetrics)
updateCompanionFromActivity
in interface ActivityListeners.ActivityListener
public void updateActivityFromCompanion(HabaneroActivity activity, CompanionMetrics companionMetrics)
updateActivityFromCompanion
in interface ActivityListeners.ActivityListener
protected void deregisterPhasers(HabaneroActivity activity)
deregisterPhasers.
activity
- a HabaneroActivity
object.protected void resume(HabaneroActivity activity, InternalPhaser phaser, boolean newValue)
resume.
activity
- a HabaneroActivity
object.phaser
- a InternalPhaser
object.newValue
- a boolean.protected int doNextSinglePhase1(HabaneroActivity activity, String loc) throws SuspendableException
doNextSinglePhase1.
activity
- a HabaneroActivity
object.loc
- a String
object.SuspendableException
protected void doNextSinglePhase2(HabaneroActivity activity) throws SuspendableException
doNextSinglePhase2.
activity
- a HabaneroActivity
object.SuspendableException
Copyright © 2015 Rice University - Department of Computer Science. All rights reserved.