@NotThreadSafe public final class HeartbeatThread extends Object implements Runnable, Reconfigurable
Modifier and Type | Class and Description |
---|---|
static class |
HeartbeatThread.Status
Enum representing the status of HeartbeatThread.
|
Constructor and Description |
---|
HeartbeatThread(String executorName,
HeartbeatExecutor executor,
com.google.common.base.Supplier<Long> intervalSupplier,
AlluxioConfiguration conf,
UserState userState)
Convenience method for
HeartbeatThread(String, String, HeartbeatExecutor, Supplier, AlluxioConfiguration,
UserState) where threadId is null. |
HeartbeatThread(String executorName,
String threadId,
HeartbeatExecutor executor,
com.google.common.base.Supplier<Long> intervalSupplier,
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) |
HeartbeatThread.Status |
getStatus() |
void |
run() |
void |
update()
When the property changed, this function will be invoked.
|
void |
updateIntervalMs(long intervalMs)
Updates the heartbeat interval.
|
public HeartbeatThread(String executorName, String threadId, HeartbeatExecutor executor, com.google.common.base.Supplier<Long> intervalSupplier, 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 interfaceintervalSupplier
- Sleep time between different heartbeat supplierconf
- Alluxio configurationuserState
- the user state for this heartbeat threadpublic HeartbeatThread(String executorName, HeartbeatExecutor executor, com.google.common.base.Supplier<Long> intervalSupplier, AlluxioConfiguration conf, UserState userState)
HeartbeatThread(String, String, HeartbeatExecutor, Supplier, AlluxioConfiguration,
UserState)
where threadId is null.executorName
- the executor name that is one of those defined in HeartbeatContext
executor
- the heartbeat executorintervalSupplier
- the interval between heartbeats supplierconf
- 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 mspublic HeartbeatThread.Status getStatus()
public void update()
Reconfigurable
update
in interface Reconfigurable
Copyright © 2023. All Rights Reserved.