MASTER_RESULT - master result for computation in each iteration.WORKER_RESULT - worker result for computation in each iteration.public abstract class AbstractMasterCoordinator<MASTER_RESULT extends Bytable,WORKER_RESULT extends Bytable> extends BasicCoordinator<MASTER_RESULT,WORKER_RESULT> implements MasterInterceptor<MASTER_RESULT,WORKER_RESULT>
AbstractMasterCoordinator has some common implementation for both async and sync worker coordinator.
Common functions include: znodes cleaning up, fail-over support and others.
| Modifier and Type | Class and Description |
|---|---|
protected class |
AbstractMasterCoordinator.FailOverCommand
AbstractMasterCoordinator.FailOverCommand is used to read last iteration before task failed. |
protected class |
AbstractMasterCoordinator.MasterElectionCommand
Elect master from several backup masters.
|
BasicCoordinator.BasicCoordinatorCommand, BasicCoordinator.CoordinatorCommand, BasicCoordinator.RetryCoordinatorCommandWAIT_SLOT_MILLS| Constructor and Description |
|---|
AbstractMasterCoordinator() |
| Modifier and Type | Method and Description |
|---|---|
String |
getMyBid() |
protected boolean |
isAllWorkersHalt(Iterable<WORKER_RESULT> workerResults)
Check whether all workers are halted.
|
void |
postApplication(MasterContext<MASTER_RESULT,WORKER_RESULT> context)
The hook point after any computation logic.
|
void |
postIteration(MasterContext<MASTER_RESULT,WORKER_RESULT> context)
The hook point after computation of each iteration.
|
protected void |
setMasterResult(MasterContext<MASTER_RESULT,WORKER_RESULT> context,
String appMasterNode,
String appMasterSplitNode) |
void |
setMyBid(String myBid) |
protected void |
setWorkerResults(MasterContext<MASTER_RESULT,WORKER_RESULT> context,
String appCurrentWorkersNode,
String appId,
int iteration)
Set worker results from znodes.
|
protected void |
updateMasterHaltStatus(MasterContext<MASTER_RESULT,WORKER_RESULT> context)
Check whether GuaguaConstants.GUAGUA_WORKER_HALT_ENABLE) is enabled, if yes, check whether all workers are halted
and update master status.
|
checkAndSetZooKeeper, closeZooKeeper, getAppNode, getBaseMasterElectionNode, getBytesFromZNode, getCurrentMasterNode, getCurrentMasterSplitNode, getCurrentWorkerNode, getCurrentWorkerSplitNode, getLastMasterNode, getLastWorkerNode, getMasterBaseNode, getMasterElectionNode, getMasterNode, getMasterSerializer, getRootNode, getSleepTime, getWorkerBaseNode, getWorkerBaseNode, getWorkerNode, getWorkerSerializer, getZkConnLatch, getZooKeeper, initialize, isFixedTime, process, setBytesToZNode, setFixedTime, setMasterSerializer, setSleepTime, setWorkerSerializer, setZooKeeper, startHeartbeat, stopHeartBeatclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitpreApplication, preIterationpublic void postIteration(MasterContext<MASTER_RESULT,WORKER_RESULT> context)
MasterInterceptorpostIteration in interface MasterInterceptor<MASTER_RESULT extends Bytable,WORKER_RESULT extends Bytable>context - the master context instance which includes worker results and other useful parameters.public void postApplication(MasterContext<MASTER_RESULT,WORKER_RESULT> context)
MasterInterceptorpostApplication in interface MasterInterceptor<MASTER_RESULT extends Bytable,WORKER_RESULT extends Bytable>context - the master context instance which includes worker results and other useful parameters.protected void setWorkerResults(MasterContext<MASTER_RESULT,WORKER_RESULT> context, String appCurrentWorkersNode, String appId, int iteration) throws org.apache.zookeeper.KeeperException, InterruptedException
org.apache.zookeeper.KeeperExceptionInterruptedExceptionprotected void updateMasterHaltStatus(MasterContext<MASTER_RESULT,WORKER_RESULT> context)
protected void setMasterResult(MasterContext<MASTER_RESULT,WORKER_RESULT> context, String appMasterNode, String appMasterSplitNode) throws org.apache.zookeeper.KeeperException, InterruptedException
org.apache.zookeeper.KeeperExceptionInterruptedExceptionprotected boolean isAllWorkersHalt(Iterable<WORKER_RESULT> workerResults)
public String getMyBid()
public void setMyBid(String myBid)
Copyright © 2015. All Rights Reserved.