Class ModularLoadManagerWrapper
- java.lang.Object
-
- org.apache.pulsar.broker.loadbalance.impl.ModularLoadManagerWrapper
-
- All Implemented Interfaces:
LoadManager
public class ModularLoadManagerWrapper extends java.lang.Object implements LoadManager
Wrapper class allowing classes of instance ModularLoadManager to be compatible with the interface LoadManager.
-
-
Field Summary
-
Fields inherited from interface org.apache.pulsar.broker.loadbalance.LoadManager
LOADBALANCE_BROKERS_ROOT, LOG
-
-
Constructor Summary
Constructors Constructor Description ModularLoadManagerWrapper(ModularLoadManager loadManager)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddisableBroker()Removes visibility of current broker from loadbalancer list so, other brokers can't redirect any request to this broker and this broker won't accept new connection requests.voiddoLoadShedding()Unload a candidate service unit to balance the load.voiddoNamespaceBundleSplit()Namespace bundle split.org.apache.pulsar.policies.data.loadbalancer.LoadManagerReportgenerateLoadReport()Generate the load report.java.util.Set<java.lang.String>getAvailableBrokers()Get list of available brokers in cluster.java.util.concurrent.CompletableFuture<java.util.Set<java.lang.String>>getAvailableBrokersAsync()java.util.Optional<ResourceUnit>getLeastLoaded(org.apache.pulsar.common.naming.ServiceUnitId serviceUnit)Returns the Least Loaded Resource Unit decided by some algorithm or criteria which is implementation specific.java.util.List<org.apache.pulsar.common.stats.Metrics>getLoadBalancingMetrics()Generate load balancing stats metrics.ModularLoadManagergetLoadManager()voidinitialize(PulsarService pulsar)Initialize this LoadManager.booleanisCentralized()Is centralized decision making to assign a new bundle.voidsetLoadReportForceUpdateFlag()Set flag to force load report update.voidstart()voidstop()voidwriteLoadReportOnZookeeper()Publish the current load report on ZK.voidwriteLoadReportOnZookeeper(boolean force)Publish the current load report on ZK, forced or not.voidwriteResourceQuotasToZooKeeper()Update namespace bundle resource quota on ZK.
-
-
-
Constructor Detail
-
ModularLoadManagerWrapper
public ModularLoadManagerWrapper(ModularLoadManager loadManager)
-
-
Method Detail
-
disableBroker
public void disableBroker() throws java.lang.ExceptionDescription copied from interface:LoadManagerRemoves visibility of current broker from loadbalancer list so, other brokers can't redirect any request to this broker and this broker won't accept new connection requests.- Specified by:
disableBrokerin interfaceLoadManager- Throws:
java.lang.Exception
-
doLoadShedding
public void doLoadShedding()
Description copied from interface:LoadManagerUnload a candidate service unit to balance the load.- Specified by:
doLoadSheddingin interfaceLoadManager
-
doNamespaceBundleSplit
public void doNamespaceBundleSplit()
Description copied from interface:LoadManagerNamespace bundle split.- Specified by:
doNamespaceBundleSplitin interfaceLoadManager
-
generateLoadReport
public org.apache.pulsar.policies.data.loadbalancer.LoadManagerReport generateLoadReport()
Description copied from interface:LoadManagerGenerate the load report.- Specified by:
generateLoadReportin interfaceLoadManager
-
getLeastLoaded
public java.util.Optional<ResourceUnit> getLeastLoaded(org.apache.pulsar.common.naming.ServiceUnitId serviceUnit)
Description copied from interface:LoadManagerReturns the Least Loaded Resource Unit decided by some algorithm or criteria which is implementation specific.- Specified by:
getLeastLoadedin interfaceLoadManager
-
getLoadBalancingMetrics
public java.util.List<org.apache.pulsar.common.stats.Metrics> getLoadBalancingMetrics()
Description copied from interface:LoadManagerGenerate load balancing stats metrics.- Specified by:
getLoadBalancingMetricsin interfaceLoadManager
-
initialize
public void initialize(PulsarService pulsar)
Description copied from interface:LoadManagerInitialize this LoadManager.- Specified by:
initializein interfaceLoadManager- Parameters:
pulsar- The service to initialize this with.
-
isCentralized
public boolean isCentralized()
Description copied from interface:LoadManagerIs centralized decision making to assign a new bundle.- Specified by:
isCentralizedin interfaceLoadManager
-
setLoadReportForceUpdateFlag
public void setLoadReportForceUpdateFlag()
Description copied from interface:LoadManagerSet flag to force load report update.- Specified by:
setLoadReportForceUpdateFlagin interfaceLoadManager
-
start
public void start() throws org.apache.pulsar.broker.PulsarServerException- Specified by:
startin interfaceLoadManager- Throws:
org.apache.pulsar.broker.PulsarServerException
-
stop
public void stop() throws org.apache.pulsar.broker.PulsarServerException- Specified by:
stopin interfaceLoadManager- Throws:
org.apache.pulsar.broker.PulsarServerException
-
writeLoadReportOnZookeeper
public void writeLoadReportOnZookeeper()
Description copied from interface:LoadManagerPublish the current load report on ZK.- Specified by:
writeLoadReportOnZookeeperin interfaceLoadManager
-
writeLoadReportOnZookeeper
public void writeLoadReportOnZookeeper(boolean force)
Description copied from interface:LoadManagerPublish the current load report on ZK, forced or not. By default rely on method writeLoadReportOnZookeeper().- Specified by:
writeLoadReportOnZookeeperin interfaceLoadManager
-
writeResourceQuotasToZooKeeper
public void writeResourceQuotasToZooKeeper()
Description copied from interface:LoadManagerUpdate namespace bundle resource quota on ZK.- Specified by:
writeResourceQuotasToZooKeeperin interfaceLoadManager
-
getLoadManager
public ModularLoadManager getLoadManager()
-
getAvailableBrokers
public java.util.Set<java.lang.String> getAvailableBrokers() throws java.lang.ExceptionDescription copied from interface:LoadManagerGet list of available brokers in cluster.- Specified by:
getAvailableBrokersin interfaceLoadManager- Returns:
- Throws:
java.lang.Exception
-
getAvailableBrokersAsync
public java.util.concurrent.CompletableFuture<java.util.Set<java.lang.String>> getAvailableBrokersAsync()
- Specified by:
getAvailableBrokersAsyncin interfaceLoadManager
-
-