Class LocalBrokerData
java.lang.Object
org.apache.pulsar.policies.data.loadbalancer.LocalBrokerData
- All Implemented Interfaces:
LoadManagerReport
,ServiceLookupData
Contains all the data that is maintained locally on each broker.
-
Field Summary
-
Constructor Summary
ConstructorDescriptionLocalBrokerData
(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 TypeMethodDescriptionvoid
boolean
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.getCpu()
long
double
double
getMaxResourceUsageWithWeight
(double cpuWeight, double directMemoryWeight, double bandwidthInWeight, double bandwidthOutWeight) double
getMaxResourceUsageWithWeight
(double cpuWeight, double memoryWeight, double directMemoryWeight, double bandwidthInWeight, double bandwidthOutWeight) Deprecated.double
double
double
double
int
int
int
int
getProtocol
(String protocol) long
int
hashCode()
boolean
boolean
static double
max
(double... args) void
setAdvertisedListeners
(Map<String, AdvertisedListener> advertisedListeners) void
setBandwidthIn
(ResourceUsage bandwidthIn) void
setBandwidthOut
(ResourceUsage bandwidthOut) void
setBrokerVersionString
(String brokerVersionString) void
setBundles
(Set<String> bundles) void
setCpu
(ResourceUsage cpu) void
setDirectMemory
(ResourceUsage directMemory) void
setLastBundleGains
(Set<String> lastBundleGains) void
setLastBundleLosses
(Set<String> lastBundleLosses) void
setLastStats
(Map<String, NamespaceBundleStats> lastStats) void
setLastUpdate
(long lastUpdate) void
setLoadManagerClassName
(String loadManagerClassName) void
setMemory
(ResourceUsage memory) void
setMsgRateIn
(double msgRateIn) void
setMsgRateOut
(double msgRateOut) void
setMsgThroughputIn
(double msgThroughputIn) void
setMsgThroughputOut
(double msgThroughputOut) void
setNonPersistentTopicsEnabled
(boolean nonPersistentTopicsEnabled) void
setNumBundles
(int numBundles) void
setNumConsumers
(int numConsumers) void
setNumProducers
(int numProducers) void
setNumTopics
(int numTopics) void
setPersistentTopicsEnabled
(boolean persistentTopicsEnabled) void
setProtocols
(Map<String, String> protocols) void
update
(LocalBrokerData other) Using another LocalBrokerData, update this.void
update
(SystemResourceUsage systemResourceUsage, Map<String, 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, 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
@Deprecated public double getMaxResourceUsageWithWeight(double cpuWeight, double memoryWeight, double directMemoryWeight, double bandwidthInWeight, double bandwidthOutWeight) Deprecated. -
getMaxResourceUsageWithWeight
public double getMaxResourceUsageWithWeight(double cpuWeight, double directMemoryWeight, double bandwidthInWeight, double bandwidthOutWeight) -
max
public static double max(double... args) -
getLoadReportType
-
getCpu
- Specified by:
getCpu
in interfaceLoadManagerReport
-
setCpu
-
getMemory
- Specified by:
getMemory
in interfaceLoadManagerReport
-
setMemory
-
getDirectMemory
- Specified by:
getDirectMemory
in interfaceLoadManagerReport
-
setDirectMemory
-
getBandwidthIn
- Specified by:
getBandwidthIn
in interfaceLoadManagerReport
-
setBandwidthIn
-
getBandwidthOut
- Specified by:
getBandwidthOut
in interfaceLoadManagerReport
-
setBandwidthOut
-
getLastBundleGains
-
cleanDeltas
public void cleanDeltas() -
setLastBundleGains
-
getLastBundleLosses
-
setLastBundleLosses
-
getLastUpdate
public long getLastUpdate()- Specified by:
getLastUpdate
in interfaceLoadManagerReport
-
setLastUpdate
public void setLastUpdate(long lastUpdate) -
getBundles
-
setBundles
-
getLastStats
-
setLastStats
-
getNumTopics
public int getNumTopics()- Specified by:
getNumTopics
in interfaceLoadManagerReport
-
setNumTopics
public void setNumTopics(int numTopics) -
getNumBundles
public int getNumBundles()- Specified by:
getNumBundles
in interfaceLoadManagerReport
-
setNumBundles
public void setNumBundles(int numBundles) -
getNumConsumers
public int getNumConsumers()- Specified by:
getNumConsumers
in interfaceLoadManagerReport
-
setNumConsumers
public void setNumConsumers(int numConsumers) -
getNumProducers
public int getNumProducers()- Specified by:
getNumProducers
in interfaceLoadManagerReport
-
setNumProducers
public void setNumProducers(int numProducers) -
getMsgThroughputIn
public double getMsgThroughputIn()- Specified by:
getMsgThroughputIn
in interfaceLoadManagerReport
-
setMsgThroughputIn
public void setMsgThroughputIn(double msgThroughputIn) -
getMsgThroughputOut
public double getMsgThroughputOut()- Specified by:
getMsgThroughputOut
in interfaceLoadManagerReport
-
setMsgThroughputOut
public void setMsgThroughputOut(double msgThroughputOut) -
getMsgRateIn
public double getMsgRateIn()- Specified by:
getMsgRateIn
in interfaceLoadManagerReport
-
setMsgRateIn
public void setMsgRateIn(double msgRateIn) -
getMsgRateOut
public double getMsgRateOut()- Specified by:
getMsgRateOut
in interfaceLoadManagerReport
-
setMsgRateOut
public void setMsgRateOut(double msgRateOut) -
setBrokerVersionString
-
getBrokerVersionString
- Specified by:
getBrokerVersionString
in interfaceLoadManagerReport
-
getWebServiceUrl
- Specified by:
getWebServiceUrl
in interfaceServiceLookupData
-
getWebServiceUrlTls
- Specified by:
getWebServiceUrlTls
in interfaceServiceLookupData
-
getPulsarServiceUrl
- Specified by:
getPulsarServiceUrl
in interfaceServiceLookupData
-
getPulsarServiceUrlTls
- Specified by:
getPulsarServiceUrlTls
in interfaceServiceLookupData
-
isPersistentTopicsEnabled
public boolean isPersistentTopicsEnabled()- Specified by:
isPersistentTopicsEnabled
in interfaceLoadManagerReport
-
setPersistentTopicsEnabled
public void setPersistentTopicsEnabled(boolean persistentTopicsEnabled) -
isNonPersistentTopicsEnabled
public boolean isNonPersistentTopicsEnabled()- Specified by:
isNonPersistentTopicsEnabled
in interfaceLoadManagerReport
-
setNonPersistentTopicsEnabled
public void setNonPersistentTopicsEnabled(boolean nonPersistentTopicsEnabled) -
getBundleStats
- Specified by:
getBundleStats
in interfaceLoadManagerReport
-
setProtocols
-
getProtocols
- Specified by:
getProtocols
in interfaceServiceLookupData
-
getProtocol
- Specified by:
getProtocol
in interfaceServiceLookupData
-
getAdvertisedListeners
-
setAdvertisedListeners
-
getLoadManagerClassName
- Specified by:
getLoadManagerClassName
in interfaceServiceLookupData
-
setLoadManagerClassName
-
getStartTimestamp
public long getStartTimestamp()- Specified by:
getStartTimestamp
in interfaceServiceLookupData
-