private String fetchRegionFromCache ( String bucketName ) { String bucketRegion = bucketRegionCache . get ( bucketName ) ; if ( bucketRegion == null ) { if ( log . isDebugEnabled ( ) ) { log . debug ( "Bucket region cache doesn't have an entry for " + bucketName + ". Trying to get bucket region from Amazon S3." ) ; } bucketRegion = getBucketRegionViaHeadRequest ( bucketName ) ; if ( bucketRegion != null ) { bucketRegionCache . put ( bucketName , bucketRegion ) ; } } if ( log . isDebugEnabled ( ) ) { log . debug ( "Region for " + bucketName + " is " + bucketRegion ) ; } return bucketRegion ; }
Fetches the region of the bucket from the cache maintained . If the cache doesn t have an entry fetches the region from Amazon S3 and updates the cache .