Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ public String getServiceUrl() {
return this.serviceUrl;
}

@Override
public int hashCode() {
return Objects.hashCode(serviceUrl);
}

@Override
public boolean equals(Object obj) {
if (obj instanceof LeaderBroker) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ protected void populateBucketEntries(Map<String, Double> map, String mkey, doubl
double value;

// example of key : "<metric_key>_0.0_0.5"
if (i == 0) {
if (i == 0 && boundaries.length > 0) {
bucketKey = String.format("%s_0.0_%1.1f", mkey, boundaries[i]);
} else if (i < boundaries.length) {
bucketKey = String.format("%s_%1.1f_%1.1f", mkey, boundaries[i - 1], boundaries[i]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,13 @@ public int compareTo(NamespaceBundle other) {
return this.keyRange.lowerEndpoint().compareTo(other.keyRange.lowerEndpoint());
}

@Override
public int hashCode() {
return Objects.hashCode(nsname,
keyRange.lowerEndpoint(), keyRange.lowerBoundType(),
keyRange.upperEndpoint(), keyRange.upperBoundType());
}

@Override
public boolean equals(Object other) {
if (other instanceof NamespaceBundle) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,11 @@ private static final long[] convertPartitions(SortedSet<Long> partitionsSet) {
return partitions;
}

@Override
public int hashCode() {
return Objects.hashCode(nsname, bundles);
}

@Override
public boolean equals(Object obj) {
if (obj != null && obj instanceof NamespaceBundles) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ private void init(ProducerConfigurationData conf) {
| currentNumMsgsSent) != 0) {

for (int i = 0; i < latencyPctValues.length; i++) {
if (latencyPctValues[i] == Double.NaN) {
if (Double.isNaN(latencyPctValues[i])) {
latencyPctValues[i] = 0;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,11 @@ public byte[] toByteArray() {
return messageId.toByteArray();
}

@Override
public int hashCode() {
return Objects.hash(topicPartitionName, messageId);
}

@Override
public boolean equals(Object obj) {
if (!(obj instanceof TopicMessageIdImpl)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ public AuthPolicies() {
subscription_auth_roles = Maps.newTreeMap();
}

@Override
public int hashCode() {
return Objects.hash(namespace_auth, destination_auth,
subscription_auth_roles);
}

@Override
public boolean equals(Object obj) {
if (obj instanceof AuthPolicies) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ public class AutoFailoverPolicyData {
public AutoFailoverPolicyType policy_type;
public Map<String, String> parameters;

@Override
public int hashCode() {
return Objects.hashCode(policy_type, parameters);
}

@Override
public boolean equals(Object obj) {
if (obj instanceof AutoFailoverPolicyData) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ public class BrokerNamespaceIsolationData {
public String brokerName;
public List<String> namespaceRegex; //isolated namespace regex

@Override
public int hashCode() {
return Objects.hashCode(brokerName, namespaceRegex);
}

@Override
public boolean equals(Object obj) {
if (obj instanceof BrokerNamespaceIsolationData) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@ public void setNumBundles(int numBundles) {
this.numBundles = numBundles;
}

@Override
public int hashCode() {
return Objects.hash(boundaries);
}

@Override
public boolean equals(Object obj) {
if (obj instanceof BundlesData) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ public void setBrokers(Set<String> brokers) {
this.brokers = brokers;
}

@Override
public int hashCode() {
return Objects.hashCode(brokers);
}

@Override
public boolean equals(Object obj) {
if (obj instanceof FailureDomain) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ public LocalPolicies() {
bundles = defaultBundle();
}

@Override
public int hashCode() {
return Objects.hashCode(bundles);
}

@Override
public boolean equals(Object obj) {
if (obj instanceof LocalPolicies) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@ public class NamespaceIsolationData {
public List<String> secondary = new ArrayList<String>();
public AutoFailoverPolicyData auto_failover_policy;

@Override
public int hashCode() {
return Objects.hashCode(namespaces, primary, secondary,
auto_failover_policy);
}

@Override
public boolean equals(Object obj) {
if (obj instanceof NamespaceIsolationData) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
*/
package org.apache.pulsar.common.policies.data;

import java.util.Objects;

import com.google.common.base.MoreObjects;

public class PersistencePolicies {
Expand Down Expand Up @@ -54,6 +56,11 @@ public double getManagedLedgerMaxMarkDeleteRate() {
return managedLedgerMaxMarkDeleteRate;
}

@Override
public int hashCode() {
return Objects.hash(bookkeeperEnsemble, bookkeeperWriteQuorum,
bookkeeperAckQuorum, managedLedgerMaxMarkDeleteRate);
}
@Override
public boolean equals(Object obj) {
if (obj instanceof PersistencePolicies) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,21 @@ public class Policies {
public SchemaAutoUpdateCompatibilityStrategy schema_auto_update_compatibility_strategy =
SchemaAutoUpdateCompatibilityStrategy.Full;

@Override
public int hashCode() {
return Objects.hash(auth_policies, replication_clusters,
backlog_quota_map, clusterDispatchRate,
clusterSubscribeRate, deduplicationEnabled, persistence,
bundles, latency_stats_sample_rate,
message_ttl_in_seconds, retention_policies,
encryption_required, subscription_auth_mode,
antiAffinityGroup, max_producers_per_topic,
max_consumers_per_topic, max_consumers_per_subscription,
compaction_threshold, offload_threshold,
offload_deletion_lag_ms,
schema_auto_update_compatibility_strategy);
}

@Override
public boolean equals(Object obj) {
if (obj instanceof Policies) {
Expand All @@ -77,7 +92,8 @@ public boolean equals(Object obj) {
&& Objects.equals(deduplicationEnabled, other.deduplicationEnabled)
&& Objects.equals(persistence, other.persistence) && Objects.equals(bundles, other.bundles)
&& Objects.equals(latency_stats_sample_rate, other.latency_stats_sample_rate)
&& message_ttl_in_seconds == other.message_ttl_in_seconds
&& Objects.equals(message_ttl_in_seconds,
other.message_ttl_in_seconds)
&& Objects.equals(retention_policies, other.retention_policies)
&& Objects.equals(encryption_required, other.encryption_required)
&& Objects.equals(subscription_auth_mode, other.subscription_auth_mode)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,12 @@ public void substract(ResourceQuota quota) {
this.memory -= quota.memory;
}

@Override
public int hashCode() {
return Objects.hashCode(msgRateIn, msgRateOut, bandwidthIn,
bandwidthOut, memory, dynamic);
}

@Override
public boolean equals(Object obj) {
if (obj instanceof ResourceQuota) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ public MinAvailablePolicy(AutoFailoverPolicyData policyData) {
this.usage_threshold = Integer.parseInt(policyData.parameters.get(USAGE_THRESHOLD_KEY));
}

@Override
public int hashCode() {
return Objects.hashCode(min_limit, usage_threshold);
}

@Override
public boolean equals(Object obj) {
if (obj instanceof MinAvailablePolicy) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,12 @@ public boolean isSecondaryBroker(String broker) {
return this.matchesBrokerRegex(this.secondary, broker);
}

@Override
public int hashCode() {
return Objects.hashCode(namespaces, primary, secondary,
auto_failover_policy);
}

@Override
public boolean equals(Object obj) {
if (obj instanceof NamespaceIsolationPolicyImpl) {
Expand Down