public abstract class Worker extends UnicastRemoteObject implements Runnable
| Modifier and Type | Field and Description |
|---|---|
Config |
configParams |
StorageSystem |
dataStorage |
long |
endTime |
Logger |
log |
boolean |
master |
RWSetInfo |
rwsetinfo |
long |
startTime |
StatContainer |
statCommitTaskTime |
StatContainer |
statComputeTime |
StatContainer |
statDoTaskTime |
StatContainer |
statGetTaskTime |
StatContainer |
statValidateTime |
static long |
STS_DELAY |
HashSet<Task> |
tasksCreated |
Hashtable<String,Node> |
updatedNodes |
Hashtable<String,NodeData> |
updatedNodesData |
int |
workerId |
WorkerStatus |
workerStatus |
LocalWorkpoolImpl |
workpool |
ref| Constructor and Description |
|---|
Worker(String configFile,
LocalWorkpoolImpl wpool,
int workerNum,
StorageSystem dataStore,
boolean master) |
| Modifier and Type | Method and Description |
|---|---|
TransactionInfo |
beginTransaction() |
void |
cleanUp() |
void |
commitTask(Task t)
Commits the completed, valid task and removes it from the workpool.
|
abstract void |
doTask(Task tsk)
Each concrete Worker class is responsible for defining its own logic on how to
execute the given task
|
boolean |
earlyValidation(Task t,
Vector<Node> readNodes,
Vector<NodeData> readNodesData)
A means to validate tasks before execution of the task itself
|
Vector<Node> |
getLocalNeighbors(Node u) |
Vector<String> |
getNeighborIds(Node u) |
Vector<Node> |
getNeighbors(Node u) |
Vector<Node> |
getRemoteNeighbors(Vector<String> nbrKeys) |
String |
getStats() |
void |
recordStat(StatContainer stat,
float value) |
Vector<Node> |
refetchNodes(HashSet<String> refetchSet,
Vector<Node> neighborNodes)
TODO : Move this to the respective worker class like PreFlowPushWorker
|
void |
run()
Continuously queries the workpool for tasks to execute until the system has reached termination.
|
clone, exportObject, exportObject, exportObject, unexportObjectgetClientHost, getLog, setLogpublic LocalWorkpoolImpl workpool
public StorageSystem dataStorage
public RWSetInfo rwsetinfo
public Config configParams
public int workerId
public boolean master
public long startTime
public long endTime
public WorkerStatus workerStatus
public Logger log
public static long STS_DELAY
public StatContainer statGetTaskTime
public StatContainer statDoTaskTime
public StatContainer statComputeTime
public StatContainer statValidateTime
public StatContainer statCommitTaskTime
public Worker(String configFile, LocalWorkpoolImpl wpool, int workerNum, StorageSystem dataStore, boolean master) throws RemoteException
configFile - The configuration for the workerswpool - The workpool this worker will its tasks fromworkerNum - The total number of workers at the serverdataStore - The StorageSystem this worker will put and get nodes frommaster - True if this worker is the master, false otherwise.RemoteException - Thrown if this worker could not be constructedpublic void cleanUp()
public Vector<Node> getNeighbors(Node u) throws Exception
Exception - Thrown if the neighbors could not be fetched.public Vector<Node> getLocalNeighbors(Node u) throws Exception
Exception - Thrown if the neighbors could not be fetchedpublic Vector<Node> getRemoteNeighbors(Vector<String> nbrKeys) throws Exception
nbrKeys - The nodeIds of a node's neighbors that are on a different server than the worker's serverException - Thrown if the neighbors could not be fetched.public Vector<String> getNeighborIds(Node u)
public TransactionInfo beginTransaction() throws RemoteException
TransactionInfo representing the current transaction.RemoteException - Thrown if the transaction could not be started.public abstract void doTask(Task tsk) throws Exception
tsk - The task that is to be executed.Exceptionpublic void commitTask(Task t)
t - The task that is to be committed.public boolean earlyValidation(Task t, Vector<Node> readNodes, Vector<NodeData> readNodesData)
t - The task that is to be validatedreadNodes - The neighbors of the node that the task is associated withreadNodesData - The nodedata of the neighbors of the node that the task is associated withpublic Vector<Node> refetchNodes(HashSet<String> refetchSet, Vector<Node> neighborNodes) throws Exception
TODO : Move this to the respective worker class like PreFlowPushWorker
Not usedExceptionpublic void run()
public void recordStat(StatContainer stat, float value)
public String getStats()