public abstract class HookMasterComputable<MASTER_RESULT extends Bytable,WORKER_RESULT extends Bytable> extends Object implements MasterComputable<MASTER_RESULT,WORKER_RESULT>
MasterComputable abstraction to define setup(MasterContext) and
cleanup(MasterContext) hooks.
For classes who extends HookMasterComputable, user can provide its own setup(MasterContext) and
cleanup(MasterContext). Guagua will make sure both will be called only once at the beginning and the end of
whole process.
| Constructor and Description |
|---|
HookMasterComputable() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
cleanup(MasterContext<MASTER_RESULT,WORKER_RESULT> context)
Cleanup method for master computation.
|
MASTER_RESULT |
compute(MasterContext<MASTER_RESULT,WORKER_RESULT> context)
Master computation for each iteration.
|
abstract MASTER_RESULT |
doCompute(MasterContext<MASTER_RESULT,WORKER_RESULT> context)
Real computation logic excluding some setup and cleanup hooks.
|
protected void |
setup(MasterContext<MASTER_RESULT,WORKER_RESULT> context)
Setup method for master computation.
|
protected void setup(MasterContext<MASTER_RESULT,WORKER_RESULT> context)
context - the worker context instance.public MASTER_RESULT compute(MasterContext<MASTER_RESULT,WORKER_RESULT> context)
MasterComputablecompute in interface MasterComputable<MASTER_RESULT extends Bytable,WORKER_RESULT extends Bytable>context - the master context instance which includes worker results and other useful parameters.public abstract MASTER_RESULT doCompute(MasterContext<MASTER_RESULT,WORKER_RESULT> context)
context - the worker context instance.protected void cleanup(MasterContext<MASTER_RESULT,WORKER_RESULT> context)
context - the worker context instance.for cleanup hookCopyright © 2015. All Rights Reserved.