2 Replies Latest reply on Jun 9, 2005 11:33 AM by bdueck

    Error in capacity warning calculation in Region.putNodeEvent

      Hi;

      I've found a problem with the formula used to calculate whether or not a Region's nodeEventQueue is approaching capacity.

      According to my calculation, the following line from putNodeEvent, would actually mean the user would never see a warning (which was my observation).

      if( nodeEventQueue_.size() > ((100*RegionManager.CAPACITY)/98) {

      Breaking the math down a litter further, you can see the problem:
      (100*RegionManager.CAPACITY)/98)
      (100 * 200000) / 98
      (20000000) / 98
      204081

      Therefore the above code evaluated at runtime is really:
      if( nodeEventQueue_.size() > (204081) {

      Since the buffer has a hardcoded limit of 200000, this means the warning will never be shown.
      I'd suggest fixing the problem by declaring a constant as follows:
      private final static int CAPACITY_WARN_THRESHOLD = (100*RegionManager.CAPACITY)*102;

      The above will evaluate to 196078, which is I think more like what we're looking for.
      Then, obviously change the code to use the constant:
      if( nodeEventQueue_.size() > (CAPACITY_WARN_THRESHOLD) {

      If you'd like me to report this on Jira, just let me know.

      Regards,

      Brian.