"Division by Zero" exception occured while doing "List Statistic" on Datasource, from EAP Admin Console

Solution Verified - Updated -

Issue

  • When calling the datasource statistic on an unused datasource, a division by zero exception occurs as no statistics will be shown:

        Following is the snippet of the exception stack trace:

     Caused by: java.lang.ArithmeticException: / by zero
        at org.jboss.resource.connectionmanager.InternalManagedConnectionPool.getAverageBlockTime(InternalManagedConnectionPool.java:591)

          Code snippet that generates a part of the report:

------------
InternalManagedConnectionPool.java:

   public long getAverageBlockTime()
   {
      return connectionCounter.getTotalBlockTime() / 
               getConnectionCreatedCount();
   }
-------------

Environment

  • JBoss Enterprise Application Platform 5.1.0

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content