Source:
public OMClientResponse validateAndUpdateCache(OzoneManager ozoneManager, long transactionLogIndex) { CreateKeyRequest createKeyRequest = getOmRequest().getCreateKeyRequest(); KeyArgs keyArgs = createKeyRequest.getKeyArgs(); String volumeName = keyArgs.getVolumeName(); String bucketName = keyArgs.getBucketName(); String keyName = keyArgs.getKeyName(); OMMetrics omMetrics = ozoneManager.getMetrics(); omMetrics.incNumKeyAllocates(); OMMetadataManager omMetadataManager = ozoneManager.getMetadataManager(); OmKeyInfo omKeyInfo = null; final List< OmKeyLocationInfo > locations = new ArrayList<>(); FileEncryptionInfo encryptionInfo = null; IOException exception = null; boolean acquireLock = false; try { if (ozoneManager.getAclsEnabled()) { checkAcls(ozoneManager, OzoneObj.ResourceType.KEY, OzoneObj.StoreType.OZONE, IAccessAuthorizer.ACLType.WRITE, volumeName, bucketName, keyName); } validateBucketAndVolume(omMetadataManager, volumeName, bucketName); OmBucketInfo bucketInfo = omMetadataManager.getBucketTable().get( omMetadataManager.getBucketKey(volumeName, bucketName)); encryptionInfo = getFileEncryptionInfo(ozoneManager, bucketInfo); omKeyInfo = prepareKeyInfo(omMetadataManager, keyArgs, omMetadataManager.getOzoneKey(volumeName, bucketName, keyName), keyArgs.getDataSize(), locations, encryptionInfo); } catch (IOException ex) { LOG.error("Key open failed for volume:{} bucket:{} key:{}", volumeName, bucketName, keyName, ex); exception = ex; } finally { if (acquireLock) { omMetadataManager.getLock().releaseLock(BUCKET_LOCK, volumeName, bucketName); } } return prepareCreateKeyResponse(keyArgs, omKeyInfo, locations, encryptionInfo, exception, createKeyRequest.getClientID(), transactionLogIndex, volumeName, bucketName, keyName, ozoneManager, OMAction.ALLOCATE_KEY); }

Target:
public OMClientResponse validateAndUpdateCache(OzoneManager ozoneManager, long transactionLogIndex) { CreateKeyRequest createKeyRequest = getOmRequest().getCreateKeyRequest(); KeyArgs keyArgs = createKeyRequest.getKeyArgs(); String volumeName = keyArgs.getVolumeName(); String bucketName = keyArgs.getBucketName(); String keyName = keyArgs.getKeyName(); OMMetrics omMetrics = ozoneManager.getMetrics(); omMetrics.incNumKeyAllocates(); OMMetadataManager omMetadataManager = ozoneManager.getMetadataManager(); OmKeyInfo omKeyInfo = null; final List< OmKeyLocationInfo > locations = new ArrayList<>(); FileEncryptionInfo encryptionInfo = null; IOException exception = null; boolean acquireLock = false; try { if (ozoneManager.getAclsEnabled()) { checkAcls(ozoneManager, OzoneObj.ResourceType.KEY, OzoneObj.StoreType.OZONE, IAccessAuthorizer.ACLType.WRITE, volumeName, bucketName, keyName); } acquireLock = omMetadataManager.getLock().acquireLock(BUCKET_LOCK, volumeName, bucketName); validateBucketAndVolume(omMetadataManager, volumeName, bucketName); OmBucketInfo bucketInfo = omMetadataManager.getBucketTable().get( omMetadataManager.getBucketKey(volumeName, bucketName)); encryptionInfo = getFileEncryptionInfo(ozoneManager, bucketInfo); omKeyInfo = prepareKeyInfo(omMetadataManager, keyArgs, omMetadataManager.getOzoneKey(volumeName, bucketName, keyName), keyArgs.getDataSize(), locations, encryptionInfo); } catch (IOException ex) { LOG.error("Key open failed for volume:{} bucket:{} key:{}", volumeName, bucketName, keyName, ex); exception = ex; } finally { if (acquireLock) { omMetadataManager.getLock().releaseLock(BUCKET_LOCK, volumeName, bucketName); } } return prepareCreateKeyResponse(keyArgs, omKeyInfo, locations, encryptionInfo, exception, createKeyRequest.getClientID(), transactionLogIndex, volumeName, bucketName, keyName, ozoneManager, OMAction.ALLOCATE_KEY); }