You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2018/04/08 16:12:40 UTC
[GitHub] merlimat closed pull request #1524: Issue 1510: java.lang.IllegalArgumentException on refreshing stats
merlimat closed pull request #1524: Issue 1510: java.lang.IllegalArgumentException on refreshing stats
URL: https://github.com/apache/incubator-pulsar/pull/1524
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
diff --git a/managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerFactoryMBeanImpl.java b/managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerFactoryMBeanImpl.java
index b97fda682f..8d25b88b42 100644
--- a/managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerFactoryMBeanImpl.java
+++ b/managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerFactoryMBeanImpl.java
@@ -38,6 +38,11 @@ public ManagedLedgerFactoryMBeanImpl(ManagedLedgerFactoryImpl factory) throws Ex
public void refreshStats(long period, TimeUnit unit) {
double seconds = unit.toMillis(period) / 1000.0;
+ if (seconds <= 0.0) {
+ // skip refreshing stats
+ return;
+ }
+
cacheHits.calculateRate(seconds);
cacheMisses.calculateRate(seconds);
cacheEvictions.calculateRate(seconds);
diff --git a/managed-ledger/src/main/java/org/apache/bookkeeper/mledger/util/Rate.java b/managed-ledger/src/main/java/org/apache/bookkeeper/mledger/util/Rate.java
index 2b8e018399..504d5d927d 100644
--- a/managed-ledger/src/main/java/org/apache/bookkeeper/mledger/util/Rate.java
+++ b/managed-ledger/src/main/java/org/apache/bookkeeper/mledger/util/Rate.java
@@ -57,7 +57,7 @@ public void calculateRate() {
}
public void calculateRate(double period) {
- checkArgument(period != 0);
+ checkArgument(period > 0, "Invalid period %s to calculate rate", period);
count = countAdder.sumThenReset();
long sum = valueAdder.sumThenReset();
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services