Class LocalBrokerData
java.lang.Object
org.apache.pulsar.policies.data.loadbalancer.LocalBrokerData
- All Implemented Interfaces:
org.apache.pulsar.policies.data.loadbalancer.LoadManagerReport,org.apache.pulsar.policies.data.loadbalancer.ServiceLookupData
public class LocalBrokerData
extends Object
implements org.apache.pulsar.policies.data.loadbalancer.LoadManagerReport
Contains all the data that is maintained locally on each broker.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionLocalBrokerData(String webServiceUrl, String webServiceUrlTls, String pulsarServiceUrl, String pulsarServiceUrlTls) Broker data constructor which takes in four URLs to satisfy the contract of ServiceLookupData.LocalBrokerData(String webServiceUrl, String webServiceUrlTls, String pulsarServiceUrl, String pulsarServiceUrlTls, Map<String, AdvertisedListener> advertisedListeners) -
Method Summary
Modifier and TypeMethodDescriptionvoidbooleanSince the broker data is also used as a lock for the broker, we need to have a stable comparison operator that is not affected by the actual load on the broker.org.apache.pulsar.policies.data.loadbalancer.ResourceUsageorg.apache.pulsar.policies.data.loadbalancer.ResourceUsageorg.apache.pulsar.policies.data.loadbalancer.ResourceUsagegetCpu()org.apache.pulsar.policies.data.loadbalancer.ResourceUsagelongdoubledoublegetMaxResourceUsageWithWeight(double cpuWeight, double memoryWeight, double directMemoryWeight, double bandwidthInWeight, double bandwidthOutWeight) org.apache.pulsar.policies.data.loadbalancer.ResourceUsagedoubledoubledoubledoubleintintintintgetProtocol(String protocol) inthashCode()booleanbooleanvoidsetAdvertisedListeners(Map<String, AdvertisedListener> advertisedListeners) voidsetBandwidthIn(org.apache.pulsar.policies.data.loadbalancer.ResourceUsage bandwidthIn) voidsetBandwidthOut(org.apache.pulsar.policies.data.loadbalancer.ResourceUsage bandwidthOut) voidsetBrokerVersionString(String brokerVersionString) voidsetBundles(Set<String> bundles) voidsetCpu(org.apache.pulsar.policies.data.loadbalancer.ResourceUsage cpu) voidsetDirectMemory(org.apache.pulsar.policies.data.loadbalancer.ResourceUsage directMemory) voidsetLastBundleGains(Set<String> lastBundleGains) voidsetLastBundleLosses(Set<String> lastBundleLosses) voidsetLastStats(Map<String, org.apache.pulsar.policies.data.loadbalancer.NamespaceBundleStats> lastStats) voidsetLastUpdate(long lastUpdate) voidsetMemory(org.apache.pulsar.policies.data.loadbalancer.ResourceUsage memory) voidsetMsgRateIn(double msgRateIn) voidsetMsgRateOut(double msgRateOut) voidsetMsgThroughputIn(double msgThroughputIn) voidsetMsgThroughputOut(double msgThroughputOut) voidsetNonPersistentTopicsEnabled(boolean nonPersistentTopicsEnabled) voidsetNumBundles(int numBundles) voidsetNumConsumers(int numConsumers) voidsetNumProducers(int numProducers) voidsetNumTopics(int numTopics) voidsetPersistentTopicsEnabled(boolean persistentTopicsEnabled) voidsetProtocols(Map<String, String> protocols) voidupdate(LocalBrokerData other) Using another LocalBrokerData, update this.voidupdate(SystemResourceUsage systemResourceUsage, Map<String, org.apache.pulsar.policies.data.loadbalancer.NamespaceBundleStats> bundleStats) Using the system resource usage and bundle stats acquired from the Pulsar client, update this LocalBrokerData.
-
Field Details
-
loadReportType
-
-
Constructor Details
-
Method Details
-
equals
Since the broker data is also used as a lock for the broker, we need to have a stable comparison operator that is not affected by the actual load on the broker. -
hashCode
public int hashCode() -
update
public void update(SystemResourceUsage systemResourceUsage, Map<String, org.apache.pulsar.policies.data.loadbalancer.NamespaceBundleStats> bundleStats) Using the system resource usage and bundle stats acquired from the Pulsar client, update this LocalBrokerData.- Parameters:
systemResourceUsage- System resource usage (cpu, memory, and direct memory).bundleStats- The bundle stats retrieved from the Pulsar client.
-
update
Using another LocalBrokerData, update this.- Parameters:
other- LocalBrokerData to update from.
-
getMaxResourceUsage
public double getMaxResourceUsage() -
printResourceUsage
-
getMaxResourceUsageWithWeight
public double getMaxResourceUsageWithWeight(double cpuWeight, double memoryWeight, double directMemoryWeight, double bandwidthInWeight, double bandwidthOutWeight) -
getLoadReportType
-
getCpu
public org.apache.pulsar.policies.data.loadbalancer.ResourceUsage getCpu()- Specified by:
getCpuin interfaceorg.apache.pulsar.policies.data.loadbalancer.LoadManagerReport
-
setCpu
public void setCpu(org.apache.pulsar.policies.data.loadbalancer.ResourceUsage cpu) -
getMemory
public org.apache.pulsar.policies.data.loadbalancer.ResourceUsage getMemory()- Specified by:
getMemoryin interfaceorg.apache.pulsar.policies.data.loadbalancer.LoadManagerReport
-
setMemory
public void setMemory(org.apache.pulsar.policies.data.loadbalancer.ResourceUsage memory) -
getDirectMemory
public org.apache.pulsar.policies.data.loadbalancer.ResourceUsage getDirectMemory()- Specified by:
getDirectMemoryin interfaceorg.apache.pulsar.policies.data.loadbalancer.LoadManagerReport
-
setDirectMemory
public void setDirectMemory(org.apache.pulsar.policies.data.loadbalancer.ResourceUsage directMemory) -
getBandwidthIn
public org.apache.pulsar.policies.data.loadbalancer.ResourceUsage getBandwidthIn()- Specified by:
getBandwidthInin interfaceorg.apache.pulsar.policies.data.loadbalancer.LoadManagerReport
-
setBandwidthIn
public void setBandwidthIn(org.apache.pulsar.policies.data.loadbalancer.ResourceUsage bandwidthIn) -
getBandwidthOut
public org.apache.pulsar.policies.data.loadbalancer.ResourceUsage getBandwidthOut()- Specified by:
getBandwidthOutin interfaceorg.apache.pulsar.policies.data.loadbalancer.LoadManagerReport
-
setBandwidthOut
public void setBandwidthOut(org.apache.pulsar.policies.data.loadbalancer.ResourceUsage bandwidthOut) -
getLastBundleGains
-
cleanDeltas
public void cleanDeltas() -
setLastBundleGains
-
getLastBundleLosses
-
setLastBundleLosses
-
getLastUpdate
public long getLastUpdate()- Specified by:
getLastUpdatein interfaceorg.apache.pulsar.policies.data.loadbalancer.LoadManagerReport
-
setLastUpdate
public void setLastUpdate(long lastUpdate) -
getBundles
-
setBundles
-
getLastStats
-
setLastStats
-
getNumTopics
public int getNumTopics()- Specified by:
getNumTopicsin interfaceorg.apache.pulsar.policies.data.loadbalancer.LoadManagerReport
-
setNumTopics
public void setNumTopics(int numTopics) -
getNumBundles
public int getNumBundles()- Specified by:
getNumBundlesin interfaceorg.apache.pulsar.policies.data.loadbalancer.LoadManagerReport
-
setNumBundles
public void setNumBundles(int numBundles) -
getNumConsumers
public int getNumConsumers()- Specified by:
getNumConsumersin interfaceorg.apache.pulsar.policies.data.loadbalancer.LoadManagerReport
-
setNumConsumers
public void setNumConsumers(int numConsumers) -
getNumProducers
public int getNumProducers()- Specified by:
getNumProducersin interfaceorg.apache.pulsar.policies.data.loadbalancer.LoadManagerReport
-
setNumProducers
public void setNumProducers(int numProducers) -
getMsgThroughputIn
public double getMsgThroughputIn()- Specified by:
getMsgThroughputInin interfaceorg.apache.pulsar.policies.data.loadbalancer.LoadManagerReport
-
setMsgThroughputIn
public void setMsgThroughputIn(double msgThroughputIn) -
getMsgThroughputOut
public double getMsgThroughputOut()- Specified by:
getMsgThroughputOutin interfaceorg.apache.pulsar.policies.data.loadbalancer.LoadManagerReport
-
setMsgThroughputOut
public void setMsgThroughputOut(double msgThroughputOut) -
getMsgRateIn
public double getMsgRateIn()- Specified by:
getMsgRateInin interfaceorg.apache.pulsar.policies.data.loadbalancer.LoadManagerReport
-
setMsgRateIn
public void setMsgRateIn(double msgRateIn) -
getMsgRateOut
public double getMsgRateOut()- Specified by:
getMsgRateOutin interfaceorg.apache.pulsar.policies.data.loadbalancer.LoadManagerReport
-
setMsgRateOut
public void setMsgRateOut(double msgRateOut) -
setBrokerVersionString
-
getBrokerVersionString
- Specified by:
getBrokerVersionStringin interfaceorg.apache.pulsar.policies.data.loadbalancer.LoadManagerReport
-
getWebServiceUrl
- Specified by:
getWebServiceUrlin interfaceorg.apache.pulsar.policies.data.loadbalancer.ServiceLookupData
-
getWebServiceUrlTls
- Specified by:
getWebServiceUrlTlsin interfaceorg.apache.pulsar.policies.data.loadbalancer.ServiceLookupData
-
getPulsarServiceUrl
- Specified by:
getPulsarServiceUrlin interfaceorg.apache.pulsar.policies.data.loadbalancer.ServiceLookupData
-
getPulsarServiceUrlTls
- Specified by:
getPulsarServiceUrlTlsin interfaceorg.apache.pulsar.policies.data.loadbalancer.ServiceLookupData
-
isPersistentTopicsEnabled
public boolean isPersistentTopicsEnabled()- Specified by:
isPersistentTopicsEnabledin interfaceorg.apache.pulsar.policies.data.loadbalancer.LoadManagerReport
-
setPersistentTopicsEnabled
public void setPersistentTopicsEnabled(boolean persistentTopicsEnabled) -
isNonPersistentTopicsEnabled
public boolean isNonPersistentTopicsEnabled()- Specified by:
isNonPersistentTopicsEnabledin interfaceorg.apache.pulsar.policies.data.loadbalancer.LoadManagerReport
-
setNonPersistentTopicsEnabled
public void setNonPersistentTopicsEnabled(boolean nonPersistentTopicsEnabled) -
getBundleStats
public Map<String,org.apache.pulsar.policies.data.loadbalancer.NamespaceBundleStats> getBundleStats()- Specified by:
getBundleStatsin interfaceorg.apache.pulsar.policies.data.loadbalancer.LoadManagerReport
-
setProtocols
-
getProtocols
- Specified by:
getProtocolsin interfaceorg.apache.pulsar.policies.data.loadbalancer.ServiceLookupData
-
getProtocol
- Specified by:
getProtocolin interfaceorg.apache.pulsar.policies.data.loadbalancer.ServiceLookupData
-
getAdvertisedListeners
-
setAdvertisedListeners
-