0 Replies Latest reply on Nov 4, 2013 10:04 AM by ulrich-scholz

    JBoss AS 7 database connection pools: MaxUsedCount incorrect?

    ulrich-scholz

      I'm using the native interface to read pool statistics of JBoss AS7 datasources. I retrieve ActiveCount and AvailableCount and both seem to be correct. But MaxUsedCount always seems to be the same as ActiveCount.

       

      I'm testing the mechanism with a script that grabs 9 connections and immediately afterwards releases 4 of them. So, if ActiveCount and MaxUsedCount before script execution is, e.g., 10, the numbers should be 15 for ActiveCount and 19 for MaxUsedCount afterwards.  But both numbers are 15.

       

      Script execution and reading the numbers are only seconds apart, such that resetting MaxUsedCount should not be an issue (the effect is 100% reproducable). Also, after reading the numbers, I try to reset MaxUsedCount. But, in my understanding, that can also be not the cause for the issue.

       

      My code:


              final long activeCount = poolNode.get("ActiveCount").asLong();

              final long availableCount = poolNode.get("AvailableCount").asLong();

              final long maxUsedCount = poolNode.get("MaxUsedCount").asLong();

       

              poolNode.get("operation").set("write-attribute"); // poolNode is the correct ModelNode

              poolNode.get("name").set("MaxUseCount");

              poolNode.get("value").set(0);

       

              try

              {

                           mc.execute(poolNode); // mc is the correct ModelControllerClient, also used to create/find poolNode

              }

              catch (final IOException e)

              {

                  log.warning("setting MaxUseCount failed", e);

              }

       

              log.debug("accountName={0}: active={1}, maxUsedCount={2}",

                        new String[]{accountName, String.valueOf(activeCount), String.valueOf(maxUsedCount)});