@NotThreadSafe public class SpecificMasterBlockSync extends Object implements HeartbeatExecutor, Closeable
BlockMasterSync
in:
1. The registration takes place asynchronously and the caller can poll the registration state.
We need to make the process async because when standby master read is enabled, workers have to
register to all masters and these registrations can happen concurrently to speed up the process.
2. A registration failure doesn't throw a fatal exception. Instead, it retries endlessly.
This is because a standby master registration failure
should be a soft failure and can be retried later.Modifier and Type | Class and Description |
---|---|
static class |
SpecificMasterBlockSync.Metrics
Metrics.
|
Constructor and Description |
---|
SpecificMasterBlockSync(BlockWorker blockWorker,
BlockMasterClient masterClient,
BlockHeartbeatReporter heartbeatReporter)
Creates a new instance of
SpecificMasterBlockSync . |
Modifier and Type | Method and Description |
---|---|
protected void |
beforeHeartbeat() |
void |
close()
Cleans up any resources used by the heartbeat executor.
|
void |
heartbeat()
Implements the heartbeat logic.
|
boolean |
isRegistered() |
protected void |
registerWithMasterInternal() |
public SpecificMasterBlockSync(BlockWorker blockWorker, BlockMasterClient masterClient, BlockHeartbeatReporter heartbeatReporter) throws IOException
SpecificMasterBlockSync
.blockWorker
- the BlockWorker
this syncer is updating tomasterClient
- the block master clientheartbeatReporter
- the heartbeat reporterIOException
protected void registerWithMasterInternal() throws IOException, FailedToAcquireRegisterLeaseException
public void heartbeat() throws InterruptedException
HeartbeatExecutor
heartbeat
in interface HeartbeatExecutor
InterruptedException
- if the thread is interruptedprotected void beforeHeartbeat()
public void close()
HeartbeatExecutor
close
in interface HeartbeatExecutor
close
in interface Closeable
close
in interface AutoCloseable
public boolean isRegistered()
Copyright © 2023. All Rights Reserved.