MASTER_RESULT - master result for computation in each iteration.WORKER_RESULT - worker result for computation in each iteration.public class WorkerContext<MASTER_RESULT extends Bytable,WORKER_RESULT extends Bytable> extends Object
WorkerContext is a context to contain all useful info which can be used in worker computation.
The info includes:
| Modifier and Type | Class and Description |
|---|---|
static interface |
WorkerContext.WorkerCompletionCallBack<MASTER_RESULT extends Bytable,WORKER_RESULT extends Bytable>
Define callback for completion of worker computation.
|
| Constructor and Description |
|---|
WorkerContext(int totalIteration,
String appId,
Properties props,
String containerId,
List<GuaguaFileSplit> fileSplits,
String masterResultClassName,
String workerResultClassName) |
| Modifier and Type | Method and Description |
|---|---|
void |
addCompletionCallBack(WorkerContext.WorkerCompletionCallBack<MASTER_RESULT,WORKER_RESULT> callback)
Add callback function.
|
String |
getAppId() |
Object |
getAttachment() |
List<WorkerContext.WorkerCompletionCallBack<MASTER_RESULT,WORKER_RESULT>> |
getCallBackList() |
String |
getContainerId() |
int |
getCurrentIteration() |
List<GuaguaFileSplit> |
getFileSplits() |
MASTER_RESULT |
getLastMasterResult() |
String |
getMasterResultClassName() |
Properties |
getProps() |
int |
getTotalIteration() |
WORKER_RESULT |
getWorkerResult() |
String |
getWorkerResultClassName() |
boolean |
isFirstIteration()
Whether is in first iteration, default first iteration is 1.
|
boolean |
isInitIteration()
Whether is in initiate iteration, default initiate iteration is 1.
|
void |
setAttachment(Object attachment) |
void |
setCurrentIteration(int currentIteration) |
void |
setLastMasterResult(MASTER_RESULT lastMasterResult) |
String |
toString() |
public WorkerContext(int totalIteration,
String appId,
Properties props,
String containerId,
List<GuaguaFileSplit> fileSplits,
String masterResultClassName,
String workerResultClassName)
public int getCurrentIteration()
public void setCurrentIteration(int currentIteration)
public int getTotalIteration()
public MASTER_RESULT getLastMasterResult()
public void setLastMasterResult(MASTER_RESULT lastMasterResult)
public String getAppId()
public String getContainerId()
public List<GuaguaFileSplit> getFileSplits()
public Properties getProps()
public WORKER_RESULT getWorkerResult()
public String getWorkerResultClassName()
public String getMasterResultClassName()
public Object getAttachment()
public void setAttachment(Object attachment)
public boolean isFirstIteration()
public boolean isInitIteration()
public void addCompletionCallBack(WorkerContext.WorkerCompletionCallBack<MASTER_RESULT,WORKER_RESULT> callback)
public List<WorkerContext.WorkerCompletionCallBack<MASTER_RESULT,WORKER_RESULT>> getCallBackList()
Copyright © 2019. All Rights Reserved.