@NotThreadSafe public final class HeartbeatThread extends Object implements Runnable
Constructor and Description |
---|
HeartbeatThread(String executorName,
HeartbeatExecutor executor,
long intervalMs,
AlluxioConfiguration conf,
UserState userState)
Convenience method for
HeartbeatThread(String, String, HeartbeatExecutor, long, AlluxioConfiguration, UserState)
where threadId is null. |
HeartbeatThread(String executorName,
String threadId,
HeartbeatExecutor executor,
long intervalMs,
AlluxioConfiguration conf,
UserState userState)
Creates a
Runnable to execute heartbeats for the given HeartbeatExecutor . |
Modifier and Type | Method and Description |
---|---|
static String |
generateThreadName(String executorName,
String threadId) |
void |
run() |
void |
updateIntervalMs(long intervalMs)
Updates the heartbeat interval.
|
public HeartbeatThread(String executorName, String threadId, HeartbeatExecutor executor, long intervalMs, AlluxioConfiguration conf, UserState userState)
Runnable
to execute heartbeats for the given HeartbeatExecutor
.
This class is responsible for closing the given HeartbeatExecutor
when it finishes.executorName
- identifies the heartbeat thread's executor, should be those defined in
HeartbeatContext
threadId
- the thread identifier, normally, it is empty, but if a heartbeat
executor is started in multiple threads, this can be used to distinguish them, the heartbeat
thread's name is a combination of executorName and threadIdexecutor
- identifies the heartbeat thread executor; an instance of a class that
implements the HeartbeatExecutor interfaceintervalMs
- Sleep time between different heartbeatconf
- Alluxio configurationuserState
- the user state for this heartbeat threadpublic HeartbeatThread(String executorName, HeartbeatExecutor executor, long intervalMs, AlluxioConfiguration conf, UserState userState)
HeartbeatThread(String, String, HeartbeatExecutor, long, AlluxioConfiguration, UserState)
where threadId is null.executorName
- the executor name that is one of those defined in HeartbeatContext
executor
- the heartbeat executorintervalMs
- the interval between heartbeatsconf
- the Alluxio configurationuserState
- the user state for this heartbeat threadpublic static String generateThreadName(String executorName, String threadId)
executorName
- the executor name defined in HeartbeatContext
threadId
- the thread identifierpublic void updateIntervalMs(long intervalMs)
intervalMs
- the heartbeat interval in msCopyright © 2023. All Rights Reserved.