code: public ResourceMetadata getResourceMetadata() {
      if (poolInfo.getPoolName() == null ||
          !counters.containsKey(MetricName.MIN) ||
          !counters.containsKey(MetricName.MAX) ||
          !counters.containsKey(MetricName.GRANTED) ||
          !counters.containsKey(MetricName.REQUESTED)) {
        return null;
      }
  
      return new ResourceMetadata(
          PoolInfo.createStringFromPoolInfo(poolInfo),
          counters.get(MetricName.MIN).intValue(),
          counters.get(MetricName.MAX).intValue(),
          counters.get(MetricName.GRANTED).intValue(),
          counters.get(MetricName.REQUESTED).intValue());
    }
docs: Get a snapshot of the resource metadata for this pool.  Used for
  collecting metrics.  Will not collect resource metadata for PoolGroup
  objects or if any counters are missing.
  
  @return ResourceMetadata for this pool or null if the metrics are invalid.