public final class JMWorkerAgent
extends java.lang.Object
It provides: worker discovery barrier method Ping service
It can be started in two different modes: Threaded and Blocking
If the user calls: startThreaded() It starts as a Thread and the call to this method returns
If the user calls: startBlocking() It uses the calling thread and this call does not return unless the close method is called
Modifier and Type | Class and Description |
---|---|
class |
JMWorkerAgent.ClientConnectHandler |
Modifier and Type | Method and Description |
---|---|
static boolean |
addAllJoinedListener(IAllJoinedListener iAllJoinedListener)
only one IAllJoinedListener can be added
if the second IAllJoinedListener tried to be added, false returned
|
static boolean |
addReceiverFromDriver(IReceiverFromDriver receiverFromDriver)
only one IReceiverFromDriver can be added
if the second IReceiverFromDriver tried to be added, returns false
|
static boolean |
addScalerListener(IScalerListener scalerListener)
only one IScalerListener can be added
if the second IScalerListener tried to be added, false returned
|
static boolean |
addWorkerFailureListener(IWorkerFailureListener workerFailureListener)
only one IWorkerFailureListener can be added
if the second IWorkerFailureListener tried to be added, returns false
|
void |
close()
stop the JMWorkerAgent
|
static JMWorkerAgent |
createJMWorkerAgent(Config config,
WorkerInfo thisWorker,
java.lang.String jmAddress,
int jmPort,
int numberOfWorkers,
int restartCount)
create the singleton JMWorkerAgent
if it is already created, return the previous one.
|
CheckpointingClientImpl |
getCheckpointClient() |
JMDriverAgent |
getDriverAgent()
return JMSenderToDriver for this worker
|
static JMWorkerAgent |
getJMWorkerAgent()
return the singleton agent object
|
JMWorkerController |
getJMWorkerController()
return JMWorkerController for this worker
|
JMWorkerStatusUpdater |
getStatusUpdater() |
WorkerInfo |
getWorkerInfo()
return WorkerInfo for this worker
|
boolean |
reconnect(java.lang.String jobMasterAddress)
this method is called after the connection is lost to job master
it can be called after the jm restarted
it reconnects the worker to the job master
|
boolean |
sendWorkerCompletedMessage(JobMasterAPI.WorkerState finalState) |
void |
startBlocking()
start the Job Master Client in a blocking call
|
java.lang.Thread |
startThreaded()
start the Job Master Client in a Thread
|
boolean |
tryUntilConnected(long timeLimit)
try connecting until the time limit is reached
|
public static JMWorkerAgent createJMWorkerAgent(Config config, WorkerInfo thisWorker, java.lang.String jmAddress, int jmPort, int numberOfWorkers, int restartCount)
public static JMWorkerAgent getJMWorkerAgent()
public java.lang.Thread startThreaded()
public void startBlocking()
public boolean tryUntilConnected(long timeLimit)
public boolean reconnect(java.lang.String jobMasterAddress)
public WorkerInfo getWorkerInfo()
public JMWorkerController getJMWorkerController()
public JMDriverAgent getDriverAgent()
public JMWorkerStatusUpdater getStatusUpdater()
public CheckpointingClientImpl getCheckpointClient()
public static boolean addScalerListener(IScalerListener scalerListener)
public static boolean addAllJoinedListener(IAllJoinedListener iAllJoinedListener)
public static boolean addReceiverFromDriver(IReceiverFromDriver receiverFromDriver)
public static boolean addWorkerFailureListener(IWorkerFailureListener workerFailureListener)
public boolean sendWorkerCompletedMessage(JobMasterAPI.WorkerState finalState)
public void close()