mirror of https://github.com/apache/activemq.git
Preventing a divide by 0 error by taking a local reference to the prefetch size to guarantee that the value doesn't change after the > 0 check
This commit is contained in:
parent
4b2760e749
commit
42dabb7a7a
|
@ -236,8 +236,9 @@ public abstract class AbstractSubscription implements Subscription {
|
|||
|
||||
@Override
|
||||
public int getInFlightUsage() {
|
||||
if (info.getPrefetchSize() > 0) {
|
||||
return (getInFlightSize() * 100)/info.getPrefetchSize();
|
||||
int prefetchSize = info.getPrefetchSize();
|
||||
if (prefetchSize > 0) {
|
||||
return (getInFlightSize() * 100) / prefetchSize;
|
||||
}
|
||||
return Integer.MAX_VALUE;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue