* @param resourceAllocator ResourceAllocator
* @return ResourceHandle newly created resource
* @throws PoolingException when unable create a resource
*/
protected ResourceHandle createSingleResource(ResourceAllocator resourceAllocator) throws PoolingException {
ResourceHandle resourceHandle;
int count = 0;
long startTime = 0;
while (true) {
try {
count++;
startTime = System.currentTimeMillis();
resourceHandle = resourceAllocator.createResource();
if(_logger.isLoggable(Level.FINE)) {
_logger.log(Level.FINE, "Time taken to create a single "
+ "resource : "
+ resourceHandle.getResourceSpec().getResourceId()
+ " and adding to the pool (ms) : "
+ (System.currentTimeMillis() - startTime));
}
if (validation || validateAtmostEveryIdleSecs)
resourceHandle.setLastValidated(System.currentTimeMillis());
break;
} catch (Exception ex) {
if(_logger.isLoggable(Level.FINE)) {
_logger.log(Level.FINE, "Connection creation failed for " + count + " time. It will be retried, "
+ "if connection creation retrial is enabled.", ex);