public class BarrierMonitor extends java.lang.Object implements JobFaultListener
Constructor and Description |
---|
BarrierMonitor(WorkerMonitor workerMonitor,
InitBarrierListener barrierListener) |
Modifier and Type | Method and Description |
---|---|
void |
arrivedAtDefault(int workerID,
long timeout)
a worker arrived at the default barrier
|
void |
arrivedAtInit(int workerID,
long timeout)
a worker arrived at the init barrier
|
void |
checkBarrierFailure()
this method is called periodically by Job Master to check for the barrier failure
barriers fail for two reasons:
the barrier times out: barrier failure message should be broadcasted to all waiting workers
job becomes faulty: default barrier fails in this case only
|
void |
faultOccurred()
this is called when a worker failed in the job
it is also called when a worker is restarted before its failure message received
|
void |
faultRestored()
this is called when all workers restored
and they all come to a barrier after the barrier
|
void |
initDefaultAfterRestart(java.util.Set<java.lang.Integer> initialWorkers,
long timeout,
int expectedWorkers) |
void |
initInitAfterRestart(java.util.Set<java.lang.Integer> initialWorkers,
long timeout,
int expectedWorkers)
this method is invoked when JM restarts
it gets previous status from ZK
|
boolean |
isFirstInitProceeded() |
void |
removedFromDefault(int workerID)
a worker is removed from the default barrier
we expect it to come back later on
remove it from the list
|
void |
removedFromInit(int workerID)
a worker is removed from the init barrier
we expect it to come back later on
remove it from the list
|
void |
setBarrierResponder(BarrierResponder barrierResponder) |
public BarrierMonitor(WorkerMonitor workerMonitor, InitBarrierListener barrierListener)
public void setBarrierResponder(BarrierResponder barrierResponder)
public void initDefaultAfterRestart(java.util.Set<java.lang.Integer> initialWorkers, long timeout, int expectedWorkers)
public void initInitAfterRestart(java.util.Set<java.lang.Integer> initialWorkers, long timeout, int expectedWorkers)
initialWorkers
- timeout
- expectedWorkers
- public boolean isFirstInitProceeded()
public void faultOccurred()
JobFaultListener
faultOccurred
in interface JobFaultListener
public void faultRestored()
JobFaultListener
faultRestored
in interface JobFaultListener
public void arrivedAtDefault(int workerID, long timeout)
workerID
- timeout
- public void arrivedAtInit(int workerID, long timeout)
workerID
- timeout
- public void checkBarrierFailure()
public void removedFromDefault(int workerID)
public void removedFromInit(int workerID)