mirror of
https://github.com/apache/activemq.git
synced 2025-02-09 19:45:55 +00:00
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 (cherry picked from commit 42dabb7a7a7f981eb57d46663456ac1d7c912acb)
This commit is contained in:
parent
c3d71ebe01
commit
78cacc5e17
@ -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…
x
Reference in New Issue
Block a user