Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * IronJacamar, a Java EE Connector Architecture implementation
   * Copyright 2011, Red Hat Inc, and individual contributors
   * as indicated by the @author tags. See the copyright.txt file in the
   * distribution for a full listing of individual contributors.
   *
   * This is free software; you can redistribute it and/or modify it
   * under the terms of the GNU Lesser General Public License as
   * published by the Free Software Foundation; either version 2.1 of
  * the License, or (at your option) any later version.
  *
  * This software is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this software; if not, write to the Free
  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
  */
 
 package org.jboss.jca.core.connectionmanager.pool.mcp;
 
 
 
Managed connection pool utility class

Author(s):
Jesper Pedersen
 
 {
    private static String newLine = SecurityActions.getSystemProperty("line.separator");

   
Get the full details of a managed connection pool state

Parameters:
method The method identifier
poolName The pool name
inUse The in use count
max The max
Returns:
The state
 
    static String details(String methodString poolNameint inUseint max)
    {
       StringBuilder sb = new StringBuilder(1024);
 
       sb.append(poolName).append(": ");
       sb.append(method).append(" ");
       sb.append("[");
       sb.append(Integer.toString(inUse));
       sb.append("/");
       sb.append(Integer.toString(max));
       sb.append("]");
 
       return sb.toString();
    }

   
Get the full details of a managed connection pool state

Parameters:
identifier The managed connection pool identifier
method The method identifier
mcf The managed connection factory
clf The connection listener factory
pool The pool
pc The pool configuration
available The available connection listeners
inUse The in-use connection listeners
mcps The statistics
Returns:
The state
 
    static String fullDetails(int identifierString methodManagedConnectionFactory mcf,
                              ConnectionListenerFactory clfPool poolPoolConfiguration pc,
                              Collection<ConnectionListeneravailableCollection<ConnectionListenerinUse,
                              ManagedConnectionPoolStatistics mcps)
    {
       StringBuilder sb = new StringBuilder(1024);
 
       sb.append(method).append();
       sb.append("ManagedConnectionPool: ").append(Integer.toHexString(identifier)).append();
       sb.append("Method: ").append(method).append();
       sb.append("ManagedConnectionFactory:").append();
       sb.append("  Class: ").append(mcf.getClass().getName()).append();
       sb.append("  Object: ").append(Integer.toHexString(System.identityHashCode(mcf))).append();
       sb.append("ConnectionListenerFactory:").append();
       sb.append("  Class: ").append(clf.getClass().getName()).append();
       sb.append("  Object: ").append(Integer.toHexString(System.identityHashCode(clf))).append();
       sb.append("Pool:").append();
       sb.append("  Name: ").append(pool.getName()).append();
       sb.append("PoolConfiguration:").append();
       sb.append("  MinSize: ").append(pc.getMinSize()).append();
       sb.append("  InitialSize: ").append(pc.getInitialSize()).append();
      sb.append("  MaxSize: ").append(pc.getMaxSize()).append();
      sb.append("  BlockingTimeout: ").append(pc.getBlockingTimeout()).append();
      sb.append("  IdleTimeoutMinutes: ").append(pc.getIdleTimeoutMinutes()).append();
      sb.append("  BackgroundValidation: ").append(pc.isBackgroundValidation()).append();
      sb.append("  BackgroundValidationMillis: ").append(pc.getBackgroundValidationMillis()).append();
      sb.append("  StrictMin: ").append(pc.isStrictMin()).append();
      sb.append("  UseFastFail: ").append(pc.isUseFastFail()).append();
      int availableSize = (available != null ? available.size() : 0);
      sb.append("Available (").append(availableSize).append("):").append();
      if (available != null)
      {
         for (ConnectionListener cl : available)
         {
            sb.append("  ").append(Integer.toHexString(System.identityHashCode(cl)));
            sb.append(" (").append(cl.getState()).append(")");
            sb.append(" (Used: ").append(cl.getLastUsedTime()).append(")");
            sb.append(" (Validated: ").append(cl.getLastValidatedTime()).append(")").append();
         }
      }
      int inUseSize = (inUse != null ? inUse.size() : 0);
      sb.append("InUse (").append(inUseSize).append("):").append();
      if (inUse != null)
      {
         for (ConnectionListener cl : inUse)
         {
            sb.append("  ").append(Integer.toHexString(System.identityHashCode(cl)));
            sb.append(" (").append(cl.getState()).append(")");
            sb.append(" (Validated: ").append(cl.getLastValidatedTime()).append(")").append();
         }
      }
      sb.append("Statistics:").append();
      sb.append("  ActiveCount: ").append(mcps.getActiveCount()).append();
      sb.append("  AvailableCount: ").append(mcps.getAvailableCount()).append();
      sb.append("  AverageBlockingTime: ").append(mcps.getAverageBlockingTime()).append();
      sb.append("  AverageCreationTime: ").append(mcps.getAverageCreationTime()).append();
      sb.append("  AverageGetTime: ").append(mcps.getAverageGetTime()).append();
      sb.append("  BlockingFailureCount: ").append(mcps.getBlockingFailureCount()).append();
      sb.append("  CreatedCount: ").append(mcps.getCreatedCount()).append();
      sb.append("  DestroyedCount: ").append(mcps.getDestroyedCount()).append();
      sb.append("  IdleCount: ").append(mcps.getIdleCount()).append();
      sb.append("  InUseCount: ").append(mcps.getInUseCount()).append();
      sb.append("  MaxCreationTime: ").append(mcps.getMaxCreationTime()).append();
      sb.append("  MaxGetTime: ").append(mcps.getMaxGetTime()).append();
      sb.append("  MaxUsedCount: ").append(mcps.getMaxUsedCount()).append();
      sb.append("  MaxWaitCount: ").append(mcps.getMaxWaitCount()).append();
      sb.append("  MaxWaitTime: ").append(mcps.getMaxWaitTime()).append();
      sb.append("  TimedOut: ").append(mcps.getTimedOut()).append();
      sb.append("  TotalBlockingTime: ").append(mcps.getTotalBlockingTime()).append();
      sb.append("  TotalCreationTime: ").append(mcps.getTotalCreationTime()).append();
      sb.append("  TotalGetTime: ").append(mcps.getTotalGetTime()).append();
      sb.append("  WaitCount: ").append(mcps.getWaitCount());
      return sb.toString();
   }
New to GrepCode? Check out our FAQ X