@InterfaceAudience.Private public class MasterAddressRefresher extends Object implements Closeable
MasterRegistry
up to date. This
uses the RPC MasterProtos.ClientMetaService.getMasters(org.apache.hbase.thirdparty.com.google.protobuf.RpcController, org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.GetMastersRequest, org.apache.hbase.thirdparty.com.google.protobuf.RpcCallback<org.apache.hadoop.hbase.shaded.protobuf.generated.MasterProtos.GetMastersResponse>)
to fetch the latest list of registered masters.
By default the refresh happens periodically (configured via
PERIODIC_REFRESH_INTERVAL_SECS
). The refresh can also be triggered on demand via
refreshNow()
. To prevent a flood of on-demand refreshes we expect that any attempts two
should be spaced at least MIN_SECS_BETWEEN_REFRESHES
seconds apart.Modifier and Type | Class and Description |
---|---|
private class |
MasterAddressRefresher.RefreshThread
Thread that refreshes the master end points until it is interrupted via
close() . |
Modifier and Type | Field and Description |
---|---|
private static org.slf4j.Logger |
LOG |
static String |
MIN_SECS_BETWEEN_REFRESHES |
private static int |
MIN_SECS_BETWEEN_REFRESHES_DEFAULT |
static String |
PERIODIC_REFRESH_INTERVAL_SECS |
private static int |
PERIODIC_REFRESH_INTERVAL_SECS_DEFAULT |
private long |
periodicRefreshMs |
private ExecutorService |
pool |
private Object |
refreshMasters |
private MasterRegistry |
registry |
private long |
timeBetweenRefreshesMs |
Constructor and Description |
---|
MasterAddressRefresher(org.apache.hadoop.conf.Configuration conf,
MasterRegistry registry) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
(package private) void |
refreshNow()
Notifies the refresher thread to refresh the configuration.
|
private static final org.slf4j.Logger LOG
public static final String PERIODIC_REFRESH_INTERVAL_SECS
private static final int PERIODIC_REFRESH_INTERVAL_SECS_DEFAULT
public static final String MIN_SECS_BETWEEN_REFRESHES
private static final int MIN_SECS_BETWEEN_REFRESHES_DEFAULT
private final ExecutorService pool
private final MasterRegistry registry
private final long periodicRefreshMs
private final long timeBetweenRefreshesMs
private final Object refreshMasters
MasterAddressRefresher(org.apache.hadoop.conf.Configuration conf, MasterRegistry registry)
public void close()
close
in interface Closeable
close
in interface AutoCloseable
void refreshNow()
Copyright © 2007–2021 The Apache Software Foundation. All rights reserved.