Esempio n. 1
0
  private void displayDS(String connectionName, String where) {
    try {
      DataSource ds = null;
      if (connectionName == null) {
        ds = (DataSource) DatabaseConfig.getInstance().getPooledDataSource();
      } else {
        ds = (DataSource) DatabaseConfig.getInstance().getPooledDataSource(connectionName);
      }

      // make sure it's a c3p0 PooledDataSource
      if (ds != null && (ds instanceof PooledDataSource)) {
        PooledDataSource pds = (PooledDataSource) ds;
        log.debug(
            "displayDS for "
                + where
                + " -      num_connections: "
                + pds.getNumConnectionsDefaultUser());
        log.debug(
            "displayDS for "
                + where
                + " - num_busy_connections: "
                + pds.getNumBusyConnectionsDefaultUser());
        log.debug(
            "displayDS for "
                + where
                + " - num_idle_connections: "
                + pds.getNumIdleConnectionsDefaultUser());
      }
    } catch (Exception ex) {
      log.debug("displayDS for " + where + " - ERROR: " + ex.getMessage());
    }
  }